Class: Cp8Cli::Main
- Inherits:
-
Object
- Object
- Cp8Cli::Main
- Defined in:
- lib/cp8_cli/main.rb
Instance Method Summary collapse
- #ci ⇒ Object
- #cleanup ⇒ Object
- #finish(options = {}) ⇒ Object
-
#initialize(global_config = GlobalConfig.new, local_config = LocalConfig.new) ⇒ Main
constructor
A new instance of Main.
- #open ⇒ Object
- #start(name) ⇒ Object
- #suggest ⇒ Object
Constructor Details
#initialize(global_config = GlobalConfig.new, local_config = LocalConfig.new) ⇒ Main
Returns a new instance of Main.
9 10 11 12 13 |
# File 'lib/cp8_cli/main.rb', line 9 def initialize(global_config = GlobalConfig.new, local_config = LocalConfig.new) Trello::Base.configure(key: global_config.trello_key, token: global_config.trello_token) Github::Base.configure(token: global_config.github_token) @local_config = local_config end |
Instance Method Details
#cleanup ⇒ Object
49 50 51 |
# File 'lib/cp8_cli/main.rb', line 49 def cleanup Cleanup.new(Branch.current.target).run end |
#finish(options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/cp8_cli/main.rb', line 29 def finish( = {}) branch = Branch.current branch.push branch.open_pull_request() end |
#open ⇒ Object
25 26 27 |
# File 'lib/cp8_cli/main.rb', line 25 def open Branch.current.open_story_in_browser end |
#start(name) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/cp8_cli/main.rb', line 15 def start(name) Command.error "Your `cp8_cli` version is out of date. Please run `gem update cp8_cli`." unless Version.latest? story = create_or_pick_story(name) story.assign(current_user) story.start Branch.from_story(user: current_user, story: story).checkout rescue Trello::Error => error Command.error(error.) end |
#suggest ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/cp8_cli/main.rb', line 39 def suggest original_branch = Branch.current suggestion_branch = Branch.new("suggestion-#{SecureRandom.hex(8)}") suggestion_branch.checkout suggestion_branch.push suggestion_branch.open_pull_request(target: original_branch, expand: false) original_branch.checkout original_branch.reset end |