Class: Semvergen::Shell
- Inherits:
-
Object
- Object
- Semvergen::Shell
- Defined in:
- lib/semvergen/shell.rb
Instance Method Summary collapse
- #build_gem(gem_name) ⇒ Object
- #commit(version_path, new_version, commit_subject, features) ⇒ Object
- #git_index_dirty? ⇒ Boolean
-
#initialize(execute_function = method(:system_exec).to_proc) ⇒ Shell
constructor
A new instance of Shell.
- #publish(gem_name, version, gem_server) ⇒ Object
Constructor Details
#initialize(execute_function = method(:system_exec).to_proc) ⇒ Shell
Returns a new instance of Shell.
5 6 7 |
# File 'lib/semvergen/shell.rb', line 5 def initialize(execute_function = method(:system_exec).to_proc) @execute_function = execute_function end |
Instance Method Details
#build_gem(gem_name) ⇒ Object
21 22 23 |
# File 'lib/semvergen/shell.rb', line 21 def build_gem(gem_name) execute "gem build #{gem_name}.gemspec --force" end |
#commit(version_path, new_version, commit_subject, features) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/semvergen/shell.rb', line 13 def commit(version_path, new_version, commit_subject, features) commit_body = COMMIT_MESSAGE % [new_version, commit_subject, features.join("\n")] execute "git add CHANGELOG.md" execute "git add #{version_path}" execute %Q[git commit -m "#{commit_body}"] end |
#git_index_dirty? ⇒ Boolean
9 10 11 |
# File 'lib/semvergen/shell.rb', line 9 def git_index_dirty? execute("git status --porcelain") =~ /^\s*(D|M|A|R|C)\s/ end |
#publish(gem_name, version, gem_server) ⇒ Object
25 26 27 |
# File 'lib/semvergen/shell.rb', line 25 def publish(gem_name, version, gem_server) execute "gem inabox #{gem_name}-#{version}.gem --host #{gem_server}" end |