jeweler 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.markdown +28 -40
- data/Rakefile +25 -31
- data/VERSION.yml +3 -2
- data/bin/jeweler +1 -4
- data/features/generator/cucumber.feature +3 -3
- data/features/generator/directory_layout.feature +6 -6
- data/features/generator/git.feature +6 -6
- data/features/generator/rakefile.feature +17 -17
- data/features/generator/test.feature +10 -3
- data/features/generator/test_helper.feature +16 -9
- data/features/step_definitions/filesystem_steps.rb +2 -2
- data/features/step_definitions/generator_steps.rb +11 -4
- data/features/support/env.rb +1 -1
- data/features/tasks/version.feature +7 -0
- data/features/tasks/version_bumping.feature +16 -0
- data/jeweler.gemspec +60 -34
- data/lib/jeweler.rb +49 -27
- data/lib/jeweler/commands.rb +22 -14
- data/lib/jeweler/commands/build_gem.rb +6 -1
- data/lib/jeweler/commands/install_gem.rb +1 -1
- data/lib/jeweler/commands/release_to_git.rb +57 -0
- data/lib/jeweler/commands/{release.rb → release_to_github.rb} +2 -22
- data/lib/jeweler/commands/release_to_rubyforge.rb +4 -3
- data/lib/jeweler/commands/setup_rubyforge.rb +7 -1
- data/lib/jeweler/commands/version/write.rb +2 -2
- data/lib/jeweler/commands/write_gemspec.rb +5 -3
- data/lib/jeweler/gemcutter_tasks.rb +2 -1
- data/lib/jeweler/gemspec_helper.rb +27 -14
- data/lib/jeweler/generator.rb +60 -82
- data/lib/jeweler/generator/application.rb +5 -7
- data/lib/jeweler/generator/bacon_mixin.rb +1 -1
- data/lib/jeweler/generator/github_mixin.rb +29 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +1 -1
- data/lib/jeweler/generator/minitest_mixin.rb +6 -6
- data/lib/jeweler/generator/options.rb +67 -11
- data/lib/jeweler/generator/riot_mixin.rb +42 -0
- data/lib/jeweler/generator/rspec_mixin.rb +1 -1
- data/lib/jeweler/generator/shoulda_mixin.rb +4 -4
- data/lib/jeweler/generator/testspec_mixin.rb +42 -0
- data/lib/jeweler/generator/testunit_mixin.rb +3 -3
- data/lib/jeweler/generator/yard_mixin.rb +1 -1
- data/lib/jeweler/rubyforge_tasks.rb +42 -24
- data/lib/jeweler/specification.rb +11 -5
- data/lib/jeweler/tasks.rb +78 -41
- data/lib/jeweler/templates/.gitignore +17 -1
- data/lib/jeweler/templates/Rakefile +4 -8
- data/lib/jeweler/templates/minitest/flunking.rb +2 -2
- data/lib/jeweler/templates/minitest/helper.rb +3 -3
- data/lib/jeweler/templates/riot/flunking.rb +11 -0
- data/lib/jeweler/templates/riot/helper.rb +3 -0
- data/lib/jeweler/templates/rspec/spec.opts +1 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +2 -2
- data/lib/jeweler/templates/testspec/flunking.rb +7 -0
- data/lib/jeweler/templates/testspec/helper.rb +7 -0
- data/lib/jeweler/templates/testunit/flunking.rb +2 -2
- data/lib/jeweler/version_helper.rb +14 -5
- data/test/fixtures/existing-project-with-version-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +83 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/test/jeweler/commands/test_build_gem.rb +54 -23
- data/test/jeweler/commands/test_install_gem.rb +4 -4
- data/test/jeweler/commands/test_release_to_git.rb +201 -0
- data/test/jeweler/commands/{test_release.rb → test_release_to_github.rb} +10 -49
- data/test/jeweler/commands/test_release_to_rubyforge.rb +0 -4
- data/test/jeweler/commands/test_setup_rubyforge.rb +0 -4
- data/test/jeweler/commands/test_write_gemspec.rb +11 -2
- data/test/jeweler/commands/version/test_write.rb +1 -2
- data/test/{test_application.rb → jeweler/generator/test_application.rb} +23 -50
- data/test/{test_options.rb → jeweler/generator/test_options.rb} +72 -8
- data/test/{test_gemspec_helper.rb → jeweler/test_gemspec_helper.rb} +5 -1
- data/test/{test_generator.rb → jeweler/test_generator.rb} +32 -76
- data/test/{test_generator_initialization.rb → jeweler/test_generator_initialization.rb} +43 -35
- data/test/{test_generator_mixins.rb → jeweler/test_generator_mixins.rb} +8 -3
- data/test/{test_specification.rb → jeweler/test_specification.rb} +0 -0
- data/test/jeweler/test_tasks.rb +50 -0
- data/test/{test_version_helper.rb → jeweler/test_version_helper.rb} +66 -5
- data/test/test_helper.rb +20 -2
- data/test/test_jeweler.rb +21 -8
- metadata +58 -26
- data/ROADMAP +0 -12
- data/test/test_tasks.rb +0 -35
@@ -3,6 +3,11 @@ require 'rubygems/specification'
|
|
3
3
|
class Jeweler
|
4
4
|
# Extend a Gem::Specification instance with this module to give it Jeweler
|
5
5
|
# super-cow powers.
|
6
|
+
#
|
7
|
+
# [files] a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely
|
8
|
+
# [test_files] Similar to gem.files, except it's only things under the spec, test, or examples directory.
|
9
|
+
# [extra_rdoc_files] a Rake::FileList including files like README*, ChangeLog*, and LICENSE*
|
10
|
+
# [executables] uses anything found in the bin/ directory. You can override this.
|
6
11
|
module Specification
|
7
12
|
|
8
13
|
def self.filelist_attribute(name)
|
@@ -22,13 +27,14 @@ class Jeweler
|
|
22
27
|
filelist_attribute :test_files
|
23
28
|
filelist_attribute :extra_rdoc_files
|
24
29
|
|
25
|
-
|
26
30
|
# Assigns the Jeweler defaults to the Gem::Specification
|
27
|
-
def set_jeweler_defaults(base_dir)
|
31
|
+
def set_jeweler_defaults(base_dir, git_base_dir = nil)
|
28
32
|
Dir.chdir(base_dir) do
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
require 'git'
|
34
|
+
if blank?(files) && git_base_dir
|
35
|
+
git_subdir = File.expand_path(base_dir).sub(File.join(File.expand_path(git_base_dir), ""), "")
|
36
|
+
repo = Git.open(git_base_dir)
|
37
|
+
self.files = (repo.ls_files.keys - repo.lib.ignored_files).map {|fn| fn.sub(File.join(git_subdir, ""), "")}
|
32
38
|
end
|
33
39
|
|
34
40
|
if blank?(test_files) && File.directory?(File.join(base_dir, '.git'))
|
data/lib/jeweler/tasks.rb
CHANGED
@@ -2,7 +2,14 @@ require 'rake'
|
|
2
2
|
require 'rake/tasklib'
|
3
3
|
|
4
4
|
class Rake::Application
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :jeweler_tasks
|
6
|
+
|
7
|
+
# The jeweler instance that has be instantiated in the current Rakefile.
|
8
|
+
#
|
9
|
+
# This is usually useful if you want to get at info like version from other files.
|
10
|
+
def jeweler
|
11
|
+
jeweler_tasks.jeweler
|
12
|
+
end
|
6
13
|
end
|
7
14
|
|
8
15
|
class Jeweler
|
@@ -19,31 +26,43 @@ class Jeweler
|
|
19
26
|
# gem.authors = ["Josh Nichols"]
|
20
27
|
# end
|
21
28
|
#
|
22
|
-
# 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
|
23
|
-
#
|
24
|
-
# Jeweler fills in a few reasonable defaults for you:
|
25
|
-
#
|
26
|
-
# [gem.files] a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely
|
27
|
-
# [gem.test_files] Similar to gem.files, except it's only things under the spec, test, or examples directory.
|
28
|
-
# [gem.extra_rdoc_files] a Rake::FileList including files like README*, ChangeLog*, and LICENSE*
|
29
|
-
# [gem.executables] uses anything found in the bin/ directory. You can override this.
|
30
|
-
#
|
29
|
+
# 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 has a defaults set for you. See Jeweler::Specification for more details.
|
31
30
|
class Tasks < ::Rake::TaskLib
|
32
|
-
attr_accessor :gemspec, :jeweler
|
31
|
+
attr_accessor :gemspec, :jeweler, :gemspec_building_block
|
33
32
|
|
34
|
-
def initialize(gemspec = nil, &
|
33
|
+
def initialize(gemspec = nil, &gemspec_building_block)
|
35
34
|
@gemspec = gemspec || Gem::Specification.new
|
36
|
-
|
37
|
-
yield @gemspec if block_given?
|
35
|
+
self.gemspec_building_block = gemspec_building_block
|
38
36
|
|
39
|
-
Rake.application.
|
37
|
+
Rake.application.jeweler_tasks = self
|
40
38
|
define
|
41
39
|
end
|
42
40
|
|
41
|
+
def jeweler
|
42
|
+
if @jeweler.nil?
|
43
|
+
@jeweler = Jeweler.new(gemspec)
|
44
|
+
gemspec_building_block.call gemspec if gemspec_building_block
|
45
|
+
end
|
46
|
+
@jeweler
|
47
|
+
end
|
48
|
+
|
43
49
|
private
|
50
|
+
|
51
|
+
def yield_gemspec_set_version?
|
52
|
+
yielded_gemspec = @gemspec.dup
|
53
|
+
yielded_gemspec.extend(Jeweler::Specification)
|
54
|
+
yielded_gemspec.files = FileList[]
|
55
|
+
yielded_gemspec.test_files = FileList[]
|
56
|
+
yielded_gemspec.extra_rdoc_files = FileList[]
|
57
|
+
|
58
|
+
gemspec_building_block.call(yielded_gemspec) if gemspec_building_block
|
59
|
+
|
60
|
+
! yielded_gemspec.version.nil?
|
61
|
+
end
|
62
|
+
|
44
63
|
def define
|
45
64
|
task :version_required do
|
46
|
-
|
65
|
+
if jeweler.expects_version_file? && !jeweler.version_file_exists?
|
47
66
|
abort "Expected VERSION or VERSION.yml to exist. See version:write to create an initial one."
|
48
67
|
end
|
49
68
|
end
|
@@ -54,7 +73,7 @@ class Jeweler
|
|
54
73
|
end
|
55
74
|
|
56
75
|
desc "Install gem using sudo"
|
57
|
-
task :install => :build do
|
76
|
+
task :install => ['check_dependencies:runtime', :build] do
|
58
77
|
jeweler.install_gem
|
59
78
|
end
|
60
79
|
|
@@ -71,6 +90,11 @@ class Jeweler
|
|
71
90
|
task :generate => :version_required do
|
72
91
|
jeweler.write_gemspec
|
73
92
|
end
|
93
|
+
|
94
|
+
desc "Display the gemspec for debugging purposes"
|
95
|
+
task :debug do
|
96
|
+
puts jeweler.gemspec_helper.to_ruby
|
97
|
+
end
|
74
98
|
end
|
75
99
|
|
76
100
|
desc "Displays the current version"
|
@@ -78,40 +102,53 @@ class Jeweler
|
|
78
102
|
$stdout.puts "Current version: #{jeweler.version}"
|
79
103
|
end
|
80
104
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
namespace :bump do
|
90
|
-
desc "Bump the gemspec by a major version."
|
91
|
-
task :major => [:version_required, :version] do
|
92
|
-
jeweler.bump_major_version
|
105
|
+
unless yield_gemspec_set_version?
|
106
|
+
namespace :version do
|
107
|
+
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"
|
108
|
+
task :write do
|
109
|
+
major, minor, patch, build = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i, (ENV['BUILD'] || nil )
|
110
|
+
jeweler.write_version(major, minor, patch, build, :announce => false, :commit => false)
|
93
111
|
$stdout.puts "Updated version: #{jeweler.version}"
|
94
112
|
end
|
95
113
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
114
|
+
namespace :bump do
|
115
|
+
desc "Bump the gemspec by a major version."
|
116
|
+
task :major => [:version_required, :version] do
|
117
|
+
jeweler.bump_major_version
|
118
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
119
|
+
end
|
120
|
+
|
121
|
+
desc "Bump the gemspec by a minor version."
|
122
|
+
task :minor => [:version_required, :version] do
|
123
|
+
jeweler.bump_minor_version
|
124
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
125
|
+
end
|
126
|
+
|
127
|
+
desc "Bump the gemspec by a patch version."
|
128
|
+
task :patch => [:version_required, :version] do
|
129
|
+
jeweler.bump_patch_version
|
130
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
131
|
+
end
|
100
132
|
end
|
133
|
+
end
|
134
|
+
end
|
101
135
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
$stdout.puts "Updated version: #{jeweler.version}"
|
106
|
-
end
|
136
|
+
namespace :github do
|
137
|
+
task :release do
|
138
|
+
jeweler.release_gem_to_github
|
107
139
|
end
|
108
140
|
end
|
109
141
|
|
110
|
-
|
111
|
-
|
112
|
-
|
142
|
+
task :release => 'github:release'
|
143
|
+
|
144
|
+
namespace :git do
|
145
|
+
task :release do
|
146
|
+
jeweler.release_to_git
|
147
|
+
end
|
113
148
|
end
|
114
149
|
|
150
|
+
task :release => 'git:release'
|
151
|
+
|
115
152
|
desc "Check that runtime and development dependencies are installed"
|
116
153
|
task :check_dependencies do
|
117
154
|
jeweler.check_dependencies
|
@@ -8,13 +8,13 @@ begin
|
|
8
8
|
gem.summary = %Q{<%= summary %>}
|
9
9
|
gem.description = %Q{<%= description %>}
|
10
10
|
gem.email = "<%= user_email %>"
|
11
|
-
gem.homepage = "<%=
|
11
|
+
gem.homepage = "<%= homepage %>"
|
12
12
|
gem.authors = ["<%= user_name %>"]
|
13
13
|
<% if should_setup_rubyforge %>
|
14
14
|
gem.rubyforge_project = "<%= project_name %>"
|
15
15
|
<% end %>
|
16
|
-
<% development_dependencies.each do |
|
17
|
-
gem.add_development_dependency "<%=
|
16
|
+
<% development_dependencies.each do |name, version| %>
|
17
|
+
gem.add_development_dependency "<%= name %>", "<%= version %>"
|
18
18
|
<% end %>
|
19
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
20
|
end
|
@@ -130,11 +130,7 @@ task :default => :<%= default_task %>
|
|
130
130
|
<% when :rdoc %>
|
131
131
|
require 'rake/rdoctask'
|
132
132
|
Rake::RDocTask.new do |rdoc|
|
133
|
-
|
134
|
-
version = File.read('VERSION')
|
135
|
-
else
|
136
|
-
version = ""
|
137
|
-
end
|
133
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
138
134
|
|
139
135
|
rdoc.rdoc_dir = 'rdoc'
|
140
136
|
rdoc.title = "<%= project_name %> #{version}"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
|
-
class <%= constant_name %>
|
3
|
+
class Test<%= constant_name %> < MiniTest::Unit::TestCase
|
4
4
|
def test_something_for_real
|
5
5
|
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
6
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'minitest/unit'
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
require '<%= require_name %>'
|
7
7
|
|
8
|
-
class
|
8
|
+
class MiniTest::Unit::TestCase
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
MiniTest::Unit.autorun
|
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
|
-
class <%= constant_name %>
|
3
|
+
class Test<%= constant_name %> < Test::Unit::TestCase
|
4
4
|
should "probably rename this file and start testing for real" do
|
5
5
|
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
|
-
class <%= constant_name %>
|
3
|
+
class Test<%= constant_name %> < Test::Unit::TestCase
|
4
4
|
def test_something_for_real
|
5
5
|
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
6
|
end
|
@@ -3,7 +3,7 @@ require 'yaml'
|
|
3
3
|
class Jeweler
|
4
4
|
class VersionHelper
|
5
5
|
attr_accessor :base_dir
|
6
|
-
attr_reader :major, :minor, :patch
|
6
|
+
attr_reader :major, :minor, :patch, :build
|
7
7
|
|
8
8
|
module YamlExtension
|
9
9
|
def write
|
@@ -16,7 +16,8 @@ class Jeweler
|
|
16
16
|
{
|
17
17
|
:major => major,
|
18
18
|
:minor => minor,
|
19
|
-
:patch => patch
|
19
|
+
:patch => patch,
|
20
|
+
:build => build
|
20
21
|
}
|
21
22
|
end
|
22
23
|
|
@@ -29,6 +30,7 @@ class Jeweler
|
|
29
30
|
@major = (yaml['major'] || yaml[:major]).to_i
|
30
31
|
@minor = (yaml['minor'] || yaml[:minor]).to_i
|
31
32
|
@patch = (yaml['patch'] || yaml[:patch]).to_i
|
33
|
+
@build = (yaml['build'] || yaml[:build])
|
32
34
|
end
|
33
35
|
|
34
36
|
def read_yaml
|
@@ -53,10 +55,13 @@ class Jeweler
|
|
53
55
|
|
54
56
|
def parse_plaintext
|
55
57
|
plaintext = read_plaintext.chomp
|
56
|
-
|
58
|
+
# http://rubular.com/regexes/10467 -> 3.5.4.a1
|
59
|
+
# http://rubular.com/regexes/10468 -> 3.5.4
|
60
|
+
if plaintext =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
|
57
61
|
@major = $1.to_i
|
58
62
|
@minor = $2.to_i
|
59
63
|
@patch = $3.to_i
|
64
|
+
@build = $4
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
@@ -91,25 +96,29 @@ class Jeweler
|
|
91
96
|
@major += 1
|
92
97
|
@minor = 0
|
93
98
|
@patch = 0
|
99
|
+
@build = nil
|
94
100
|
end
|
95
101
|
|
96
102
|
def bump_minor
|
97
103
|
@minor += 1
|
98
104
|
@patch = 0
|
105
|
+
@build = nil
|
99
106
|
end
|
100
107
|
|
101
108
|
def bump_patch
|
102
109
|
@patch += 1
|
110
|
+
@build = nil
|
103
111
|
end
|
104
112
|
|
105
|
-
def update_to(major, minor, patch)
|
113
|
+
def update_to(major, minor, patch, build=nil)
|
106
114
|
@major = major
|
107
115
|
@minor = minor
|
108
116
|
@patch = patch
|
117
|
+
@build = build
|
109
118
|
end
|
110
119
|
|
111
120
|
def to_s
|
112
|
-
|
121
|
+
[major, minor, patch, build].compact.join('.')
|
113
122
|
end
|
114
123
|
|
115
124
|
def yaml_path
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Josh Nichols
|
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.
|