Class: AssistedWorkflow::CLI
- Inherits:
-
Thor
- Object
- Thor
- AssistedWorkflow::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/assisted_workflow/cli.rb
Constant Summary collapse
- GLOBAL_CONFIG =
File.(".awconfig", ENV["HOME"])
- LOCAL_CONFIG =
".awconfig"
Class Method Summary collapse
Instance Method Summary collapse
- #config(*args) ⇒ Object
- #finish ⇒ Object
- #setup ⇒ Object
- #start(story_id = nil) ⇒ Object
- #submit ⇒ Object
- #thanks ⇒ Object
- #version ⇒ Object
Class Method Details
.start(given_args = ARGV, config = {}) ⇒ Object
132 133 134 135 136 137 |
# File 'lib/assisted_workflow/cli.rb', line 132 def start(given_args=ARGV, config={}) super rescue AssistedWorkflow::Error => e config[:shell].say e., :red exit(1) end |
Instance Method Details
#config(*args) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/assisted_workflow/cli.rb', line 84 def config(*args) if args.empty? print_table configuration.to_hash else config_file.parse(args).save! end end |
#finish ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/assisted_workflow/cli.rb', line 67 def finish check_awfile! unless story_id = git.current_story_id raise AssistedWorkflow::Error, "story not found, make sure a feature branch in active" end git.check_merged! git.remove_branch out.next_command "well done! check your next stories using:", "$ aw start" end |
#setup ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/assisted_workflow/cli.rb', line 18 def setup copy_file "awconfig.global.tt", GLOBAL_CONFIG copy_file "awconfig.local.tt", LOCAL_CONFIG if File.exists?(".git") copy_file "commit-msg.tt", ".git/hooks/commit-msg" chmod ".git/hooks/commit-msg", "a+x" else raise AssistedWorkflow::Error, ".git folder not found" end out.next_command "set your own configuration running:", "" do |c| c << "$ aw config pivotal.fullname='Your Pivotal User Name' --global" c << "$ aw config pivotal.token=MYPIVOTALTOKEN --global" c << "$ aw config github.token=MYGITHUBOAUTHTOKEN --global" c << "$ aw config pivotal.project_id=00001" end end |
#start(story_id = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/assisted_workflow/cli.rb', line 38 def start(story_id=nil) check_awfile! story = tracker.find_story(story_id) if story.nil? stories = tracker.pending_stories(:include_started => [:all]) out.print_stories "pending stories", stories, out.next_command "start a story using:", "$ aw start [STORY_ID]" else tracker.start_story(story, :estimate => [:estimate]) out.print_story story git.create_story_branch(story) out.next_command "after commiting your changes, submit a pull request using:", "$ aw submit" end end |
#submit ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/assisted_workflow/cli.rb', line 54 def submit check_awfile! story_id = git.current_story_id unless story = tracker.find_story(story_id) raise AssistedWorkflow::Error, "story not found, make sure a feature branch in active" end git.rebase_and_push pr_url = github.create_pull_request(git.current_branch, story) tracker.finish_story(story, :note => pr_url) out.next_command "after pull request approval, remove the feature branch using:", "$ aw finish" end |
#thanks ⇒ Object
93 94 95 |
# File 'lib/assisted_workflow/cli.rb', line 93 def thanks out.say "you're welcome!", :on_magenta end |
#version ⇒ Object
78 79 80 |
# File 'lib/assisted_workflow/cli.rb', line 78 def version say AssistedWorkflow::VERSION end |