Class: SocialStream::Release::Global::Release
- Inherits:
-
Object
- Object
- SocialStream::Release::Global::Release
- Includes:
- Thor::Actions
- Defined in:
- lib/social_stream/release/global/release.rb
Direct Known Subclasses
Constant Summary collapse
- DEPENDENCY_REGEXP =
/dependency.*social_stream-(\w*)/
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #bump_version ⇒ Object
- #commit ⇒ Object
- #commit_command ⇒ Object
- #commit_files ⇒ Object
- #dependencies ⇒ Object
- #gemspec ⇒ Object
-
#initialize(target = nil) ⇒ Release
constructor
A new instance of Release.
- #rake_release ⇒ Object
- #rake_release_command ⇒ Object
- #release! ⇒ Object
- #update_dependencies ⇒ Object
- #version_file ⇒ Object
Constructor Details
#initialize(target = nil) ⇒ Release
Returns a new instance of Release.
11 12 13 |
# File 'lib/social_stream/release/global/release.rb', line 11 def initialize(target = nil) @target = target end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/social_stream/release/global/release.rb', line 9 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/social_stream/release/global/release.rb', line 9 def version @version end |
Instance Method Details
#bump_version ⇒ Object
25 26 27 |
# File 'lib/social_stream/release/global/release.rb', line 25 def bump_version @version = version_file.bump! end |
#commit ⇒ Object
48 49 50 |
# File 'lib/social_stream/release/global/release.rb', line 48 def commit system(commit_command) || raise(RuntimeError.new) end |
#commit_command ⇒ Object
52 53 54 |
# File 'lib/social_stream/release/global/release.rb', line 52 def commit_command "git commit #{ commit_files } -m #{ @version }" end |
#commit_files ⇒ Object
56 57 58 |
# File 'lib/social_stream/release/global/release.rb', line 56 def commit_files "#{ @version_file.filename } #{ gemspec }" end |
#dependencies ⇒ Object
33 34 35 36 |
# File 'lib/social_stream/release/global/release.rb', line 33 def dependencies @dependencies ||= File.read(gemspec).scan(DEPENDENCY_REGEXP).flatten end |
#gemspec ⇒ Object
44 45 46 |
# File 'lib/social_stream/release/global/release.rb', line 44 def gemspec "social_stream.gemspec" end |
#rake_release ⇒ Object
60 61 62 |
# File 'lib/social_stream/release/global/release.rb', line 60 def rake_release system(rake_release_command) || raise(RuntimeError.new) end |
#rake_release_command ⇒ Object
64 65 66 |
# File 'lib/social_stream/release/global/release.rb', line 64 def rake_release_command "rake release" end |
#release! ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/social_stream/release/global/release.rb', line 15 def release! bump_version update_dependencies commit rake_release end |
#update_dependencies ⇒ Object
38 39 40 41 42 |
# File 'lib/social_stream/release/global/release.rb', line 38 def update_dependencies dependencies.each do |d| DependencyUpdate.new.invoke(:update, [ gemspec, d, Component::VersionFile.new(d).old_number ]) end end |
#version_file ⇒ Object
29 30 31 |
# File 'lib/social_stream/release/global/release.rb', line 29 def version_file @version_file ||= VersionFile.new(@target) end |