Skip to content

Commit

Permalink
Stop generating gemspec file.
Browse files Browse the repository at this point in the history
* Because the generating is confusing us including contributors.
* The reason of new file lib/rack/test/version.rb is because of preventing
  an error when "rack/test" is loaded recursively in gemspec file.
* Add release way to README again because that is useful
  for people who do release.
  • Loading branch information
junaruga committed May 30, 2017
1 parent bc60286 commit 0a77b37
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 168 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ before_install:
- which bundle || gem install bundler
script:
- bundle list
# Unit test
- bundle exec rake
# Release test
- bundle exec thor :build
ls -l pkg/rack-test-*.gem
gem install pkg/rack-test-*.gem
gem list rack-test
ruby -e 'require "rack/test"'
gem specification pkg/rack-test-*.gem --ruby
rvm:
- 2.2.7
- 2.3.4
Expand Down
13 changes: 2 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,5 @@ source 'https://rubygems.org'

gemspec

# Development dependency
gem 'rake'
gem 'rspec'
# To use rack 2
gem 'sinatra', '~> 2.0'
# Keep version < 1 to supress deprecated warning temporary.
gem 'codeclimate-test-reporter', '< 1', :require => false

# For Thorfile. Run "bundle exec thor help" to see the help.
gem 'thor'
gem 'git'
# Runtime dependency
gem 'rack', '~> 2.0'
7 changes: 0 additions & 7 deletions Gemfile.rack-1.x
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ gemspec

# Runtime dependency
gem 'rack', '< 2'

# Development dependency
gem 'rake'
gem 'rspec'
gem 'sinatra'
# Keep version < 1 to supress deprecated warning temporary.
gem 'codeclimate-test-reporter', '< 1', :require => false
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ Contributions are welcome. Please make sure to:
* Write tests for the new or changed behaviour
* Provide an explanation/motivation in your commit message / PR message
* Ensure History.txt is updated

## Releasing

* Ensure History.txt is up-to-date
* Bump VERSION in lib/rack/test/version.rb
* bundle exec thor :release
70 changes: 2 additions & 68 deletions Thorfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,4 @@
module GemHelpers

def generate_gemspec
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib")))
require "rack/test"

Gem::Specification.new do |s|
s.name = "rack-test"
s.version = Rack::Test::VERSION
s.author = "Bryan Helmkamp"
s.email = "bryan@brynary.com"
s.license = "MIT"
s.homepage = "http://github.com/rack-test/rack-test"
s.summary = "Simple testing API built on Rack"
s.description = <<-EOS.strip
Rack::Test is a small, simple testing API for Rack apps. It can be used on its
own or as a reusable starting point for Web frameworks and testing libraries
to build on. Most of its initial functionality is an extraction of Merb 1.0's
request helpers feature.
EOS
s.rubyforge_project = "rack-test"

require "git"
repo = Git.open(".")

s.files = normalize_files(repo.ls_files.keys - repo.lib.ignored_files)
s.test_files = normalize_files(Dir['spec/**/*.rb'] - repo.lib.ignored_files)

s.has_rdoc = true
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt]

s.add_dependency "rack", ">= 1.0"
end
end

def normalize_files(array)
# only keep files, no directories, and sort
array.select do |path|
File.file?(path)
end.sort
end

# Adds extra space when outputting an array. This helps create better version
# control diffs, because otherwise it is all on the same line.
def prettyify_array(gemspec_ruby, array_name)
gemspec_ruby.gsub(/s\.#{array_name.to_s} = \[.+?\]/) do |match|
leadin, files = match[0..-2].split("[")
leadin + "[\n #{files.split(",").join(",\n ")}\n ]"
end
end

def read_gemspec
@read_gemspec ||= eval(File.read("rack-test.gemspec"))
end
Expand All @@ -62,21 +12,6 @@ end
class Default < Thor
include GemHelpers

desc "gemspec", "Regenerate rack-test.gemspec"
def gemspec
File.open("rack-test.gemspec", "w") do |file|
gemspec_ruby = generate_gemspec.to_ruby
gemspec_ruby = prettyify_array(gemspec_ruby, :files)
gemspec_ruby = prettyify_array(gemspec_ruby, :test_files)
gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files)

file.write gemspec_ruby
end

puts "Wrote gemspec to rack-test.gemspec"
read_gemspec.validate
end

desc "build", "Build a rack-test gem"
def build
sh "gem build rack-test.gemspec"
Expand All @@ -89,9 +24,8 @@ class Default < Thor
sh "gem install --local pkg/#{read_gemspec.file_name}"
end

desc "release", "Release the current branch to GitHub and Gemcutter"
desc "release", "Release the current branch to GitHub and RubyGems.org"
def release
gemspec
build
Release.new.tag
Release.new.gem
Expand All @@ -108,7 +42,7 @@ class Release < Thor
sh "git push origin #{release_tag}"
end

desc "gem", "Push the gem to Gemcutter"
desc "gem", "Push the gem to RubyGems.org"
def gem
sh "gem push pkg/#{read_gemspec.file_name}"
end
Expand Down
3 changes: 1 addition & 2 deletions lib/rack/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
require "rack/test/utils"
require "rack/test/methods"
require "rack/test/uploaded_file"
require "rack/test/version"

module Rack
module Test
VERSION = "0.6.3"

DEFAULT_HOST = "example.org"
MULTIPART_BOUNDARY = "----------XnJLe9ZIbbGUYtzPQJ16u1"

Expand Down
5 changes: 5 additions & 0 deletions lib/rack/test/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Rack
module Test
VERSION = "0.6.3"
end
end
108 changes: 28 additions & 80 deletions rack-test.gemspec
Original file line number Diff line number Diff line change
@@ -1,84 +1,32 @@
# -*- encoding: utf-8 -*-
# stub: rack-test 0.6.3 ruby lib

Gem::Specification.new do |s|
s.name = "rack-test"
s.version = "0.6.3"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Bryan Helmkamp"]
s.date = "2017-05-08"
s.description = "Rack::Test is a small, simple testing API for Rack apps. It can be used on its\nown or as a reusable starting point for Web frameworks and testing libraries\nto build on. Most of its initial functionality is an extraction of Merb 1.0's\nrequest helpers feature."
s.email = "bryan@brynary.com"
s.extra_rdoc_files = [
"README.rdoc",
"MIT-LICENSE.txt"
]
s.files = [
".document",
".gitignore",
".travis.yml",
"Gemfile",
"Gemfile.rack-1.x",
"History.txt",
"MIT-LICENSE.txt",
"README.rdoc",
"Rakefile",
"Thorfile",
"lib/rack/mock_session.rb",
"lib/rack/test.rb",
"lib/rack/test/cookie_jar.rb",
"lib/rack/test/methods.rb",
"lib/rack/test/mock_digest_request.rb",
"lib/rack/test/uploaded_file.rb",
"lib/rack/test/utils.rb",
"rack-test.gemspec",
"spec/fixtures/bar.txt",
"spec/fixtures/config.ru",
"spec/fixtures/fake_app.rb",
"spec/fixtures/foo.txt",
"spec/rack/test/cookie_jar_spec.rb",
"spec/rack/test/cookie_object_spec.rb",
"spec/rack/test/cookie_spec.rb",
"spec/rack/test/digest_auth_spec.rb",
"spec/rack/test/multipart_spec.rb",
"spec/rack/test/uploaded_file_spec.rb",
"spec/rack/test/utils_spec.rb",
"spec/rack/test_spec.rb",
"spec/spec_helper.rb",
"spec/support/matchers/body.rb",
"spec/support/matchers/challenge.rb"
]
s.homepage = "http://github.com/rack-test/rack-test"
s.licenses = ["MIT"]
s.rubyforge_project = "rack-test"
s.rubygems_version = "2.4.5.2"
s.summary = "Simple testing API built on Rack"
s.test_files = [
"spec/fixtures/fake_app.rb",
"spec/rack/test/cookie_jar_spec.rb",
"spec/rack/test/cookie_object_spec.rb",
"spec/rack/test/cookie_spec.rb",
"spec/rack/test/digest_auth_spec.rb",
"spec/rack/test/multipart_spec.rb",
"spec/rack/test/uploaded_file_spec.rb",
"spec/rack/test/utils_spec.rb",
"spec/rack/test_spec.rb",
"spec/spec_helper.rb",
"spec/support/matchers/body.rb",
"spec/support/matchers/challenge.rb"
]
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'rack/test/version'

if s.respond_to? :specification_version then
s.specification_version = 4

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
else
s.add_dependency(%q<rack>, [">= 1.0"])
end
else
s.add_dependency(%q<rack>, [">= 1.0"])
end
Gem::Specification.new do |s|
s.name = 'rack-test'
s.version = Rack::Test::VERSION
s.platform = Gem::Platform::RUBY
s.author = 'Bryan Helmkamp'
s.email = 'bryan@brynary.com'
s.license = 'MIT'
s.homepage = 'http://github.com/rack-test/rack-test'
s.summary = 'Simple testing API built on Rack'
s.description = <<-EOS.strip
Rack::Test is a small, simple testing API for Rack apps. It can be used on its
own or as a reusable starting point for Web frameworks and testing libraries
to build on. Most of its initial functionality is an extraction of Merb 1.0's
request helpers feature.
EOS
s.require_paths = ['lib']
s.files = `git ls-files -- lib/*`.split("\n") +
%w[History.md MIT-LICENSE.txt README.md]
s.add_dependency 'rack', '>= 1.0', '< 3'
s.add_development_dependency 'rake', '~> 12.0'
s.add_development_dependency 'rspec', '~> 3.6'
s.add_development_dependency 'sinatra', '>= 1.0', '< 3'
# Keep version < 1 to supress deprecated warning temporary.
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.6'
# For Thorfile. Run "bundle exec thor help" to see the help.
s.add_development_dependency 'thor', '~> 0.19'
end

0 comments on commit 0a77b37

Please sign in to comment.