juwelier 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.document +8 -0
  4. data/.semver +5 -0
  5. data/.travis.yml +7 -0
  6. data/.yardopts +2 -0
  7. data/ChangeLog.markdown +230 -0
  8. data/Gemfile +40 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.markdown +252 -0
  11. data/Rakefile +78 -0
  12. data/bin/juwelier +9 -0
  13. data/features/generator/cucumber.feature +103 -0
  14. data/features/generator/directory_layout.feature +86 -0
  15. data/features/generator/dotdocument.feature +13 -0
  16. data/features/generator/env_options.feature +9 -0
  17. data/features/generator/gemfile.feature +81 -0
  18. data/features/generator/git.feature +102 -0
  19. data/features/generator/license.feature +20 -0
  20. data/features/generator/rakefile.feature +158 -0
  21. data/features/generator/readme.feature +12 -0
  22. data/features/generator/test.feature +54 -0
  23. data/features/generator/test_helper.feature +149 -0
  24. data/features/placeholder.feature +5 -0
  25. data/features/step_definitions/debug_steps.rb +6 -0
  26. data/features/step_definitions/filesystem_steps.rb +70 -0
  27. data/features/step_definitions/generator_steps.rb +387 -0
  28. data/features/step_definitions/task_steps.rb +6 -0
  29. data/features/support/env.rb +41 -0
  30. data/features/tasks/build_gem.feature +9 -0
  31. data/features/tasks/version.feature +31 -0
  32. data/features/tasks/version_bumping.feature +49 -0
  33. data/juwelier.gemspec +241 -0
  34. data/lib/juwelier.rb +178 -0
  35. data/lib/juwelier/commands.rb +20 -0
  36. data/lib/juwelier/commands/build_gem.rb +40 -0
  37. data/lib/juwelier/commands/check_dependencies.rb +66 -0
  38. data/lib/juwelier/commands/install_gem.rb +31 -0
  39. data/lib/juwelier/commands/release_gemspec.rb +87 -0
  40. data/lib/juwelier/commands/release_to_git.rb +64 -0
  41. data/lib/juwelier/commands/release_to_rubygems.rb +28 -0
  42. data/lib/juwelier/commands/validate_gemspec.rb +30 -0
  43. data/lib/juwelier/commands/version/base.rb +55 -0
  44. data/lib/juwelier/commands/version/bump_major.rb +13 -0
  45. data/lib/juwelier/commands/version/bump_minor.rb +12 -0
  46. data/lib/juwelier/commands/version/bump_patch.rb +14 -0
  47. data/lib/juwelier/commands/version/write.rb +12 -0
  48. data/lib/juwelier/commands/write_gemspec.rb +39 -0
  49. data/lib/juwelier/errors.rb +8 -0
  50. data/lib/juwelier/gemcutter_tasks.rb +8 -0
  51. data/lib/juwelier/gemspec_helper.rb +87 -0
  52. data/lib/juwelier/generator.rb +304 -0
  53. data/lib/juwelier/generator/application.rb +63 -0
  54. data/lib/juwelier/generator/bacon_mixin.rb +43 -0
  55. data/lib/juwelier/generator/github_mixin.rb +22 -0
  56. data/lib/juwelier/generator/micronaut_mixin.rb +41 -0
  57. data/lib/juwelier/generator/minitest_mixin.rb +42 -0
  58. data/lib/juwelier/generator/options.rb +172 -0
  59. data/lib/juwelier/generator/rdoc_mixin.rb +13 -0
  60. data/lib/juwelier/generator/riot_mixin.rb +42 -0
  61. data/lib/juwelier/generator/rspec_mixin.rb +42 -0
  62. data/lib/juwelier/generator/shindo_mixin.rb +44 -0
  63. data/lib/juwelier/generator/shoulda_mixin.rb +42 -0
  64. data/lib/juwelier/generator/testspec_mixin.rb +42 -0
  65. data/lib/juwelier/generator/testunit_mixin.rb +39 -0
  66. data/lib/juwelier/generator/yard_mixin.rb +15 -0
  67. data/lib/juwelier/rubyforge_tasks.rb +95 -0
  68. data/lib/juwelier/rubygems_dot_org_tasks.rb +38 -0
  69. data/lib/juwelier/rubygems_tasks.rb +38 -0
  70. data/lib/juwelier/specification.rb +110 -0
  71. data/lib/juwelier/tasks.rb +239 -0
  72. data/lib/juwelier/templates/.document +5 -0
  73. data/lib/juwelier/templates/.gitignore +49 -0
  74. data/lib/juwelier/templates/Gemfile +12 -0
  75. data/lib/juwelier/templates/LICENSE.txt +20 -0
  76. data/lib/juwelier/templates/README.rdoc +19 -0
  77. data/lib/juwelier/templates/Rakefile +9 -0
  78. data/lib/juwelier/templates/bacon/flunking.rb +7 -0
  79. data/lib/juwelier/templates/bacon/helper.rb +10 -0
  80. data/lib/juwelier/templates/bundler_setup.erb +10 -0
  81. data/lib/juwelier/templates/features/default.feature +9 -0
  82. data/lib/juwelier/templates/features/support/env.rb +11 -0
  83. data/lib/juwelier/templates/juwelier_tasks.erb +31 -0
  84. data/lib/juwelier/templates/micronaut/flunking.rb +7 -0
  85. data/lib/juwelier/templates/micronaut/helper.rb +19 -0
  86. data/lib/juwelier/templates/minitest/flunking.rb +7 -0
  87. data/lib/juwelier/templates/minitest/helper.rb +13 -0
  88. data/lib/juwelier/templates/other_tasks.erb +70 -0
  89. data/lib/juwelier/templates/riot/flunking.rb +11 -0
  90. data/lib/juwelier/templates/riot/helper.rb +5 -0
  91. data/lib/juwelier/templates/rspec/.rspec +1 -0
  92. data/lib/juwelier/templates/rspec/flunking.rb +7 -0
  93. data/lib/juwelier/templates/rspec/helper.rb +14 -0
  94. data/lib/juwelier/templates/shindo/flunking.rb +8 -0
  95. data/lib/juwelier/templates/shindo/helper.rb +7 -0
  96. data/lib/juwelier/templates/shoulda/flunking.rb +7 -0
  97. data/lib/juwelier/templates/shoulda/helper.rb +12 -0
  98. data/lib/juwelier/templates/simplecov.erb +16 -0
  99. data/lib/juwelier/templates/testspec/flunking.rb +7 -0
  100. data/lib/juwelier/templates/testspec/helper.rb +7 -0
  101. data/lib/juwelier/templates/testunit/flunking.rb +7 -0
  102. data/lib/juwelier/templates/testunit/helper.rb +11 -0
  103. data/lib/juwelier/version.rb +10 -0
  104. data/lib/juwelier/version_helper.rb +141 -0
  105. data/test/fixtures/bar/VERSION.yml +4 -0
  106. data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
  107. data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
  108. data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
  109. data/test/fixtures/existing-project-with-version-constant/.document +5 -0
  110. data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
  111. data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
  112. data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
  113. data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
  114. data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
  115. data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
  116. data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
  117. data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
  118. data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
  119. data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
  120. data/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt +20 -0
  121. data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
  122. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
  123. data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
  124. data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
  125. data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
  126. data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
  127. data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
  128. data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
  129. data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
  130. data/test/fixtures/existing-project-with-version-yaml/LICENSE.txt +20 -0
  131. data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
  132. data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
  133. data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
  134. data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
  135. data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
  136. data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
  137. data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
  138. data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
  139. data/test/geminstaller.yml +12 -0
  140. data/test/juwelier/commands/test_build_gem.rb +112 -0
  141. data/test/juwelier/commands/test_install_gem.rb +35 -0
  142. data/test/juwelier/commands/test_release_to_gemcutter.rb +39 -0
  143. data/test/juwelier/commands/test_release_to_git.rb +271 -0
  144. data/test/juwelier/commands/test_release_to_github.rb +477 -0
  145. data/test/juwelier/commands/test_validate_gemspec.rb +27 -0
  146. data/test/juwelier/commands/test_write_gemspec.rb +103 -0
  147. data/test/juwelier/commands/version/test_base.rb +53 -0
  148. data/test/juwelier/commands/version/test_bump_major.rb +22 -0
  149. data/test/juwelier/commands/version/test_bump_minor.rb +19 -0
  150. data/test/juwelier/commands/version/test_bump_patch.rb +20 -0
  151. data/test/juwelier/commands/version/test_write.rb +22 -0
  152. data/test/juwelier/generator/test_application.rb +142 -0
  153. data/test/juwelier/generator/test_options.rb +227 -0
  154. data/test/juwelier/test_gemspec_helper.rb +44 -0
  155. data/test/juwelier/test_generator.rb +140 -0
  156. data/test/juwelier/test_generator_initialization.rb +150 -0
  157. data/test/juwelier/test_generator_mixins.rb +23 -0
  158. data/test/juwelier/test_specification.rb +245 -0
  159. data/test/juwelier/test_tasks.rb +50 -0
  160. data/test/juwelier/test_version_helper.rb +214 -0
  161. data/test/shoulda_macros/juwelier_macros.rb +35 -0
  162. data/test/test_helper.rb +174 -0
  163. data/test/test_juwelier.rb +177 -0
  164. metadata +396 -0
@@ -0,0 +1,20 @@
1
+ class Juwelier
2
+ module Commands
3
+ autoload :BuildGem, 'juwelier/commands/build_gem'
4
+ autoload :InstallGem, 'juwelier/commands/install_gem'
5
+ autoload :CheckDependencies, 'juwelier/commands/check_dependencies'
6
+ autoload :ReleaseToGit, 'juwelier/commands/release_to_git'
7
+ autoload :ReleaseGemspec, 'juwelier/commands/release_gemspec'
8
+ autoload :ReleaseToRubygems, 'juwelier/commands/release_to_rubygems'
9
+ autoload :ValidateGemspec, 'juwelier/commands/validate_gemspec'
10
+ autoload :WriteGemspec, 'juwelier/commands/write_gemspec'
11
+
12
+ module Version
13
+ autoload :Base, 'juwelier/commands/version/base'
14
+ autoload :BumpMajor, 'juwelier/commands/version/bump_major'
15
+ autoload :BumpMinor, 'juwelier/commands/version/bump_minor'
16
+ autoload :BumpPatch, 'juwelier/commands/version/bump_patch'
17
+ autoload :Write, 'juwelier/commands/version/write'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ class Juwelier
2
+ module Commands
3
+ class BuildGem
4
+ attr_accessor :base_dir, :gemspec_helper, :file_utils, :version_helper
5
+
6
+ def initialize
7
+ self.file_utils = FileUtils
8
+ end
9
+
10
+ def run
11
+ gemspec_helper.update_version(version_helper) unless gemspec_helper.has_version?
12
+
13
+ gemspec = gemspec_helper.parse
14
+
15
+ if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a")
16
+ gem_file_name = Gem::Package.build(gemspec)
17
+ else
18
+ require "rubygems/builder"
19
+ gem_file_name = Gem::Builder.new(gemspec).build
20
+ end
21
+
22
+ pkg_dir = File.join(base_dir, 'pkg')
23
+ file_utils.mkdir_p pkg_dir
24
+
25
+ gem_file_name = File.join(base_dir, gem_file_name)
26
+ file_utils.mv gem_file_name, pkg_dir
27
+ end
28
+
29
+ def self.build_for(juwelier)
30
+ command = new
31
+
32
+ command.base_dir = juwelier.base_dir
33
+ command.gemspec_helper = juwelier.gemspec_helper
34
+ command.version_helper = juwelier.version_helper
35
+
36
+ command
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,66 @@
1
+ class Juwelier
2
+ module Commands
3
+ class CheckDependencies
4
+ class MissingDependenciesError < RuntimeError
5
+ attr_accessor :dependencies, :type
6
+ end
7
+
8
+ attr_accessor :gemspec, :type
9
+
10
+ def run
11
+ missing_dependencies = find_missing_dependencies
12
+
13
+ if missing_dependencies.empty?
14
+ puts "#{type || 'All'} dependencies seem to be installed."
15
+ else
16
+ puts "Missing some dependencies. Install them with the following commands:"
17
+ missing_dependencies.each do |dependency|
18
+ puts %Q{\tgem install #{dependency.name} --version "#{dependency.requirement.to_s}"}
19
+ end
20
+
21
+ abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
22
+ end
23
+ end
24
+
25
+ def find_missing_dependencies
26
+ if Gem::Specification.respond_to?(:find_by_name)
27
+ dependencies.select do |dependency|
28
+ begin
29
+ spec = Gem::Specification.find_by_name(dependency.name, *dependency.requirement.as_list)
30
+ spec.activate if spec
31
+ !spec
32
+ rescue LoadError => e
33
+ true
34
+ end
35
+ end
36
+ else
37
+ dependencies.select do |dependency|
38
+ begin
39
+ Gem.activate dependency.name, *dependency.requirement.as_list
40
+ false
41
+ rescue LoadError => e
42
+ true
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ def dependencies
49
+ case type
50
+ when :runtime, :development
51
+ gemspec.send("#{type}_dependencies")
52
+ else
53
+ gemspec.dependencies
54
+ end
55
+ end
56
+
57
+ def self.build_for(juwelier)
58
+ command = new
59
+
60
+ command.gemspec = juwelier.gemspec
61
+
62
+ command
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,31 @@
1
+ class Juwelier
2
+ module Commands
3
+ class InstallGem
4
+ include FileUtils
5
+
6
+ attr_accessor :gemspec_helper, :output
7
+
8
+ def initialize
9
+ self.output = $stdout
10
+ end
11
+
12
+ def run
13
+ command = "#{gem_command} install #{gemspec_helper.gem_path}"
14
+ output.puts "Executing #{command.inspect}:"
15
+
16
+ sh command # TODO where does sh actually come from!? - rake, apparently
17
+ end
18
+
19
+ def gem_command
20
+ "#{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -S gem"
21
+ end
22
+
23
+ def self.build_for(juwelier)
24
+ command = new
25
+ command.output = juwelier.output
26
+ command.gemspec_helper = juwelier.gemspec_helper
27
+ command
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,87 @@
1
+ require 'pathname'
2
+
3
+ class Juwelier
4
+ module Commands
5
+ class ReleaseGemspec
6
+ attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir
7
+
8
+ def initialize(attributes = {})
9
+ self.output = $stdout
10
+
11
+ attributes.each_pair do |key, value|
12
+ send("#{key}=", value)
13
+ end
14
+ end
15
+
16
+ def run(args = {})
17
+ remote = args[:remote] || 'origin'
18
+ branch = args[:branch] || 'master'
19
+ local_branch = args[:local_branch] || branch
20
+ remote_branch = args[:remote_branch] || branch
21
+
22
+ unless clean_staging_area?
23
+ system "git status"
24
+ raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
25
+ end
26
+
27
+ repo.checkout(local_branch)
28
+
29
+ regenerate_gemspec!
30
+ commit_gemspec! if gemspec_changed?
31
+
32
+ output.puts "Pushing #{local_branch} to #{remote}"
33
+ repo.push(remote, "#{local_branch}:#{remote_branch}")
34
+ end
35
+
36
+ def clean_staging_area?
37
+ # surprisingly simpler than ruby-git
38
+ `git ls-files --deleted --modified --others --exclude-standard` == ""
39
+ end
40
+
41
+ def commit_gemspec!
42
+ gemspec_gitpath = working_subdir.join(gemspec_helper.path)
43
+ repo.add(gemspec_gitpath.to_s)
44
+ output.puts "Committing #{gemspec_gitpath}"
45
+ repo.commit "Regenerate gemspec for version #{version}"
46
+ end
47
+
48
+ def regenerate_gemspec!
49
+ gemspec_helper.update_version(version)
50
+ gemspec_helper.write
51
+ end
52
+
53
+ def gemspec_changed?
54
+ # OMGHAX. ruby-git status always ends up being 'M', so let's do it a crazy way
55
+ system "git status -s #{working_subdir.join(gemspec_helper.path)} | grep #{working_subdir.join(gemspec_helper.path)} > /dev/null 2>/dev/null"
56
+ end
57
+
58
+ def gemspec_helper
59
+ @gemspec_helper ||= Juwelier::GemSpecHelper.new(self.gemspec, self.base_dir)
60
+ end
61
+
62
+ def working_subdir
63
+ return @working_subdir if @working_subdir
64
+ cwd = base_dir_path
65
+ @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
66
+ @working_subdir
67
+ end
68
+
69
+ def base_dir_path
70
+ Pathname.new(base_dir).realpath
71
+ end
72
+
73
+ def self.build_for(juwelier)
74
+ command = self.new
75
+
76
+ command.base_dir = juwelier.base_dir
77
+ command.gemspec = juwelier.gemspec
78
+ command.version = juwelier.version
79
+ command.repo = juwelier.repo
80
+ command.output = juwelier.output
81
+ command.gemspec_helper = juwelier.gemspec_helper
82
+
83
+ command
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,64 @@
1
+ class Juwelier
2
+ module Commands
3
+ class ReleaseToGit
4
+ attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir
5
+
6
+ def initialize(attributes = {})
7
+ self.output = $stdout
8
+
9
+ attributes.each_pair do |key, value|
10
+ send("#{key}=", value)
11
+ end
12
+ end
13
+
14
+ def run(args = {})
15
+ remote = args[:remote] || 'origin'
16
+ branch = args[:branch] || 'master'
17
+ local_branch = args[:local_branch] || branch
18
+ remote_branch = args[:remote_branch] || branch
19
+
20
+ unless clean_staging_area?
21
+ system "git status"
22
+ raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
23
+ end
24
+
25
+ repo.checkout(local_branch)
26
+ repo.push(remote, "#{local_branch}:#{remote_branch}")
27
+
28
+ if release_not_tagged?
29
+ output.puts "Tagging #{release_tag}"
30
+ repo.add_tag(release_tag)
31
+
32
+ output.puts "Pushing #{release_tag} to #{remote}"
33
+ repo.push(remote, release_tag)
34
+ end
35
+ end
36
+
37
+ def clean_staging_area?
38
+ `git ls-files --deleted --modified --others --exclude-standard` == ""
39
+ end
40
+
41
+ def release_tag
42
+ "v#{version}"
43
+ end
44
+
45
+ def release_not_tagged?
46
+ tag = repo.tag(release_tag) rescue nil
47
+ tag.nil?
48
+ end
49
+
50
+ def self.build_for(juwelier)
51
+ command = self.new
52
+
53
+ command.base_dir = juwelier.base_dir
54
+ command.gemspec = juwelier.gemspec
55
+ command.version = juwelier.version
56
+ command.repo = juwelier.repo
57
+ command.output = juwelier.output
58
+ command.gemspec_helper = juwelier.gemspec_helper
59
+
60
+ command
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,28 @@
1
+ class Juwelier
2
+ module Commands
3
+ class ReleaseToRubygems
4
+ include FileUtils
5
+
6
+ attr_accessor :gemspec, :version, :output, :gemspec_helper
7
+
8
+ def initialize
9
+ self.output = $stdout
10
+ end
11
+
12
+ def run
13
+ command = "gem push #{@gemspec_helper.gem_path}"
14
+ output.puts "Executing #{command.inspect}:"
15
+ sh command
16
+ end
17
+
18
+ def self.build_for(juwelier)
19
+ command = new
20
+ command.gemspec = juwelier.gemspec
21
+ command.gemspec_helper = juwelier.gemspec_helper
22
+ command.version = juwelier.version
23
+ command.output = juwelier.output
24
+ command
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ class Juwelier
2
+ module Commands
3
+ class ValidateGemspec
4
+ attr_accessor :gemspec_helper, :output
5
+
6
+ def initialize
7
+ self.output = $stdout
8
+ end
9
+
10
+ def run
11
+ begin
12
+ gemspec_helper.parse
13
+ output.puts "#{gemspec_helper.path} is valid."
14
+ rescue Exception => e
15
+ output.puts "#{gemspec_helper.path} is invalid. See the backtrace for more details."
16
+ raise
17
+ end
18
+ end
19
+
20
+ def self.build_for(juwelier)
21
+ command = new
22
+
23
+ command.gemspec_helper = juwelier.gemspec_helper
24
+ command.output = juwelier.output
25
+
26
+ command
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,55 @@
1
+ require 'pathname'
2
+
3
+ class Juwelier
4
+ module Commands
5
+ module Version
6
+ class Base
7
+
8
+ attr_accessor :repo, :version_helper, :gemspec, :commit, :base_dir
9
+
10
+ def run
11
+ update_version
12
+
13
+ self.version_helper.write
14
+ self.gemspec.version = self.version_helper.to_s
15
+
16
+ commit_version if self.repo && self.commit
17
+ end
18
+
19
+ def update_version
20
+ raise "Subclasses should implement this"
21
+ end
22
+
23
+ def commit_version
24
+ if self.repo
25
+ self.repo.add(working_subdir.join(version_helper.path).to_s)
26
+ self.repo.commit("Version bump to #{self.version_helper.to_s}")
27
+ end
28
+ end
29
+
30
+ def working_subdir
31
+ return @working_subdir if @working_subdir
32
+ cwd = base_dir_path
33
+ @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
34
+ @working_subdir
35
+ end
36
+
37
+ def base_dir_path
38
+ Pathname.new(base_dir).realpath
39
+ end
40
+
41
+
42
+ def self.build_for(juwelier)
43
+ command = new
44
+ command.repo = juwelier.repo
45
+ command.version_helper = juwelier.version_helper
46
+ command.gemspec = juwelier.gemspec
47
+ command.commit = juwelier.commit
48
+ command.base_dir = juwelier.base_dir
49
+
50
+ command
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,13 @@
1
+ class Juwelier
2
+ module Commands
3
+ module Version
4
+ class BumpMajor < Base
5
+
6
+ def update_version
7
+ self.version_helper.bump_major
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+ end