jeweler 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/ChangeLog.markdown +64 -0
  2. data/LICENSE +20 -0
  3. data/README.markdown +164 -0
  4. data/Rakefile +89 -0
  5. data/TODO +11 -0
  6. data/VERSION.yml +4 -0
  7. data/bin/jeweler +8 -0
  8. data/lib/jeweler.rb +154 -0
  9. data/lib/jeweler/commands.rb +12 -0
  10. data/lib/jeweler/commands/build_gem.rb +31 -0
  11. data/lib/jeweler/commands/install_gem.rb +26 -0
  12. data/lib/jeweler/commands/release.rb +59 -0
  13. data/lib/jeweler/commands/release_to_rubyforge.rb +51 -0
  14. data/lib/jeweler/commands/setup_rubyforge.rb +38 -0
  15. data/lib/jeweler/commands/validate_gemspec.rb +30 -0
  16. data/lib/jeweler/commands/version/base.rb +41 -0
  17. data/lib/jeweler/commands/version/bump_major.rb +13 -0
  18. data/lib/jeweler/commands/version/bump_minor.rb +12 -0
  19. data/lib/jeweler/commands/version/bump_patch.rb +14 -0
  20. data/lib/jeweler/commands/version/write.rb +12 -0
  21. data/lib/jeweler/commands/write_gemspec.rb +39 -0
  22. data/lib/jeweler/errors.rb +20 -0
  23. data/lib/jeweler/gemspec_helper.rb +51 -0
  24. data/lib/jeweler/generator.rb +347 -0
  25. data/lib/jeweler/generator/application.rb +45 -0
  26. data/lib/jeweler/generator/options.rb +68 -0
  27. data/lib/jeweler/tasks.rb +119 -0
  28. data/lib/jeweler/templates/.document +5 -0
  29. data/lib/jeweler/templates/.gitignore +5 -0
  30. data/lib/jeweler/templates/LICENSE +20 -0
  31. data/lib/jeweler/templates/README.rdoc +7 -0
  32. data/lib/jeweler/templates/Rakefile +125 -0
  33. data/lib/jeweler/templates/bacon/flunking.rb +7 -0
  34. data/lib/jeweler/templates/bacon/helper.rb +8 -0
  35. data/lib/jeweler/templates/features/default.feature +9 -0
  36. data/lib/jeweler/templates/features/support/env.rb +11 -0
  37. data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
  38. data/lib/jeweler/templates/micronaut/helper.rb +17 -0
  39. data/lib/jeweler/templates/minitest/flunking.rb +7 -0
  40. data/lib/jeweler/templates/minitest/helper.rb +11 -0
  41. data/lib/jeweler/templates/rspec/flunking.rb +7 -0
  42. data/lib/jeweler/templates/rspec/helper.rb +9 -0
  43. data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
  44. data/lib/jeweler/templates/shoulda/helper.rb +10 -0
  45. data/lib/jeweler/templates/testunit/flunking.rb +7 -0
  46. data/lib/jeweler/templates/testunit/helper.rb +9 -0
  47. data/lib/jeweler/version_helper.rb +83 -0
  48. data/test/fixtures/bar/VERSION.yml +4 -0
  49. data/test/fixtures/existing-project-with-version/LICENSE +20 -0
  50. data/test/fixtures/existing-project-with-version/README.rdoc +7 -0
  51. data/test/fixtures/existing-project-with-version/Rakefile +82 -0
  52. data/test/fixtures/existing-project-with-version/VERSION.yml +4 -0
  53. data/test/fixtures/existing-project-with-version/existing-project-with-version.gemspec +29 -0
  54. data/test/fixtures/existing-project-with-version/lib/existing_project_with_version.rb +0 -0
  55. data/test/fixtures/existing-project-with-version/test/existing_project_with_version_test.rb +7 -0
  56. data/test/fixtures/existing-project-with-version/test/test_helper.rb +10 -0
  57. data/test/geminstaller.yml +12 -0
  58. data/test/generators/initialization_test.rb +146 -0
  59. data/test/jeweler/commands/test_build_gem.rb +72 -0
  60. data/test/jeweler/commands/test_install_gem.rb +21 -0
  61. data/test/jeweler/commands/test_release.rb +180 -0
  62. data/test/jeweler/commands/test_release_to_rubyforge.rb +157 -0
  63. data/test/jeweler/commands/test_setup_rubyforge.rb +88 -0
  64. data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
  65. data/test/jeweler/commands/test_write_gemspec.rb +92 -0
  66. data/test/jeweler/commands/version/test_base.rb +32 -0
  67. data/test/jeweler/commands/version/test_bump_major.rb +22 -0
  68. data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
  69. data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
  70. data/test/jeweler/commands/version/test_write.rb +23 -0
  71. data/test/shoulda_macros/jeweler_macros.rb +35 -0
  72. data/test/test_application.rb +113 -0
  73. data/test/test_gemspec_helper.rb +36 -0
  74. data/test/test_generator.rb +183 -0
  75. data/test/test_helper.rb +118 -0
  76. data/test/test_jeweler.rb +177 -0
  77. data/test/test_options.rb +96 -0
  78. data/test/test_tasks.rb +41 -0
  79. data/test/test_version_helper.rb +115 -0
  80. data/test/version_tmp/VERSION.yml +4 -0
  81. metadata +171 -0
@@ -0,0 +1,119 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ class Jeweler
5
+ class Tasks < ::Rake::TaskLib
6
+ attr_accessor :gemspec, :jeweler
7
+
8
+ def initialize(gemspec = nil, &block)
9
+ @gemspec = gemspec || Gem::Specification.new()
10
+ yield @gemspec if block_given?
11
+
12
+ @jeweler = Jeweler.new(@gemspec)
13
+
14
+ define
15
+ end
16
+
17
+ private
18
+ def define
19
+ desc "Setup initial version of 0.0.0"
20
+ file "VERSION.yml" do
21
+ @jeweler.write_version 0, 0, 0, :commit => false
22
+ $stdout.puts "Created VERSION.yml: 0.0.0"
23
+ end
24
+
25
+ desc "Build gem"
26
+ task :build do
27
+ @jeweler.build_gem
28
+ end
29
+
30
+ desc "Install gem using sudo"
31
+ task :install => :build do
32
+ @jeweler.install_gem
33
+ end
34
+
35
+ desc "Generate and validates gemspec"
36
+ task :gemspec => ['gemspec:generate', 'gemspec:validate']
37
+
38
+ namespace :gemspec do
39
+ desc "Validates the gemspec"
40
+ task :validate => 'VERSION.yml' do
41
+ @jeweler.validate_gemspec
42
+ end
43
+
44
+ desc "Generates the gemspec, using version from VERSION.yml"
45
+ task :generate => 'VERSION.yml' do
46
+ @jeweler.write_gemspec
47
+ end
48
+ end
49
+
50
+ desc "Displays the current version"
51
+ task :version => 'VERSION.yml' do
52
+ $stdout.puts "Current version: #{@jeweler.version}"
53
+ end
54
+
55
+ namespace :version do
56
+ desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH"
57
+ task :write do
58
+ major, minor, patch = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i
59
+ @jeweler.write_version(major, minor, patch, :announce => false, :commit => false)
60
+ $stdout.puts "Updated version: #{@jeweler.version}"
61
+ end
62
+
63
+ namespace :bump do
64
+ desc "Bump the gemspec by a major version."
65
+ task :major => ['VERSION.yml', :version] do
66
+ @jeweler.bump_major_version
67
+ $stdout.puts "Updated version: #{@jeweler.version}"
68
+ end
69
+
70
+ desc "Bump the gemspec by a minor version."
71
+ task :minor => ['VERSION.yml', :version] do
72
+ @jeweler.bump_minor_version
73
+ $stdout.puts "Updated version: #{@jeweler.version}"
74
+ end
75
+
76
+ desc "Bump the gemspec by a patch version."
77
+ task :patch => ['VERSION.yml', :version] do
78
+ @jeweler.bump_patch_version
79
+ $stdout.puts "Updated version: #{@jeweler.version}"
80
+ end
81
+ end
82
+ end
83
+
84
+ desc "Release the current version. Includes updating the gemspec, pushing, and tagging the release"
85
+ task :release do
86
+ @jeweler.release
87
+ end
88
+
89
+ namespace :rubyforge do
90
+ namespace :release do
91
+ desc "Release the current gem version to RubyForge."
92
+ task :gem => [:gemspec, :build] do
93
+ begin
94
+ @jeweler.release_gem_to_rubyforge
95
+ rescue NoRubyForgeProjectInGemspecError => e
96
+ abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
97
+ rescue MissingRubyForgePackageError => e
98
+ abort "Rubyforge reported that the #{e.message} package isn't setup. Run rake rubyforge:setup to do so."
99
+ rescue RubyForgeProjectNotConfiguredError => e
100
+ abort "RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
101
+ end
102
+ end
103
+ end
104
+
105
+ desc "Setup a rubyforge project for this gem"
106
+ task :setup do
107
+ begin
108
+ @jeweler.setup_rubyforge
109
+ rescue NoRubyForgeProjectInGemspecError => e
110
+ abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
111
+ rescue RubyForgeProjectNotConfiguredError => e
112
+ abort "The RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
113
+ end
114
+ end
115
+
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 <%= user_name %>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ = <%= github_repo_name %>
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) <%= Time.now.year %> <%= user_name %>. See LICENSE for details.
@@ -0,0 +1,125 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "<%= github_repo_name %>"
8
+ gem.summary = %Q{<%= summary %>}
9
+ gem.email = "<%= user_email %>"
10
+ gem.homepage = "<%= github_url %>"
11
+ gem.authors = ["<%= user_name %>"]
12
+ <% if should_setup_rubyforge %>
13
+ gem.rubyforge_project = "<%= github_repo_name %>"
14
+ <% end %>
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ rescue LoadError
18
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
19
+ end
20
+
21
+ <% case testing_framework.to_sym %>
22
+ <% when :rspec %>
23
+ require 'spec/rake/spectask'
24
+ Spec::Rake::SpecTask.new(:spec) do |spec|
25
+ spec.libs << 'lib' << 'spec'
26
+ spec.spec_files = FileList['spec/**/*_spec.rb']
27
+ end
28
+ <% when :micronaut %>
29
+ require 'micronaut/rake_task'
30
+ Micronaut::RakeTask.new(:examples) do |examples|
31
+ examples.pattern = 'examples/**/*_example.rb'
32
+ examples.ruby_opts << '-Ilib -Iexamples'
33
+ end
34
+ <% else %>
35
+ require 'rake/testtask'
36
+ Rake::TestTask.new(:<%= test_or_spec %>) do |<%= test_or_spec %>|
37
+ <%= test_or_spec %>.libs << 'lib' << '<%= test_or_spec %>'
38
+ <%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
39
+ <%= test_or_spec %>.verbose = false
40
+ end
41
+ <% end %>
42
+
43
+ <% case testing_framework.to_sym %>
44
+ <% when :rspec %>
45
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
46
+ spec.libs << 'lib' << 'spec'
47
+ spec.pattern = 'spec/**/*_spec.rb'
48
+ spec.rcov = true
49
+ end
50
+ <% when :micronaut %>
51
+ Micronaut::RakeTask.new(:rcov) do |examples|
52
+ examples.pattern = 'examples/**/*_example.rb'
53
+ examples.rcov_opts = '-Ilib -Iexamples'
54
+ examples.rcov = true
55
+ end
56
+ <% else %>
57
+ begin
58
+ require 'rcov/rcovtask'
59
+ Rcov::RcovTask.new do |<%= test_or_spec %>|
60
+ <%= test_or_spec %>.libs << '<%= test_or_spec %>'
61
+ <%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
62
+ <%= test_or_spec %>.verbose = true
63
+ end
64
+ rescue LoadError
65
+ task :rcov do
66
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
67
+ end
68
+ end
69
+ <% end %>
70
+
71
+ <% if should_use_cucumber %>
72
+ begin
73
+ require 'cucumber/rake/task'
74
+ Cucumber::Rake::Task.new(:features)
75
+ rescue LoadError
76
+ task :features do
77
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
78
+ end
79
+ end
80
+ <% end %>
81
+
82
+ task :default => :<%= default_task %>
83
+
84
+ require 'rake/rdoctask'
85
+ Rake::RDocTask.new do |rdoc|
86
+ if File.exist?('VERSION.yml')
87
+ config = YAML.load(File.read('VERSION.yml'))
88
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
89
+ else
90
+ version = ""
91
+ end
92
+
93
+ rdoc.rdoc_dir = 'rdoc'
94
+ rdoc.title = "<%= github_repo_name %> #{version}"
95
+ rdoc.rdoc_files.include('README*')
96
+ rdoc.rdoc_files.include('lib/**/*.rb')
97
+ end
98
+
99
+ <% if should_setup_rubyforge %>
100
+ begin
101
+ require 'rake/contrib/sshpublisher'
102
+ namespace :rubyforge do
103
+
104
+ desc "Release gem and RDoc documentation to RubyForge"
105
+ task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
106
+
107
+ namespace :release do
108
+ desc "Publish RDoc to RubyForge."
109
+ task :docs => [:rdoc] do
110
+ config = YAML.load(
111
+ File.read(File.expand_path('~/.rubyforge/user-config.yml'))
112
+ )
113
+
114
+ host = "#{config['username']}@rubyforge.org"
115
+ remote_dir = "/var/www/gforge-projects/<%= github_repo_name %>/"
116
+ local_dir = 'rdoc'
117
+
118
+ Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
119
+ end
120
+ end
121
+ end
122
+ rescue LoadError
123
+ puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
124
+ end
125
+ <% end %>
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe "<%= constant_name %>" do
4
+ it "fails" do
5
+ should.flunk "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bacon'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require '<%= file_name_prefix %>'
7
+
8
+ Bacon.summary_on_exit
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require '<%= file_name_prefix %>'
3
+
4
+ require '<%= feature_support_require %>'
5
+
6
+ World do |world|
7
+ <% if feature_support_extend %>
8
+ world.extend(<%= feature_support_extend %>)
9
+ <% end %>
10
+ world
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'example_helper'
2
+
3
+ describe "<%= constant_name %>" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'micronaut'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+
7
+ require '<%= file_name_prefix %>'
8
+
9
+ def not_in_editor?
10
+ !(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
11
+ end
12
+
13
+ Micronaut.configure do |c|
14
+ c.color_enabled = not_in_editor?
15
+ c.filter_run :focused => true
16
+ end
17
+
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= constant_name %>Test < Mini::Test::TestCase
4
+ def test_something_for_real
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'mini/test'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require '<%= file_name_prefix %>'
7
+
8
+ class Mini::Test::TestCase
9
+ end
10
+
11
+ Mini::Test.autorun
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe "<%= constant_name %>" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require '<%= file_name_prefix %>'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= constant_name %>Test < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require '<%= file_name_prefix %>'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= constant_name %>Test < Test::Unit::TestCase
4
+ def test_something_for_real
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require '<%= file_name_prefix %>'
7
+
8
+ class Test::Unit::TestCase
9
+ end