forked from rack/rack-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop generating gemspec file. (rack#181)
* 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
Showing
8 changed files
with
52 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "[email protected]" | ||
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 | ||
|
@@ -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" | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Rack | ||
module Test | ||
VERSION = "0.6.3" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "[email protected]" | ||
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 = '[email protected]' | ||
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 |