Class: Jeweler::Commands::ReleaseToGit
- Inherits:
-
Object
- Object
- Jeweler::Commands::ReleaseToGit
- Includes:
- ReleaseCommon
- Defined in:
- lib/jeweler/commands/release_to_git.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#gemspec ⇒ Object
Returns the value of attribute gemspec.
-
#gemspec_helper ⇒ Object
Returns the value of attribute gemspec_helper.
-
#output ⇒ Object
Returns the value of attribute output.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ReleaseToGit
constructor
A new instance of ReleaseToGit.
- #release_not_tagged? ⇒ Boolean
- #release_tag ⇒ Object
- #run ⇒ Object
Methods included from ReleaseCommon
Constructor Details
#initialize(attributes = {}) ⇒ ReleaseToGit
Returns a new instance of ReleaseToGit.
11 12 13 14 15 16 17 |
# File 'lib/jeweler/commands/release_to_git.rb', line 11 def initialize(attributes = {}) self.output = $stdout attributes.each_pair do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def base_dir @base_dir end |
#gemspec ⇒ Object
Returns the value of attribute gemspec.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def gemspec @gemspec end |
#gemspec_helper ⇒ Object
Returns the value of attribute gemspec_helper.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def gemspec_helper @gemspec_helper end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def output @output end |
#repo ⇒ Object
Returns the value of attribute repo.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def repo @repo end |
#version ⇒ Object
Returns the value of attribute version.
9 10 11 |
# File 'lib/jeweler/commands/release_to_git.rb', line 9 def version @version end |
Class Method Details
.build_for(jeweler) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/jeweler/commands/release_to_git.rb', line 48 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 |
Instance Method Details
#release_not_tagged? ⇒ Boolean
43 44 45 46 |
# File 'lib/jeweler/commands/release_to_git.rb', line 43 def release_not_tagged? tag = repo.tag(release_tag) rescue nil tag.nil? end |
#release_tag ⇒ Object
39 40 41 |
# File 'lib/jeweler/commands/release_to_git.rb', line 39 def release_tag "v#{version}" end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jeweler/commands/release_to_git.rb', line 19 def run 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('master') branch = repo.current_branch output.puts "Pushing #{branch} to origin" repo.push('origin', branch) if release_not_tagged? output.puts "Tagging #{release_tag}" repo.add_tag(release_tag) output.puts "Pushing #{release_tag} to origin" repo.push('origin', release_tag) end end |