diff --git a/.gitignore b/.gitignore index 85585d7..b2d3c89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .ruby-version .bundle +*.gem diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f960008 --- /dev/null +++ b/Rakefile @@ -0,0 +1,33 @@ +task default: :spec + +task :spec do + sh "rspec" +end + +task release: %i[clean spec git gem] do + sh "echo gem push *.gem" + + sh "git tag v%s" % [version] + sh "git push --tags" +end + +task gem: %i[clean git] do + version = ENV["VERSION"] || ENV["V"] + abort "Specify VERSION=x.y.z to release" unless version + + require_relative "lib/faraday/restrict_ip_addresses/version" + act = Faraday::RestrictIPAddresses::VERSION + + abort "Version specified doesn't match %p" % [act] unless act == version + + sh "gem build" +end + +task :git do + status = `git status --porcelain` + abort "git looks dirty\n#{status}" unless status.lines.empty? +end + +task :clean do + rm_f Dir["**/*~", "*.gem"] +end