Class: Jeweler::Commands::ReleaseToGit
- Inherits:
-
Object
- Object
- Jeweler::Commands::ReleaseToGit
- Defined in:
- lib/jeweler/commands/release_to_git.rb
Instance Attribute Summary (collapse)
-
- (Object) base_dir
Returns the value of attribute base_dir.
-
- (Object) gemspec
Returns the value of attribute gemspec.
-
- (Object) gemspec_helper
Returns the value of attribute gemspec_helper.
-
- (Object) output
Returns the value of attribute output.
-
- (Object) repo
Returns the value of attribute repo.
-
- (Object) version
Returns the value of attribute version.
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Boolean) clean_staging_area?
-
- (ReleaseToGit) initialize(attributes = {})
constructor
A new instance of ReleaseToGit.
- - (Boolean) release_not_tagged?
- - (Object) release_tag
- - (Object) run
Constructor Details
- (ReleaseToGit) initialize(attributes = {})
A new instance of ReleaseToGit
6 7 8 9 10 11 12 |
# File 'lib/jeweler/commands/release_to_git.rb', line 6 def initialize(attributes = {}) self.output = $stdout attributes.each_pair do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
- (Object) base_dir
Returns the value of attribute base_dir
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def base_dir @base_dir end |
- (Object) gemspec
Returns the value of attribute gemspec
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def gemspec @gemspec end |
- (Object) gemspec_helper
Returns the value of attribute gemspec_helper
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def gemspec_helper @gemspec_helper end |
- (Object) output
Returns the value of attribute output
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def output @output end |
- (Object) repo
Returns the value of attribute repo
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def repo @repo end |
- (Object) version
Returns the value of attribute version
4 5 6 |
# File 'lib/jeweler/commands/release_to_git.rb', line 4 def version @version end |
Class Method Details
+ (Object) build_for(jeweler)
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jeweler/commands/release_to_git.rb', line 45 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
- (Boolean) clean_staging_area?
32 33 34 |
# File 'lib/jeweler/commands/release_to_git.rb', line 32 def clean_staging_area? `git ls-files --deleted --modified --others --exclude-standard` == "" end |
- (Boolean) release_not_tagged?
40 41 42 43 |
# File 'lib/jeweler/commands/release_to_git.rb', line 40 def release_not_tagged? tag = repo.tag(release_tag) rescue nil tag.nil? end |
- (Object) release_tag
36 37 38 |
# File 'lib/jeweler/commands/release_to_git.rb', line 36 def release_tag "v#{version}" end |
- (Object) run
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jeweler/commands/release_to_git.rb', line 14 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') repo.push 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 |