technicalpickles-jeweler 0.11.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/ChangeLog.markdown +8 -0
- data/README.markdown +9 -9
- data/ROADMAP +12 -0
- data/Rakefile +22 -5
- data/VERSION.yml +2 -2
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +110 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +65 -0
- data/features/step_definitions/generator_steps.rb +251 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +19 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +204 -0
- data/lib/jeweler/commands/release.rb +35 -11
- data/lib/jeweler/commands/version/base.rb +1 -1
- data/lib/jeweler/gemspec_helper.rb +4 -6
- data/lib/jeweler/generator/application.rb +8 -3
- data/lib/jeweler/generator/bacon_mixin.rb +39 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +38 -0
- data/lib/jeweler/generator/minitest_mixin.rb +39 -0
- data/lib/jeweler/generator/options.rb +5 -1
- data/lib/jeweler/generator/rspec_mixin.rb +39 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +39 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator.rb +48 -111
- data/lib/jeweler/rubyforge_tasks.rb +46 -0
- data/lib/jeweler/specification.rb +3 -2
- data/lib/jeweler/tasks.rb +32 -26
- data/lib/jeweler/templates/README.rdoc +1 -1
- data/lib/jeweler/templates/Rakefile +29 -52
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +4 -7
- data/lib/jeweler/templates/micronaut/helper.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -1
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +1 -1
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/lib/jeweler/version_helper.rb +78 -33
- data/lib/jeweler.rb +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/LICENSE +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/README.rdoc +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/Rakefile +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/existing-project-with-version.gemspec +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/existing_project_with_version_test.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/test_helper.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-yaml}/VERSION.yml +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/jeweler/commands/test_release.rb +304 -79
- data/test/test_application.rb +26 -0
- data/test/test_gemspec_helper.rb +4 -0
- data/test/test_generator.rb +83 -112
- data/test/test_generator_initialization.rb +113 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +3 -0
- data/test/test_options.rb +6 -0
- data/test/test_specification.rb +6 -2
- data/test/test_version_helper.rb +47 -9
- metadata +72 -17
- data/test/generators/initialization_test.rb +0 -146
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'rake/contrib/sshpublisher'
|
4
|
+
|
5
|
+
|
6
|
+
class Jeweler
|
7
|
+
class RubyforgeTasks < ::Rake::TaskLib
|
8
|
+
attr_accessor :project, :remote_doc_path
|
9
|
+
attr_accessor :jeweler
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
yield self if block_given?
|
13
|
+
|
14
|
+
self.jeweler = Rake.application.jeweler
|
15
|
+
|
16
|
+
self.remote_doc_path ||= jeweler.gemspec.name
|
17
|
+
self.project ||= jeweler.gemspec.rubyforge_project
|
18
|
+
|
19
|
+
define
|
20
|
+
end
|
21
|
+
|
22
|
+
def define
|
23
|
+
namespace :rubyforge do
|
24
|
+
|
25
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
26
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
27
|
+
|
28
|
+
namespace :release do
|
29
|
+
desc "Publish RDoc to RubyForge."
|
30
|
+
task :docs => [:rdoc] do
|
31
|
+
config = YAML.load(
|
32
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
33
|
+
)
|
34
|
+
|
35
|
+
host = "#{config['username']}@rubyforge.org"
|
36
|
+
remote_dir = "/var/www/gforge-projects/#{project}/#{remote_doc_path}"
|
37
|
+
local_dir = 'rdoc'
|
38
|
+
|
39
|
+
sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -26,8 +26,9 @@ class Jeweler
|
|
26
26
|
# Assigns the Jeweler defaults to the Gem::Specification
|
27
27
|
def set_jeweler_defaults(base_dir)
|
28
28
|
Dir.chdir(base_dir) do
|
29
|
-
if blank?(files)
|
30
|
-
|
29
|
+
if blank?(files) && File.directory?(File.join(base_dir, '.git'))
|
30
|
+
repo = Git.open(base_dir)
|
31
|
+
self.files = repo.ls_files.keys
|
31
32
|
end
|
32
33
|
|
33
34
|
if blank?(test_files)
|
data/lib/jeweler/tasks.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/tasklib'
|
3
3
|
|
4
|
+
class Rake::Application
|
5
|
+
attr_accessor :jeweler
|
6
|
+
end
|
7
|
+
|
4
8
|
class Jeweler
|
5
9
|
class Tasks < ::Rake::TaskLib
|
6
10
|
attr_accessor :gemspec, :jeweler
|
@@ -10,25 +14,27 @@ class Jeweler
|
|
10
14
|
@jeweler = Jeweler.new(@gemspec)
|
11
15
|
yield @gemspec if block_given?
|
12
16
|
|
17
|
+
Rake.application.jeweler = @jeweler
|
13
18
|
define
|
14
19
|
end
|
15
20
|
|
16
21
|
private
|
17
22
|
def define
|
18
23
|
desc "Setup initial version of 0.0.0"
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
task :version_required do
|
25
|
+
unless jeweler.version_exists?
|
26
|
+
abort "Expected VERSION or VERSION.yml to exist. See version:write to create an initial one."
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
30
|
desc "Build gem"
|
25
31
|
task :build do
|
26
|
-
|
32
|
+
jeweler.build_gem
|
27
33
|
end
|
28
34
|
|
29
35
|
desc "Install gem using sudo"
|
30
36
|
task :install => :build do
|
31
|
-
|
37
|
+
jeweler.install_gem
|
32
38
|
end
|
33
39
|
|
34
40
|
desc "Generate and validates gemspec"
|
@@ -36,53 +42,53 @@ class Jeweler
|
|
36
42
|
|
37
43
|
namespace :gemspec do
|
38
44
|
desc "Validates the gemspec"
|
39
|
-
task :validate =>
|
40
|
-
|
45
|
+
task :validate => :version_required do
|
46
|
+
jeweler.validate_gemspec
|
41
47
|
end
|
42
48
|
|
43
|
-
desc "Generates the gemspec, using version from VERSION
|
44
|
-
task :generate =>
|
45
|
-
|
49
|
+
desc "Generates the gemspec, using version from VERSION"
|
50
|
+
task :generate => :version_required do
|
51
|
+
jeweler.write_gemspec
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
49
55
|
desc "Displays the current version"
|
50
|
-
task :version =>
|
51
|
-
$stdout.puts "Current version: #{
|
56
|
+
task :version => :version_required do
|
57
|
+
$stdout.puts "Current version: #{jeweler.version}"
|
52
58
|
end
|
53
59
|
|
54
60
|
namespace :version do
|
55
61
|
desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH"
|
56
62
|
task :write do
|
57
63
|
major, minor, patch = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i
|
58
|
-
|
59
|
-
$stdout.puts "Updated version: #{
|
64
|
+
jeweler.write_version(major, minor, patch, :announce => false, :commit => false)
|
65
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
60
66
|
end
|
61
67
|
|
62
68
|
namespace :bump do
|
63
69
|
desc "Bump the gemspec by a major version."
|
64
|
-
task :major => [
|
65
|
-
|
66
|
-
$stdout.puts "Updated version: #{
|
70
|
+
task :major => [:version_required, :version] do
|
71
|
+
jeweler.bump_major_version
|
72
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
67
73
|
end
|
68
74
|
|
69
75
|
desc "Bump the gemspec by a minor version."
|
70
|
-
task :minor => [
|
71
|
-
|
72
|
-
$stdout.puts "Updated version: #{
|
76
|
+
task :minor => [:version_required, :version] do
|
77
|
+
jeweler.bump_minor_version
|
78
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
73
79
|
end
|
74
80
|
|
75
81
|
desc "Bump the gemspec by a patch version."
|
76
|
-
task :patch => [
|
77
|
-
|
78
|
-
$stdout.puts "Updated version: #{
|
82
|
+
task :patch => [:version_required, :version] do
|
83
|
+
jeweler.bump_patch_version
|
84
|
+
$stdout.puts "Updated version: #{jeweler.version}"
|
79
85
|
end
|
80
86
|
end
|
81
87
|
end
|
82
88
|
|
83
89
|
desc "Release the current version. Includes updating the gemspec, pushing, and tagging the release"
|
84
90
|
task :release do
|
85
|
-
|
91
|
+
jeweler.release
|
86
92
|
end
|
87
93
|
|
88
94
|
namespace :rubyforge do
|
@@ -90,7 +96,7 @@ class Jeweler
|
|
90
96
|
desc "Release the current gem version to RubyForge."
|
91
97
|
task :gem => [:gemspec, :build] do
|
92
98
|
begin
|
93
|
-
|
99
|
+
jeweler.release_gem_to_rubyforge
|
94
100
|
rescue NoRubyForgeProjectInGemspecError => e
|
95
101
|
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
96
102
|
rescue MissingRubyForgePackageError => e
|
@@ -104,7 +110,7 @@ class Jeweler
|
|
104
110
|
desc "Setup a rubyforge project for this gem"
|
105
111
|
task :setup do
|
106
112
|
begin
|
107
|
-
|
113
|
+
jeweler.setup_rubyforge
|
108
114
|
rescue NoRubyForgeProjectInGemspecError => e
|
109
115
|
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
110
116
|
rescue RubyForgeProjectNotConfiguredError => e
|
@@ -4,62 +4,66 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "<%=
|
7
|
+
gem.name = "<%= project_name %>"
|
8
8
|
gem.summary = %Q{<%= summary %>}
|
9
9
|
gem.email = "<%= user_email %>"
|
10
|
-
gem.homepage = "<%=
|
10
|
+
gem.homepage = "<%= project_homepage %>"
|
11
11
|
gem.authors = ["<%= user_name %>"]
|
12
12
|
<% if should_setup_rubyforge %>
|
13
|
-
gem.rubyforge_project = "<%=
|
14
|
-
|
13
|
+
gem.rubyforge_project = "<%= project_name %>"
|
14
|
+
<% end %>
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
|
+
|
18
|
+
<% if should_setup_rubyforge %>
|
19
|
+
Jeweler::RubyforgeTasks.new
|
20
|
+
<% end %>
|
17
21
|
rescue LoadError
|
18
|
-
puts "Jeweler not available. Install it with: sudo gem install
|
22
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
23
|
end
|
20
24
|
|
21
|
-
<% case testing_framework
|
25
|
+
<% case testing_framework %>
|
22
26
|
<% when :rspec %>
|
23
27
|
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(
|
25
|
-
|
26
|
-
|
28
|
+
Spec::Rake::SpecTask.new(:<%= test_task %>) do |<%= test_task %>|
|
29
|
+
<%= test_task %>.libs << 'lib' << '<%= test_dir %>'
|
30
|
+
<%= test_task %>.spec_files = FileList['<%= test_pattern %>']
|
27
31
|
end
|
28
32
|
<% when :micronaut %>
|
29
33
|
require 'micronaut/rake_task'
|
30
|
-
Micronaut::RakeTask.new(
|
31
|
-
|
32
|
-
|
34
|
+
Micronaut::RakeTask.new(<%= test_task %>) do |<%= test_task %>|
|
35
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
36
|
+
<%= test_task %>.ruby_opts << '-Ilib -I<%= test_dir %>'
|
33
37
|
end
|
34
38
|
<% else %>
|
35
39
|
require 'rake/testtask'
|
36
|
-
Rake::TestTask.new(:<%=
|
37
|
-
<%=
|
38
|
-
<%=
|
39
|
-
<%=
|
40
|
+
Rake::TestTask.new(:<%= test_task %>) do |<%= test_task %>|
|
41
|
+
<%= test_task %>.libs << 'lib' << '<%= test_dir %>'
|
42
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
43
|
+
<%= test_task %>.verbose = true
|
40
44
|
end
|
41
45
|
<% end %>
|
42
46
|
|
43
|
-
<% case testing_framework
|
47
|
+
<% case testing_framework %>
|
44
48
|
<% when :rspec %>
|
45
49
|
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
46
50
|
spec.libs << 'lib' << 'spec'
|
47
|
-
spec.pattern = '
|
51
|
+
spec.pattern = '<%= test_pattern %>'
|
48
52
|
spec.rcov = true
|
49
53
|
end
|
50
54
|
<% when :micronaut %>
|
51
55
|
Micronaut::RakeTask.new(:rcov) do |examples|
|
52
|
-
examples.pattern = '
|
53
|
-
examples.rcov_opts = '-Ilib -
|
56
|
+
examples.pattern = '<%= test_pattern %>'
|
57
|
+
examples.rcov_opts = '-Ilib -I<%= test_dir %>'
|
54
58
|
examples.rcov = true
|
55
59
|
end
|
56
60
|
<% else %>
|
57
61
|
begin
|
58
62
|
require 'rcov/rcovtask'
|
59
|
-
Rcov::RcovTask.new do |<%=
|
60
|
-
<%=
|
61
|
-
<%=
|
62
|
-
<%=
|
63
|
+
Rcov::RcovTask.new do |<%= test_task %>|
|
64
|
+
<%= test_task %>.libs << '<%= test_dir %>'
|
65
|
+
<%= test_task %>.pattern = '<%= test_pattern %>'
|
66
|
+
<%= test_task %>.verbose = true
|
63
67
|
end
|
64
68
|
rescue LoadError
|
65
69
|
task :rcov do
|
@@ -91,35 +95,8 @@ Rake::RDocTask.new do |rdoc|
|
|
91
95
|
end
|
92
96
|
|
93
97
|
rdoc.rdoc_dir = 'rdoc'
|
94
|
-
rdoc.title = "<%=
|
98
|
+
rdoc.title = "<%= project_name %> #{version}"
|
95
99
|
rdoc.rdoc_files.include('README*')
|
96
100
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
97
101
|
end
|
98
102
|
|
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 %>
|
@@ -1,11 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
-
require '<%=
|
2
|
+
require '<%= require_name %>'
|
3
3
|
|
4
4
|
require '<%= feature_support_require %>'
|
5
|
+
<% if feature_support_extend %>
|
5
6
|
|
6
|
-
World
|
7
|
-
|
8
|
-
world.extend(<%= feature_support_extend %>)
|
9
|
-
<% end %>
|
10
|
-
world
|
11
|
-
end
|
7
|
+
World(<%= feature_support_extend %>)
|
8
|
+
<% end %>
|
@@ -4,7 +4,7 @@ require 'micronaut'
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
|
7
|
-
require '<%=
|
7
|
+
require '<%= require_name %>'
|
8
8
|
|
9
9
|
def not_in_editor?
|
10
10
|
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
|
@@ -5,11 +5,85 @@ class Jeweler
|
|
5
5
|
attr_accessor :base_dir
|
6
6
|
attr_reader :major, :minor, :patch
|
7
7
|
|
8
|
+
module YamlExtension
|
9
|
+
def write
|
10
|
+
File.open(yaml_path, 'w+') do |f|
|
11
|
+
YAML.dump(self.to_hash, f)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_hash
|
16
|
+
{
|
17
|
+
:major => major,
|
18
|
+
:minor => minor,
|
19
|
+
:patch => patch
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def refresh
|
24
|
+
parse_yaml
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_yaml
|
28
|
+
yaml = read_yaml
|
29
|
+
@major = (yaml['major'] || yaml[:major]).to_i
|
30
|
+
@minor = (yaml['minor'] || yaml[:minor]).to_i
|
31
|
+
@patch = (yaml['patch'] || yaml[:patch]).to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def read_yaml
|
35
|
+
if File.exists?(yaml_path)
|
36
|
+
YAML.load_file(yaml_path)
|
37
|
+
else
|
38
|
+
raise VersionYmlError, "#{yaml_path} does not exist!"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def path
|
43
|
+
yaml_path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module PlaintextExtension
|
48
|
+
def write
|
49
|
+
File.open(plaintext_path, 'w') do |file|
|
50
|
+
file.puts to_s
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_plaintext
|
55
|
+
plaintext = read_plaintext.chomp
|
56
|
+
if plaintext =~ /^(\d+)\.(\d+)\.(\d+)$/
|
57
|
+
@major = $1.to_i
|
58
|
+
@minor = $2.to_i
|
59
|
+
@patch = $3.to_i
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def read_plaintext
|
64
|
+
File.read(plaintext_path)
|
65
|
+
end
|
66
|
+
|
67
|
+
def refresh
|
68
|
+
parse_plaintext
|
69
|
+
end
|
70
|
+
|
71
|
+
def path
|
72
|
+
plaintext_path
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
8
76
|
def initialize(base_dir)
|
9
77
|
self.base_dir = base_dir
|
10
78
|
|
11
79
|
if File.exists?(yaml_path)
|
80
|
+
extend YamlExtension
|
12
81
|
parse_yaml
|
82
|
+
else
|
83
|
+
extend PlaintextExtension
|
84
|
+
if File.exists?(plaintext_path)
|
85
|
+
parse_plaintext
|
86
|
+
end
|
13
87
|
end
|
14
88
|
end
|
15
89
|
|
@@ -34,49 +108,20 @@ class Jeweler
|
|
34
108
|
@patch = patch
|
35
109
|
end
|
36
110
|
|
37
|
-
def write
|
38
|
-
File.open(yaml_path, 'w+') do |f|
|
39
|
-
YAML.dump(self.to_hash, f)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
111
|
def to_s
|
44
112
|
"#{major}.#{minor}.#{patch}"
|
45
113
|
end
|
46
114
|
|
47
|
-
def to_hash
|
48
|
-
{
|
49
|
-
:major => major,
|
50
|
-
:minor => minor,
|
51
|
-
:patch => patch
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
def refresh
|
56
|
-
parse_yaml
|
57
|
-
end
|
58
|
-
|
59
115
|
def yaml_path
|
60
116
|
denormalized_path = File.join(@base_dir, 'VERSION.yml')
|
61
117
|
absolute_path = File.expand_path(denormalized_path)
|
62
118
|
absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
|
63
119
|
end
|
64
120
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
@major = (yaml['major'] || yaml[:major]).to_i
|
70
|
-
@minor = (yaml['minor'] || yaml[:minor]).to_i
|
71
|
-
@patch = (yaml['patch'] || yaml[:patch]).to_i
|
72
|
-
end
|
73
|
-
|
74
|
-
def read_yaml
|
75
|
-
if File.exists?(yaml_path)
|
76
|
-
YAML.load_file(yaml_path)
|
77
|
-
else
|
78
|
-
raise VersionYmlError, "#{yaml_path} does not exist!"
|
79
|
-
end
|
121
|
+
def plaintext_path
|
122
|
+
denormalized_path = File.join(@base_dir, 'VERSION')
|
123
|
+
absolute_path = File.expand_path(denormalized_path)
|
124
|
+
absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
|
80
125
|
end
|
81
126
|
|
82
127
|
end
|
data/lib/jeweler.rb
CHANGED
@@ -13,6 +13,7 @@ require 'jeweler/generator/application'
|
|
13
13
|
require 'jeweler/commands'
|
14
14
|
|
15
15
|
require 'jeweler/tasks'
|
16
|
+
require 'jeweler/rubyforge_tasks'
|
16
17
|
|
17
18
|
require 'jeweler/specification'
|
18
19
|
|
@@ -133,5 +134,9 @@ class Jeweler
|
|
133
134
|
File.exists?(File.join(self.base_dir, '.git'))
|
134
135
|
end
|
135
136
|
|
137
|
+
def version_exists?
|
138
|
+
File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path)
|
139
|
+
end
|
140
|
+
|
136
141
|
end
|
137
142
|
|
data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
1.5.3
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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.
|