Class: Dude::CLI
Constant Summary
Constants included from Settings
Instance Method Summary collapse
- #checkout(issue_id, project_title = folder_name) ⇒ Object
- #install ⇒ Object
- #start(issue_id, project_title = folder_name) ⇒ Object
- #stats ⇒ Object
- #stop ⇒ Object
- #tasks(project_title = folder_name) ⇒ Object
Methods included from Settings
Instance Method Details
#checkout(issue_id, project_title = folder_name) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/dude/cli.rb', line 24 def checkout(issue_id, project_title = folder_name) issue_title = Gitlab.new( issue_id: issue_id, project_title: project_title ).call Git.new(branch_name: git_branch_name(issue_title, issue_id)).call end |
#install ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/dude/cli.rb', line 13 def install path = File.join(Dir.home, Settings::CONFIG_FILE) if File.exist?(path) puts "Config file already exists" else File.open(path, 'w') {|f| f.write(duderc_file_content) } puts ".duderc created in your HOME directory" end end |
#start(issue_id, project_title = folder_name) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/dude/cli.rb', line 32 def start(issue_id, project_title = folder_name) checkout(issue_id, project_title) issue_title = Gitlab.new( issue_id: issue_id, project_title: project_title ).call Toggl.new(title: "##{issue_id} #{issue_title}", project_title: project_title).start_time_entry puts "Starting Toggl task" end |
#stats ⇒ Object
53 54 55 |
# File 'lib/dude/cli.rb', line 53 def stats Toggl.new.report end |
#stop ⇒ Object
48 49 50 |
# File 'lib/dude/cli.rb', line 48 def stop Toggl.new.stop_current_time_entry end |
#tasks(project_title = folder_name) ⇒ Object
42 43 44 45 |
# File 'lib/dude/cli.rb', line 42 def tasks(project_title = folder_name) issues = Gitlab.new(project_title: project_title).my_issues Interface.new.issues_list(issues) end |