jeweler-2.0.1/0000755000175000017500000000000012641037113011543 5ustar aleealeejeweler-2.0.1/features/0000755000175000017500000000000012641037113013361 5ustar aleealeejeweler-2.0.1/features/step_definitions/0000755000175000017500000000000012641037113016727 5ustar aleealeejeweler-2.0.1/features/step_definitions/filesystem_steps.rb0000644000175000017500000000375512641037113022670 0ustar aleealeeGiven 'a working directory' do @working_dir = create_construct end After do @working_dir.destroy! if @working_dir end Given /^I use the jeweler command to generate the "([^"]+)" project in the working directory$/ do |name| @name = name return_to = Dir.pwd path_to_jeweler = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jeweler') begin FileUtils.cd @working_dir @stdout = `#{path_to_jeweler} #{@name}` ensure FileUtils.cd return_to end end Given /^"([^"]+)" does not exist$/ do |file| assert ! File.exists?(File.join(@working_dir, file)) end When /^I run "([^"]+)" in "([^"]+)"$/ do |command, directory| full_path = File.join(@working_dir, directory) lib_path = File.expand_path 'lib' command.gsub!(/^rake /, "rake --trace -I#{lib_path} ") assert File.directory?(full_path), "#{full_path} is not a directory" @stdout = `cd #{full_path} && #{command}` @exited_cleanly = $?.exited? end Then /^the updated version, (.*), is displayed$/ do |version| assert_match "Updated version: #{version}", @stdout end Then /^the current version, (\d+\.\d+\.\d+), is displayed$/ do |version| assert_match "Current version: #{version}", @stdout end Then /^the process should exit cleanly$/ do assert @exited_cleanly, "Process did not exit cleanly: #{@stdout}" end Then /^the process should not exit cleanly$/ do assert !@exited_cleanly, "Process did exit cleanly: #{@stdout}" end Given /^I use the existing project "([^"]+)" as a template$/ do |fixture_project| @name = fixture_project FileUtils.cp_r File.join(fixture_dir, fixture_project), @working_dir end Given /^"VERSION\.yml" contains hash "([^"]+)"$/ do |ruby_string| version_hash = YAML.load(File.read(File.join(@working_dir, @name, 'VERSION.yml'))) evaled_hash = eval(ruby_string) assert_equal evaled_hash, version_hash end Given /^"VERSION" contains "([^\"]*)"$/ do |expected| version = File.read(File.join(@working_dir, @name, 'VERSION')).chomp assert_equal expected, version end jeweler-2.0.1/features/step_definitions/debug_steps.rb0000644000175000017500000000010112641037113021550 0ustar aleealeeThen /^I debug$/ do require 'ruby-debug' breakpoint 0 end jeweler-2.0.1/features/step_definitions/generator_steps.rb0000644000175000017500000002766712641037113022502 0ustar aleealeeGiven /^I do not want cucumber stories$/ do @use_cucumber = false end Given /^I want cucumber stories$/ do @use_cucumber = true end Given /^I do not want reek$/ do @use_reek = false end Given /^I want reek$/ do @use_reek = true end Given /^I do not want bundler$/ do @use_bundler = false end Given /^I want bundler$/ do @use_bundler = true end Given /^I do not want roodi$/ do @use_roodi = false end Given /^I want roodi$/ do @use_roodi = true end And /^I do not want rubyforge setup$/ do @use_rubyforge = false end And /^I want rubyforge setup$/ do @use_rubyforge = true end Given /^I want to use yard instead of rdoc$/ do @documentation_framework = "yard" end Given /^I want to use rdoc instead of yard$/ do @documentation_framework = "rdoc" end Given /^I intend to test with (\w+)$/ do |testing_framework| @testing_framework = testing_framework.to_sym end Given /^I have configured git sanely$/ do @user_email = 'bar@example.com' @user_name = 'foo' @github_user = 'technicalpickles' require 'git' Git.stubs(:global_config). returns({ 'user.name' => @user_name, 'user.email' => @user_email, 'github.user' => @github_user}) end Given /^I set JEWELER_OPTS env variable to "(.*)"$/ do |val| ENV['JEWELER_OPTS'] = val end When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)'$/ do |testing_framework, name, summary| step "I generate a #{testing_framework}project named '#{name}' that is '#{summary}' and described as ''" end When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and described as '([^']*)'$/ do |testing_framework, name, summary, description| @name = name @summary = summary @description = description testing_framework = testing_framework.squeeze.strip unless testing_framework.blank? @testing_framework = testing_framework.to_sym end arguments = [ '--summary', @summary, '--description', @description, @use_cucumber ? '--cucumber' : nil, @testing_framework ? "--#{@testing_framework}" : nil, @use_rubyforge ? '--rubyforge' : nil, @use_roodi ? '--roodi' : nil, @use_reek ? '--reek' : nil, case @use_bundler when true then '--bundler' when false then '--no-bundler' else nil end, @documentation_framework ? "--#{@documentation_framework}" : nil, "#{@working_dir}/#{@name}"].compact @stdout = OutputCatcher.catch_out do Jeweler::Generator::Application.run! *arguments end @repo = Git.open(File.join(@working_dir, @name)) end Then /^a directory named '(.*)' is created$/ do |directory| directory = File.join(@working_dir, directory) assert File.exists?(directory), "#{directory} did not exist" assert File.directory?(directory), "#{directory} is not a directory" end Then "cucumber directories are created" do step "a directory named 'the-perfect-gem/features' is created" step "a directory named 'the-perfect-gem/features/support' is created" step "a directory named 'the-perfect-gem/features/step_definitions' is created" end Then /^a file named '(.*)' is created$/ do |file| file = File.join(@working_dir, file) assert File.exists?(file), "#{file} expected to exist, but did not" assert File.file?(file), "#{file} expected to be a file, but is not" end Then /^a file named '(.*)' is not created$/ do |file| file = File.join(@working_dir, file) assert ! File.exists?(file), "#{file} expected to not exist, but did" end Then /^a sane '.gitignore' is created$/ do step "a file named 'the-perfect-gem/.gitignore' is created" step "'coverage' is ignored by git" step "'coverage.data' is ignored by git" step "'*.swp' is ignored by git" step "'.DS_Store' is ignored by git" step "'rdoc' is ignored by git" step "'pkg' is ignored by git" end Then /^'(.*)' is ignored by git$/ do |git_ignore| @gitignore_content ||= File.read(File.join(@working_dir, @name, '.gitignore')) assert_match git_ignore, @gitignore_content end Then /^Rakefile has '(.*)' for the (.*) (.*)$/ do |value, task_class, field| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) block_variable, task_block = yank_task_info(@rakefile_content, task_class) #raise "Found in #{task_class}: #{block_variable.inspect}: #{task_block.inspect}" assert_match /#{block_variable}\.#{field} = (%Q\{|"|')#{Regexp.escape(value)}(\}|"|')/, task_block end Then /^Rakefile adds '(.*)' as a development dependency to Jeweler::Tasks$/ do |dependency| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) block_variable, task_block = yank_task_info(@rakefile_content, "Jeweler::Tasks") assert_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block end Then /^Rakefile does not add '(.*)' as a development dependency to Jeweler::Tasks$/ do |dependency| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) block_variable, task_block = yank_task_info(@rakefile_content, "Jeweler::Tasks") assert_no_match /#{block_variable}\.add_development_dependency "#{dependency}"/, task_block end Then /^Rakefile has '(.*)' in the Rcov::RcovTask libs$/ do |libs| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) block_variable, task_block = yank_task_info(@rakefile_content, 'Rcov::RcovTask') assert_match "#{block_variable}.libs << '#{libs}'", @rakefile_content end Then /^Rakefile has '(.*)' in the Rcov::RcovTask rcov_opts$/ do |rcov_opts| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) block_variable, task_block = yank_task_info(@rakefile_content, 'Rcov::RcovTask') assert_match "#{block_variable}.rcov_opts << '#{rcov_opts}'", @rakefile_content end Then /^'(.*)' contains '(.*)'$/ do |file, expected_string| contents = File.read(File.join(@working_dir, @name, file)) assert_match expected_string, contents end Then /^'(.*)' mentions copyright belonging to me in (\d{4})$/ do |file, year| contents = File.read(File.join(@working_dir, @name, file)) assert_match "Copyright (c) #{year} #{@user_name}", contents end Then /^'(.*)' mentions copyright belonging to me in the current year$/ do |file| current_year = Time.now.year step "'#{file}' mentions copyright belonging to me in #{current_year}" end Then /^LICENSE\.txt credits '(.*)'$/ do |copyright_holder| step "a file named 'the-perfect-gem/LICENSE.txt' is created" @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt')) assert_match copyright_holder, @license_content end Given /^it is the year (\d+)$/ do |year| time = Time.local(year.to_i, 9, 1, 10, 5, 0) Timecop.travel(time) end Then /^LICENSE\.txt has a copyright in the year (\d+)$/ do |year| step "a file named 'the-perfect-gem/LICENSE.txt' is created" @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE.txt')) assert_match year, @license_content end Then /^'(.*)' should define '(.*)' as a subclass of '(.*)'$/ do |file, class_name, superclass_name| @test_content = File.read((File.join(@working_dir, @name, file))) assert_match "class #{class_name} < #{superclass_name}", @test_content end Then /^'(.*)' should describe '(.*)'$/ do |file, describe_name| @spec_content ||= File.read((File.join(@working_dir, @name, file))) assert_match %Q{describe "#{describe_name}" do}, @spec_content end Then /^'(.*)' should contextualize '(.*)'$/ do |file, describe_name| @spec_content ||= File.read((File.join(@working_dir, @name, file))) assert_match %Q{context "#{describe_name}" do}, @spec_content end Then /^'(.*)' should have tests for '(.*)'$/ do |file, describe_name| @tests_content ||= File.read((File.join(@working_dir, @name, file))) assert_match %Q{Shindo.tests("#{describe_name}") do}, @tests_content end Then /^'(.*)' requires '(.*)'$/ do |file, lib| content = File.read(File.join(@working_dir, @name, file)) assert_match /require ['"]#{Regexp.escape(lib)}['"]/, content end Then /^'(.*)' does not require '(.*)'$/ do |file, lib| content = File.read(File.join(@working_dir, @name, file)) assert_no_match /require ['"]#{Regexp.escape(lib)}['"]/, content end Then /^Rakefile does not require '(.*)'$/ do |file| step "'Rakefile' does not require '#{file}'" end Then /^Rakefile requires '(.*)'$/ do |file| step "'Rakefile' requires '#{file}'" end Then /^Rakefile does not instantiate a (.*)$/ do |task_name| content = File.read(File.join(@working_dir, @name, 'Rakefile')) assert_no_match /#{task_name}/, content end Then /^Rakefile instantiates a (.*)$/ do |task_name| content = File.read(File.join(@working_dir, @name, 'Rakefile')) assert_match /#{task_name}/, content end Then /^'(.+?)' should autorun tests$/ do |test_helper| content = File.read(File.join(@working_dir, @name, test_helper)) assert_match "MiniTest::Unit.autorun", content end Then /^cucumber world extends "(.*)"$/ do |module_to_extend| content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb')) assert_match "World(#{module_to_extend})", content end Then /^'features\/support\/env\.rb' sets up features to use test\/unit assertions$/ do end Then /^'features\/support\/env\.rb' sets up features to use minitest assertions$/ do content = File.read(File.join(@working_dir, @name, 'features', 'support', 'env.rb')) assert_match "world.extend(Mini::Test::Assertions)", content end Then /^git repository has '(.*)' remote$/ do |remote| remote = @repo.remotes.first assert_equal 'origin', remote.name end Then /^git repository '(.*)' remote should be '(.*)'/ do |remote, remote_url| remote = @repo.remotes.first assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url end Then /^a commit with the message '(.*)' is made$/ do |message| assert_match message, @repo.log.first.message end Then /^'(.*)' was checked in$/ do |file| status = @repo.status[file] assert_not_nil status, "wasn't able to get status for #{file}" assert ! status.untracked, "#{file} was untracked" assert_nil status.type, "#{file} had a type. it should have been nil" end Then /^no files are (\w+)$/ do |type| assert_equal 0, @repo.status.send(type).size end Then /^Rakefile has "(.*)" as the default task$/ do |task| @rakefile_content ||= File.read(File.join(@working_dir, @name, 'Rakefile')) assert_match "task :default => :#{task}", @rakefile_content end After do ENV['JEWELER_OPTS'] = nil end Then /^'Gemfile' has a (\w+) dependency on '(.*)'$/ do |group, name| @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile')) group_block = yank_group_info(@gemfile_content, group) assert_match name, group_block end Then /^'Gemfile' does not have a (\w+) dependency on '(.*)'$/ do |group, name| @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile')) group_block = yank_group_info(@gemfile_content, group) assert_no_match Regexp.new(Regexp.escape(name)), group_block end Then /^'Gemfile' has a development dependency on the current version of jeweler$/ do @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile')) group_block = yank_group_info(@gemfile_content, 'development') assert_match %Q{gem "jeweler", "~> #{Jeweler::Version::STRING}"}, group_block end Then /^'(.*)' sets up bundler using the default and development groups$/ do |file| content = File.read(File.join(@working_dir, @name, file)) assert_match "Bundler.setup(:default, :development)", content end Then /^'(.*)' does not setup bundler$/ do |file| content = File.read(File.join(@working_dir, @name, file)) assert_no_match /Bundler\.setup/, content end Then /^'Gemfile' uses the (.*) source$/ do |source| content = File.read(File.join(@working_dir, @name, 'Gemfile')) assert_match %Q{source "http://rubygems.org"}, content end Then /^Rakefile has a magic comment for UTF\-(\d+)$/ do |arg1| content = File.read(File.join(@working_dir, @name, 'Rakefile')) assert_match "# encoding: utf-8", content end jeweler-2.0.1/features/step_definitions/task_steps.rb0000644000175000017500000000035612641037113021440 0ustar aleealeeThen /^I can gem install "([^"]+)"$/ do |gem_path| @stdout = `cd #{@working_dir}; gem install --install-dir #{@working_dir}/gem-install-dir --no-ri --no-rdoc #{gem_path} 2>&1` assert_no_match /ERROR/, @stdout assert $?.exited? end jeweler-2.0.1/features/tasks/0000755000175000017500000000000012641037113014506 5ustar aleealeejeweler-2.0.1/features/tasks/version.feature0000644000175000017500000000271612641037113017556 0ustar aleealeeFeature: version rake task #Scenario: a newly created project without a version # Given a working directory # And I use the jeweler command to generate the "the-perfect-gem" project in the working directory # And "the-perfect-gem/VERSION" does not exist # When I run "rake version" in "the-perfect-gem" # Then the process should not exit cleanly Scenario: an existing project with version yaml Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version" in "existing-project-with-version-yaml" Then the process should exit cleanly And the current version, 1.5.3, is displayed Scenario: an existing project with version plaintext Given a working directory And I use the existing project "existing-project-with-version-plaintext" as a template And "VERSION" contains "1.5.3" When I run "rake version" in "existing-project-with-version-plaintext" Then the process should exit cleanly And the current version, 1.5.3, is displayed Scenario: an existing project with version constant Given a working directory And I use the existing project "existing-project-with-version-constant" as a template When I run "rake version" in "existing-project-with-version-constant" Then the process should exit cleanly And the current version, 1.0.0, is displayed jeweler-2.0.1/features/tasks/version_bumping.feature0000644000175000017500000000467712641037113021307 0ustar aleealeeFeature: bumping version Scenario: major version Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version:bump:major" in "existing-project-with-version-yaml" Then the process should exit cleanly And the updated version, 2.0.0, is displayed Scenario: minor version Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version:bump:minor" in "existing-project-with-version-yaml" Then the process should exit cleanly And the updated version, 1.6.0, is displayed Scenario: patch version Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version:bump:patch" in "existing-project-with-version-yaml" Then the process should exit cleanly And the updated version, 1.5.4, is displayed Scenario: arbitrary version Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version:write MAJOR=3 MINOR=7 PATCH=1" in "existing-project-with-version-yaml" Then the process should exit cleanly And the updated version, 3.7.1, is displayed Scenario: arbitrary version with a build version yaml Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" When I run "rake version:write MAJOR=3 MINOR=7 PATCH=1 BUILD=2" in "existing-project-with-version-yaml" Then the process should exit cleanly And the updated version, 3.7.1.2, is displayed Scenario: arbitrary version with a build version plaintext Given a working directory And I use the existing project "existing-project-with-version-plaintext" as a template And "VERSION" contains "1.5.3" When I run "rake version:write MAJOR=3 MINOR=7 PATCH=1 BUILD=2" in "existing-project-with-version-plaintext" Then the process should exit cleanly And the updated version, 3.7.1.2, is displayed jeweler-2.0.1/features/tasks/build_gem.feature0000644000175000017500000000100212641037113020003 0ustar aleealeeFeature: building gems Scenario: default Given a working directory And I use the existing project "existing-project-with-version-yaml" as a template And "VERSION.yml" contains hash "{ :major => 1, :minor => 5, :patch => 3}" And "existing-project-with-version/pkg/existing-project-with-version-1.5.3.gem" does not exist When I run "rake build" in "existing-project-with-version-yaml" Then I can gem install "existing-project-with-version-yaml/pkg/existing-project-with-version-1.5.3.gem" jeweler-2.0.1/features/placeholder.feature0000644000175000017500000000014412641037113017217 0ustar aleealeeFeature: I am a placeholder Scenario: I am also a placeholder Given a working directory jeweler-2.0.1/features/support/0000755000175000017500000000000012641037113015075 5ustar aleealeejeweler-2.0.1/features/support/env.rb0000644000175000017500000000146212641037113016215 0ustar aleealeerequire 'bundler' begin Bundler.setup(:default, :xzibit, :test) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'jeweler' require 'mocha' require 'output_catcher' require 'timecop' require 'ruby-debug' require 'active_support' require 'test/unit/assertions' World(Test::Unit::Assertions) require 'construct' World(Construct::Helpers) def yank_task_info(content, task) if content =~ /#{Regexp.escape(task)}.new(\(.*\))? do \|(.*?)\|(.*?)^end$/m [$2, $3] end end def yank_group_info(content, group) if content =~ /group :#{group} do(.*?)end/m $1 end end def fixture_dir File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures') end After do Timecop.return end jeweler-2.0.1/features/generator/0000755000175000017500000000000012641037113015347 5ustar aleealeejeweler-2.0.1/features/generator/env_options.feature0000644000175000017500000000067412641037113021276 0ustar aleealeeFeature: Getting options from environment variable In order to avoid having to type --rspec over and over A user will need to set up a JEWELER_OPTS environment variable Scenario: Environment variable set Given a working directory And I set JEWELER_OPTS env variable to "--rspec" When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/the-perfect-gem_spec.rb' should describe 'ThePerfectGem' jeweler-2.0.1/features/generator/directory_layout.feature0000644000175000017500000000635412641037113022335 0ustar aleealeeFeature: generated directory layout In order to start a new gem A user should be able to generate a directory layout Scenario: shared Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem' is created And a directory named 'the-perfect-gem/lib' is created And a file named 'the-perfect-gem/README.rdoc' is created And a file named 'the-perfect-gem/.document' is created And a file named 'the-perfect-gem/lib/the-perfect-gem.rb' is created Scenario: bacon Given a working directory And I have configured git sanely When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/spec' is created And a file named 'the-perfect-gem/spec/spec_helper.rb' is created And a file named 'the-perfect-gem/spec/the-perfect-gem_spec.rb' is created Scenario: minitest Given a working directory And I have configured git sanely When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/test' is created And a file named 'the-perfect-gem/test/helper.rb' is created And a file named 'the-perfect-gem/test/test_the-perfect-gem.rb' is created Scenario: rspec Given a working directory And I have configured git sanely When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/spec' is created And a file named 'the-perfect-gem/spec/spec_helper.rb' is created And a file named 'the-perfect-gem/spec/the-perfect-gem_spec.rb' is created Scenario: shoulda Given a working directory And I have configured git sanely When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/test' is created And a file named 'the-perfect-gem/test/helper.rb' is created And a file named 'the-perfect-gem/test/test_the-perfect-gem.rb' is created Scenario: testunit Given a working directory And I have configured git sanely When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/test' is created And a file named 'the-perfect-gem/test/helper.rb' is created And a file named 'the-perfect-gem/test/test_the-perfect-gem.rb' is created Scenario: micronaut Given a working directory And I have configured git sanely When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/examples' is created And a file named 'the-perfect-gem/examples/example_helper.rb' is created And a file named 'the-perfect-gem/examples/the-perfect-gem_example.rb' is created Scenario: shindo Given a working directory And I have configured git sanely When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then a directory named 'the-perfect-gem/tests' is created And a file named 'the-perfect-gem/tests/tests_helper.rb' is created And a file named 'the-perfect-gem/tests/the-perfect-gem_tests.rb' is created jeweler-2.0.1/features/generator/cucumber.feature0000644000175000017500000001022112641037113020525 0ustar aleealeeFeature: generating cucumber stories In order to get started using cucumber in a project A user should be able to generate a project setup for their testing framework of choice Scenario: sans cucumber setup Given a working directory And I have configured git sanely And I do not want cucumber stories When I generate a project named 'the-perfect-gem' that is 'zomg, so good' And a file named 'the-perfect-gem/features/the-perfect-gem.feature' is not created And a file named 'the-perfect-gem/features/support/env.rb' is not created And a file named 'the-perfect-gem/features/steps/the-perfect-gem_steps.rb' is not created Scenario: basic cucumber setup Given a working directory And I have configured git sanely And I want cucumber stories When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then cucumber directories are created And a file named 'the-perfect-gem/features/the-perfect-gem.feature' is created And a file named 'the-perfect-gem/features/support/env.rb' is created And a file named 'the-perfect-gem/features/step_definitions/the-perfect-gem_steps.rb' is created And 'features/support/env.rb' requires 'bundler' And 'features/support/env.rb' sets up bundler using the default and development groups And 'features/support/env.rb' requires 'the-perfect-gem' Scenario: bundler Given a working directory And I want bundler And I have configured git sanely And I want cucumber stories When I generate a project named 'the-perfect-gem' that is 'zomg, so good' And 'features/support/env.rb' requires 'bundler' And 'features/support/env.rb' sets up bundler using the default and development groups Scenario: no bundler Given a working directory And I have configured git sanely And I do not want bundler And I want cucumber stories When I generate a project named 'the-perfect-gem' that is 'zomg, so good' And 'features/support/env.rb' does not require 'bundler' And 'features/support/env.rb' does not setup bundler Scenario: cucumber setup for bacon Given a working directory And I have configured git sanely And I want cucumber stories When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'test/unit/assertions' And cucumber world extends "Test::Unit::Assertions" Scenario: cucumber setup for shoulda Given a working directory And I have configured git sanely And I want cucumber stories When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'test/unit/assertions' And cucumber world extends "Test::Unit::Assertions" Scenario: cucumber setup for testunit Given a working directory And I have configured git sanely And I want cucumber stories When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'test/unit/assertions' And cucumber world extends "Test::Unit::Assertions" Scenario: cucumber setup for minitest Given a working directory And I have configured git sanely And I want cucumber stories When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'minitest/unit' And cucumber world extends "MiniTest::Assertions" Scenario: cucumber setup for rspec Given a working directory And I have configured git sanely And I want cucumber stories When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'the-perfect-gem' And 'features/support/env.rb' requires 'rspec/expectations' Scenario: cucumber setup for mirconaut Given a working directory And I have configured git sanely And I want cucumber stories When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/support/env.rb' requires 'the-perfect-gem' And 'features/support/env.rb' requires 'micronaut/expectations' And cucumber world extends "Micronaut::Matchers" jeweler-2.0.1/features/generator/git.feature0000644000175000017500000000673712641037113017524 0ustar aleealeeFeature: git support In order to start a new gem for GitHub A user should be able to generate a project that is setup for git Scenario: git remote configuration Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then git repository has 'origin' remote And git repository 'origin' remote should be 'git@github.com:technicalpickles/the-perfect-gem.git' Scenario: .gitignore Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a sane '.gitignore' is created Scenario: baseline repository Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a commit with the message 'Initial commit to the-perfect-gem.' is made And 'README.rdoc' was checked in And 'Rakefile' was checked in And 'LICENSE.txt' was checked in And 'lib/the-perfect-gem.rb' was checked in And '.gitignore' was checked in And no files are untracked And no files are changed And no files are added And no files are deleted Scenario: bacon Given a working directory And I have configured git sanely When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' was checked in And 'spec/the-perfect-gem_spec.rb' was checked in Scenario: minitest Given a working directory And I have configured git sanely When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' was checked in And 'test/test_the-perfect-gem.rb' was checked in Scenario: rspec Given a working directory And I have configured git sanely When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' was checked in And 'spec/the-perfect-gem_spec.rb' was checked in Scenario: shoulda Given a working directory And I have configured git sanely When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' was checked in And 'test/test_the-perfect-gem.rb' was checked in Scenario: testunit Given a working directory And I have configured git sanely When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' was checked in And 'test/test_the-perfect-gem.rb' was checked in Scenario: micronaut Given a working directory And I have configured git sanely When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'examples/example_helper.rb' was checked in And 'examples/the-perfect-gem_example.rb' was checked in Scenario: cucumber Given a working directory And I have configured git sanely And I want cucumber stories When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then 'features/the-perfect-gem.feature' was checked in And 'features/support/env.rb' was checked in And 'features/step_definitions/the-perfect-gem_steps.rb' was checked in Scenario: shindo Given a working directory And I have configured git sanely When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then 'tests/tests_helper.rb' was checked in And 'tests/the-perfect-gem_tests.rb' was checked in jeweler-2.0.1/features/generator/test.feature0000644000175000017500000000442012641037113017703 0ustar aleealeeFeature: generated test or spec In order to start a new gem A user should be able to generate a test or spec Scenario: bacon Given a working directory And I have configured git sanely When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/the-perfect-gem_spec.rb' should describe 'ThePerfectGem' Scenario: minitest Given a working directory And I have configured git sanely When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/test_the-perfect-gem.rb' should define 'TestThePerfectGem' as a subclass of 'MiniTest::Unit::TestCase' Scenario: rspec Given a working directory And I have configured git sanely When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/the-perfect-gem_spec.rb' should describe 'ThePerfectGem' Scenario: shoulda Given a working directory And I have configured git sanely And I intend to test with shoulda When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/test_the-perfect-gem.rb' should define 'TestThePerfectGem' as a subclass of 'Test::Unit::TestCase' Scenario: testunit Given a working directory And I have configured git sanely When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/test_the-perfect-gem.rb' should define 'TestThePerfectGem' as a subclass of 'Test::Unit::TestCase' Scenario: micronaut Given a working directory And I have configured git sanely When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'examples/the-perfect-gem_example.rb' should describe 'ThePerfectGem' Scenario: riot Given a working directory And I have configured git sanely When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/the-perfect-gem_test.rb' should contextualize 'the-perfect-gem' And 'test/the-perfect-gem_test.rb' requires 'teststrap' Scenario: shindo Given a working directory And I have configured git sanely When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then 'tests/the-perfect-gem_tests.rb' should have tests for 'ThePerfectGem'jeweler-2.0.1/features/generator/readme.feature0000644000175000017500000000063312641037113020163 0ustar aleealeeFeature: generated license In order to start a new gem A user should be able to generate a default license Scenario: copyright Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then 'README.rdoc' contains '= the-perfect-gem' And 'README.rdoc' mentions copyright belonging to me in the current year jeweler-2.0.1/features/generator/license.feature0000644000175000017500000000110612641037113020344 0ustar aleealeeFeature: generated license In order to start a new gem A user should be able to generate a default license Background: Given a working directory Scenario: crediting user Given I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then LICENSE.txt credits 'foo' Scenario: copyright in the current year Given it is the year 2005 And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then LICENSE.txt has a copyright in the year 2005 jeweler-2.0.1/features/generator/gemfile.feature0000644000175000017500000000631012641037113020334 0ustar aleealeeFeature: generated Gemfiel In order to start a new gem A user should be able to generate a Gemfile Background: Given a working directory And I have configured git sanely Scenario: disabled Given I do not want bundler When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a file named 'the-perfect-gemGemfile' is not created Scenario: enabled Given I want bundler When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a file named 'the-perfect-gem/Gemfile' is created Scenario: default When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then a file named 'the-perfect-gem/Gemfile' is created And 'Gemfile' uses the gemcutter source And 'Gemfile' has a development dependency on 'bundler' And 'Gemfile' has a development dependency on the current version of jeweler And 'Gemfile' has a development dependency on 'simplecov' And 'Gemfile' has a development dependency on 'rcov' And 'Gemfile' has a development dependency on 'rdoc' And 'Gemfile' does not have a development dependency on 'yard' Scenario: bacon When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'bacon' Scenario: minitest When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'minitest' Scenario: rspec When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'rspec' Scenario: shoulda When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'shoulda' Scenario: micronaut When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'micronaut' Scenario: cucumber Given I want cucumber stories When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'cucumber' Scenario: reek Given I want reek When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'reek' Scenario: roodi Given I want roodi When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'roodi' Scenario: rdoc Given I want to use rdoc instead of yard When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'rdoc' And 'Gemfile' does not have a development dependency on 'yard' Scenario: yard Given I want to use yard instead of rdoc When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'yard' Then 'Gemfile' has a development dependency on 'rdoc' Scenario: shindo When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then 'Gemfile' has a development dependency on 'shindo' jeweler-2.0.1/features/generator/dotdocument.feature0000644000175000017500000000073112641037113021252 0ustar aleealeeFeature: generated .document In order to easily generate RDoc A user should be able to generate reasonable .document file Scenario: .document Given a working directory And I have configured git sanely When I generate a project named 'the-perfect-gem' that is 'zomg, so good' Then '.document' contains 'lib/**/*.rb' And '.document' contains 'bin/*' And '.document' contains 'features/**/*.feature' And '.document' contains 'LICENSE.txt' jeweler-2.0.1/features/generator/test_helper.feature0000644000175000017500000001424412641037113021247 0ustar aleealeeFeature: generated test or spec In order to start a new gem A user should be able to generate a test or spec Scenario: bacon w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' requires 'bundler' And 'spec/spec_helper.rb' sets up bundler using the default and development groups And 'spec/spec_helper.rb' requires 'bacon' And 'spec/spec_helper.rb' requires 'the-perfect-gem' Scenario: bacon w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' does not require 'bundler' And 'spec/spec_helper.rb' does not setup bundler Scenario: minitest w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' requires 'bundler' And 'test/helper.rb' sets up bundler using the default and development groups And 'test/helper.rb' requires 'minitest/unit' And 'test/helper.rb' requires 'the-perfect-gem' And 'test/helper.rb' should autorun tests Scenario: minitest w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' does not require 'bundler' And 'test/helper.rb' does not setup bundler Scenario: rspec w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' requires 'rspec' And 'spec/spec_helper.rb' requires 'the-perfect-gem' Scenario: rspec w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'spec/spec_helper.rb' does not require 'bundler' And 'spec/spec_helper.rb' does not setup bundler Scenario: shoulda w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' requires 'bundler' And 'test/helper.rb' sets up bundler using the default and development groups And 'test/helper.rb' requires 'test/unit' And 'test/helper.rb' requires 'shoulda' And 'test/helper.rb' requires 'the-perfect-gem' Scenario: shoulda w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' And 'test/helper.rb' does not require 'bundler' And 'test/helper.rb' does not setup bundler Scenario: testunit w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/helper.rb' requires 'test/unit' And 'test/helper.rb' requires 'the-perfect-gem' And 'test/helper.rb' requires 'bundler' And 'test/helper.rb' sets up bundler using the default and development groups Scenario: testunit w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' And 'test/helper.rb' does not require 'bundler' And 'test/helper.rb' does not setup bundler Scenario: micronaut w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'examples/example_helper.rb' requires 'rubygems' Then 'examples/example_helper.rb' requires 'micronaut' Then 'examples/example_helper.rb' requires 'the-perfect-gem' And 'examples/example_helper.rb' requires 'bundler' And 'examples/example_helper.rb' sets up bundler using the default and development groups Scenario: micronaut w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' And 'examples/example_helper.rb' does not require 'bundler' And 'examples/example_helper.rb' does not setup bundler Scenario: riot w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good' Then 'test/teststrap.rb' requires 'riot' And 'test/teststrap.rb' requires 'the-perfect-gem' And 'test/teststrap.rb' requires 'bundler' And 'test/teststrap.rb' sets up bundler using the default and development groups Scenario: riot w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good' And 'test/teststrap.rb' does not require 'bundler' And 'test/teststrap.rb' does not setup bundler Scenario: shindo w/ bundler Given a working directory And I have configured git sanely And I want bundler When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then 'tests/tests_helper.rb' requires 'the-perfect-gem' Then 'tests/tests_helper.rb' requires 'shindo' Then 'tests/tests_helper.rb' requires 'bundler' And 'tests/tests_helper.rb' sets up bundler using the default and development groups Scenario: shindo w/o bundler Given a working directory And I have configured git sanely And I do not want bundler When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' Then 'tests/tests_helper.rb' does not require 'bundler' And 'tests/tests_helper.rb' does not setup bundler jeweler-2.0.1/features/generator/rakefile.feature0000644000175000017500000001504612641037113020514 0ustar aleealeeFeature: generated Rakefile In order to start a new gem A user should be able to generate a Rakefile Background: Given a working directory And I have configured git sanely Scenario: shared When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive' Then 'Rakefile' requires 'bundler' And 'Rakefile' sets up bundler using the default and development groups And 'Rakefile' requires 'rubygems' And 'Rakefile' requires 'rake' And 'Rakefile' requires 'rdoc/task' And Rakefile has 'the-perfect-gem' for the Jeweler::Tasks name And Rakefile has 'bar@example.com' for the Jeweler::Tasks email And Rakefile has 'zomg, so good' for the Jeweler::Tasks summary And Rakefile has 'Descriptive' for the Jeweler::Tasks description And Rakefile has 'http://github.com/technicalpickles/the-perfect-gem' for the Jeweler::Tasks homepage And Rakefile has 'MIT' for the Jeweler::Tasks license And Rakefile instantiates a Jeweler::RubygemsDotOrgTasks And Rakefile has a magic comment for UTF-8 Scenario: bacon When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'rcov/rcovtask' And Rakefile has 'spec/**/*_spec.rb' for the Rake::TestTask pattern And Rakefile has 'spec/**/*_spec.rb' for the Rcov::RcovTask pattern And Rakefile has 'spec' in the Rcov::RcovTask libs And Rakefile has "spec" as the default task Scenario: minitest When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'rcov/rcovtask' And Rakefile has 'test/**/test_*.rb' for the Rake::TestTask pattern And Rakefile has 'test/**/test_*.rb' for the Rcov::RcovTask pattern And Rakefile has 'test' in the Rcov::RcovTask libs And Rakefile has "test" as the default task @rspec Scenario: rspec When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'rspec/core' And 'Rakefile' requires 'rspec/core/rake_task' And Rakefile has 'spec/**/*_spec.rb' for the RSpec::Core::RakeTask pattern And Rakefile has "spec" as the default task Scenario: shoulda When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'rcov/rcovtask' And Rakefile has 'test/**/test_*.rb' for the Rake::TestTask pattern And Rakefile has 'test/**/test_*.rb' for the Rcov::RcovTask pattern And Rakefile has 'test' in the Rcov::RcovTask libs And Rakefile has "test" as the default task Scenario: micronaut When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'micronaut/rake_task' And Rakefile has 'examples/**/*_example.rb' for the Micronaut::RakeTask pattern And Rakefile has "examples" as the default task Scenario: testunit When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' requires 'rcov/rcovtask' Then Rakefile has 'test/**/test_*.rb' for the Rake::TestTask pattern And Rakefile has 'test/**/test_*.rb' for the Rcov::RcovTask pattern And Rakefile has 'test' in the Rcov::RcovTask libs And Rakefile has '--exclude "gems/*"' in the Rcov::RcovTask rcov_opts And Rakefile has "test" as the default task Scenario: no cucumber Given I do not want cucumber stories When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile does not require 'cucumber/rake/task' And Rakefile does not instantiate a Cucumber::Rake::Task Scenario: cucumber Given I want cucumber stories When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile requires 'cucumber/rake/task' And Rakefile instantiates a Cucumber::Rake::Task Scenario: no reek Given I do not want reek When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile does not require 'reek/rake/task' And Rakefile does not instantiate a Reek::Rake::Task Scenario: reek Given I want reek When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile requires 'reek/rake/task' And Rakefile instantiates a Reek::Rake::Task Scenario: no roodi Given I do not want roodi When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile does not require 'roodi' And Rakefile does not require 'roodi_task' And Rakefile does not instantiate a RoodiTask Scenario: roodi Given I want roodi When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile requires 'roodi' And Rakefile requires 'roodi_task' And Rakefile instantiates a RoodiTask Scenario: no rubyforge Given I do not want rubyforge setup When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then Rakefile does not instantiate a Jeweler::RubyforgeTasks Scenario: yard Given I want to use yard instead of rdoc When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' does not require 'rdoc/task' And 'Rakefile' requires 'yard' And Rakefile instantiates a YARD::Rake::YardocTask Scenario: rdoc Given I want to use rdoc instead of yard When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good' Then 'Rakefile' does not require 'yard' And 'Rakefile' requires 'rdoc/task' And Rakefile does not instantiate a YARD::Rake::YardocTask And Rakefile instantiates a Rake::RDocTask.new Scenario: shindo When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good' And 'Rakefile' requires 'shindo/rake' And Rakefile instantiates a Shindo::Rake.new And Rakefile has "tests" as the default task Scenario: bundler Given I want bundler When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive' Then 'Rakefile' requires 'bundler' And 'Rakefile' sets up bundler using the default and development groups And Rakefile does not add 'jeweler' as a development dependency to Jeweler::Tasks Scenario: no bundler Given I do not want bundler When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive' Then 'Rakefile' does not require 'bundler' And 'Rakefile' does not setup bundler And Rakefile adds 'jeweler' as a development dependency to Jeweler::Tasks jeweler-2.0.1/.yardopts0000644000175000017500000000004212641037113013405 0ustar aleealee--exclude /templates/ lib/**/*.rb jeweler-2.0.1/Rakefile0000644000175000017500000000360712641037113013216 0ustar aleealee# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :xzibit, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "jeweler" gem.version = Jeweler::Version::STRING gem.homepage = "http://github.com/technicalpickles/jeweler" gem.summary = "Opinionated tool for creating and managing RubyGem projects" gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub" gem.license = "MIT" gem.authors = ["Josh Nichols", "Yusuke Murata"] gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"] gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore) # dependencies defined in Gemfile end Jeweler::RubygemsDotOrgTasks.new require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.test_files = FileList.new('test/**/test_*.rb') do |list| list.exclude 'test/test_helper.rb' list.exclude 'test/fixtures/**/*.rb' end test.libs << 'test' test.verbose = true end namespace :test do task :gemspec_dup do gemspec = Rake.application.jeweler.gemspec dupped_gemspec = gemspec.dup cloned_gemspec = gemspec.clone puts gemspec.to_ruby puts dupped_gemspec.to_ruby end end require 'yard' YARD::Rake::YardocTask.new do |t| t.files = FileList['lib/**/*.rb'].exclude('lib/jeweler/templates/**/*.rb') end require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) do |features| features.cucumber_opts = "features --format progress" end namespace :features do Cucumber::Rake::Task.new(:pretty) do |features| features.cucumber_opts = "features --format progress" end end if ENV["RUN_CODE_RUN"] == "true" task :default => [:test, :features] else task :default => :test end jeweler-2.0.1/ChangeLog.markdown0000644000175000017500000002154612641037113015146 0ustar aleealee# jeweler 2.0.0, 2014-01-05 * Ruby 1.8 is not supported anymore. * rake release accepts remote and branches #249 # jeweler 1.8.7, 2013-08-12 * Lock timecop version to 0.6.1 to keep support of 1.8.7 #243 * Bump version in version.rb to reflect released gem version * jeweler's Rakefile reads version from version.rb # jeweler 1.8.6, 2013-07-04 * Fix dependency error when install #239 # jeweler 1.8.5, 2013-06-29 * Support rubygems 2.x #238 # jeweler 1.8.2, 2012-01-24 * Fixed jeweler's circular dependency on itself #224 # jeweler 1.8.2, 2012-01-24 * Standardize on invoking jeweler in development: bundle exec jeweler #220 * Add travis-ci configuration and build status to README #222 * Updated version of rspec used by generator to 2.8.0 #223 # jeweler 1.8.1, 2012-01-24 * Generated projects using yard now use ~> 0.7.4 #219 # jeweler 1.8.0, 2012-01-23 * Generator now has a --version flag #217 * Generated Gemfile now includes rdoc gem when using rdoc * Fixed jeweler's yardoc task #216 * Updated version of yard used for new projects, and include rdoc compatability # jeweler 1.7.0, 2012-01-23 * Better grammars in README! * Generated Rakefile no longer uses deprecated rake/rdoctask * Added `rake clean` * `rake release` calls `rake clean` to avoid packaging built gems in pkg #216 # jeweler 1.6.4, 2011-07-07 * Generator can now take an path to generate into, rather than just the name of the directory, ie `jeweler /path/to/awesomeness', not `jeweler --directory /path/to awesomeness`. Thanks invadersmustdie! #187 * Generator's --directory is deprecated and will be removed for 2.0.0 # jeweler 1.6.3 * Fix typo in Rake tasks, thanks yehezkielbs! #193 * Fix deprecation warnings for `Gem.activate`, thanks tickmichaeledgar! #191 # jeweler 1.6.2 * Loosen bundler dependency to work with 1.x #180 # jeweler 1.6.1 * Fix "undefined method 'sh'" when using rake 0.9.0 #181, #182, #184 # jeweler 1.6.0 * Fix generated RCov task to exclude gems * Generated .gitignore includes example for rubinius and redcar * Generated Rakefile includes magic utf-8 comment for better UTF-8 support #20 * Generated Jeweler::Tasks now correctly documents that dependencies are managed in the Gemfile * Workaround issues with ruby 1.9.2 and psych #169 * No longer deals with `test_files` #178 * JEWELER_OPTS are overridden by command line flags #178 # jeweler 1.5.1 * TODO # jeweler 1.5.0 * TODO # jeweler 1.4.0 2009-11-19 * Generator now adds gemcutter support by default. Disable it with --no-gemcutter * Generator now creates a reek task that works with the latest reek. If you have a previously generated project using it, you may need to change the require line to: require 'reek/adapters/rake_task' * Generator now exits with the correct exit code * `rake install` no longer uses `sudo` to install. If your ruby configuration needs sudo to install, use `sudo rake install` instead. * `rake install` now correctly installs dependencies as well * `rake install` should correctly figure out which `gem` binary to invoke now * `rake build` now will regenerate the gemspec as well * `rake gemspec` now eliminates duplicates for gemspec.files, gemspec.rdoc_files, etc * `rake gemspec` now automatically populates gemspec.extensions with any extconf.rb files you have in `ext` * Releasing to Rubyforge is now deprecated in favor of Gemcutter. # jeweler 1.3.0 * Now supports an additional version type, build. This can be used to add a fourth segment of the version that's arbitrary. One example use is having prereleases. * Jeweler now lazily loads, to avoid causing side-effects when running other rake tasks * Version can now be set explicitly on the gemspec, rather than relying on a VERSION file * Rubyforge and Gemcutter support now hooks into `rake release` * `rake build` now uses an in-memory copy of the gemspec, rather than the filesystem persisted one * Rubyforge support no longer forces the uploading of documentation * Generator: * Allow arbitrary homepage and git remotes, to decouple a bit from GitHub * Support for the riot testing framework: http://github.com/thumblemonks/riot/ * Support for test/spec * .gitignore now ignores emacs temporary files * rspec support now creates a spec.opts with support for color and other stuff * Updated minitest support (formally miniunit) * Improved support for autotest # jeweler 1.2.0 2009-08-06 * Generator now adds development dependencies appropriate to your testing framework * Added check_dependencies tasks for verifying gem dependencies are installed * Fixed typo in generated yard task * Fixed generator from having a lot of extra newlines # jeweler 1.1.0 2009-08-05 * Support for generating a project that uses yard instead of rdoc * Generated gemspec now includes comments about it being generated by jeweler * Only use sudo for installing on non-windows platforms [#1] * Fixed rake release to be repeatable on the same version [#16] * Fixed rake rubyforge:setup to not create duplicate packages * Use a more recent version of ruby-git * Fixes various issues with reading values out of ~/.gitconfig [#26] [#21] [#19] * Experimenting with a rake task to check development time dependencies [#22] * Fixed generated rdoc task to load from VERSION instead of VERSION.yml # jeweler 1.0.2 2009-07-29 * Don't include git ignored files for default gemspec's files and test_files * Fixed rspec generator to allow specs to be run directly * Removed misleading docstring for version_required rake task [#17] * Includes some notes about contributed in generated README * Added support for generating a project to use reek and roodi # jeweler 1.0.1 2009-05-15 # jeweler 0.11.1 * Lots of internal refactorings to how project generation happens * Fixed missing dependency on rubyforge * Depend on a recent version of schacon-git which works on ruby 1.9 * Updated cucumber support for 0.3.x * Tested on Ruby 1.9 # jeweler 0.11.0 2009-04-05 * generator will respect JEWELER_OPTS, as a way to provide default options (pat-maddox) * Include 'examples' and 'rails' directories by default in gemspec files * generated gemspec now will only include files (not directories). also, they are listed one per line, and sorted. * Jeweler::Tasks's intializer has been improved: * You can now pass it an existing gemspec (othewise a new one will be created) * Jeweler sets its defaults before yielding the gemspec to you. This allows you to append to its defaults, so you aren't forced to entirely overwrite them just to add one value. * Managing a gemspec's files, test_files, and extra_rdoc_files is now more flexible. They are now wrapped in a FileList, so you can easily 'include' or 'exclude' patterns. # jeweler 0.10.2 2009-03-26 * 'rake install' now will 'rake build' first * Support for releasing to RubyForge, thanks to jtrupiano * Steps towards Ruby 1.9 support, thanks to rsanheim # jeweler 0.9.1 2009-03-05 * Tasks: * Fixed populating default spec's extra_rdoc_files * Removed redundant gem building/installing tasks. Use rake build and rake install * Generator: * Added support for micronaut * Generate nicer block variable names in Rakefile * Cucumber generation now places steps in features/step_features, to follow cucumber standards * shoulda and test/unit test_helpers no longer require mocha * Rakefile uses more readable block variable names * .gitignore now includes pkg and coverage directories * Avoid puts'ing in Rakefile when LoadError occurs. Instead, define a task that aborts with instructions to install. * Cucumber is now optional. Generate stories using --cucumber * Bacon's 'test' task is now 'spec' * Generate README.rdoc instead of just a plain text README * Updated year in README.rdoc and COPYRIGHT to be based on the current year instead of hardcoded # jeweler 0.8.1 2009-02-03 * Fixed minitest generator # jeweler 0.8.0 2009-02-03 * Generator: * Supports these new testing frameworks: * test/unit * minitest * rspec * Added support for cucumber * Creating a new gem is now more verbose, and will show files/directories created * Binaries will now be automatically detected in 'bin' # jeweler 0.7.2 2009-01-29 * Added rake task 'version:bump' which is shorthand for 'version:bump:patch' * Generated projects no longer assume RCov is installed. # jeweler 0.7.1 2009-01-26 * Fixed yaml not being required * Automatically add files in bin as executables in gemspec # jeweler 0.7.0 2009-01-19 * Added support to generator for specifying a description * Condensed README.markdown to be less novel-like * RDoc is now included in your gemspec * Rescue errors that raise in the generator, and display better error message, and exit with a non-zero exit status # jeweler 0.6.5 2009-01-14 * `jeweler --create-repo foo` now enables gem creation in addition to creating the repository # jeweler 0.6.4 2009-01-13 * Added tasks `build` and `install` as shortcuts for `gem:build` and `gem:install` jeweler-2.0.1/.document0000644000175000017500000000017712641037113013367 0ustar aleealeelib/jeweler.rb lib/jeweler/*.rb lib/jeweler/commands/*.rb lib/jeweler/generator/*.rb bin/* - features/**/*.feature LICENSE.txt jeweler-2.0.1/lib/0000755000175000017500000000000012641037113012311 5ustar aleealeejeweler-2.0.1/lib/jeweler.rb0000644000175000017500000001134012641037113014272 0ustar aleealeerequire 'pathname' require 'date' require 'jeweler/version' # A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest. # # See Jeweler::Tasks for examples of how to get started. Additionally, resources are available on the wiki: # # * http://wiki.github.com/technicalpickles/jeweler/create-a-new-project # * http://wiki.github.com/technicalpickles/jeweler/configure-an-existing-project class Jeweler require 'jeweler/errors' require 'rubygems/user_interaction' require 'rubygems/package' autoload :Generator, 'jeweler/generator' autoload :Commands, 'jeweler/commands' autoload :VersionHelper, 'jeweler/version_helper' autoload :GemSpecHelper, 'jeweler/gemspec_helper' autoload :Tasks, 'jeweler/tasks' autoload :RubygemsDotOrgTasks, 'jeweler/rubygems_dot_org_tasks' autoload :GemcutterTasks, 'jeweler/gemcutter_tasks' autoload :RubyforgeTasks, 'jeweler/rubyforge_tasks' autoload :Specification, 'jeweler/specification' attr_reader :gemspec, :gemspec_helper, :version_helper attr_accessor :base_dir, :output, :repo, :commit def initialize(gemspec, base_dir = '.') raise(GemspecError, "Can't create a Jeweler with a nil gemspec") if gemspec.nil? @gemspec = gemspec @gemspec.extend(Specification) @gemspec.set_jeweler_defaults(base_dir, git_base_dir) @base_dir = base_dir @repo = Git.open(git_base_dir) if in_git_repo? @version_helper = Jeweler::VersionHelper.new(base_dir) @output = $stdout @commit = true @gemspec_helper = GemSpecHelper.new(gemspec, base_dir) end # Major version, as defined by the gemspec's Version module. # For 1.5.3, this would return 1. def major_version @version_helper.major end # Minor version, as defined by the gemspec's Version module. # For 1.5.3, this would return 5. def minor_version @version_helper.minor end # Patch version, as defined by the gemspec's Version module. # For 1.5.3, this would return 5. def patch_version @version_helper.patch end # Human readable version, which is used in the gemspec. def version @gemspec.version || @version_helper.to_s end # Writes out the gemspec def write_gemspec Jeweler::Commands::WriteGemspec.build_for(self).run end # Validates the project's gemspec from disk in an environment similar to how # GitHub would build from it. See http://gist.github.com/16215 def validate_gemspec Jeweler::Commands::ValidateGemspec.build_for(self).run end # is the project's gemspec from disk valid? def valid_gemspec? gemspec_helper.valid? end # Build a gem using the project's latest Gem::Specification def build_gem Jeweler::Commands::BuildGem.build_for(self).run end # Install a previously built gem def install_gem Jeweler::Commands::InstallGem.build_for(self).run end # Bumps the patch version. # # 1.5.1 -> 1.5.2 def bump_patch_version() Jeweler::Commands::Version::BumpPatch.build_for(self).run end # Bumps the minor version. # # 1.5.1 -> 1.6.0 def bump_minor_version() Jeweler::Commands::Version::BumpMinor.build_for(self).run end # Bumps the major version. # # 1.5.1 -> 2.0.0 def bump_major_version() Jeweler::Commands::Version::BumpMajor.build_for(self).run end # Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it. def write_version(major, minor, patch, build, options = {}) command = Jeweler::Commands::Version::Write.build_for(self) command.major = major command.minor = minor command.patch = patch command.build = build command.run end def release_gemspec(args) Jeweler::Commands::ReleaseGemspec.build_for(self).run(args) end def release_to_git(args) Jeweler::Commands::ReleaseToGit.build_for(self).run(args) end def release_gem_to_rubygems Jeweler::Commands::ReleaseToRubygems.build_for(self).run end def release_gem_to_rubyforge # no-op end def setup_rubyforge # no-op end def check_dependencies(type = nil) command = Jeweler::Commands::CheckDependencies.build_for(self) command.type = type command.run end def git_base_dir(base_dir = nil) if base_dir base_dir = File.dirname(base_dir) else base_dir = File.expand_path(self.base_dir || ".") end return nil if base_dir==File.dirname("/") return base_dir if File.exists?(File.join(base_dir, '.git')) return git_base_dir(base_dir) end def in_git_repo? git_base_dir end def version_file_exists? File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path) end def expects_version_file? gemspec.version.nil? end end jeweler-2.0.1/lib/jeweler/0000755000175000017500000000000012641037113013746 5ustar aleealeejeweler-2.0.1/lib/jeweler/specification.rb0000644000175000017500000000657312641037113017126 0ustar aleealee require 'rubygems/specification' class Jeweler # Extend a Gem::Specification instance with this module to give it Jeweler # super-cow powers. # # [files] a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely # [extra_rdoc_files] a Rake::FileList including files like README*, ChangeLog*, and LICENSE* # [executables] uses anything found in the bin/ directory. module Specification def self.filelist_attribute(name) code = %{ def #{name} if @#{name} && @#{name}.class != FileList @#{name} = FileList[@#{name}] end @#{name} ||= FileList[] end def #{name}=(value) @#{name} = FileList[value] end } module_eval code, __FILE__, __LINE__ - 9 end filelist_attribute :files filelist_attribute :extra_rdoc_files # Assigns the Jeweler defaults to the Gem::Specification def set_jeweler_defaults(base_dir, git_base_dir = nil) base_dir = File.expand_path(base_dir) git_base_dir = if git_base_dir File.expand_path(git_base_dir) else base_dir end can_git = git_base_dir && base_dir.include?(git_base_dir) && File.directory?(File.join(git_base_dir, '.git')) Dir.chdir(git_base_dir) do repo = if can_git require 'git' Git.open(git_base_dir) end if blank?(files) && repo base_dir_with_trailing_separator = File.join(base_dir, "") ignored_files = repo.lib.ignored_files + [".gitignore"] self.files = (repo.ls_files(base_dir).keys - ignored_files).compact.map do |file| File.expand_path(file).sub(base_dir_with_trailing_separator, "") end end if blank?(executables) && repo self.executables = (repo.ls_files(File.join(base_dir, 'bin')).keys - repo.lib.ignored_files).map do |file| File.basename(file) end end if blank?(extensions) self.extensions = FileList['ext/**/{extconf,mkrf_conf}.rb'] end if blank?(extra_rdoc_files) self.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'LICENSE*', 'TODO'] end if File.exist?('Gemfile') require 'bundler' bundler = Bundler.load bundler.dependencies_for(:default, :runtime).each do |dependency| self.add_dependency dependency.name, *dependency.requirement.as_list end bundler.dependencies_for(:development).each do |dependency| self.add_development_dependency dependency.name, *dependency.requirement.as_list end end end end # Used by Specification#to_ruby to generate a ruby-respresentation of a Gem::Specification def ruby_code(obj) case obj when Rake::FileList then obj.uniq.to_a.inspect else super end end private def blank?(value) value.nil? || value.empty? end end end # Workaround for cloning/duping a Gem::Specification # documented in http://github.com/technicalpickles/jeweler/issues#issue/73 Gem::Specification.class_eval do def initialize_copy(original) super self.files = original.files.to_a self.extra_rdoc_files = original.extra_rdoc_files.to_a end end jeweler-2.0.1/lib/jeweler/rubygems_dot_org_tasks.rb0000644000175000017500000000133712641037113021056 0ustar aleealeerequire 'rake' require 'rake/tasklib' class Jeweler # Rake tasks for putting a Jeweler gem on Gemcutter. # # Jeweler::Tasks.new needs to be used before this. # # Basic usage: # # Jeweler::RubygemsDotOrgTasks.new # # Easy enough, right? class RubygemsDotOrgTasks < ::Rake::TaskLib attr_accessor :jeweler def initialize yield self if block_given? define end def jeweler @jeweler ||= Rake.application.jeweler end def define namespace :gemcutter do desc "Release gem to Gemcutter" task :release => [:gemspec, :build] do jeweler.release_gem_to_rubygems end end task :release => 'gemcutter:release' end end end jeweler-2.0.1/lib/jeweler/generator.rb0000644000175000017500000002277712641037113016300 0ustar aleealeerequire 'git' require 'github_api' require 'highline/import' require 'erb' require 'net/http' require 'uri' require 'fileutils' require 'pathname' require 'jeweler/version' class Jeweler class NoGitUserName < StandardError end class NoGitUserEmail < StandardError end class FileInTheWay < StandardError end class NoGitHubRepoNameGiven < StandardError end class NoGitHubUser < StandardError end class GitInitFailed < StandardError end class GitRepoCreationFailed < StandardError end # Generator for creating a jeweler-enabled project class Generator require 'jeweler/generator/options' require 'jeweler/generator/application' require 'jeweler/generator/github_mixin' require 'jeweler/generator/bacon_mixin' require 'jeweler/generator/micronaut_mixin' require 'jeweler/generator/minitest_mixin' require 'jeweler/generator/rspec_mixin' require 'jeweler/generator/shoulda_mixin' require 'jeweler/generator/testspec_mixin' require 'jeweler/generator/testunit_mixin' require 'jeweler/generator/riot_mixin' require 'jeweler/generator/shindo_mixin' require 'jeweler/generator/rdoc_mixin' require 'jeweler/generator/yard_mixin' attr_accessor :target_dir, :user_name, :user_email, :summary, :homepage, :description, :project_name, :github_username, :repo, :should_create_remote_repo, :testing_framework, :documentation_framework, :should_use_cucumber, :should_use_bundler, :should_setup_rubyforge, :should_use_reek, :should_use_roodi, :development_dependencies, :options, :git_remote def initialize(options = {}) self.options = options extracted_directory = nil self.project_name = options[:project_name] if self.project_name.nil? || self.project_name.squeeze.strip == "" raise NoGitHubRepoNameGiven else path = File.split(self.project_name) if path.size > 1 extracted_directory = File.join(path[0..-1]) self.project_name = path.last end end self.development_dependencies = [] self.testing_framework = options[:testing_framework] self.documentation_framework = options[:documentation_framework] begin generator_mixin_name = "#{self.testing_framework.to_s.capitalize}Mixin" generator_mixin = self.class.const_get(generator_mixin_name) extend generator_mixin rescue NameError => e raise ArgumentError, "Unsupported testing framework (#{testing_framework})" end begin generator_mixin_name = "#{self.documentation_framework.to_s.capitalize}Mixin" generator_mixin = self.class.const_get(generator_mixin_name) extend generator_mixin rescue NameError => e raise ArgumentError, "Unsupported documentation framework (#{documentation_framework})" end self.target_dir = options[:directory] || extracted_directory || self.project_name self.summary = options[:summary] || 'TODO: one-line summary of your gem' self.description = options[:description] || 'TODO: longer description of your gem' self.should_use_cucumber = options[:use_cucumber] self.should_use_reek = options[:use_reek] self.should_use_roodi = options[:use_roodi] self.should_setup_rubyforge = options[:rubyforge] self.should_use_bundler = options[:use_bundler] development_dependencies << ["cucumber", ">= 0"] if should_use_cucumber # TODO make bundler optional? development_dependencies << ["bundler", "~> 1.0"] development_dependencies << ["jeweler", "~> #{Jeweler::Version::STRING}"] development_dependencies << ["simplecov", ">= 0"] development_dependencies << ["reek", "~> 1.2.8"] if should_use_reek development_dependencies << ["roodi", "~> 2.1.0"] if should_use_roodi self.user_name = options[:user_name] self.user_email = options[:user_email] self.homepage = options[:homepage] self.git_remote = options[:git_remote] raise NoGitUserName unless self.user_name raise NoGitUserEmail unless self.user_email extend GithubMixin end def run create_files create_version_control $stdout.puts "Jeweler has prepared your gem in #{target_dir}" if should_create_remote_repo create_and_push_repo $stdout.puts "Jeweler has pushed your repo to #{git_remote}" end end def constant_name self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join end def lib_filename "#{project_name}.rb" end def require_name self.project_name end def file_name_prefix self.project_name.gsub('-', '_') end def lib_dir 'lib' end def feature_filename "#{project_name}.feature" end def steps_filename "#{project_name}_steps.rb" end def features_dir 'features' end def features_support_dir File.join(features_dir, 'support') end def features_steps_dir File.join(features_dir, 'step_definitions') end private def create_files unless File.exists?(target_dir) || File.directory?(target_dir) FileUtils.mkdir target_dir else raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?" end output_template_in_target '.gitignore' output_template_in_target 'Rakefile' output_template_in_target 'Gemfile' if should_use_bundler output_template_in_target 'LICENSE.txt' output_template_in_target 'README.rdoc' output_template_in_target '.document' mkdir_in_target lib_dir touch_in_target File.join(lib_dir, lib_filename) mkdir_in_target test_dir output_template_in_target File.join(testing_framework.to_s, 'helper.rb'), File.join(test_dir, test_helper_filename) output_template_in_target File.join(testing_framework.to_s, 'flunking.rb'), File.join(test_dir, test_filename) if testing_framework == :rspec output_template_in_target File.join(testing_framework.to_s, '.rspec'), '.rspec' end if should_use_cucumber mkdir_in_target features_dir output_template_in_target File.join(%w(features default.feature)), File.join('features', feature_filename) mkdir_in_target features_support_dir output_template_in_target File.join(features_support_dir, 'env.rb') mkdir_in_target features_steps_dir touch_in_target File.join(features_steps_dir, steps_filename) end end def render_template(source) template_contents = File.read(File.join(template_dir, source)) template = ERB.new(template_contents, nil, '<>') # squish extraneous whitespace from some of the conditionals template.result(binding).gsub(/\n\n\n+/, "\n\n") end def output_template_in_target(source, destination = source) final_destination = File.join(target_dir, destination) template_result = render_template(source) File.open(final_destination, 'w') {|file| file.write(template_result)} $stdout.puts "\tcreate\t#{destination}" end def template_dir File.join(File.dirname(__FILE__), 'templates') end def mkdir_in_target(directory) final_destination = File.join(target_dir, directory) FileUtils.mkdir final_destination $stdout.puts "\tcreate\t#{directory}" end def touch_in_target(destination) final_destination = File.join(target_dir, destination) FileUtils.touch final_destination $stdout.puts "\tcreate\t#{destination}" end def create_version_control Dir.chdir(target_dir) do begin @repo = Git.init() rescue Git::GitExecuteError => e raise GitInitFailed, "Encountered an error during gitification. Maybe the repo already exists, or has already been pushed to?" end begin @repo.add('.') rescue Git::GitExecuteError => e #raise GitAddFailed, "There was some problem adding this directory to the git changeset" raise end begin @repo.commit "Initial commit to #{project_name}." rescue Git::GitExecuteError => e raise end begin @repo.add_remote('origin', git_remote) rescue Git::GitExecuteError => e puts "Encountered an error while adding origin remote. Maybe you have some weird settings in ~/.gitconfig?" raise end end end def create_and_push_repo puts "Please provide your Github password to create the Github repository" begin login = github_username password = ask("Password: ") { |q| q.echo = false } github = Github.new(:login => login.strip, :password => password.strip) github.repos.create(:name => project_name, :description => summary) rescue Github::Error::Unauthorized puts "Wrong login/password! Please try again" retry rescue Github::Error::UnprocessableEntity raise GitRepoCreationFailed, "Can't create that repo. Does it already exist?" end # TODO do a HEAD request to see when it's ready? @repo.push('origin') end end end jeweler-2.0.1/lib/jeweler/version_helper.rb0000644000175000017500000000550612641037113017325 0ustar aleealeebegin require 'psych' rescue ::LoadError end require 'yaml' class Jeweler class VersionHelper attr_accessor :base_dir attr_reader :major, :minor, :patch, :build module YamlExtension def write File.open(yaml_path, 'w+') do |f| YAML.dump(self.to_hash, f) end end def to_hash { :major => major, :minor => minor, :patch => patch, :build => build } end def refresh parse_yaml end def parse_yaml yaml = read_yaml @major = (yaml['major'] || yaml[:major]).to_i @minor = (yaml['minor'] || yaml[:minor]).to_i @patch = (yaml['patch'] || yaml[:patch]).to_i @build = (yaml['build'] || yaml[:build]) end def read_yaml if File.exists?(yaml_path) YAML.load_file(yaml_path) else raise VersionYmlError, "#{yaml_path} does not exist!" end end def path yaml_path end end module PlaintextExtension def write File.open(plaintext_path, 'w') do |file| file.write to_s end end def parse_plaintext plaintext = read_plaintext.chomp # http://rubular.com/regexes/10467 -> 3.5.4.a1 # http://rubular.com/regexes/10468 -> 3.5.4 if plaintext =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/ @major = $1.to_i @minor = $2.to_i @patch = $3.to_i @build = $4 end end def read_plaintext File.read(plaintext_path) end def refresh parse_plaintext end def path plaintext_path end end def initialize(base_dir) self.base_dir = base_dir if File.exists?(yaml_path) extend YamlExtension parse_yaml else extend PlaintextExtension if File.exists?(plaintext_path) parse_plaintext end end end def bump_major @major += 1 @minor = 0 @patch = 0 @build = nil end def bump_minor @minor += 1 @patch = 0 @build = nil end def bump_patch @patch += 1 @build = nil end def update_to(major, minor, patch, build=nil) @major = major @minor = minor @patch = patch @build = build end def to_s [major, minor, patch, build].compact.join('.') end def yaml_path denormalized_path = File.join(@base_dir, 'VERSION.yml') absolute_path = File.expand_path(denormalized_path) absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') end def plaintext_path denormalized_path = File.join(@base_dir, 'VERSION') absolute_path = File.expand_path(denormalized_path) absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') end end end jeweler-2.0.1/lib/jeweler/commands.rb0000644000175000017500000000163312641037113016077 0ustar aleealeeclass Jeweler module Commands autoload :BuildGem, 'jeweler/commands/build_gem' autoload :InstallGem, 'jeweler/commands/install_gem' autoload :CheckDependencies, 'jeweler/commands/check_dependencies' autoload :ReleaseToGit, 'jeweler/commands/release_to_git' autoload :ReleaseGemspec, 'jeweler/commands/release_gemspec' autoload :ReleaseToRubygems, 'jeweler/commands/release_to_rubygems' autoload :ValidateGemspec, 'jeweler/commands/validate_gemspec' autoload :WriteGemspec, 'jeweler/commands/write_gemspec' module Version autoload :Base, 'jeweler/commands/version/base' autoload :BumpMajor, 'jeweler/commands/version/bump_major' autoload :BumpMinor, 'jeweler/commands/version/bump_minor' autoload :BumpPatch, 'jeweler/commands/version/bump_patch' autoload :Write, 'jeweler/commands/version/write' end end end jeweler-2.0.1/lib/jeweler/templates/0000755000175000017500000000000012641037113015744 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/features/0000755000175000017500000000000012641037113017562 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/features/default.feature0000644000175000017500000000040312641037113022560 0ustar aleealeeFeature: something something In order to something something A user something something something something something Scenario: something something Given inspiration When I create a sweet new gem Then everyone should see how awesome I am jeweler-2.0.1/lib/jeweler/templates/features/support/0000755000175000017500000000000012641037113021276 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/features/support/env.rb0000644000175000017500000000044512641037113022416 0ustar aleealee<%= render_template 'simplecov.erb' %> <%= render_template 'bundler_setup.erb' %> $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require '<%= require_name %>' require '<%= feature_support_require %>' <% if feature_support_extend %> World(<%= feature_support_extend %>) <% end %> jeweler-2.0.1/lib/jeweler/templates/minitest/0000755000175000017500000000000012641037113017600 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/minitest/helper.rb0000644000175000017500000000050612641037113021405 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'minitest/unit' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '<%= require_name %>' class MiniTest::Unit::TestCase end MiniTest::Unit.autorun jeweler-2.0.1/lib/jeweler/templates/minitest/flunking.rb0000644000175000017500000000031312641037113021737 0ustar aleealeerequire 'helper' class Test<%= constant_name %> < MiniTest::Unit::TestCase def test_something_for_real flunk "hey buddy, you should probably rename this file and start testing for real" end end jeweler-2.0.1/lib/jeweler/templates/simplecov.erb0000644000175000017500000000036312641037113020441 0ustar aleealeerequire 'simplecov' module SimpleCov::Configuration def clean_filters @filters = [] end end SimpleCov.configure do clean_filters load_adapter 'test_frameworks' end ENV["COVERAGE"] && SimpleCov.start do add_filter "/.rvm/" end jeweler-2.0.1/lib/jeweler/templates/Rakefile0000644000175000017500000000026612641037113017415 0ustar aleealee# encoding: utf-8 require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'rake' <%= render_template 'jeweler_tasks.erb' %> <%= render_template 'other_tasks.erb' %> jeweler-2.0.1/lib/jeweler/templates/micronaut/0000755000175000017500000000000012641037113017745 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/micronaut/helper.rb0000644000175000017500000000072012641037113021550 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'micronaut' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '<%= require_name %>' def not_in_editor? !(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')) end Micronaut.configure do |c| c.color_enabled = not_in_editor? c.filter_run :focused => true end jeweler-2.0.1/lib/jeweler/templates/micronaut/flunking.rb0000644000175000017500000000025512641037113022111 0ustar aleealeerequire 'example_helper' describe "<%= constant_name %>" do it "fails" do fail "hey buddy, you should probably rename this file and start specing for real" end end jeweler-2.0.1/lib/jeweler/templates/riot/0000755000175000017500000000000012641037113016721 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/riot/helper.rb0000644000175000017500000000022212641037113020521 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'riot' require '<%= require_name %>' jeweler-2.0.1/lib/jeweler/templates/riot/flunking.rb0000644000175000017500000000020612641037113021061 0ustar aleealeerequire 'teststrap' context "<%= require_name %>" do setup do false end asserts "i'm a failure :(" do topic end end jeweler-2.0.1/lib/jeweler/templates/.document0000644000175000017500000000006712641037113017566 0ustar aleealeelib/**/*.rb bin/* - features/**/*.feature LICENSE.txt jeweler-2.0.1/lib/jeweler/templates/README.rdoc0000644000175000017500000000151512641037113017554 0ustar aleealee= <%= project_name %> Description goes here. == Contributing to <%= project_name %> * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet. * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it. * Fork the project. * Start a feature/bugfix branch. * Commit and push until you are happy with your contribution. * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. == Copyright Copyright (c) <%= Time.now.year %> <%= user_name %>. See LICENSE.txt for further details. jeweler-2.0.1/lib/jeweler/templates/bundler_setup.erb0000644000175000017500000000037012641037113021311 0ustar aleealee<% if should_use_bundler %> require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end <% end %> jeweler-2.0.1/lib/jeweler/templates/rspec/0000755000175000017500000000000012641037113017060 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/rspec/helper.rb0000644000175000017500000000062712641037113020671 0ustar aleealee<%= render_template 'simplecov.erb' %> $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require '<%= require_name %>' # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} RSpec.configure do |config| end jeweler-2.0.1/lib/jeweler/templates/rspec/flunking.rb0000644000175000017500000000032612641037113021223 0ustar aleealeerequire File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "<%= constant_name %>" do it "fails" do fail "hey buddy, you should probably rename this file and start specing for real" end end jeweler-2.0.1/lib/jeweler/templates/rspec/.rspec0000644000175000017500000000001012641037113020164 0ustar aleealee--color jeweler-2.0.1/lib/jeweler/templates/.gitignore0000644000175000017500000000146412641037113017741 0ustar aleealee# rcov generated coverage coverage.data # rdoc generated rdoc # yard generated doc .yardoc # bundler .bundle # jeweler generated pkg # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: # # * Create a file at ~/.gitignore # * Include files you want ignored # * Run: git config --global core.excludesfile ~/.gitignore # # After doing this, these files will be ignored in all your git projects, # saving you from having to 'pollute' every project you touch with them # # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) # # For MacOS: # #.DS_Store # For TextMate #*.tmproj #tmtags # For emacs: #*~ #\#* #.\#* # For vim: #*.swp # For redcar: #.redcar # For rubinius: #*.rbc jeweler-2.0.1/lib/jeweler/templates/LICENSE.txt0000644000175000017500000000206412641037113017571 0ustar aleealeeCopyright (c) <%= Time.now.year %> <%= user_name %> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jeweler-2.0.1/lib/jeweler/templates/testspec/0000755000175000017500000000000012641037113017576 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/testspec/helper.rb0000644000175000017500000000033312641037113021401 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' require 'test/spec' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '<%= require_name %>' jeweler-2.0.1/lib/jeweler/templates/testspec/flunking.rb0000644000175000017500000000032612641037113021741 0ustar aleealeerequire File.expand_path(File.dirname(__FILE__) + '/test_helper') describe "<%= constant_name %>" do it "fails" do fail "hey buddy, you should probably rename this file and start specing for real" end end jeweler-2.0.1/lib/jeweler/templates/testunit/0000755000175000017500000000000012641037113017623 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/testunit/helper.rb0000644000175000017500000000044612641037113021433 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'test/unit' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '<%= require_name %>' class Test::Unit::TestCase end jeweler-2.0.1/lib/jeweler/templates/testunit/flunking.rb0000644000175000017500000000030712641037113021765 0ustar aleealeerequire 'helper' class Test<%= constant_name %> < Test::Unit::TestCase def test_something_for_real flunk "hey buddy, you should probably rename this file and start testing for real" end end jeweler-2.0.1/lib/jeweler/templates/bacon/0000755000175000017500000000000012641037113017026 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/bacon/helper.rb0000644000175000017500000000043112641037113020630 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'bacon' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '<%= require_name %>' Bacon.summary_on_exit jeweler-2.0.1/lib/jeweler/templates/bacon/flunking.rb0000644000175000017500000000026212641037113021170 0ustar aleealeerequire 'spec_helper' describe "<%= constant_name %>" do it "fails" do should.flunk "hey buddy, you should probably rename this file and start specing for real" end end jeweler-2.0.1/lib/jeweler/templates/jeweler_tasks.erb0000644000175000017500000000221712641037113021302 0ustar aleealeerequire 'jeweler' Jeweler::Tasks.new do |gem| # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options gem.name = "<%= project_name %>" gem.homepage = "<%= homepage %>" gem.license = "MIT" gem.summary = %Q{<%= summary %>} gem.description = %Q{<%= description %>} gem.email = "<%= user_email %>" gem.authors = ["<%= user_name %>"] <% if should_setup_rubyforge %> gem.rubyforge_project = "<%= project_name %>" <% end %> <% if should_use_bundler %> # dependencies defined in Gemfile <% else %> <% development_dependencies.each do |name, version| %> # Include your dependencies below. Runtime dependencies are required when using your gem, # and development dependencies are only needed for development (ie running rake tasks, tests, etc) # gem.add_runtime_dependency 'jabber4r', '> 0.1' # gem.add_development_dependency 'rspec', '> 1.2.3' gem.add_development_dependency "<%= name %>", "<%= version %>" <% end %> <% end %> end Jeweler::RubygemsDotOrgTasks.new <% if should_setup_rubyforge %> Jeweler::RubyforgeTasks.new do |rubyforge| rubyforge.doc_task = "<%= doc_task %>" end <% end %> jeweler-2.0.1/lib/jeweler/templates/shoulda/0000755000175000017500000000000012641037113017403 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/shoulda/helper.rb0000644000175000017500000000047012641037113021210 0ustar aleealee<%= render_template 'simplecov.erb' %> require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require '<%= require_name %>' class Test::Unit::TestCase end jeweler-2.0.1/lib/jeweler/templates/shoulda/flunking.rb0000644000175000017500000000035412641037113021547 0ustar aleealeerequire 'helper' class Test<%= constant_name %> < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end jeweler-2.0.1/lib/jeweler/templates/Gemfile0000644000175000017500000000055412641037113017243 0ustar aleealeesource "http://rubygems.org" # Add dependencies required to use your gem here. # Example: # gem "activesupport", ">= 2.3.5" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do <% development_dependencies.each do |name, version| %> gem "<%= name %>", "<%= version %>" <% end %> end jeweler-2.0.1/lib/jeweler/templates/shindo/0000755000175000017500000000000012641037113017230 5ustar aleealeejeweler-2.0.1/lib/jeweler/templates/shindo/helper.rb0000644000175000017500000000040212641037113021030 0ustar aleealee<%= render_template 'simplecov.erb' %> $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require '<%= require_name %>' require 'rubygems' <%= render_template 'bundler_setup.erb' %> require 'shindo' jeweler-2.0.1/lib/jeweler/templates/shindo/flunking.rb0000644000175000017500000000034412641037113021373 0ustar aleealeerequire File.expand_path(File.dirname(__FILE__) + '/tests_helper') Shindo.tests("<%= constant_name %>") do test("fails") do "hey buddy, you should probably rename this file and start specing for real" false end end jeweler-2.0.1/lib/jeweler/templates/other_tasks.erb0000644000175000017500000000325712641037113020773 0ustar aleealee<% case testing_framework %> <% when :rspec %> require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:<%= test_task %>) do |<%= test_task %>| <%= test_task %>.pattern = FileList['<%= test_pattern %>'] end <% when :micronaut %> require 'micronaut/rake_task' Micronaut::RakeTask.new(:<%= test_task %>) do |<%= test_task %>| <%= test_task %>.pattern = '<%= test_pattern %>' <%= test_task %>.ruby_opts << '-Ilib -I<%= test_dir %>' end <% when :shindo %> require 'shindo/rake' Shindo::Rake.new <% else %> require 'rake/testtask' Rake::TestTask.new(:<%= test_task %>) do |<%= test_task %>| <%= test_task %>.libs << 'lib' << '<%= test_dir %>' <%= test_task %>.pattern = '<%= test_pattern %>' <%= test_task %>.verbose = true end <% end %> desc "Code coverage detail" task :simplecov do ENV['COVERAGE'] = "true" Rake::Task['<%= test_task %>'].execute end <% if should_use_cucumber %> require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) <% end %> <% if should_use_reek %> require 'reek/rake/task' Reek::Rake::Task.new do |t| t.fail_on_error = true t.verbose = false t.source_files = 'lib/**/*.rb' end <% end %> <% if should_use_roodi %> require 'roodi' require 'roodi_task' RoodiTask.new do |t| t.verbose = false end <% end %> task :default => :<%= default_task %> <% case documentation_framework %> <% when :rdoc %> require 'rdoc/task' Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" rdoc.rdoc_dir = 'rdoc' rdoc.title = "<%= project_name %> #{version}" rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end <% when :yard %> require 'yard' YARD::Rake::YardocTask.new <% end %> jeweler-2.0.1/lib/jeweler/version.rb0000644000175000017500000000024012641037113015754 0ustar aleealeeclass Jeweler module Version MAJOR = 2 MINOR = 0 PATCH = 1 BUILD = nil STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.') end end jeweler-2.0.1/lib/jeweler/gemspec_helper.rb0000644000175000017500000000432512641037113017261 0ustar aleealeeclass Jeweler class GemSpecHelper attr_accessor :spec, :base_dir def initialize(spec, base_dir = nil) self.spec = spec self.base_dir = base_dir || '' yield spec if block_given? end def valid? begin parse true rescue false end end def write File.open(path, 'w') do |f| f.write self.to_ruby end end def to_ruby normalize_files(:files) normalize_files(:extra_rdoc_files) gemspec_ruby = @spec.to_ruby gemspec_ruby = prettyify_array(gemspec_ruby, :files) gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files) gemspec_ruby = <<-END # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in #{Rake.application.rakefile}, and run 'rake gemspec' #{gemspec_ruby} END end def path denormalized_path = File.join(@base_dir, "#{@spec.name}.gemspec") absolute_path = File.expand_path(denormalized_path) absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') end def parse data = self.to_ruby parsed_gemspec = nil Thread.new { parsed_gemspec = eval("$SAFE = 3\n#{data}", binding, path) }.join parsed_gemspec end def normalize_files(array_attribute) array = @spec.send(array_attribute) # only keep files, no directories, and sort array = array.select do |path| File.file? File.join(@base_dir, path) end.sort @spec.send("#{array_attribute}=", array) 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.gsub(%|", "|, %|",\n "|)}\n ]" end end def gem_path File.join(@base_dir, 'pkg', parse.file_name) end def update_version(version) @spec.version = version.to_s end # Checks whether it uses the version helper or the users defined version. def has_version? !@spec.version.nil? end end end jeweler-2.0.1/lib/jeweler/tasks.rb0000644000175000017500000001634312641037113015427 0ustar aleealeerequire 'rake' require 'rake/tasklib' # Clean up after gem building require 'rake/clean' CLEAN.include('pkg/*.gem') class Rake::Application attr_accessor :jeweler_tasks # The jeweler instance that has be instantiated in the current Rakefile. # # This is usually useful if you want to get at info like version from other files. def jeweler jeweler_tasks.jeweler end end class Jeweler # Rake tasks for managing your gem. # # Here's a basic usage example: # # Jeweler::Tasks.new do |gem| # gem.name = "jeweler" # gem.summary = "Simple and opinionated helper for creating RubyGem projects on GitHub" # gem.email = "josh@technicalpickles.com" # gem.homepage = "http://github.com/technicalpickles/jeweler" # gem.description = "Simple and opinionated helper for creating RubyGem projects on GitHub" # gem.authors = ["Josh Nichols"] # end # # The block variable gem is actually a Gem::Specification, so you can # do anything you would normally do with a Gem::Specification. # For more details, see the official gemspec reference: # http://docs.rubygems.org/read/chapter/20 # # In addition, it provides reasonable defaults for several values. See Jeweler::Specification for more details. class Tasks < ::Rake::TaskLib attr_accessor :gemspec, :jeweler, :gemspec_building_block def initialize(gemspec = nil, &gemspec_building_block) @gemspec = gemspec || Gem::Specification.new self.gemspec_building_block = gemspec_building_block Rake.application.jeweler_tasks = self define end def jeweler if @jeweler.nil? @jeweler = Jeweler.new(gemspec) gemspec_building_block.call gemspec if gemspec_building_block end @jeweler end private def yield_gemspec_set_version? yielded_gemspec = @gemspec.dup yielded_gemspec.extend(Jeweler::Specification) yielded_gemspec.files = FileList[] yielded_gemspec.extra_rdoc_files = FileList[] gemspec_building_block.call(yielded_gemspec) if gemspec_building_block ! yielded_gemspec.version.nil? end def release_args args = {} args[:remote] = ENV['REMOTE'] args[:branch] = ENV['BRANCH'] args[:local_branch] = ENV['LOCAL_BRANCH'] args[:remote_branch] = ENV['REMOTE_BRANCH'] return args end def define task :version_required do if jeweler.expects_version_file? && !jeweler.version_file_exists? abort "Expected VERSION or VERSION.yml to exist. Use 'rake version:write' to create an initial one." end end task :gemspec_required do if ! File.exist?(jeweler.gemspec_helper.path) abort "Expected #{jeweler.gemspec_helper.path} to exist. See 'rake gemspec:write' to create it" end end desc "Build gem into pkg/" task :build do jeweler.build_gem end desc "Build and install gem using `gem install`" task :install => [:build] do jeweler.install_gem end desc "Displays the current version" task :version => :version_required do $stdout.puts "Current version: #{jeweler.version}" end desc "Release gem" task :release => :clean do end desc "Generate and validate gemspec" task :gemspec => ['gemspec:generate', 'gemspec:validate'] namespace :gemspec do desc "Validates the gemspec on the filesystem" task :validate => :gemspec_required do jeweler.validate_gemspec end desc "Regenerate the gemspec on the filesystem" task :generate => :version_required do jeweler.write_gemspec end desc "Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)" task :debug do # TODO move to a command jeweler.gemspec_helper.spec.version ||= begin jeweler.version_helper.refresh jeweler.version_helper.to_s end puts jeweler.gemspec_helper.to_ruby end desc "Regenerate and validate gemspec, and then commits and pushes to git" task :release do jeweler.release_gemspec(release_args) end end task :release => 'gemspec:release' unless yield_gemspec_set_version? namespace :version do desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH. Also recognizes BUILD, which defaults to nil" task :write do major, minor, patch, build = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i, (ENV['BUILD'] || nil ) jeweler.write_version(major, minor, patch, build, :announce => false, :commit => false) $stdout.puts "Updated version: #{jeweler.version}" end namespace :bump do desc "Bump the major version by 1" task :major => [:version_required, :version] do jeweler.bump_major_version $stdout.puts "Updated version: #{jeweler.version}" end desc "Bump the a minor version by 1" task :minor => [:version_required, :version] do jeweler.bump_minor_version $stdout.puts "Updated version: #{jeweler.version}" end desc "Bump the patch version by 1" task :patch => [:version_required, :version] do jeweler.bump_patch_version $stdout.puts "Updated version: #{jeweler.version}" end end end end namespace :git do desc "Tag and push release to git. (happens by default with `rake release`)" task :release do jeweler.release_to_git(release_args) end end task :release => 'git:release' unless File.exist?('Gemfile') desc "Check that runtime and development dependencies are installed" task :check_dependencies do jeweler.check_dependencies end namespace :check_dependencies do desc "Check that runtime dependencies are installed" task :runtime do jeweler.check_dependencies(:runtime) end desc"Check that development dependencies are installed" task :development do jeweler.check_dependencies(:development) end end end desc "Start IRB with all runtime dependencies loaded" task :console, [:script] do |t,args| # TODO move to a command dirs = ['ext', 'lib'].select { |dir| File.directory?(dir) } original_load_path = $LOAD_PATH cmd = if File.exist?('Gemfile') require 'bundler' Bundler.setup(:default) end # add the project code directories $LOAD_PATH.unshift(*dirs) # clear ARGV so IRB is not confused ARGV.clear require 'irb' # set the optional script to run IRB.conf[:SCRIPT] = args.script IRB.start # return the $LOAD_PATH to it's original state $LOAD_PATH.reject! { |path| !(original_load_path.include?(path)) } end end end end jeweler-2.0.1/lib/jeweler/commands/0000755000175000017500000000000012641037113015547 5ustar aleealeejeweler-2.0.1/lib/jeweler/commands/release_to_rubygems.rb0000644000175000017500000000123412641037113022133 0ustar aleealeeclass Jeweler module Commands class ReleaseToRubygems include FileUtils attr_accessor :gemspec, :version, :output, :gemspec_helper def initialize self.output = $stdout end def run command = "gem push #{@gemspec_helper.gem_path}" output.puts "Executing #{command.inspect}:" sh command end def self.build_for(jeweler) command = new command.gemspec = jeweler.gemspec command.gemspec_helper = jeweler.gemspec_helper command.version = jeweler.version command.output = jeweler.output command end end end end jeweler-2.0.1/lib/jeweler/commands/install_gem.rb0000644000175000017500000000127512641037113020377 0ustar aleealeeclass Jeweler module Commands class InstallGem include FileUtils attr_accessor :gemspec_helper, :output def initialize self.output = $stdout end def run command = "#{gem_command} install #{gemspec_helper.gem_path}" output.puts "Executing #{command.inspect}:" sh command # TODO where does sh actually come from!? - rake, apparently end def gem_command "#{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -S gem" end def self.build_for(jeweler) command = new command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end end end end jeweler-2.0.1/lib/jeweler/commands/release_to_git.rb0000644000175000017500000000325112641037113021062 0ustar aleealeeclass Jeweler module Commands class ReleaseToGit attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir def initialize(attributes = {}) self.output = $stdout attributes.each_pair do |key, value| send("#{key}=", value) end end def run(args = {}) remote = args[:remote] || 'origin' branch = args[:branch] || 'master' local_branch = args[:local_branch] || branch remote_branch = args[:remote_branch] || branch unless clean_staging_area? system "git status" raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above." end repo.checkout(local_branch) repo.push(remote, "#{local_branch}:#{remote_branch}") if release_not_tagged? output.puts "Tagging #{release_tag}" repo.add_tag(release_tag) output.puts "Pushing #{release_tag} to #{remote}" repo.push(remote, release_tag) end end def clean_staging_area? `git ls-files --deleted --modified --others --exclude-standard` == "" end def release_tag "v#{version}" end def release_not_tagged? tag = repo.tag(release_tag) rescue nil tag.nil? end def self.build_for(jeweler) command = self.new command.base_dir = jeweler.base_dir command.gemspec = jeweler.gemspec command.version = jeweler.version command.repo = jeweler.repo command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end end end end jeweler-2.0.1/lib/jeweler/commands/build_gem.rb0000644000175000017500000000201712641037113020023 0ustar aleealeeclass Jeweler module Commands class BuildGem attr_accessor :base_dir, :gemspec_helper, :file_utils, :version_helper def initialize self.file_utils = FileUtils end def run gemspec_helper.update_version(version_helper) unless gemspec_helper.has_version? gemspec = gemspec_helper.parse if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a") gem_file_name = Gem::Package.build(gemspec) else require "rubygems/builder" gem_file_name = Gem::Builder.new(gemspec).build end pkg_dir = File.join(base_dir, 'pkg') file_utils.mkdir_p pkg_dir gem_file_name = File.join(base_dir, gem_file_name) file_utils.mv gem_file_name, pkg_dir end def self.build_for(jeweler) command = new command.base_dir = jeweler.base_dir command.gemspec_helper = jeweler.gemspec_helper command.version_helper = jeweler.version_helper command end end end end jeweler-2.0.1/lib/jeweler/commands/release_gemspec.rb0000644000175000017500000000502312641037113021217 0ustar aleealeerequire 'pathname' class Jeweler module Commands class ReleaseGemspec attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir def initialize(attributes = {}) self.output = $stdout attributes.each_pair do |key, value| send("#{key}=", value) end end def run(args = {}) remote = args[:remote] || 'origin' branch = args[:branch] || 'master' local_branch = args[:local_branch] || branch remote_branch = args[:remote_branch] || branch unless clean_staging_area? system "git status" raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above." end repo.checkout(local_branch) regenerate_gemspec! commit_gemspec! if gemspec_changed? output.puts "Pushing #{local_branch} to #{remote}" repo.push(remote, "#{local_branch}:#{remote_branch}") end def clean_staging_area? # surprisingly simpler than ruby-git `git ls-files --deleted --modified --others --exclude-standard` == "" end def commit_gemspec! gemspec_gitpath = working_subdir.join(gemspec_helper.path) repo.add(gemspec_gitpath.to_s) output.puts "Committing #{gemspec_gitpath}" repo.commit "Regenerate gemspec for version #{version}" end def regenerate_gemspec! gemspec_helper.update_version(version) gemspec_helper.write end def gemspec_changed? # OMGHAX. ruby-git status always ends up being 'M', so let's do it a crazy way system "git status -s #{working_subdir.join(gemspec_helper.path)} | grep #{working_subdir.join(gemspec_helper.path)} > /dev/null 2>/dev/null" end def gemspec_helper @gemspec_helper ||= Jeweler::GemSpecHelper.new(self.gemspec, self.base_dir) end def working_subdir return @working_subdir if @working_subdir cwd = base_dir_path @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path)) @working_subdir end def base_dir_path Pathname.new(base_dir).realpath end def self.build_for(jeweler) command = self.new command.base_dir = jeweler.base_dir command.gemspec = jeweler.gemspec command.version = jeweler.version command.repo = jeweler.repo command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end end end end jeweler-2.0.1/lib/jeweler/commands/version/0000755000175000017500000000000012641037113017234 5ustar aleealeejeweler-2.0.1/lib/jeweler/commands/version/base.rb0000644000175000017500000000247612641037113020504 0ustar aleealeerequire 'pathname' class Jeweler module Commands module Version class Base attr_accessor :repo, :version_helper, :gemspec, :commit, :base_dir def run update_version self.version_helper.write self.gemspec.version = self.version_helper.to_s commit_version if self.repo && self.commit end def update_version raise "Subclasses should implement this" end def commit_version if self.repo self.repo.add(working_subdir.join(version_helper.path).to_s) self.repo.commit("Version bump to #{self.version_helper.to_s}") end end def working_subdir return @working_subdir if @working_subdir cwd = base_dir_path @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path)) @working_subdir end def base_dir_path Pathname.new(base_dir).realpath end def self.build_for(jeweler) command = new command.repo = jeweler.repo command.version_helper = jeweler.version_helper command.gemspec = jeweler.gemspec command.commit = jeweler.commit command.base_dir = jeweler.base_dir command end end end end end jeweler-2.0.1/lib/jeweler/commands/version/bump_minor.rb0000644000175000017500000000030512641037113021726 0ustar aleealeeclass Jeweler module Commands module Version class BumpMinor < Base def update_version self.version_helper.bump_minor end end end end end jeweler-2.0.1/lib/jeweler/commands/version/write.rb0000644000175000017500000000040212641037113020707 0ustar aleealeeclass Jeweler module Commands module Version class Write < Base attr_accessor :major, :minor, :patch, :build def update_version version_helper.update_to major, minor, patch, build end end end end end jeweler-2.0.1/lib/jeweler/commands/version/bump_major.rb0000644000175000017500000000027612641037113021721 0ustar aleealeeclass Jeweler module Commands module Version class BumpMajor < Base def update_version self.version_helper.bump_major end end end end end jeweler-2.0.1/lib/jeweler/commands/version/bump_patch.rb0000644000175000017500000000027712641037113021711 0ustar aleealeeclass Jeweler module Commands module Version class BumpPatch < Base def update_version self.version_helper.bump_patch end end end end end jeweler-2.0.1/lib/jeweler/commands/write_gemspec.rb0000644000175000017500000000165312641037113020736 0ustar aleealeeclass Jeweler module Commands class WriteGemspec attr_accessor :base_dir, :gemspec, :version, :output, :gemspec_helper, :version_helper def initialize self.output = $stdout end def run gemspec_helper.spec.version ||= begin version_helper.refresh version_helper.to_s end gemspec_helper.write output.puts "Generated: #{gemspec_helper.path}" end def gemspec_helper @gemspec_helper ||= GemSpecHelper.new(self.gemspec, self.base_dir) end def self.build_for(jeweler) command = new command.base_dir = jeweler.base_dir command.gemspec = jeweler.gemspec command.version = jeweler.version command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command.version_helper = jeweler.version_helper command end end end end jeweler-2.0.1/lib/jeweler/commands/check_dependencies.rb0000644000175000017500000000337412641037113021666 0ustar aleealeeclass Jeweler module Commands class CheckDependencies class MissingDependenciesError < RuntimeError attr_accessor :dependencies, :type end attr_accessor :gemspec, :type def run missing_dependencies = find_missing_dependencies if missing_dependencies.empty? puts "#{type || 'All'} dependencies seem to be installed." else puts "Missing some dependencies. Install them with the following commands:" missing_dependencies.each do |dependency| puts %Q{\tgem install #{dependency.name} --version "#{dependency.requirement.to_s}"} end abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}" end end def find_missing_dependencies if Gem::Specification.respond_to?(:find_by_name) dependencies.select do |dependency| begin spec = Gem::Specification.find_by_name(dependency.name, *dependency.requirement.as_list) spec.activate if spec !spec rescue LoadError => e true end end else dependencies.select do |dependency| begin Gem.activate dependency.name, *dependency.requirement.as_list false rescue LoadError => e true end end end end def dependencies case type when :runtime, :development gemspec.send("#{type}_dependencies") else gemspec.dependencies end end def self.build_for(jeweler) command = new command.gemspec = jeweler.gemspec command end end end end jeweler-2.0.1/lib/jeweler/commands/validate_gemspec.rb0000644000175000017500000000120412641037113021365 0ustar aleealeeclass Jeweler module Commands class ValidateGemspec attr_accessor :gemspec_helper, :output def initialize self.output = $stdout end def run begin gemspec_helper.parse output.puts "#{gemspec_helper.path} is valid." rescue Exception => e output.puts "#{gemspec_helper.path} is invalid. See the backtrace for more details." raise end end def self.build_for(jeweler) command = new command.gemspec_helper = jeweler.gemspec_helper command.output = jeweler.output command end end end end jeweler-2.0.1/lib/jeweler/gemcutter_tasks.rb0000644000175000017500000000033412641037113017477 0ustar aleealeerequire 'jeweler/rubygems_tasks' class Jeweler # Deprecated tasks for publishing to Gemcutter. See Jeweler::RubygemsDotOrgTasks # for the current tasks to use. class GemcutterTasks < RubygemsDotOrgTasks end end jeweler-2.0.1/lib/jeweler/rubygems_tasks.rb0000644000175000017500000000133512641037113017337 0ustar aleealeerequire 'rake' require 'rake/tasklib' class Jeweler # Rake tasks for putting a Jeweler gem on Gemcutter. # # Jeweler::Tasks.new needs to be used before this. # # Basic usage: # # Jeweler::RubygemsDotOrgTasks.new # # Easy enough, right? class RubygemsDotOrgTasks < ::Rake::TaskLib attr_accessor :jeweler def initialize yield self if block_given? define end def jeweler @jeweler ||= Rake.application.jeweler end def define namespace :rubygems do desc "Release gem to Gemcutter" task :release => [:gemspec, :build] do jeweler.release_gem_to_rubygems end end task :release => 'rubygems:release' end end end jeweler-2.0.1/lib/jeweler/rubyforge_tasks.rb0000644000175000017500000000615312641037113017511 0ustar aleealeerequire 'rake' require 'rake/tasklib' class Jeweler # Rake tasks for putting a Jeweler gem on Rubyforge. # # Jeweler::Tasks.new needs to be used before this. # # Basic usage: # # Jeweler::RubyforgeTasks.new # # Easy enough, right? # # There are a few options you can tweak: # # * project: the rubyforge project to operate on. This defaults to whatever you specified in your gemspec. Defaults to your gem name. # * remote_doc_path: the place to upload docs to on Rubyforge under /var/www/gforge-projects/#{project}/ # # See also http://wiki.github.com/technicalpickles/jeweler/rubyforge class RubyforgeTasks < ::Rake::TaskLib # The RubyForge project to interact with. Defaults to whatever is in your jeweler gemspec. attr_accessor :project # The path to upload docs to. It is relative to /var/www/gforge-projects/#{project}/, and defaults to your gemspec's name attr_accessor :remote_doc_path # Task to be used for generating documentation, before they are uploaded. Defaults to rdoc. attr_accessor :doc_task attr_accessor :jeweler def initialize yield self if block_given? $stderr.puts "Releasing gems to Rubyforge is deprecated. See details at http://wiki.github.com/technicalpickles/jeweler/migrating-from-releasing-gems-to-rubyforge" define end def jeweler @jeweler ||= Rake.application.jeweler end def remote_doc_path @remote_doc_path ||= jeweler.gemspec.name end def project @project ||= jeweler.gemspec.rubyforge_project end def define namespace :rubyforge do namespace :release do desc "Release the current gem version to RubyForge." task :gem do $stderr.puts "DEPRECATION: Releasing gems to RubyForge is deprecated. You should see about releasing to Gemcutter instead: http://wiki.github.com/technicalpickles/jeweler/gemcutter" end if publish_documentation? desc "Publish docs to RubyForge." task :docs => doc_task do config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/#{project}/#{remote_doc_path}" local_dir = case self.doc_task.to_sym when :rdoc then 'rdoc' when :yardoc then 'doc' when 'doc:app'.to_sym then 'doc/app' else raise "Unsure what to run to generate documentation. Please set doc_task and re-run." end sh %{rsync --archive --verbose --delete #{local_dir}/ #{host}:#{remote_dir}} end end end if publish_documentation? desc "Release RDoc documentation to RubyForge" task :release => "rubyforge:release:docs" end end task :release => 'rubyforge:release' end def publish_documentation? ! (doc_task == false || doc_task == :none) end end end jeweler-2.0.1/lib/jeweler/errors.rb0000644000175000017500000000020612641037113015605 0ustar aleealeeclass Jeweler # Gemspec related error class GemspecError < StandardError end class VersionYmlError < StandardError end end jeweler-2.0.1/lib/jeweler/generator/0000755000175000017500000000000012641037113015734 5ustar aleealeejeweler-2.0.1/lib/jeweler/generator/yard_mixin.rb0000644000175000017500000000045512641037113020430 0ustar aleealeeclass Jeweler class Generator module YardMixin def self.extended(generator) generator.development_dependencies << ["yard", "~> 0.7"] generator.development_dependencies << ["rdoc", "~> 3.12"] end def doc_task 'yardoc' end end end end jeweler-2.0.1/lib/jeweler/generator/minitest_mixin.rb0000644000175000017500000000123112641037113021316 0ustar aleealeeclass Jeweler class Generator module MinitestMixin def self.extended(generator) generator.development_dependencies << ["minitest", ">= 0"] end def default_task 'test' end def feature_support_require 'minitest/unit' end def feature_support_extend 'MiniTest::Assertions' end def test_dir 'test' end def test_task 'test' end def test_pattern 'test/**/test_*.rb' end def test_filename "test_#{require_name}.rb" end def test_helper_filename "helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/bacon_mixin.rb0000644000175000017500000000132512641037113020550 0ustar aleealeeclass Jeweler class Generator module BaconMixin def self.extended(generator) generator.development_dependencies << ["bacon", ">= 0"] end def default_task 'spec' end def feature_support_require 'test/unit/assertions' end def feature_support_extend 'Test::Unit::Assertions' # NOTE can't use bacon inside of cucumber actually end def test_dir 'spec' end def test_task 'spec' end def test_pattern 'spec/**/*_spec.rb' end def test_filename "#{require_name}_spec.rb" end def test_helper_filename "spec_helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/rdoc_mixin.rb0000644000175000017500000000034312641037113020414 0ustar aleealeeclass Jeweler class Generator module RdocMixin def self.extended(generator) generator.development_dependencies << ["rdoc", "~> 3.12"] end def doc_task 'rdoc' end end end end jeweler-2.0.1/lib/jeweler/generator/riot_mixin.rb0000644000175000017500000000121412641037113020440 0ustar aleealeeclass Jeweler class Generator module RiotMixin def self.extended(generator) generator.development_dependencies << ["riot", ">= 0"] end def default_task 'test' end def feature_support_require 'riot/context' end def feature_support_extend 'Riot::Context' end def test_dir 'test' end def test_task 'test' end def test_pattern 'test/**/*_test.rb' end def test_filename "#{require_name}_test.rb" end def test_helper_filename "teststrap.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/micronaut_mixin.rb0000644000175000017500000000132012641037113021462 0ustar aleealeeclass Jeweler class Generator module MicronautMixin def self.extended(generator) generator.development_dependencies << ["spicycode-micronaut", ">= 0"] end def default_task 'examples' end def feature_support_require 'micronaut/expectations' end def feature_support_extend 'Micronaut::Matchers' end def test_dir 'examples' end def test_task 'examples' end def test_pattern 'examples/**/*_example.rb' end def test_filename "#{require_name}_example.rb" end def test_helper_filename "example_helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/options.rb0000644000175000017500000001240412641037113017755 0ustar aleealeeclass Jeweler class Generator class Options < Hash attr_reader :opts, :orig_args def initialize(args) super() @orig_args = args.clone self[:testing_framework] = :shoulda self[:documentation_framework] = :rdoc self[:use_bundler] = true self[:user_name] = ENV['GIT_AUTHOR_NAME'] || ENV['GIT_COMMITTER_NAME'] || git_config['user.name'] self[:user_email] = ENV['GIT_AUTHOR_EMAIL'] || ENV['GIT_COMMITTER_EMAIL'] || git_config['user.email'] self[:github_username] = git_config['github.user'] require 'optparse' @opts = OptionParser.new do |o| o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem" o.on('--directory [DIRECTORY]', 'specify the directory to generate into (deprecated)') do |directory| warn "--directory is deprecated and will be removed in 2.0.0. Please specify an absolute path to a directory as the last argument instead" # DEPRECATE self[:directory] = directory end o.separator "" o.on('--rspec', 'generate rspec code examples') do self[:testing_framework] = :rspec end o.on('--shoulda', 'generate shoulda tests') do self[:testing_framework] = :shoulda end o.on('--testunit', 'generate test/unit tests') do self[:testing_framework] = :testunit end o.on('--bacon', 'generate bacon specifications') do self[:testing_framework] = :bacon end o.on('--testspec', 'generate test/spec tests') do self[:testing_framework] = :testspec end o.on('--minitest', 'generate minitest tests') do self[:testing_framework] = :minitest end o.on('--micronaut', 'generate micronaut examples') do self[:testing_framework] = :micronaut end o.on('--riot', 'generate riot tests') do self[:testing_framework] = :riot end o.on('--shindo', 'generate shindo tests') do self[:testing_framework] = :shindo end o.separator "" o.on('--[no-]bundler', 'use bundler for managing dependencies') do |v| self[:use_bundler] = v end o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do self[:use_cucumber] = true end o.separator "" o.on('--reek', 'generate rake task for reek') do self[:use_reek] = true end o.on('--roodi', 'generate rake task for roodi') do self[:use_roodi] = true end o.separator "" o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary| self[:summary] = summary end o.on('--description [DESCRIPTION]', 'specify a description of the project') do |description| self[:description] = description end o.separator "" o.on('--user-name [USER_NAME]', "the user's name, ie that is credited in the LICENSE") do |user_name| self[:user_name] = user_name end o.on('--user-email [USER_EMAIL]', "the user's email, ie that is credited in the Gem specification") do |user_email| self[:user_email] = user_email end o.separator "" o.on('--github-username [GITHUB_USERNAME]', "name of the user on GitHub to set the project up under") do |github_username| self[:github_username] = github_username end o.on('--git-remote [GIT_REMOTE]', 'URI to set the git origin remote to') do |git_remote| self[:git_remote] = git_remote end o.on('--homepage [HOMEPAGE]', "the homepage for your project (defaults to the GitHub repo)") do |homepage| self[:homepage] = homepage end o.on('--create-repo', 'create the repository on GitHub') do self[:create_repo] = true end o.separator "" o.on('--yard', 'use yard for documentation') do self[:documentation_framework] = :yard end o.on('--rdoc', 'use rdoc for documentation') do self[:documentation_framework] = :rdoc end o.on('-v', '--version', 'show version') do self[:show_version] = true end o.on_tail('-h', '--help', 'display this help and exit') do self[:show_help] = true end end begin @opts.parse!(args) self[:project_name] = args.shift rescue OptionParser::InvalidOption => e self[:invalid_argument] = e.message end end def merge(other) self.class.new(@orig_args + other.orig_args) end # Expose git config here, so we can stub it out for test environments def self.git_config @git_config ||= if Pathname.new("~/.gitconfig").expand_path.exist? Git.global_config else {} end end def git_config self.class.git_config end end end end jeweler-2.0.1/lib/jeweler/generator/shoulda_mixin.rb0000644000175000017500000000124012641037113021121 0ustar aleealeeclass Jeweler class Generator module ShouldaMixin def self.extended(generator) generator.development_dependencies << ["shoulda", ">= 0"] end def default_task 'test' end def feature_support_require 'test/unit/assertions' end def feature_support_extend 'Test::Unit::Assertions' end def test_dir 'test' end def test_task 'test' end def test_pattern 'test/**/test_*.rb' end def test_filename "test_#{require_name}.rb" end def test_helper_filename "helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/github_mixin.rb0000644000175000017500000000110412641037113020743 0ustar aleealeeclass Jeweler class Generator module GithubMixin def self.extended(generator) generator.github_username = generator.options[:github_username] generator.should_create_remote_repo = generator.options[:create_repo] unless generator.github_username raise NoGitHubUser end end def git_remote @git_remote ||= "git@github.com:#{github_username}/#{project_name}.git" end def homepage @homepage ||= "http://github.com/#{github_username}/#{project_name}" end end end end jeweler-2.0.1/lib/jeweler/generator/rspec_mixin.rb0000644000175000017500000000131612641037113020602 0ustar aleealeeclass Jeweler class Generator module RspecMixin def self.extended(generator) generator.development_dependencies << ["rspec", "~> 2.8.0"] end def default_task 'spec' end def feature_support_require 'rspec/expectations' end def feature_support_extend nil # Cucumber is smart enough extend Spec::Expectations on its own end def test_dir 'spec' end def test_task 'spec' end def test_pattern 'spec/**/*_spec.rb' end def test_filename "#{require_name}_spec.rb" end def test_helper_filename "spec_helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/testspec_mixin.rb0000644000175000017500000000125012641037113021315 0ustar aleealeeclass Jeweler class Generator module TestspecMixin def self.extended(generator) generator.development_dependencies << ["test-spec", ">= 0"] end def default_task 'test' end def feature_support_require 'test/unit/assertions' end def feature_support_extend 'Test::Unit::Assertions' end def test_dir 'test' end def test_task 'test' end def test_pattern 'test/**/*_test.rb' end def test_filename "#{require_name}_test.rb" end def test_helper_filename "test_helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/shindo_mixin.rb0000644000175000017500000000130612641037113020751 0ustar aleealeeclass Jeweler class Generator module ShindoMixin def self.extended(generator) generator.development_dependencies << ["shindo", ">= 0"] end def default_task 'tests' end def feature_support_require # 'test/unit/assertions' nil end def feature_support_extend # 'Test::Unit::Assertions' nil end def test_dir 'tests' end def test_task 'tests' end def test_pattern 'tests/**/*_tests.rb' end def test_filename "#{require_name}_tests.rb" end def test_helper_filename "tests_helper.rb" end end end end jeweler-2.0.1/lib/jeweler/generator/application.rb0000644000175000017500000000431412641037113020566 0ustar aleealeerequire 'shellwords' class Jeweler class Generator class Application class << self include Shellwords def run!(*arguments) options = build_options(arguments) if options[:invalid_argument] $stderr.puts options[:invalid_argument] options[:show_help] = true end if options[:show_version] $stderr.puts "Version: #{Jeweler::Version::STRING}" return 1 end if options[:show_help] $stderr.puts options.opts return 1 end if options[:project_name].nil? || options[:project_name].squeeze.strip == "" $stderr.puts options.opts return 1 end begin generator = Jeweler::Generator.new(options) generator.run return 0 rescue Jeweler::NoGitUserName $stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.name "mad voo"} return 1 rescue Jeweler::NoGitUserEmail $stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.email mad.vooo@gmail.com} return 1 rescue Jeweler::NoGitHubUser $stderr.puts %Q{Please specify --github-username or set github.user in ~/.gitconfig (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt} return 1 rescue Jeweler::FileInTheWay $stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?" return 1 end end def build_options(arguments) env_opts_string = ENV['JEWELER_OPTS'] || "" env_opts = Jeweler::Generator::Options.new(shellwords(env_opts_string)) argument_opts = Jeweler::Generator::Options.new(arguments) env_opts.merge(argument_opts) end end end end end jeweler-2.0.1/lib/jeweler/generator/testunit_mixin.rb0000644000175000017500000000106212641037113021343 0ustar aleealeeclass Jeweler class Generator module TestunitMixin def default_task 'test' end def feature_support_require 'test/unit/assertions' end def feature_support_extend 'Test::Unit::Assertions' end def test_dir 'test' end def test_task 'test' end def test_pattern 'test/**/test_*.rb' end def test_filename "test_#{require_name}.rb" end def test_helper_filename "helper.rb" end end end end jeweler-2.0.1/LICENSE.txt0000644000175000017500000000204012641037113013362 0ustar aleealeeCopyright (c) 2008 Josh Nichols Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jeweler-2.0.1/test/0000755000175000017500000000000012641037113012522 5ustar aleealeejeweler-2.0.1/test/geminstaller.yml0000644000175000017500000000040212641037113015727 0ustar aleealee# Dependencies required to run the test suite gems: - name: rspec version: '~> 1.1.12' - name: Shoulda version: '~> 1.2.0' - name: ruby-debug version: '~> 0.10.3' - name: rr version: '~> 0.7.1' - name: mhennemeyer-output_catcher version: '~> 1.0.1'jeweler-2.0.1/test/test_helper.rb0000644000175000017500000001031112641037113015361 0ustar aleealeerequire 'test/unit' require 'rubygems' require 'bundler' require 'coveralls' Coveralls.wear! begin Bundler.setup(:default, :xzibit, :test) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'shoulda' require 'rr' #require 'redgreen' require 'construct' require 'git' require 'time' require 'jeweler' $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'shoulda_macros/jeweler_macros' TMP_DIR = '/tmp/jeweler_test' FIXTURE_DIR = File.expand_path('../fixtures', __FILE__) class RubyForgeStub attr_accessor :userconfig, :autoconfig def initialize @userconfig = {} @autoconfig = {} end end class Test::Unit::TestCase include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit) include Construct::Helpers def tmp_dir TMP_DIR end def fixture_dir File.join(FIXTURE_DIR, 'bar') end def remove_tmpdir! FileUtils.rm_rf(tmp_dir) end def create_tmpdir! FileUtils.mkdir_p(tmp_dir) end def build_spec(*files) Gem::Specification.new do |s| s.name = "bar" s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub" s.email = "josh@technicalpickles.com" s.homepage = "http://github.com/technicalpickles/jeweler" s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub" s.authors = ["Josh Nichols"] s.files = FileList[*files] unless files.empty? s.version = '0.1.1' end end def self.gemcutter_command_context(description, &block) context description do setup do @command = eval(self.class.name.gsub(/::Test/, '::')).new if @command.respond_to? :gemspec_helper= @gemspec_helper = Object.new @command.gemspec_helper = @gemspec_helper end if @command.respond_to? :output @output = StringIO.new @command.output = @output end end context "", &block end end def self.rubyforge_command_context(description, &block) context description do setup do @command = eval(self.class.name.gsub(/::Test/, '::')).new if @command.respond_to? :gemspec= @gemspec = Object.new @command.gemspec = @gemspec end if @command.respond_to? :gemspec_helper= @gemspec_helper = Object.new @command.gemspec_helper = @gemspec_helper end if @command.respond_to? :rubyforge= @rubyforge = RubyForgeStub.new @command.rubyforge = @rubyforge end if @command.respond_to? :output @output = StringIO.new @command.output = @output end if @command.respond_to? :repo @repo = Object.new @command.repo = @repo end end context "", &block end end def self.build_command_context(description, &block) context description do setup do @repo = Object.new @version_helper = Object.new @gemspec = Object.new @commit = Object.new @version = Object.new @output = Object.new @base_dir = Object.new @gemspec_helper = Object.new @rubyforge = Object.new @jeweler = Object.new stub(@jeweler).repo { @repo } stub(@jeweler).version_helper { @version_helper } stub(@jeweler).gemspec { @gemspec } stub(@jeweler).commit { @commit } stub(@jeweler).version { @version } stub(@jeweler).output { @output } stub(@jeweler).gemspec_helper { @gemspec_helper } stub(@jeweler).base_dir { @base_dir } stub(@jeweler).rubyforge { @rubyforge } end context "", &block end end def stub_git_config(options = {}) stub(Git).global_config() { options } end def set_default_git_config @project_name = 'the-perfect-gem' @git_name = 'foo' @git_email = 'bar@example.com' @github_user = 'technicalpickles' end def valid_git_config { 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user } end end jeweler-2.0.1/test/fixtures/0000755000175000017500000000000012641037113014373 5ustar aleealeejeweler-2.0.1/test/fixtures/bar/0000755000175000017500000000000012641037113015137 5ustar aleealeejeweler-2.0.1/test/fixtures/bar/VERSION.yml0000644000175000017500000000003712641037113017007 0ustar aleealee--- major: 1 minor: 5 patch: 2 jeweler-2.0.1/test/fixtures/bar/lib/0000755000175000017500000000000012641037113015705 5ustar aleealeejeweler-2.0.1/test/fixtures/bar/lib/foo_the_ultimate_lib.rb0000644000175000017500000000000612641037113022403 0ustar aleealee# Uhuhjeweler-2.0.1/test/fixtures/bar/bin/0000755000175000017500000000000012641037113015707 5ustar aleealeejeweler-2.0.1/test/fixtures/bar/bin/foo_the_ultimate_bin0000644000175000017500000000001512641037113022005 0ustar aleealee# You betcha!jeweler-2.0.1/test/fixtures/bar/hey_include_me_in_gemspec0000644000175000017500000000000012641037113022212 0ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/0000755000175000017500000000000012641037113023265 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/VERSION.yml0000644000175000017500000000004312641037113025132 0ustar aleealee--- :major: 1 :minor: 5 :patch: 3 jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/Rakefile0000644000175000017500000000451312641037113024735 0ustar aleealeerequire 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "existing-project-with-version" gem.summary = %Q{Summarize your gem} gem.email = "josh@technicalpickles.com" gem.homepage = "http://github.com/technicalpickles/existing-project-with-version" gem.authors = ["Josh Nichols"] # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end rescue LoadError puts "Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com" end require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = false end begin require 'rcov/rcovtask' Rcov::RcovTask.new do |test| test.libs << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end rescue LoadError task :rcov do abort "RCov is not available. In order to run rcov, you must: gem install spicycode-rcov" end end task :default => :test require 'rdoc/task' Rake::RDocTask.new do |rdoc| if File.exist?('VERSION.yml') require 'yaml' config = YAML.load(File.read('VERSION.yml')) version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" else version = "" end rdoc.rdoc_dir = 'rdoc' rdoc.title = "existing-project-with-version #{version}" rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end # Rubyforge documentation task begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do require 'yaml' config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/existing-project-with-version/" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/.document0000644000175000017500000000007412641037113025105 0ustar aleealeeREADME.rdoc lib/**/*.rb bin/* features/**/*.feature LICENSE jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/README.rdoc0000644000175000017500000000020112641037113025064 0ustar aleealee= existing-project-with-version Description goes here. == Copyright Copyright (c) 2009 Josh Nichols. See LICENSE for details. jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/lib/0000755000175000017500000000000012641037113024033 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb0000644000175000017500000000000012641037113032526 0ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/.gitignore0000644000175000017500000000004212641037113025251 0ustar aleealee*.sw? .DS_Store coverage rdoc pkg jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/LICENSE.txt0000644000175000017500000000204012641037113025104 0ustar aleealeeCopyright (c) 2009 Josh Nichols Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/test/0000755000175000017500000000000012641037113024244 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb0000644000175000017500000000036012641037113027106 0ustar aleealeerequire 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'existing_project_with_version' class Test::Unit::TestCase end ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rbjeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_te0000644000175000017500000000036712641037113033045 0ustar aleealeerequire 'test_helper' class ExistingProjectWithVersionTest < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end jeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/bin/0000755000175000017500000000000012641037113024035 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin0000644000175000017500000000000012641037113030125 0ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec0000644000175000017500000000205612641037113032567 0ustar aleealee# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{existing-project-with-version} s.version = "1.5.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Josh Nichols"] s.date = %q{2009-03-13} s.email = %q{josh@technicalpickles.com} s.extra_rdoc_files = ["README.rdoc", "LICENSE"] s.files = ["README.rdoc", "VERSION.yml", "lib/existing_project_with_version.rb", "test/existing_project_with_version_test.rb", "test/test_helper.rb", "LICENSE"] s.has_rdoc = true s.homepage = %q{http://github.com/technicalpickles/existing-project-with-version} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{Summarize your gem} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else end end jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/0000755000175000017500000000000012641037113024333 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/Rakefile0000644000175000017500000000451312641037113026003 0ustar aleealeerequire 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "existing-project-with-version" gem.summary = %Q{Summarize your gem} gem.email = "josh@technicalpickles.com" gem.homepage = "http://github.com/technicalpickles/existing-project-with-version" gem.authors = ["Josh Nichols"] # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end rescue LoadError puts "Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com" end require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = false end begin require 'rcov/rcovtask' Rcov::RcovTask.new do |test| test.libs << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end rescue LoadError task :rcov do abort "RCov is not available. In order to run rcov, you must: gem install spicycode-rcov" end end task :default => :test require 'rdoc/task' Rake::RDocTask.new do |rdoc| if File.exist?('VERSION.yml') require 'yaml' config = YAML.load(File.read('VERSION.yml')) version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" else version = "" end rdoc.rdoc_dir = 'rdoc' rdoc.title = "existing-project-with-version #{version}" rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end # Rubyforge documentation task begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do require 'yaml' config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/existing-project-with-version/" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/.document0000644000175000017500000000007412641037113026153 0ustar aleealeeREADME.rdoc lib/**/*.rb bin/* features/**/*.feature LICENSE jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/README.rdoc0000644000175000017500000000020112641037113026132 0ustar aleealee= existing-project-with-version Description goes here. == Copyright Copyright (c) 2009 Josh Nichols. See LICENSE for details. jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/VERSION0000644000175000017500000000000612641037113025377 0ustar aleealee1.5.3 jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/lib/0000755000175000017500000000000012641037113025101 5ustar aleealee././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rbjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_versio0000644000175000017500000000000012641037113033014 0ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/.gitignore0000644000175000017500000000004212641037113026317 0ustar aleealee*.sw? .DS_Store coverage rdoc pkg jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt0000644000175000017500000000204012641037113026152 0ustar aleealeeCopyright (c) 2009 Josh Nichols Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/test/0000755000175000017500000000000012641037113025312 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb0000644000175000017500000000036012641037113030154 0ustar aleealeerequire 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'existing_project_with_version' class Test::Unit::TestCase end ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rbjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_versi0000644000175000017500000000036712641037113033066 0ustar aleealeerequire 'test_helper' class ExistingProjectWithVersionTest < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspecjeweler-2.0.1/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.ge0000644000175000017500000000205612641037113032605 0ustar aleealee# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{existing-project-with-version} s.version = "1.5.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Josh Nichols"] s.date = %q{2009-03-13} s.email = %q{josh@technicalpickles.com} s.extra_rdoc_files = ["README.rdoc", "LICENSE"] s.files = ["README.rdoc", "VERSION.yml", "lib/existing_project_with_version.rb", "test/existing_project_with_version_test.rb", "test/test_helper.rb", "LICENSE"] s.has_rdoc = true s.homepage = %q{http://github.com/technicalpickles/existing-project-with-version} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{Summarize your gem} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else end end jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/0000755000175000017500000000000012641037113024154 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-constant/Rakefile0000644000175000017500000000454512641037113025631 0ustar aleealeerequire 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.version = "1.0.0" gem.name = "existing-project-with-version" gem.summary = %Q{Summarize your gem} gem.email = "josh@technicalpickles.com" gem.homepage = "http://github.com/technicalpickles/existing-project-with-version" gem.authors = ["Josh Nichols"] # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end rescue LoadError puts "Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com" end require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = false end begin require 'rcov/rcovtask' Rcov::RcovTask.new do |test| test.libs << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end rescue LoadError task :rcov do abort "RCov is not available. In order to run rcov, you must: gem install spicycode-rcov" end end task :default => :test require 'rdoc/task' Rake::RDocTask.new do |rdoc| if File.exist?('VERSION.yml') require 'yaml' config = YAML.load(File.read('VERSION.yml')) version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" else version = "" end rdoc.rdoc_dir = 'rdoc' rdoc.title = "existing-project-with-version #{version}" rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end # Rubyforge documentation task begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do require 'yaml' config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/existing-project-with-version/" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/.document0000644000175000017500000000007412641037113025774 0ustar aleealeeREADME.rdoc lib/**/*.rb bin/* features/**/*.feature LICENSE jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/README.rdoc0000644000175000017500000000020112641037113025753 0ustar aleealee= existing-project-with-version Description goes here. == Copyright Copyright (c) 2009 Josh Nichols. See LICENSE for details. jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/lib/0000755000175000017500000000000012641037113024722 5ustar aleealee././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rbjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version0000644000175000017500000000000012641037113033013 0ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-constant/.gitignore0000644000175000017500000000004212641037113026140 0ustar aleealee*.sw? .DS_Store coverage rdoc pkg jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/LICENSE.txt0000644000175000017500000000204012641037113025773 0ustar aleealeeCopyright (c) 2009 Josh Nichols Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jeweler-2.0.1/test/fixtures/existing-project-with-version-constant/test/0000755000175000017500000000000012641037113025133 5ustar aleealeejeweler-2.0.1/test/fixtures/existing-project-with-version-constant/test/test_helper.rb0000644000175000017500000000036012641037113027775 0ustar aleealeerequire 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'existing_project_with_version' class Test::Unit::TestCase end ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rbjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/test/existing_project_with_versio0000644000175000017500000000036712641037113033066 0ustar aleealeerequire 'test_helper' class ExistingProjectWithVersionTest < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspecjeweler-2.0.1/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gem0000644000175000017500000000205612641037113032603 0ustar aleealee# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{existing-project-with-version} s.version = "1.5.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Josh Nichols"] s.date = %q{2009-03-13} s.email = %q{josh@technicalpickles.com} s.extra_rdoc_files = ["README.rdoc", "LICENSE"] s.files = ["README.rdoc", "VERSION.yml", "lib/existing_project_with_version.rb", "test/existing_project_with_version_test.rb", "test/test_helper.rb", "LICENSE"] s.has_rdoc = true s.homepage = %q{http://github.com/technicalpickles/existing-project-with-version} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{Summarize your gem} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else end end jeweler-2.0.1/test/shoulda_macros/0000755000175000017500000000000012641037113015525 5ustar aleealeejeweler-2.0.1/test/shoulda_macros/jeweler_macros.rb0000644000175000017500000000167512641037113021064 0ustar aleealeeclass Test::Unit::TestCase class << self def should_have_major_version(version) should "have major version of #{version}" do assert_equal version, @jeweler.major_version end end def should_have_minor_version(version) should "have minor version of #{version}" do assert_equal version, @jeweler.minor_version end end def should_have_patch_version(version) should "have patch version of #{version}" do assert_equal version, @jeweler.patch_version end end def should_be_version(version) should "be version #{version}" do assert_equal version, @jeweler.version end end def should_bump_version(major, minor, patch) version = "#{major}.#{minor}.#{patch}" should_have_major_version major should_have_minor_version minor should_have_patch_version patch should_be_version version end end end jeweler-2.0.1/test/jeweler/0000755000175000017500000000000012641037113014157 5ustar aleealeejeweler-2.0.1/test/jeweler/test_tasks.rb0000644000175000017500000000216612641037113016675 0ustar aleealeerequire 'test_helper' require 'rake' class TestTasks < Test::Unit::TestCase include Rake context 'instantiating Jeweler::Tasks' do setup do @gemspec_building_block = lambda {|gemspec|} @tasks = Jeweler::Tasks.new &@gemspec_building_block end teardown do Task.clear end should 'assign @gemspec' do assert_not_nil @tasks.gemspec end should 'not eagerly initialize Jeweler' do assert ! @tasks.instance_variable_defined?(:@jeweler) end should 'set self as the application-wide jeweler tasks' do assert_same @tasks, Rake.application.jeweler_tasks end should 'save gemspec building block for later' do assert_same @gemspec_building_block, @tasks.gemspec_building_block end context 'Jeweler instance' do setup do @tasks.jeweler end should 'initailize Jeweler' do assert @tasks.instance_variable_defined?(:@jeweler) end end should 'yield the gemspec instance' do spec = nil @tasks = Jeweler::Tasks.new { |s| spec = s } assert_not_nil @tasks.jeweler.gemspec end end end jeweler-2.0.1/test/jeweler/test_generator_initialization.rb0000644000175000017500000000766212641037113022653 0ustar aleealeerequire 'test_helper' class TestGeneratorInitialization < Test::Unit::TestCase def setup set_default_git_config end context "given a nil github repo name" do setup do stub_git_config end should 'raise NoGithubRepoNameGiven' do assert_raise Jeweler::NoGitHubRepoNameGiven do Jeweler::Generator.new() end end end context "without git user's name set" do setup do stub_git_config end should 'raise an NoGitUserName' do assert_raise Jeweler::NoGitUserName do Jeweler::Generator.new(:project_name => @project_name, :testing_framework => :shoulda, :documentation_framework => :rdoc) end end end context "without git user's email set" do setup do stub_git_config end should 'raise NoGitUserEmail' do assert_raise Jeweler::NoGitUserEmail do Jeweler::Generator.new(:project_name => @project_name, :user_name => @git_name, :testing_framework => :shoulda, :documentation_framework => :rdoc) end end end context "without github username set" do setup do stub_git_config end should 'raise NotGitHubUser' do assert_raise Jeweler::NoGitHubUser do Jeweler::Generator.new(:project_name => @project_name, :user_name => @git_name, :user_email => @git_email, :testing_framework => :shoulda, :documentation_framework => :rdoc) end end end def build_generator(options = {}) defaults = { :project_name => @project_name, :user_name => @git_name, :user_email => @git_email, :github_username => @github_user, :testing_framework => :shoulda, :documentation_framework => :rdoc } options = defaults.merge(options) Jeweler::Generator.new(options) end context "default configuration" do setup do stub_git_config @generator = build_generator end should "use shoulda for testing" do assert_equal :shoulda, @generator.testing_framework end should "use rdoc for documentation" do assert_equal :rdoc, @generator.documentation_framework end should "set todo in summary" do assert_match /todo/i, @generator.summary end should "set todo in description" do assert_match /todo/i, @generator.description end should "set target directory to the project name" do assert_equal @project_name, File.split(@generator.target_dir).last end should "set user's name from git config" do assert_equal @git_name, @generator.user_name end should "set email from git config" do assert_equal @git_email, @generator.user_email end should "set origin remote as github, based on username and project name" do assert_equal "git@github.com:#{@github_user}/#{@project_name}.git", @generator.git_remote end should "set homepage as github based on username and project name" do assert_equal "http://github.com/#{@github_user}/#{@project_name}", @generator.homepage end should "set github username from git config" do assert_equal @github_user, @generator.github_username end should "set project name as the-perfect-gem" do assert_equal @project_name, @generator.project_name end end context "using yard" do setup do @generator = build_generator(:documentation_framework => :yard) end should "set the doc_task to yardoc" do assert_equal "yardoc", @generator.doc_task end end context "using rdoc" do setup do @generator = build_generator(:documentation_framework => :rdoc) end should "set the doc_task to rdoc" do assert_equal "rdoc", @generator.doc_task end end context "using a custom homepage" do setup do @generator = build_generator(:homepage => 'http://zomg.com') end should "set the homepage" do assert_equal "http://zomg.com", @generator.homepage end end end jeweler-2.0.1/test/jeweler/test_specification.rb0000644000175000017500000001505012641037113020364 0ustar aleealeerequire 'test_helper' class TestSpecification < Test::Unit::TestCase def setup @project = create_construct end def teardown @project.destroy! end def build_jeweler_gemspec(&block) gemspec = if block Gem::Specification.new(&block) else Gem::Specification.new() end gemspec.extend(Jeweler::Specification) gemspec end should "be able to use to_ruby on a duped gemspec without error" do gemspec = build_jeweler_gemspec gemspec.files.include 'throwaway value' gemspec.dup.to_ruby end context "basic defaults" do setup do @gemspec = build_jeweler_gemspec end should "make files a FileList" do assert_equal FileList, @gemspec.files.class end should "make extra_rdoc_files a FileList" do assert_equal FileList, @gemspec.extra_rdoc_files.class end end context "there aren't any executables in the project directory" do setup do @project.directory 'bin' end context "and there hasn't been any set on the gemspec" do setup do @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project) end should "have empty gemspec executables" do assert_equal [], @gemspec.executables end end context "and has been previously set executables" do setup do @gemspec = build_jeweler_gemspec do |gemspec| gemspec.executables = %w(non-existant) end @gemspec.set_jeweler_defaults(@project) end should "have only the original executables in the gemspec" do assert_equal %w(non-existant), @gemspec.executables end end end context "there are multiple executables in the project directory" do setup do @project.directory('bin') do |bin| bin.file 'burnination' bin.file 'trogdor' end repo = Git.init(@project.to_s) repo.config('user.name', 'who') repo.config('user.email', 'who@where.com') repo.add('bin/burnination') repo.commit('Initial commit') end context "and there hasn't been any set on the gemspec" do setup do @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project) end should "have the executables under version control in the gemspec" do assert_equal %w(burnination), @gemspec.executables end end context "and has been previously set executables" do setup do @gemspec = build_jeweler_gemspec do |gemspec| gemspec.executables = %w(burnination) end @gemspec.set_jeweler_defaults(@project) end should "have only the original executables in the gemspec" do assert_equal %w(burnination), @gemspec.executables end end end context "there are mutiple extconf.rb and mkrf_conf.rb in the project directory" do setup do @project.directory('ext') do |ext| ext.file 'extconf.rb' ext.file 'mkrf_conf.rb' ext.directory('trogdor_native') do |trogdor_native| trogdor_native.file 'extconf.rb' trogdor_native.file 'mkrf_conf.rb' end end end context "and there hasn't been any extensions set on the gemspec" do setup do @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project) end should "have all the extconf.rb and mkrf_config.rb files in extensions" do assert_equal %w(ext/mkrf_conf.rb ext/trogdor_native/mkrf_conf.rb ext/extconf.rb ext/trogdor_native/extconf.rb).sort, @gemspec.extensions.sort end end end context "there are some files and is setup for git" do setup do @project.file 'Rakefile' @project.directory('lib') do |lib| lib.file 'example.rb' end repo = Git.init(@project.to_s) repo.config('user.name', 'who') repo.config('user.email', 'who@where.com') repo.add('.') repo.commit('Initial commit') end context "and the files defaults are used" do setup do @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project, @project) end should "populate files from git" do assert_equal %w(Rakefile lib/example.rb), @gemspec.files.sort end end context "and the files specified manually" do setup do @gemspec = build_jeweler_gemspec do |gemspec| gemspec.files = %w(Rakefile) end @gemspec.set_jeweler_defaults(@project, @project) end should "not be overridden by files from git" do assert_equal %w(Rakefile), @gemspec.files end end end context "there are some files and is setup for git with ignored files" do setup do @project.file '.gitignore', 'ignored' @project.file 'ignored' @project.file 'Rakefile' @project.directory('lib') do |lib| lib.file 'example.rb' end repo = Git.init(@project.to_s) repo.config('user.name', 'who') repo.config('user.email', 'who@where.com') repo.add('.') repo.commit('Initial commit') @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project, @project) end should "populate files from git excluding ignored and .gitignore" do assert_equal %w(Rakefile lib/example.rb), @gemspec.files.sort end end context "there are some files and is setup for git and working in a sub directory" do setup do @subproject = File.join(@project, 'subproject') @project.file 'Rakefile' @project.file 'README' @project.directory 'subproject' do |subproject| subproject.file 'README' subproject.directory('lib') do |lib| lib.file 'subproject_example.rb' end end repo = Git.init(@project.to_s) repo.config('user.name', 'who') repo.config('user.email', 'who@where.com') repo.add('.') repo.commit('Initial commit') @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@subproject, @project) end should "populate files from git relative to sub directory" do assert_equal %w(lib/subproject_example.rb README).sort, @gemspec.files.sort end end context "there are some files and is not setup for git" do setup do @project.file 'Rakefile' @project.directory('lib') do |lib| lib.file 'example.rb' end @gemspec = build_jeweler_gemspec @gemspec.set_jeweler_defaults(@project, @project) end should "not populate files" do assert_equal [], @gemspec.files.sort end end end jeweler-2.0.1/test/jeweler/test_gemspec_helper.rb0000644000175000017500000000161112641037113020524 0ustar aleealeerequire 'test_helper' class TestGemspecHelper < Test::Unit::TestCase def setup Rake.application.instance_variable_set(:@rakefile, "Rakefile") end context "given a gemspec" do setup do @spec = build_spec @helper = Jeweler::GemSpecHelper.new(@spec, File.dirname(__FILE__)) end should 'have sane gemspec path' do assert_equal "test/jeweler/#{@spec.name}.gemspec", @helper.path end end context "#write" do setup do @spec = build_spec @helper = Jeweler::GemSpecHelper.new(@spec, File.dirname(__FILE__)) FileUtils.rm_f(@helper.path) @helper.write end teardown do FileUtils.rm_f(@helper.path) end should "create gemspec file" do assert File.exists?(@helper.path) end should "make valid spec" do assert @helper.valid? end should "parse" do @helper.parse end end end jeweler-2.0.1/test/jeweler/commands/0000755000175000017500000000000012641037113015760 5ustar aleealeejeweler-2.0.1/test/jeweler/commands/test_build_gem.rb0000644000175000017500000000715112641037113021277 0ustar aleealeerequire 'test_helper' require 'jeweler/commands/build_gem' class Jeweler module Commands class TestBuildGem < Test::Unit::TestCase context "after running without a version" do setup do initialize_build_gem_environment @command.run end should "check if the gemspec helper has a version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.has_version? } end should "update version of gemspec helper if the gemspec doesn't have a version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version(@version_helper)} end should "call gemspec helper's parse" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.parse } end should "build from parsed gemspec" do if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a") assert_received(Gem::Package) {|builder_class| builder_class.build(@gemspec) } else assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) } assert_received(@builder) {|builder| builder.build } end end should 'make package directory' do assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'} end should 'move built gem into package directory' do assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'} end end context 'after running with a version' do setup do initialize_build_gem_environment true @command.run end should "check if the gemspec helper has a version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.has_version? } end should "update version of gemspec helper if the gemspec doesn't have a version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version(@version_helper).never } end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::BuildGem.build_for(@jeweler) end should "assign base_dir" do assert_same @base_dir, @jeweler.base_dir end should "assign gemspec_helper" do assert_same @gemspec_helper, @jeweler.gemspec_helper end should "return BuildGem" do assert_kind_of Jeweler::Commands::BuildGem, @command end end def initialize_build_gem_environment(has_version = false) @gemspec = Object.new stub(@gemspec).file_name { 'zomg-1.2.3.gem' } @gemspec_helper = Object.new stub(@gemspec_helper).parse { @gemspec } stub(@gemspec_helper).update_version stub(@gemspec_helper).has_version? { has_version } @version_helper = "Jeweler::VersionHelper" @builder = Object.new if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a") stub(Gem::Package).build { 'zomg-1.2.3.gem' } else stub(Gem::Builder).new { @builder } stub(@builder).build { 'zomg-1.2.3.gem' } end @file_utils = Object.new stub(@file_utils).mkdir_p './pkg' stub(@file_utils).mv './zomg-1.2.3.gem', './pkg' @base_dir = '.' @command = Jeweler::Commands::BuildGem.new @command.base_dir = @base_dir @command.file_utils = @file_utils @command.gemspec_helper = @gemspec_helper @command.version_helper = @version_helper end end end end jeweler-2.0.1/test/jeweler/commands/test_install_gem.rb0000644000175000017500000000162212641037113021643 0ustar aleealeerequire 'test_helper' class Jeweler module Commands class TestInstallGem < Test::Unit::TestCase rubyforge_command_context "running" do setup do stub(@gemspec_helper).gem_path { 'pkg/zomg-1.1.1.gem' } stub(@command).gem_command { 'ruby -S gem' } stub(@command).sh @command.run end should "call sh with gem install" do assert_received(@command) {|command| command.sh 'ruby -S gem install pkg/zomg-1.1.1.gem' } end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::InstallGem.build_for(@jeweler) end should "assign gemspec helper" do assert_equal @gemspec_helper, @command.gemspec_helper end should "assign output" do assert_equal @output, @command.output end end end end end jeweler-2.0.1/test/jeweler/commands/test_validate_gemspec.rb0000644000175000017500000000120712641037113022640 0ustar aleealeerequire 'test_helper' class Jeweler module Commands class TestValidateGemspec < Test::Unit::TestCase build_command_context "build context" do setup do @command = Jeweler::Commands::ValidateGemspec.build_for(@jeweler) end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign output" do assert_same @output, @command.output end should "return Jeweler::Commands::ValidateGemspec" do assert_kind_of Jeweler::Commands::ValidateGemspec, @command end end end end end jeweler-2.0.1/test/jeweler/commands/test_release_to_git.rb0000644000175000017500000001603512641037113022336 0ustar aleealeerequire 'test_helper' class Jeweler module Commands class TestReleaseToGit < Test::Unit::TestCase rubyforge_command_context "running" do context "happily" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@repo) do add_tag(anything) push(anything, anything) end stub(@repo).push stub(@command).release_not_tagged? { true } @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'master:master') } end end context "happily with different remote, local branch and remote branch" do setup do stub(@command).clean_staging_area? { true } stub(@command).release_tag { "v1.2.0" } stub(@repo).checkout(anything) stub(@repo) do add_tag(anything) push(anything, anything) end stub(@repo).push stub(@command).release_not_tagged? { true } @command.run({:remote => 'upstream', :local_branch => 'feature', :remote_branch => 'v1'}) end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('feature') } end should "tag version" do assert_received(@repo) {|repo| repo.add_tag('v1.2.0') } end should "push" do assert_received(@repo) {|repo| repo.push('upstream', 'feature:v1') } end end context "happily with different branch" do setup do stub(@command).clean_staging_area? { true } stub(@command).release_tag { "v3.2.0" } stub(@repo).checkout(anything) stub(@repo) do add_tag(anything) push(anything, anything) end stub(@repo).push stub(@command).release_not_tagged? { true } @command.run({:branch => 'v3'}) end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('v3') } end should "tag version" do assert_received(@repo) {|repo| repo.add_tag('v3.2.0') } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'v3:v3') } end end context "with an unclean staging area" do setup do stub(@command).clean_staging_area? { false } stub(@command).system end should 'raise error' do assert_raises RuntimeError, /try commiting/i do @command.run end end should 'display git status' do @command.run rescue nil assert_received(@command) {|command| command.system("git status") } end end context "with a release already tagged" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@repo).push stub(@command).release_not_tagged? { false } @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'master:master') } end end end build_command_context "building from jeweler" do setup do @command = Jeweler::Commands::ReleaseToGit.build_for(@jeweler) end should "assign gemspec" do assert_same @gemspec, @command.gemspec end should "assign version" do assert_same @version, @command.version end should "assign repo" do assert_same @repo, @command.repo end should "assign output" do assert_same @output, @command.output end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign base_dir" do assert_same @base_dir, @command.base_dir end end # FIXME this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday #context "clean_staging_area?" do # should "be false if there added files" do # repo = build_repo :added => %w(README) # command = Jeweler::Commands::ReleaseToGit.new :repo => repo # assert ! command.clean_staging_area? # end # should "be false if there are changed files" do # repo = build_repo :changed => %w(README) # command = Jeweler::Commands::ReleaseToGit.new # command.repo = repo # assert ! command.clean_staging_area? # end # should "be false if there are deleted files" do # repo = build_repo :deleted => %w(README) # command = Jeweler::Commands::ReleaseToGit.new # command.repo = repo # assert ! command.clean_staging_area? # end # should "be true if nothing added, changed, or deleted" do # repo = build_repo # command = Jeweler::Commands::ReleaseToGit.new # command.repo = repo # assert command.clean_staging_area? # end #end context "release_tagged? when no tag exists" do setup do @repo = Object.new stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag } @output = StringIO.new @command = Jeweler::Commands::ReleaseToGit.new @command.output = @output @command.repo = @repo @command.version = '1.2.3' end should_eventually "be true" do assert @command.release_not_tagged? end end context "release_tagged? when tag exists" do setup do @repo = Object.new stub(@repo) do tag('v1.2.3') { Object.new } end @output = StringIO.new @command = Jeweler::Commands::ReleaseToGit.new @command.output = @output @command.repo = @repo @command.version = '1.2.3' end should_eventually "be false" do assert @command.release_not_tagged? end end def build_repo(options = {}) status = build_status options repo = Object.new stub(repo).status { status } repo end def build_status(options = {}) options = {:added => [], :deleted => [], :changed => []}.merge(options) status = Object.new stub(status) do added { options[:added] } deleted { options[:deleted] } changed { options[:changed] } end end end end end jeweler-2.0.1/test/jeweler/commands/version/0000755000175000017500000000000012641037113017445 5ustar aleealeejeweler-2.0.1/test/jeweler/commands/version/test_write.rb0000644000175000017500000000102112641037113022155 0ustar aleealeerequire 'test_helper' class Jeweler module Commands module Version class TestWrite < Test::Unit::TestCase should "call write_version on version_helper in update_version" do mock(version_helper = Object.new).update_to 1, 2, 3, nil command = Jeweler::Commands::Version::Write.new command.version_helper = version_helper command.major = 1 command.minor = 2 command.patch = 3 command.update_version end end end end end jeweler-2.0.1/test/jeweler/commands/version/test_bump_minor.rb0000644000175000017500000000066612641037113023210 0ustar aleealeerequire 'test_helper' class Jeweler module Commands module Version class TestBumpMinor < Test::Unit::TestCase should "call bump_minor on version_helper in update_version" do mock(version_helper = Object.new).bump_minor command = Jeweler::Commands::Version::BumpMinor.new command.version_helper = version_helper command.update_version end end end end end jeweler-2.0.1/test/jeweler/commands/version/test_bump_major.rb0000644000175000017500000000067112641037113023170 0ustar aleealeerequire 'test_helper' class Jeweler module Commands module Version class TestBumpMajor < Test::Unit::TestCase should "call bump_major on version_helper in update_version" do mock(version_helper = Object.new).bump_major command = Jeweler::Commands::Version::BumpMajor.new command.version_helper = version_helper command.update_version end end end end end jeweler-2.0.1/test/jeweler/commands/version/test_bump_patch.rb0000644000175000017500000000066712641037113023164 0ustar aleealeerequire 'test_helper' class Jeweler module Commands module Version class TestBumpPatch < Test::Unit::TestCase should "call bump_patch on version_helper in update_version" do mock(version_helper = Object.new).bump_patch command = Jeweler::Commands::Version::BumpPatch.new command.version_helper = version_helper command.update_version end end end end end jeweler-2.0.1/test/jeweler/commands/version/test_base.rb0000644000175000017500000000266612641037113021755 0ustar aleealeerequire 'test_helper' class Jeweler module Commands module Version class TestBase < Test::Unit::TestCase build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::Version::Base.build_for(@jeweler) end should "assign repo" do assert_equal @repo, @command.repo end should "assign version_helper" do assert_equal @version_helper, @command.version_helper end should "assign gemspec" do assert_equal @gemspec, @command.gemspec end should "assign commit" do assert_equal @commit, @command.commit end context "commit_version" do setup do @dir = Object.new stub(@repo).dir { @dir } stub(@dir).path { Dir.pwd } stub(@version_helper).path { Pathname.new 'VERSION' } stub(@version_helper).to_s { '1.0.0' } stub(@repo) do add(anything) commit(anything) end @command.base_dir = Dir.pwd @command.commit_version end should "add VERSION" do assert_received(@repo) {|repo| repo.add('VERSION')} assert_received(@repo) {|repo| repo.commit('Version bump to 1.0.0')} end end end end end end end jeweler-2.0.1/test/jeweler/commands/test_release_to_gemcutter.rb0000644000175000017500000000203512641037113023545 0ustar aleealeerequire 'test_helper' class Jeweler module Commands class TestReleaseToRubygems < Test::Unit::TestCase def self.subject Jeweler::Commands::ReleaseToRubygems.new end gemcutter_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do setup do stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'} stub(@command).sh @command.run end should "push to rubygems" do push_command = "gem push #{@gemspec_helper.gem_path}" assert_received(@command) { |command| command.sh(push_command) } end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::ReleaseToRubygems.build_for(@jeweler) end should "assign gemspec helper" do assert_equal @gemspec_helper, @command.gemspec_helper end should "assign output" do assert_equal @output, @command.output end end end end end jeweler-2.0.1/test/jeweler/commands/test_release_to_github.rb0000644000175000017500000003174112641037113023036 0ustar aleealeerequire 'test_helper' require 'pathname' class Jeweler module Commands class TestReleaseGemspec < Test::Unit::TestCase rubyforge_command_context "running" do context "happily" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@command).regenerate_gemspec! stub(@command).gemspec_changed? { true } stub(@command).commit_gemspec! { true } stub(@repo).push stub(@command).release_not_tagged? { true } @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "regenerate gemspec" do assert_received(@command) {|command| command.regenerate_gemspec! } end should "commit gemspec" do assert_received(@command) {|command| command.commit_gemspec! } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'master:master') } end end context "happily with different remote, local branch and remote branch" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@command).regenerate_gemspec! stub(@command).gemspec_changed? { true } stub(@command).commit_gemspec! { true } stub(@repo).push stub(@command).release_not_tagged? { true } @command.run({:remote => 'upstream', :local_branch => 'branch', :remote_branch => 'remote_branch'}) end should "checkout local branch" do assert_received(@repo) {|repo| repo.checkout('branch') } end should "regenerate gemspec" do assert_received(@command) {|command| command.regenerate_gemspec! } end should "commit gemspec" do assert_received(@command) {|command| command.commit_gemspec! } end should "push" do assert_received(@repo) {|repo| repo.push('upstream', 'branch:remote_branch') } end end context "happily with different branch" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@command).regenerate_gemspec! stub(@command).gemspec_changed? { true } stub(@command).commit_gemspec! { true } stub(@repo).push stub(@command).release_not_tagged? { true } @command.run({:branch => 'v3'}) end should "checkout local branch" do assert_received(@repo) {|repo| repo.checkout('v3') } end should "regenerate gemspec" do assert_received(@command) {|command| command.regenerate_gemspec! } end should "commit gemspec" do assert_received(@command) {|command| command.commit_gemspec! } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'v3:v3') } end end context "with an unclean staging area" do setup do stub(@command).clean_staging_area? { false } stub(@command).system end should 'raise error' do assert_raises RuntimeError, /try commiting/i do @command.run end end should 'display git status' do @command.run rescue nil assert_received(@command) {|command| command.system("git status") } end end context "with an unchanged gemspec" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@command).regenerate_gemspec! stub(@command).gemspec_changed? { false } dont_allow(@command).commit_gemspec! { true } stub(@repo).push stub(@command).release_not_tagged? { true } @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "regenerate gemspec" do assert_received(@command) {|command| command.regenerate_gemspec! } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'master:master') } end end context "with a release already tagged" do setup do stub(@command).clean_staging_area? { true } stub(@repo).checkout(anything) stub(@command).regenerate_gemspec! stub(@command).gemspec_changed? { true } stub(@command).commit_gemspec! { true } stub(@repo).push stub(@command).release_not_tagged? { false } @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "regenerate gemspec" do assert_received(@command) {|command| command.regenerate_gemspec! } end should "commit gemspec" do assert_received(@command) {|command| command.commit_gemspec! } end should "push" do assert_received(@repo) {|repo| repo.push('origin', 'master:master') } end end end build_command_context "building from jeweler" do setup do @command = Jeweler::Commands::ReleaseGemspec.build_for(@jeweler) end should "assign gemspec" do assert_same @gemspec, @command.gemspec end should "assign version" do assert_same @version, @command.version end should "assign repo" do assert_same @repo, @command.repo end should "assign output" do assert_same @output, @command.output end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign base_dir" do assert_same @base_dir, @command.base_dir end end # FIXME this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday #context "clean_staging_area?" do # should "be false if there added files" do # repo = build_repo :added => %w(README) # command = Jeweler::Commands::ReleaseGemspec.new :repo => repo # assert ! command.clean_staging_area? # end # should "be false if there are changed files" do # repo = build_repo :changed => %w(README) # command = Jeweler::Commands::ReleaseGemspec.new # command.repo = repo # assert ! command.clean_staging_area? # end # should "be false if there are deleted files" do # repo = build_repo :deleted => %w(README) # command = Jeweler::Commands::ReleaseGemspec.new # command.repo = repo # assert ! command.clean_staging_area? # end # should "be true if nothing added, changed, or deleted" do # repo = build_repo # command = Jeweler::Commands::ReleaseGemspec.new # command.repo = repo # assert command.clean_staging_area? # end #end context "regenerate_gemspec!" do setup do @repo = Object.new stub(@repo) do add(anything) commit(anything) end @gemspec_helper = Object.new stub(@gemspec_helper) do write path {'zomg.gemspec'} update_version('1.2.3') end @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new :output => @output, :repo => @repo, :gemspec_helper => @gemspec_helper, :version => '1.2.3' @command.regenerate_gemspec! end should "refresh gemspec version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') } end should "write gemspec" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write } end end context "commit_gemspec!" do setup do @repo = Object.new stub(@repo) do add(anything) commit(anything) end @gemspec_helper = Object.new stub(@gemspec_helper) do path {'zomg.gemspec'} update_version('1.2.3') end @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new :output => @output, :repo => @repo, :gemspec_helper => @gemspec_helper, :version => '1.2.3' stub(@command).working_subdir { Pathname.new(".") } @command.commit_gemspec! end should "add gemspec to repository" do assert_received(@repo) {|repo| repo.add('zomg.gemspec') } end should "commit with commit message including version" do assert_received(@repo) {|repo| repo.commit("Regenerate gemspec for version 1.2.3") } end end context "commit_gemspec! in top dir" do setup do @repo = Object.new stub(@repo) do add(anything) commit(anything) end @gemspec_helper = Object.new stub(@gemspec_helper) do path {'zomg.gemspec'} update_version('1.2.3') end @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new :output => @output, :repo => @repo, :gemspec_helper => @gemspec_helper, :version => '1.2.3', :base_dir => '.' @dir = Object.new stub(@repo).dir { @dir } stub(@dir).path { "/x/y/z" } stub(@command).base_dir_path { Pathname.new("/x/y/z") } @command.commit_gemspec! end should "add gemspec to repository" do assert_received(@repo) {|repo| repo.add('zomg.gemspec') } end end context "commit_gemspec! in sub dir" do setup do @repo = Object.new stub(@repo) do add(anything) commit(anything) end @gemspec_helper = Object.new stub(@gemspec_helper) do path {'zomg.gemspec'} update_version('1.2.3') end @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new :output => @output, :repo => @repo, :gemspec_helper => @gemspec_helper, :version => '1.2.3', :base_dir => '.' @dir = Object.new stub(@repo).dir { @dir } stub(@dir).path { "/x/y/z" } stub(@command).base_dir_path { Pathname.new("/x/y/z/gem") } @command.commit_gemspec! end should "add gemspec to repository" do assert_received(@repo) {|repo| repo.add('gem/zomg.gemspec') } end end context "release_tagged? when no tag exists" do setup do @repo = Object.new stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag } @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new @command.output = @output @command.repo = @repo @command.version = '1.2.3' end should_eventually "be true" do assert @command.release_not_tagged? end end context "release_tagged? when tag exists" do setup do @repo = Object.new stub(@repo) do tag('v1.2.3') { Object.new } end @output = StringIO.new @command = Jeweler::Commands::ReleaseGemspec.new @command.output = @output @command.repo = @repo @command.version = '1.2.3' end should_eventually "be false" do assert @command.release_not_tagged? end end def build_repo(options = {}) status = build_status options repo = Object.new stub(repo).status { status } repo end def build_status(options = {}) options = {:added => [], :deleted => [], :changed => []}.merge(options) status = Object.new stub(status) do added { options[:added] } deleted { options[:deleted] } changed { options[:changed] } end end end end end jeweler-2.0.1/test/jeweler/commands/test_write_gemspec.rb0000644000175000017500000000604512641037113022206 0ustar aleealeerequire 'test_helper' class Jeweler module Commands class TestWriteGemspec < Test::Unit::TestCase context "after run" do setup do @gemspec = Gem::Specification.new {|s| s.name = 'zomg' } @gemspec_helper = Object.new stub(@gemspec_helper).spec { @gemspec } stub(@gemspec_helper).path { 'zomg.gemspec' } stub(@gemspec_helper).write @output = StringIO.new @version_helper = Object.new stub(@version_helper).to_s { '1.2.3' } stub(@version_helper).refresh @command = Jeweler::Commands::WriteGemspec.new @command.base_dir = 'tmp' @command.version_helper = @version_helper @command.gemspec = @gemspec @command.output = @output @command.gemspec_helper = @gemspec_helper # FIXME apparently rubygems doesn't use Time.now under the hood when generating a date @now = Time.local(2008, 9, 1, 12, 0, 0) stub(Time.now).now { @now } end should "refresh version" do @command.run assert_received(@version_helper) {|version_helper| version_helper.refresh } end should "update gemspec version" do @command.run assert_equal '1.2.3', @gemspec.version.to_s end should "not refresh version neither update version if it's set on the gemspec" do @gemspec.version = '2.3.4' @command.run assert_equal '2.3.4', @gemspec.version.to_s end should_eventually "update gemspec date to the beginning of today" do @command.run # FIXME apparently rubygems doesn't use Time.now under the hood when generating a date assert_equal Time.local(@now.year, @now.month, @now.day, 0, 0), @gemspec.date end should "write gemspec" do @command.run assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write } end should_eventually "output that the gemspec was written" do @command.run assert_equal @output.string, "Generated: tmp/zomg.gemspec" end end build_command_context "building for jeweler" do setup do @command = Jeweler::Commands::WriteGemspec.build_for(@jeweler) end should "assign base_dir" do assert_same @base_dir, @command.base_dir end should "assign gemspec" do assert_same @gemspec, @command.gemspec end should "assign version" do assert_same @version, @command.version end should "assign output" do assert_same @output, @command.output end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign version_helper" do assert_same @version_helper, @command.version_helper end should "return WriteGemspec" do assert_kind_of Jeweler::Commands::WriteGemspec, @command end end end end end jeweler-2.0.1/test/jeweler/test_generator.rb0000644000175000017500000001421012641037113017527 0ustar aleealeerequire 'test_helper' class TestGenerator < Test::Unit::TestCase def build_generator(testing_framework = :shoulda, options = {}) options = { :project_name => 'the-perfect-gem', :user_name => 'John Doe', :user_email => 'john@example.com', :github_username => 'johndoe', :documentation_framework => :rdoc }.merge(options) options[:testing_framework] = testing_framework Jeweler::Generator.new(options) end should "have the correct constant name" do assert_equal "ThePerfectGem", build_generator.constant_name end should "have the correct file name prefix" do assert_equal "the_perfect_gem", build_generator.file_name_prefix end should "have the correct require name" do assert_equal "the-perfect-gem", build_generator.require_name end should "have the correct lib file name" do assert_equal "the-perfect-gem.rb", build_generator.lib_filename end should "have the correct git-remote" do assert_equal 'user@host:/path/to/repo', build_generator(:shoulda, {:git_remote => "user@host:/path/to/repo"}).git_remote assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote end should "extract project name from absolut path" do assert_equal "my-project", build_generator(:shoulda, {:project_name => "/tmp/my-project"}).project_name end should "extract project name from relative path" do assert_equal "my-project", build_generator(:shoulda, {:project_name => "../my-project"}).project_name end should "extract project name from direct path" do assert_equal "my-project", build_generator(:shoulda, {:project_name => "my-project"}).project_name end def self.should_have_generator_attribute(attribute, value) should "have #{value} for #{attribute}" do assert_equal value, build_generator(@framework).send(attribute) end end context "shoulda" do setup { @framework = :shoulda } should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'test/**/test_*.rb' should_have_generator_attribute :test_filename, 'test_the-perfect-gem.rb' should_have_generator_attribute :test_helper_filename, 'helper.rb' end context "testunit" do setup { @framework = :testunit } should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'test/**/test_*.rb' should_have_generator_attribute :test_filename, 'test_the-perfect-gem.rb' should_have_generator_attribute :test_helper_filename, 'helper.rb' end context "minitest" do setup { @framework = :minitest } should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'minitest/unit' should_have_generator_attribute :feature_support_extend, 'MiniTest::Assertions' should_have_generator_attribute :test_pattern, 'test/**/test_*.rb' should_have_generator_attribute :test_filename, 'test_the-perfect-gem.rb' should_have_generator_attribute :test_helper_filename, 'helper.rb' end context "bacon" do setup { @framework = :bacon } should_have_generator_attribute :test_task, 'spec' should_have_generator_attribute :test_dir, 'spec' should_have_generator_attribute :default_task, 'spec' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb' should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb' should_have_generator_attribute :test_helper_filename, 'spec_helper.rb' end context "rspec" do setup { @framework = :rspec } should_have_generator_attribute :test_task, 'spec' should_have_generator_attribute :test_dir, 'spec' should_have_generator_attribute :default_task, 'spec' should_have_generator_attribute :feature_support_require, 'rspec/expectations' should_have_generator_attribute :feature_support_extend, nil should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb' should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb' should_have_generator_attribute :test_helper_filename, 'spec_helper.rb' end context "micronaut" do setup { @framework = :micronaut } should_have_generator_attribute :test_task, 'examples' should_have_generator_attribute :test_dir, 'examples' should_have_generator_attribute :default_task, 'examples' should_have_generator_attribute :feature_support_require, 'micronaut/expectations' should_have_generator_attribute :feature_support_extend, 'Micronaut::Matchers' should_have_generator_attribute :test_pattern, 'examples/**/*_example.rb' should_have_generator_attribute :test_filename, 'the-perfect-gem_example.rb' should_have_generator_attribute :test_helper_filename, 'example_helper.rb' end context "testspec" do setup { @framework = :testspec } should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'test/**/*_test.rb' should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb' should_have_generator_attribute :test_helper_filename, 'test_helper.rb' end end jeweler-2.0.1/test/jeweler/test_version_helper.rb0000644000175000017500000001273712641037113020601 0ustar aleealeerequire 'test_helper' class TestVersionHelper < Test::Unit::TestCase VERSION_TMP_DIR = File.dirname(__FILE__) + '/version_tmp' def self.should_have_version(major, minor, patch, build=nil) should "have major version #{major}" do assert_equal major, @version_helper.major end should "have minor version #{minor}" do assert_equal minor, @version_helper.minor end should "have patch version #{patch}" do assert_equal patch, @version_helper.patch end should "have build version #{build}" do assert_equal build, @version_helper.build end version_s = [major, minor, patch, build].compact.join('.') should "render string as #{version_s.inspect}" do assert_equal version_s, @version_helper.to_s end #version_hash = {:major => major, :minor => minor, :patch => patch} #should "render hash as #{version_hash.inspect}" do #assert_equal version_hash, @version_helper.to_hash #end end context "VERSION.yml with 3.5.4" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR build_version_yml VERSION_TMP_DIR, 3, 5, 4 @version_helper = Jeweler::VersionHelper.new VERSION_TMP_DIR end should_have_version 3, 5, 4 context "bumping major version" do setup { @version_helper.bump_major } should_have_version 4, 0, 0 end context "bumping the minor version" do setup { @version_helper.bump_minor } should_have_version 3, 6, 0 end context "bumping the patch version" do setup { @version_helper.bump_patch } should_have_version 3, 5, 5 end end context "VERSION.yml with 3.5.4.a1" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR build_version_yml VERSION_TMP_DIR, 3, 5, 4, 'a1' @version_helper = Jeweler::VersionHelper.new VERSION_TMP_DIR end should_have_version 3, 5, 4, 'a1' context "bumping major version" do setup { @version_helper.bump_major } should_have_version 4, 0, 0, nil end context "bumping the minor version" do setup { @version_helper.bump_minor } should_have_version 3, 6, 0, nil end context "bumping the patch version" do setup { @version_helper.bump_patch } should_have_version 3, 5, 5, nil end end context "VERSION with 3.5.4" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR build_version_plaintext VERSION_TMP_DIR, 3, 5, 4 @version_helper = Jeweler::VersionHelper.new VERSION_TMP_DIR end should_have_version 3, 5, 4 context "bumping major version" do setup { @version_helper.bump_major } should_have_version 4, 0, 0 end context "bumping the minor version" do setup { @version_helper.bump_minor } should_have_version 3, 6, 0 end context "bumping the patch version" do setup { @version_helper.bump_patch } should_have_version 3, 5, 5 end end context "VERSION with 3.5.4.a1" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR build_version_plaintext VERSION_TMP_DIR, 3, 5, 4, 'a1' @version_helper = Jeweler::VersionHelper.new VERSION_TMP_DIR end should_have_version 3, 5, 4, 'a1' context "bumping major version" do setup { @version_helper.bump_major } should_have_version 4, 0, 0, nil end context "bumping the minor version" do setup { @version_helper.bump_minor } should_have_version 3, 6, 0, nil end context "bumping the patch version" do setup { @version_helper.bump_patch } should_have_version 3, 5, 5, nil end end context "Non-existant VERSION.yml" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR end should "not raise error if the VERSION.yml doesn't exist" do assert_nothing_raised Jeweler::VersionYmlError do Jeweler::VersionHelper.new(VERSION_TMP_DIR) end end context "setting an initial version" do setup do @version_helper = Jeweler::VersionHelper.new(VERSION_TMP_DIR) @version_helper.update_to 0, 0, 1 end should_have_version 0, 0, 1 should "not create VERSION.yml" do assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml')) end should "not create VERSION" do assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION')) end context "outputting" do setup do @version_helper.write end should "create VERSION" do assert File.exists?(File.join(VERSION_TMP_DIR, 'VERSION')) end context "re-reading VERSION" do setup do @version_helper = Jeweler::VersionHelper.new(VERSION_TMP_DIR) end should_have_version 0, 0, 1 end end end end def build_version_yml(base_dir, major, minor, patch, build=nil) version_path = File.join(base_dir, 'VERSION.yml') File.open(version_path, 'w+') do |f| version_hash = { 'major' => major.to_i, 'minor' => minor.to_i, 'patch' => patch.to_i } version_hash['build'] = build if build YAML.dump(version_hash, f) end end def build_version_plaintext(base_dir, major, minor, patch, build=nil) version_path = File.join(base_dir, 'VERSION') File.open(version_path, 'w+') do |f| f.puts [major, minor, patch, build].compact.join('.') end end end jeweler-2.0.1/test/jeweler/generator/0000755000175000017500000000000012641037113016145 5ustar aleealeejeweler-2.0.1/test/jeweler/generator/test_options.rb0000644000175000017500000001243312641037113021227 0ustar aleealeerequire 'test_helper' class TestOptions < Test::Unit::TestCase def setup set_default_git_config stub_git_config valid_git_config end def self.should_have_testing_framework(testing_framework) should "use #{testing_framework} for testing" do assert_equal testing_framework.to_sym, @options[:testing_framework] end end def self.should_have_docmentation_framework(documentation_framework) should "use #{documentation_framework} for documentation" do assert_equal documentation_framework.to_sym, @options[:documentation_framework] end end def setup_options(*arguments) stub(Jeweler::Generator::Options).git_config { valid_git_config } @options = Jeweler::Generator::Options.new(["project_name"] + arguments) end def self.for_options(*options) context options.join(' ') do setup { setup_options *options } yield end end context "default options" do setup { setup_options } should_have_testing_framework :shoulda should_have_docmentation_framework :rdoc should 'not create repository' do assert ! @options[:create_repo] end should "have project name" do assert_equal "project_name", @options[:project_name] end should "use github username from git config" do assert_equal @github_user, @options[:github_username] end should "use user name from git config" do assert_equal @git_name, @options[:user_name] end should "use user email from git config" do assert_equal @git_email, @options[:user_email] end should "use bundler" do assert @options[:use_bundler] end end for_options "--bacon" do should_have_testing_framework :bacon end for_options '--micronaut' do should_have_testing_framework :micronaut end for_options '--minitest' do should_have_testing_framework :minitest end for_options '--rspec' do should_have_testing_framework :rspec end for_options '--shoulda' do should_have_testing_framework :shoulda end for_options "--testunit" do should_have_testing_framework :testunit end for_options "--testspec" do should_have_testing_framework :testspec end for_options '--cucumber' do should 'enable cucumber' do assert_equal true, @options[:use_cucumber] end end for_options '--reek' do should 'enable reek' do assert_equal true, @options[:use_reek] end end for_options '--roodi' do should 'enable roodi' do assert_equal true, @options[:use_roodi] end end for_options '--create-repo' do should 'create repository' do assert @options[:create_repo] end end for_options '--rdoc' do should_have_docmentation_framework :rdoc end for_options '--yard' do should_have_docmentation_framework :yard end for_options '--summary', 'zomg so awesome' do should 'have summary zomg so awesome' do assert_equal 'zomg so awesome', @options[:summary] end end for_options '--description', 'Descriptive' do should 'have description Descriptive' do assert_equal 'Descriptive', @options[:description] end end for_options '--directory', 'foo' do should 'have directory foo' do assert_equal 'foo', @options[:directory] end end for_options '--version' do should 'show version' do assert @options[:show_version] end end for_options '-v' do should 'show version' do assert @options[:show_version] end end for_options '--help' do should 'show help' do assert @options[:show_help] end end for_options '-h' do should 'show help' do assert @options[:show_help] end end for_options '--zomg-invalid' do should 'be an invalid argument' do assert @options[:invalid_argument] end end for_options '--user-name', 'myname' do should "set user name" do assert_equal 'myname', @options[:user_name] end end for_options '--user-email', 'myname@mydomain.com' do should "set user email" do assert_equal 'myname@mydomain.com', @options[:user_email] end end for_options '--homepage', 'http://zomg.com' do should 'set hoempage' do assert_equal 'http://zomg.com', @options[:homepage] end end for_options '--git-remote', 'git@my-awesome-domain.com:zomg.git' do should 'set the git remote' do assert_equal 'git@my-awesome-domain.com:zomg.git', @options[:git_remote] end end for_options '--github-username', 'mygithub' do should "set github username" do assert_equal 'mygithub', @options[:github_username] end end for_options '--bundler' do should "use bundler" do assert @options[:use_bundler] end end for_options '--no-bundler' do should "not use bundler" do assert !@options[:use_bundler] end end context "merging options" do should "take options from each" do options = Jeweler::Generator::Options.new(["--rspec"]). merge Jeweler::Generator::Options.new(["--create-repo"]) assert_equal :rspec, options[:testing_framework] assert options[:create_repo] end should "shadow options" do options = Jeweler::Generator::Options.new(["--bacon"]). merge Jeweler::Generator::Options.new(["--rspec"]) assert_equal :rspec, options[:testing_framework] end end end jeweler-2.0.1/test/jeweler/generator/test_application.rb0000644000175000017500000000615712641037113022045 0ustar aleealeerequire 'test_helper' class TestApplication < Test::Unit::TestCase def run_application(*arguments) original_stdout = $stdout original_stderr = $stderr fake_stdout = StringIO.new fake_stderr = StringIO.new $stdout = fake_stdout $stderr = fake_stderr result = nil begin result = Jeweler::Generator::Application.run!(*arguments) ensure $stdout = original_stdout $stderr = original_stderr end @stdout = fake_stdout.string @stderr = fake_stderr.string result end def stub_options(options = {}) stub(options).opts { 'Usage:' } options end def self.should_exit_with_code(code) should "exit with code #{code}" do assert_equal code, @result end end context "when options indicate version" do setup do stub(Jeweler::Generator::Application).build_opts do stub_options(:show_version => true) end stub(Jeweler::Generator).new { raise "Shouldn't have made this far"} assert_nothing_raised do @result = run_application("-v") end end should_exit_with_code 1 should 'should puts option version' do assert_match 'Version:', @stderr end end context "when options indicate help usage" do setup do stub(Jeweler::Generator::Application).build_opts do stub_options(:show_help => true) end stub(Jeweler::Generator).new { raise "Shouldn't have made this far"} assert_nothing_raised do @result = run_application("-h") end end should_exit_with_code 1 should 'should puts option usage' do assert_match 'Usage:', @stderr end should 'not display anything on stdout' do assert_equal '', @stdout.squeeze.strip end end context "when options indicate an invalid argument" do setup do stub(Jeweler::Generator::Application).build_opts do stub_options(:invalid_argument => '--invalid-argument') end stub(Jeweler::Generator).new { raise "Shouldn't have made this far"} assert_nothing_raised do @result = run_application("--invalid-argument") end end should_exit_with_code 1 should 'display invalid argument' do assert_match '--invalid-argument', @stderr end should 'display usage on stderr' do assert_match 'Usage:', @stderr end should 'not display anything on stdout' do assert_equal '', @stdout.squeeze.strip end end context "when options are good" do setup do @generator = "generator" stub(@generator).run stub(Jeweler::Generator).new { @generator } @jeweler_options = stub_options :project_name => 'zomg' stub(Jeweler::Generator::Application).build_options do @jeweler_options end assert_nothing_raised do @result = run_application("zomg") end end should_exit_with_code 0 should "create generator with options" do assert_received(Jeweler::Generator) {|subject| subject.new(@jeweler_options) } end should "run generator" do assert_received(@generator) {|subject| subject.run } end end end jeweler-2.0.1/test/jeweler/test_generator_mixins.rb0000644000175000017500000000125212641037113021120 0ustar aleealeerequire 'test_helper' class TestGeneratorMixins < Test::Unit::TestCase [Jeweler::Generator::BaconMixin, Jeweler::Generator::MicronautMixin, Jeweler::Generator::MinitestMixin, Jeweler::Generator::RspecMixin, Jeweler::Generator::ShouldaMixin, Jeweler::Generator::TestspecMixin, Jeweler::Generator::TestunitMixin, ].each do |mixin| context "#{mixin}" do %w(default_task feature_support_require feature_support_extend test_dir test_task test_pattern test_filename test_helper_filename).each do |method| should "define #{method}" do assert mixin.method_defined?(method) end end end end end jeweler-2.0.1/test/test_jeweler.rb0000644000175000017500000001001212641037113015535 0ustar aleealeerequire 'test_helper' class TestJeweler < Test::Unit::TestCase def build_jeweler(base_dir = nil) base_dir ||= git_dir_path FileUtils.mkdir_p base_dir Jeweler.new(build_spec, base_dir) end def git_dir_path File.join(tmp_dir, 'git') end def non_git_dir_path File.join(tmp_dir, 'nongit') end def build_git_dir FileUtils.mkdir_p git_dir_path Dir.chdir git_dir_path do Git.init end end def build_non_git_dir FileUtils.mkdir_p non_git_dir_path end should "raise an error if a nil gemspec is given" do assert_raises Jeweler::GemspecError do Jeweler.new(nil) end end should "know if it is in a git repo" do build_git_dir assert build_jeweler(git_dir_path).in_git_repo? end should "know if it is not in a git repo" do build_non_git_dir jeweler = build_jeweler(non_git_dir_path) assert ! jeweler.in_git_repo?, "jeweler doesn't know that #{jeweler.base_dir} is not a git repository" end should "find the base repo" do jeweler = build_jeweler(File.dirname(File.expand_path(__FILE__))) assert_equal File.dirname(File.dirname(File.expand_path(__FILE__))), jeweler.git_base_dir end should "build and run write gemspec command when writing gemspec" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::WriteGemspec).build_for(jeweler) { command } jeweler.write_gemspec end should "build and run validate gemspec command when validating gemspec" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::ValidateGemspec).build_for(jeweler) { command } jeweler.validate_gemspec end should "build and run build gem command when building gem" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::BuildGem).build_for(jeweler) { command } jeweler.build_gem end should "build and run build gem command when installing gem" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::InstallGem).build_for(jeweler) { command } jeweler.install_gem end should "build and run bump major version command when bumping major version" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::Version::BumpMajor).build_for(jeweler) { command } jeweler.bump_major_version end should "build and run bump minor version command when bumping minor version" do jeweler = build_jeweler command = Object.new mock(command).run mock(Jeweler::Commands::Version::BumpMinor).build_for(jeweler) { command } jeweler.bump_minor_version end should "build and run write version command when writing version" do jeweler = build_jeweler command = Object.new mock(command).run mock(command).major=(1) mock(command).minor=(5) mock(command).patch=(2) mock(command).build=('a1') mock(Jeweler::Commands::Version::Write).build_for(jeweler) { command } jeweler.write_version(1, 5, 2, 'a1') end should "build and run release to github command when running release_gemspec" do jeweler = build_jeweler args = {} command = Object.new mock(command).run(args) mock(Jeweler::Commands::ReleaseGemspec).build_for(jeweler) { command } jeweler.release_gemspec(args) end should "build and run release to git command when running release_to_git" do jeweler = build_jeweler args = {} command = Object.new mock(command).run(args) mock(Jeweler::Commands::ReleaseToGit).build_for(jeweler) { command } jeweler.release_to_git(args) end should "respond to gemspec_helper" do assert_respond_to build_jeweler, :gemspec_helper end should "respond to version_helper" do assert_respond_to build_jeweler, :version_helper end should "respond to repo" do assert_respond_to build_jeweler, :repo end should "respond to commit" do assert_respond_to build_jeweler, :commit end end jeweler-2.0.1/bin/0000755000175000017500000000000012641037113012313 5ustar aleealeejeweler-2.0.1/bin/jeweler0000755000175000017500000000050712641037113013700 0ustar aleealee#!/usr/bin/env ruby # Don't try to run this binary directory. Instead: # * `bundle exec jeweler` if doing jeweler development # * `bundle exec jeweler` if part of a bundle # * `jeweler` if installed through rubygems, relying on the rubygem wrapper require 'jeweler/generator' exit Jeweler::Generator::Application.run!(*ARGV) jeweler-2.0.1/.travis.yml0000644000175000017500000000014312641037113013652 0ustar aleealeelanguage: ruby rvm: - 1.9.2 - 1.9.3 - 2.0.0 notifications: irc: "irc.freenode.org#jeweler" jeweler-2.0.1/jeweler.gemspec0000644000175000017500000002512412641037113014551 0ustar aleealee# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "jeweler" s.version = "2.0.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Josh Nichols", "Yusuke Murata"] s.date = "2014-01-29" s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub" s.email = ["josh@technicalpickles.com", "info@muratayusuke.com"] s.executables = ["jeweler"] s.extra_rdoc_files = [ "ChangeLog.markdown", "LICENSE.txt", "README.markdown" ] s.files = [ ".coveralls.yml", ".document", ".travis.yml", ".yardopts", "ChangeLog.markdown", "Gemfile", "LICENSE.txt", "README.markdown", "Rakefile", "bin/jeweler", "features/generator/cucumber.feature", "features/generator/directory_layout.feature", "features/generator/dotdocument.feature", "features/generator/env_options.feature", "features/generator/gemfile.feature", "features/generator/git.feature", "features/generator/license.feature", "features/generator/rakefile.feature", "features/generator/readme.feature", "features/generator/test.feature", "features/generator/test_helper.feature", "features/placeholder.feature", "features/step_definitions/debug_steps.rb", "features/step_definitions/filesystem_steps.rb", "features/step_definitions/generator_steps.rb", "features/step_definitions/task_steps.rb", "features/support/env.rb", "features/tasks/build_gem.feature", "features/tasks/version.feature", "features/tasks/version_bumping.feature", "jeweler.gemspec", "lib/jeweler.rb", "lib/jeweler/commands.rb", "lib/jeweler/commands/build_gem.rb", "lib/jeweler/commands/check_dependencies.rb", "lib/jeweler/commands/install_gem.rb", "lib/jeweler/commands/release_gemspec.rb", "lib/jeweler/commands/release_to_git.rb", "lib/jeweler/commands/release_to_rubygems.rb", "lib/jeweler/commands/validate_gemspec.rb", "lib/jeweler/commands/version/base.rb", "lib/jeweler/commands/version/bump_major.rb", "lib/jeweler/commands/version/bump_minor.rb", "lib/jeweler/commands/version/bump_patch.rb", "lib/jeweler/commands/version/write.rb", "lib/jeweler/commands/write_gemspec.rb", "lib/jeweler/errors.rb", "lib/jeweler/gemcutter_tasks.rb", "lib/jeweler/gemspec_helper.rb", "lib/jeweler/generator.rb", "lib/jeweler/generator/application.rb", "lib/jeweler/generator/bacon_mixin.rb", "lib/jeweler/generator/github_mixin.rb", "lib/jeweler/generator/micronaut_mixin.rb", "lib/jeweler/generator/minitest_mixin.rb", "lib/jeweler/generator/options.rb", "lib/jeweler/generator/rdoc_mixin.rb", "lib/jeweler/generator/riot_mixin.rb", "lib/jeweler/generator/rspec_mixin.rb", "lib/jeweler/generator/shindo_mixin.rb", "lib/jeweler/generator/shoulda_mixin.rb", "lib/jeweler/generator/testspec_mixin.rb", "lib/jeweler/generator/testunit_mixin.rb", "lib/jeweler/generator/yard_mixin.rb", "lib/jeweler/rubyforge_tasks.rb", "lib/jeweler/rubygems_dot_org_tasks.rb", "lib/jeweler/rubygems_tasks.rb", "lib/jeweler/specification.rb", "lib/jeweler/tasks.rb", "lib/jeweler/templates/.document", "lib/jeweler/templates/.gitignore", "lib/jeweler/templates/Gemfile", "lib/jeweler/templates/LICENSE.txt", "lib/jeweler/templates/README.rdoc", "lib/jeweler/templates/Rakefile", "lib/jeweler/templates/bacon/flunking.rb", "lib/jeweler/templates/bacon/helper.rb", "lib/jeweler/templates/bundler_setup.erb", "lib/jeweler/templates/features/default.feature", "lib/jeweler/templates/features/support/env.rb", "lib/jeweler/templates/jeweler_tasks.erb", "lib/jeweler/templates/micronaut/flunking.rb", "lib/jeweler/templates/micronaut/helper.rb", "lib/jeweler/templates/minitest/flunking.rb", "lib/jeweler/templates/minitest/helper.rb", "lib/jeweler/templates/other_tasks.erb", "lib/jeweler/templates/riot/flunking.rb", "lib/jeweler/templates/riot/helper.rb", "lib/jeweler/templates/rspec/.rspec", "lib/jeweler/templates/rspec/flunking.rb", "lib/jeweler/templates/rspec/helper.rb", "lib/jeweler/templates/shindo/flunking.rb", "lib/jeweler/templates/shindo/helper.rb", "lib/jeweler/templates/shoulda/flunking.rb", "lib/jeweler/templates/shoulda/helper.rb", "lib/jeweler/templates/simplecov.erb", "lib/jeweler/templates/testspec/flunking.rb", "lib/jeweler/templates/testspec/helper.rb", "lib/jeweler/templates/testunit/flunking.rb", "lib/jeweler/templates/testunit/helper.rb", "lib/jeweler/version.rb", "lib/jeweler/version_helper.rb", "test/fixtures/bar/VERSION.yml", "test/fixtures/bar/bin/foo_the_ultimate_bin", "test/fixtures/bar/hey_include_me_in_gemspec", "test/fixtures/bar/lib/foo_the_ultimate_lib.rb", "test/fixtures/existing-project-with-version-constant/.document", "test/fixtures/existing-project-with-version-constant/.gitignore", "test/fixtures/existing-project-with-version-constant/LICENSE.txt", "test/fixtures/existing-project-with-version-constant/README.rdoc", "test/fixtures/existing-project-with-version-constant/Rakefile", "test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec", "test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb", "test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb", "test/fixtures/existing-project-with-version-constant/test/test_helper.rb", "test/fixtures/existing-project-with-version-plaintext/.document", "test/fixtures/existing-project-with-version-plaintext/.gitignore", "test/fixtures/existing-project-with-version-plaintext/LICENSE.txt", "test/fixtures/existing-project-with-version-plaintext/README.rdoc", "test/fixtures/existing-project-with-version-plaintext/Rakefile", "test/fixtures/existing-project-with-version-plaintext/VERSION", "test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec", "test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb", "test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb", "test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb", "test/fixtures/existing-project-with-version-yaml/.document", "test/fixtures/existing-project-with-version-yaml/.gitignore", "test/fixtures/existing-project-with-version-yaml/LICENSE.txt", "test/fixtures/existing-project-with-version-yaml/README.rdoc", "test/fixtures/existing-project-with-version-yaml/Rakefile", "test/fixtures/existing-project-with-version-yaml/VERSION.yml", "test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin", "test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec", "test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb", "test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb", "test/fixtures/existing-project-with-version-yaml/test/test_helper.rb", "test/geminstaller.yml", "test/jeweler/commands/test_build_gem.rb", "test/jeweler/commands/test_install_gem.rb", "test/jeweler/commands/test_release_to_gemcutter.rb", "test/jeweler/commands/test_release_to_git.rb", "test/jeweler/commands/test_release_to_github.rb", "test/jeweler/commands/test_validate_gemspec.rb", "test/jeweler/commands/test_write_gemspec.rb", "test/jeweler/commands/version/test_base.rb", "test/jeweler/commands/version/test_bump_major.rb", "test/jeweler/commands/version/test_bump_minor.rb", "test/jeweler/commands/version/test_bump_patch.rb", "test/jeweler/commands/version/test_write.rb", "test/jeweler/generator/test_application.rb", "test/jeweler/generator/test_options.rb", "test/jeweler/test_gemspec_helper.rb", "test/jeweler/test_generator.rb", "test/jeweler/test_generator_initialization.rb", "test/jeweler/test_generator_mixins.rb", "test/jeweler/test_specification.rb", "test/jeweler/test_tasks.rb", "test/jeweler/test_version_helper.rb", "test/shoulda_macros/jeweler_macros.rb", "test/test_helper.rb", "test/test_jeweler.rb" ] s.homepage = "http://github.com/technicalpickles/jeweler" s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = "2.0.3" s.summary = "Opinionated tool for creating and managing RubyGem projects" 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, [">= 0"]) s.add_runtime_dependency(%q, [">= 1.2.5"]) s.add_runtime_dependency(%q, [">= 1.5.10"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 1.6.15"]) s.add_runtime_dependency(%q, [">= 1.0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0.8.5"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 1.1.4"]) s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.2.5"]) s.add_dependency(%q, [">= 1.5.10"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.6.15"]) s.add_dependency(%q, [">= 1.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0.8.5"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.1.4"]) s.add_dependency(%q, [">= 0"]) end else s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.2.5"]) s.add_dependency(%q, [">= 1.5.10"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.6.15"]) s.add_dependency(%q, [">= 1.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0.8.5"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.1.4"]) s.add_dependency(%q, [">= 0"]) end end jeweler-2.0.1/Gemfile0000644000175000017500000000147212641037113013042 0ustar aleealeesource "http://rubygems.org" source "http://gems.github.com" gem "rake" gem "git", ">= 1.2.5" gem "nokogiri", ">= 1.5.10" gem "github_api" gem "highline", ">= 1.6.15" gem "bundler", ">= 1.0" gem "rdoc" gem "builder" group :development do gem "yard", ">= 0.8.5" gem "bluecloth" gem "cucumber", ">= 1.1.4" gem "simplecov" end group :test do gem "timecop" gem "activesupport", "~> 3.2.16" gem "shoulda" gem "mhennemeyer-output_catcher" gem "rr", ">= 1.0.4" gem "mocha" gem "redgreen" gem "test-construct" gem 'coveralls', :require => false end # yo dawg, i herd u lieked jeweler group :xzibit do # steal a page from bundler's gemspec: # add this directory as jeweler, in order to bundle exec jeweler and use the current working directory gem 'jeweler', :path => '.' end group :debug do end jeweler-2.0.1/metadata.yml0000644000175000017500000003034612641037113014054 0ustar aleealee--- !ruby/object:Gem::Specification name: jeweler version: !ruby/object:Gem::Version version: 2.0.1 platform: ruby authors: - Josh Nichols - Yusuke Murata autorequire: bindir: bin cert_chain: [] date: 2014-01-29 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: git requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.2.5 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.2.5 - !ruby/object:Gem::Dependency name: nokogiri requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.5.10 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.5.10 - !ruby/object:Gem::Dependency name: github_api requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: highline requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.6.15 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.6.15 - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '1.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '1.0' - !ruby/object:Gem::Dependency name: rdoc requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: builder requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: yard requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 0.8.5 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 0.8.5 - !ruby/object:Gem::Dependency name: bluecloth requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: cucumber requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.1.4 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: 1.1.4 - !ruby/object:Gem::Dependency name: simplecov requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' description: Simple and opinionated helper for creating Rubygem projects on GitHub email: - josh@technicalpickles.com - info@muratayusuke.com executables: - jeweler extensions: [] extra_rdoc_files: - ChangeLog.markdown - LICENSE.txt - README.markdown files: - .coveralls.yml - .document - .travis.yml - .yardopts - ChangeLog.markdown - Gemfile - LICENSE.txt - README.markdown - Rakefile - bin/jeweler - features/generator/cucumber.feature - features/generator/directory_layout.feature - features/generator/dotdocument.feature - features/generator/env_options.feature - features/generator/gemfile.feature - features/generator/git.feature - features/generator/license.feature - features/generator/rakefile.feature - features/generator/readme.feature - features/generator/test.feature - features/generator/test_helper.feature - features/placeholder.feature - features/step_definitions/debug_steps.rb - features/step_definitions/filesystem_steps.rb - features/step_definitions/generator_steps.rb - features/step_definitions/task_steps.rb - features/support/env.rb - features/tasks/build_gem.feature - features/tasks/version.feature - features/tasks/version_bumping.feature - jeweler.gemspec - lib/jeweler.rb - lib/jeweler/commands.rb - lib/jeweler/commands/build_gem.rb - lib/jeweler/commands/check_dependencies.rb - lib/jeweler/commands/install_gem.rb - lib/jeweler/commands/release_gemspec.rb - lib/jeweler/commands/release_to_git.rb - lib/jeweler/commands/release_to_rubygems.rb - lib/jeweler/commands/validate_gemspec.rb - lib/jeweler/commands/version/base.rb - lib/jeweler/commands/version/bump_major.rb - lib/jeweler/commands/version/bump_minor.rb - lib/jeweler/commands/version/bump_patch.rb - lib/jeweler/commands/version/write.rb - lib/jeweler/commands/write_gemspec.rb - lib/jeweler/errors.rb - lib/jeweler/gemcutter_tasks.rb - lib/jeweler/gemspec_helper.rb - lib/jeweler/generator.rb - lib/jeweler/generator/application.rb - lib/jeweler/generator/bacon_mixin.rb - lib/jeweler/generator/github_mixin.rb - lib/jeweler/generator/micronaut_mixin.rb - lib/jeweler/generator/minitest_mixin.rb - lib/jeweler/generator/options.rb - lib/jeweler/generator/rdoc_mixin.rb - lib/jeweler/generator/riot_mixin.rb - lib/jeweler/generator/rspec_mixin.rb - lib/jeweler/generator/shindo_mixin.rb - lib/jeweler/generator/shoulda_mixin.rb - lib/jeweler/generator/testspec_mixin.rb - lib/jeweler/generator/testunit_mixin.rb - lib/jeweler/generator/yard_mixin.rb - lib/jeweler/rubyforge_tasks.rb - lib/jeweler/rubygems_dot_org_tasks.rb - lib/jeweler/rubygems_tasks.rb - lib/jeweler/specification.rb - lib/jeweler/tasks.rb - lib/jeweler/templates/.document - lib/jeweler/templates/.gitignore - lib/jeweler/templates/Gemfile - lib/jeweler/templates/LICENSE.txt - lib/jeweler/templates/README.rdoc - lib/jeweler/templates/Rakefile - lib/jeweler/templates/bacon/flunking.rb - lib/jeweler/templates/bacon/helper.rb - lib/jeweler/templates/bundler_setup.erb - lib/jeweler/templates/features/default.feature - lib/jeweler/templates/features/support/env.rb - lib/jeweler/templates/jeweler_tasks.erb - lib/jeweler/templates/micronaut/flunking.rb - lib/jeweler/templates/micronaut/helper.rb - lib/jeweler/templates/minitest/flunking.rb - lib/jeweler/templates/minitest/helper.rb - lib/jeweler/templates/other_tasks.erb - lib/jeweler/templates/riot/flunking.rb - lib/jeweler/templates/riot/helper.rb - lib/jeweler/templates/rspec/.rspec - lib/jeweler/templates/rspec/flunking.rb - lib/jeweler/templates/rspec/helper.rb - lib/jeweler/templates/shindo/flunking.rb - lib/jeweler/templates/shindo/helper.rb - lib/jeweler/templates/shoulda/flunking.rb - lib/jeweler/templates/shoulda/helper.rb - lib/jeweler/templates/simplecov.erb - lib/jeweler/templates/testspec/flunking.rb - lib/jeweler/templates/testspec/helper.rb - lib/jeweler/templates/testunit/flunking.rb - lib/jeweler/templates/testunit/helper.rb - lib/jeweler/version.rb - lib/jeweler/version_helper.rb - test/fixtures/bar/VERSION.yml - test/fixtures/bar/bin/foo_the_ultimate_bin - test/fixtures/bar/hey_include_me_in_gemspec - test/fixtures/bar/lib/foo_the_ultimate_lib.rb - test/fixtures/existing-project-with-version-constant/.document - test/fixtures/existing-project-with-version-constant/.gitignore - test/fixtures/existing-project-with-version-constant/LICENSE.txt - test/fixtures/existing-project-with-version-constant/README.rdoc - test/fixtures/existing-project-with-version-constant/Rakefile - test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec - test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb - test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb - test/fixtures/existing-project-with-version-constant/test/test_helper.rb - test/fixtures/existing-project-with-version-plaintext/.document - test/fixtures/existing-project-with-version-plaintext/.gitignore - test/fixtures/existing-project-with-version-plaintext/LICENSE.txt - test/fixtures/existing-project-with-version-plaintext/README.rdoc - test/fixtures/existing-project-with-version-plaintext/Rakefile - test/fixtures/existing-project-with-version-plaintext/VERSION - test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec - test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb - test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb - test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb - test/fixtures/existing-project-with-version-yaml/.document - test/fixtures/existing-project-with-version-yaml/.gitignore - test/fixtures/existing-project-with-version-yaml/LICENSE.txt - test/fixtures/existing-project-with-version-yaml/README.rdoc - test/fixtures/existing-project-with-version-yaml/Rakefile - test/fixtures/existing-project-with-version-yaml/VERSION.yml - test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin - test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec - test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb - test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb - test/fixtures/existing-project-with-version-yaml/test/test_helper.rb - test/geminstaller.yml - test/jeweler/commands/test_build_gem.rb - test/jeweler/commands/test_install_gem.rb - test/jeweler/commands/test_release_to_gemcutter.rb - test/jeweler/commands/test_release_to_git.rb - test/jeweler/commands/test_release_to_github.rb - test/jeweler/commands/test_validate_gemspec.rb - test/jeweler/commands/test_write_gemspec.rb - test/jeweler/commands/version/test_base.rb - test/jeweler/commands/version/test_bump_major.rb - test/jeweler/commands/version/test_bump_minor.rb - test/jeweler/commands/version/test_bump_patch.rb - test/jeweler/commands/version/test_write.rb - test/jeweler/generator/test_application.rb - test/jeweler/generator/test_options.rb - test/jeweler/test_gemspec_helper.rb - test/jeweler/test_generator.rb - test/jeweler/test_generator_initialization.rb - test/jeweler/test_generator_mixins.rb - test/jeweler/test_specification.rb - test/jeweler/test_tasks.rb - test/jeweler/test_version_helper.rb - test/shoulda_macros/jeweler_macros.rb - test/test_helper.rb - test/test_jeweler.rb homepage: http://github.com/technicalpickles/jeweler licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.0.3 signing_key: specification_version: 4 summary: Opinionated tool for creating and managing RubyGem projects test_files: [] jeweler-2.0.1/README.markdown0000644000175000017500000002572412641037113014256 0ustar aleealee# Jeweler: Craft the perfect RubyGem Jeweler provides the noble ruby developer with two primary features: * a library for managing and releasing RubyGem projects * a scaffold generator for starting new RubyGem projects [![Build Status](https://travis-ci.org/technicalpickles/jeweler.png)](https://travis-ci.org/technicalpickles/jeweler) [![Coverage Status](https://coveralls.io/repos/technicalpickles/jeweler/badge.png)](https://coveralls.io/r/technicalpickles/jeweler) [![Dependency Status](https://www.versioneye.com/ruby/jeweler/2.0.0/badge.png)](https://www.versioneye.com/ruby/jeweler/2.0.0) ## Hello, world Use RubyGems to install the heck out of jeweler to get started: $ gem install jeweler With jeweler installed, you can use the `jeweler` command to generate a new project. For the most basic use, just give it a name: $ jeweler hello-gem This requires some Git configuration (like name, email, GitHub account, etc), but `jeweler` will prompt along the way. Your new `hello-gem` gem is ready in the `hello-gem` directory. Take a peek, and you'll see several files and directories * `Rakefile` setup for jeweler, running tests, generating documentation, and releasing to [rubygems.org](http://rubygems.org/) * `README.rdoc` with contribution guidelines and copyright info crediting you * `LICENSE` with the MIT licensed crediting you * `Gemfile` with development dependencies filled in * `lib/hello-gem.rb` waiting for you to code * `test/` containing a (failing) shoulda test suite [shoulda](http://github.com/thoughtbot/shoulda) ### More `jeweler` options The `jeweler` command supports a lot of options. Mostly, they are for generating baked in support for this test framework, or that. Check out `jeweler --help` for the most up to date options. ## Hello, rake tasks Beyond just editing source code, you'll be interacting with your gem using `rake` a lot. To see all the tasks available with a brief description, you can run: $ rake -T You'll need a version before you can start installing your gem locally. The easiest way is with the `version:write` Rake task. Let's imagine you start with 0.1.0 $ rake version:write MAJOR=0 MINOR=1 PATCH=0 You can now go forth and develop, now that there's an initial version defined. Eventually, you should install and test the gem: $ rake install The `install` rake task builds the gem and `gem install`s it. You're all set if you're using [RVM](http://rvm.beginrescueend.com/), but you may need to run it with sudo if you have a system-installed ruby: $ sudo rake install ### Releasing At last, it's time to [ship it](http://shipitsquirrel.github.com/)! Make sure you have everything committed and pushed, then go wild: $ rake release This will automatically: * Generate `hello-gem.gemspec` and commit it * Use `git` to tag `v0.1.0` and push it * Build `hello-gem-0.1.0.gem` and push it to [rubygems.org](http://rubygems.org/gems/) `rake release` accepts REMOTE(default: `origin`), LOCAL_BRANCH(default: `master`), REMOTE_BRANCH(default: `master`) and BRANCH(default: master)as options. $ rake release REMOTE=upstream LOCAL_BRANCH=critical-security-fix REMOTE_BRANCH=v3 This will tag and push the commits on your local branch named `critical-security-fix` to branch named `v3` in remote named `upstream` (if you have commit rights on `upstream`) and release the gem. $ rake release BRANCH=v3 If both remote and local branches are the same, use `BRANCH` option to simplify. This will tag and push the commits on your local branch named `v3` to branch named `v3` in remote named `origin` (if you have commit rights on `origin`) and release the gem. ### Version bumping It feels good to release code. Do it, do it often. But before that, bump the version. Then release it. There's a few ways to update the version: # version:write like before $ rake version:write MAJOR=0 MINOR=3 PATCH=0 # bump just major, ie 0.1.0 -> 1.0.0 $ rake version:bump:major # bump just minor, ie 0.1.0 -> 0.2.0 $ rake version:bump:minor # bump just patch, ie 0.1.0 -> 0.1.1 $ rake version:bump:patch Then it's the same `release` we used before: $ rake release ## Customizing your gem If you've been following along so far, your gem is just a blank slate. You're going to need to make it colorful and full of metadata. You can customize your gem by updating your `Rakefile`. With a newly generated project, it will look something like this: require 'jeweler' Jeweler::Tasks.new do |gem| # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options gem.name = "whatwhatwhat" gem.summary = %Q{TODO: one-line summary of your gem} gem.description = %Q{TODO: longer description of your gem} gem.email = "josh@technicalpickles.com" gem.homepage = "http://github.com/technicalpickles/whatwhatwhat" gem.authors = ["Joshua Nichols"] end Jeweler::RubygemsDotOrgTasks.new It's crucial to understand the `gem` object is just a Gem::Specification. You can read up about it at [docs.rubygems.org/read/chapter/20](http://docs.rubygems.org/read/chapter/20). This is the most basic way of specifying a gem, Jeweler-managed or not. Jeweler just exposes this to you, in addition to providing some reasonable defaults, which we'll explore now. ### Project information gem.name = "whatwhatwhat" Every gem has a name. Among other things, the gem name is how you are able to `gem install` it. [Reference](http://docs.rubygems.org/read/chapter/20#name) gem.summary = %Q{TODO: one-line summary of your gem} This is a one line summary of your gem. This is displayed, for example, when you use `gem list --details` or view it on [rubygems.org](http://rubygems.org/gems/). gem.description = %Q{TODO: longer description of your gem} Description is a longer description. Scholars ascertain that knowledge of where the description is used was lost centuries ago. gem.email = "josh@technicalpickles.com" This should be a way to get a hold of you regarding the gem. gem.homepage = "http://github.com/technicalpickles/whatwhatwhat" The homepage should have more information about your gem. The jeweler generator guesses this based on the assumption your code lives on [GitHub](http://github.com/), using your Git configuration to find your GitHub username. This is displayed by `gem list --details` and on rubygems.org. gem.authors = ["Joshua Nichols"] Hey, this is you, the author (or me in this case). The `jeweler` generator also guesses this from your Git configuration. This is displayed by `gem list --details` and on rubygems.org. ### Files The quickest way to add more files is to `git add` them. Jeweler uses your Git repository to populate your gem's files by including added and committed and excluding `.gitignore`d. In most cases, this is reasonable enough. If you need to tweak the files, that's cool. Jeweler populates `gem.files` as a `Rake::FileList`. It's like a normal array, except you can `include` and `exclude` file globs: gem.files.exclude 'tmp' # exclude temporary directory gem.files.include 'lib/foo/bar.rb' # explicitly include lib/foo/bar.rb If that's not enough, you can just set `gem.files` outright gem.files = Dir.glob('lib/**/*.rb') ### Dependencies Dependencies let you define other gems that your gem needs to function. `gem install your-gem` will install your-gem's dependencies along with it, and when you use your-gem in an application, the dependencies will be made available. Use `gem.add_dependency` to register them. [Reference](http://docs.rubygems.org/read/chapter/20#dependencies) gem.add_dependency 'nokogiri' This will ensure a version of `nokogiri` is installed, but it doesn't require anything more than that. You can provide extra args to be more specific: gem.add_dependency 'nokogiri', '= 1.2.1' # exactly version 1.2.1 gem.add_dependency 'nokogiri', '>= 1.2.1' # greater than or equal to 1.2.1, ie, 1.2.1, 1.2.2, 1.3.0, 2.0.0, etc gem.add_dependency 'nokogiri', '>= 1.2.1', '< 1.3.0' # greater than or equal to 1.2.1, but less than 1.3.0 gem.add_dependency 'nokogiri', '~> 1.2.1' # same thing, but more concise When specifying which version is required, there's a bit of the condunrum. You want to allow the most versions possible, but you want to be sure they are compatible. Using `>= 1.2.1` is fine most of the time, except until the point that 2.0.0 comes out and totally breaks backwards the API. That's when it's good to use `~> 1.2.1`, which requires any version in the `1.2` family, starting with `1.2.1`. ### Executables Executables let your gem install shell commands. Just put any executable scripts in the `bin/` directory, make sure they are added using `git`, and Jeweler will take care of the rest. When you need more finely grained control over it, you can set it yourself: gem.executables = ['foo'] # note, it's the file name relative to `bin/`, not the project root ### Versioning We discussed earlier how to bump the version. The rake tasks are really just convience methods for manipulating the `VERSION` file. It just contains a version string, like `1.2.3`. `VERSION` is a convention used by Jeweler, and is used to populate `gem.version`. You can actually set this yourself, and Jeweler won't try to override it: gem.version = '1.2.3' A common pattern is to have this in a version constant in your library. This is convenient, because users of the library can query the version they are using at runtime. # in lib/foo/version.rb class Foo module Version MAJOR = 1 MINOR = 2 PATCH = 3 BUILD = 'pre3' STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.') end end # in Rakefile require 'jeweler' require './lib/foo/version.rb' Jeweler::Tasks.new do |gem| # snip gem.version = Foo::Version::STRING end ### Rake tasks Jeweler lives inside of Rake. As a result, they are dear friends. But, that friendship doesn't interfere with typical Rake operations. That means you can define your own namespaces, tasks, or use third party Rake libraries without cause for concern. ## Contributing to Jeweler * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet * Ask on the [mailing list](http://groups.google.com/group/jeweler-rb) for feedback on your proposal, to see if somebody else has done it. * Check out the [issue tracker](http://github.com/technicalpickles/jeweler/issues) to make sure someone already hasn't requested it and/or contributed it * Fork the project * Start a feature/bugfix branch * Commit and push until you are happy with your contribution * Make sure to add tests for the feature/bugfix. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate it to its own commit so I can cherry-pick around it. ## Copyright Copyright (c) 2008-2010 Josh Nichols. See LICENSE for details. jeweler-2.0.1/.coveralls.yml0000644000175000017500000000010512641037113014332 0ustar aleealeeservice_name: travis-ci repo_token: AhkOkfc0MYCOqb24btF6YAac7cpKcm1Fw