caperoma 0.1.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -0
  3. data/Capefile +48 -0
  4. data/Capefile.template +48 -0
  5. data/Capefile.test +20 -0
  6. data/Gemfile +25 -10
  7. data/Gemfile.lock +196 -77
  8. data/HELP +321 -0
  9. data/README.md +528 -0
  10. data/Rakefile +73 -18
  11. data/VERSION +1 -1
  12. data/bin/caperoma +47 -11
  13. data/caperoma.gemspec +144 -45
  14. data/config/crontab +10 -0
  15. data/config/schedule.rb +21 -0
  16. data/lib/caperoma.rb +409 -9
  17. data/lib/caperoma/models/account.rb +47 -0
  18. data/lib/caperoma/models/application_record.rb +5 -0
  19. data/lib/caperoma/models/branch.rb +6 -0
  20. data/lib/caperoma/models/project.rb +14 -0
  21. data/lib/caperoma/models/property.rb +5 -0
  22. data/lib/caperoma/models/report.rb +177 -0
  23. data/lib/caperoma/models/report_recipient.rb +6 -0
  24. data/lib/caperoma/models/reports/daily_report.rb +23 -0
  25. data/lib/caperoma/models/reports/retrospective_report.rb +19 -0
  26. data/lib/caperoma/models/reports/three_day_report.rb +19 -0
  27. data/lib/caperoma/models/task.rb +368 -0
  28. data/lib/caperoma/models/tasks/bug.rb +36 -0
  29. data/lib/caperoma/models/tasks/chore.rb +40 -0
  30. data/lib/caperoma/models/tasks/feature.rb +27 -0
  31. data/lib/caperoma/models/tasks/fix.rb +56 -0
  32. data/lib/caperoma/models/tasks/meeting.rb +40 -0
  33. data/lib/caperoma/models/tasks/modules/git.rb +65 -0
  34. data/lib/caperoma/models/tasks/task_with_commit.rb +40 -0
  35. data/lib/caperoma/models/tasks/task_with_separate_branch.rb +42 -0
  36. data/lib/caperoma/services/airbrake_email_processor.rb +47 -0
  37. data/lib/caperoma/services/pivotal_fetcher.rb +108 -0
  38. data/lib/caperoma/version.rb +9 -0
  39. data/spec/caperoma_spec.rb +3 -21
  40. data/spec/factories/accounts.rb +10 -0
  41. data/spec/factories/branches.rb +9 -0
  42. data/spec/factories/projects.rb +8 -0
  43. data/spec/factories/report_recipients.rb +7 -0
  44. data/spec/factories/reports.rb +16 -0
  45. data/spec/factories/tasks.rb +37 -0
  46. data/spec/features/bug_spec.rb +60 -0
  47. data/spec/features/chore_spec.rb +60 -0
  48. data/spec/features/command_unknown_spec.rb +14 -0
  49. data/spec/features/config_spec.rb +161 -0
  50. data/spec/features/feature_spec.rb +60 -0
  51. data/spec/features/finish_spec.rb +18 -0
  52. data/spec/features/fix_spec.rb +60 -0
  53. data/spec/features/meeting_spec.rb +22 -0
  54. data/spec/features/projects_spec.rb +17 -0
  55. data/spec/features/report_recipientss_spec.rb +117 -0
  56. data/spec/features/reports_spec.rb +65 -0
  57. data/spec/features/status_spec.rb +33 -0
  58. data/spec/features/version_spec.rb +11 -0
  59. data/spec/models/account_spec.rb +51 -0
  60. data/spec/models/branch_spec.rb +8 -0
  61. data/spec/models/bug_spec.rb +33 -0
  62. data/spec/models/chore_spec.rb +33 -0
  63. data/spec/models/daily_report_spec.rb +38 -0
  64. data/spec/models/feature_spec.rb +33 -0
  65. data/spec/models/fix_spec.rb +55 -0
  66. data/spec/models/meeting_spec.rb +33 -0
  67. data/spec/models/project_spec.rb +11 -0
  68. data/spec/models/report_recipient_spec.rb +22 -0
  69. data/spec/models/report_spec.rb +16 -0
  70. data/spec/models/retrospective_report_spec.rb +38 -0
  71. data/spec/models/task_spec.rb +613 -0
  72. data/spec/models/task_with_commit_spec.rb +105 -0
  73. data/spec/models/task_with_separate_branch_spec.rb +97 -0
  74. data/spec/models/three_day_report_spec.rb +49 -0
  75. data/spec/spec_helper.rb +26 -16
  76. data/spec/support/capefile_generator.rb +36 -0
  77. data/spec/support/database_cleaner.rb +21 -0
  78. data/spec/support/stubs.rb +178 -9
  79. metadata +283 -42
  80. data/.document +0 -5
  81. data/README.rdoc +0 -26
  82. data/lib/caperoma/credentials.rb +0 -13
  83. data/lib/caperoma/jira_client.rb +0 -57
  84. data/spec/caperoma/credentials_spec.rb +0 -25
  85. data/spec/caperoma/jira_spec.rb +0 -35
data/HELP ADDED
@@ -0,0 +1,321 @@
1
+ Caperoma is a gem that helps to automate your workflow.
2
+
3
+ Available commands
4
+
5
+ ### Setup
6
+ `caperoma setup` - creates the database (~/.caperoma.sqlite3) on your computer.
7
+
8
+ ### Initialize
9
+ `caperoma init` - initializes Caperoma inside a project (creates Capefile).
10
+
11
+ ### Get Issue IDs from Jira
12
+ `caperoma get_jira_issue_type_ids` - see what issue IDs does your Jira support, to put them into the Capefile.
13
+
14
+ ### Status
15
+ `caperoma status` - shows a task you are working on now.
16
+ Example:
17
+ ```bash
18
+ $ caperoma status
19
+ You are working on:
20
+ Title: Some task
21
+ Type: Feature
22
+ Jira ID: PRJ-24 (https://example.atlassian.net/browse/PRJ-24)
23
+ Pivotal ID: 167396414 (https://www.pivotaltracker.com/story/show/167396414)
24
+ Time spent at the moment: 2h 50m
25
+ Pull request will be sent to this branch: master
26
+
27
+ $ caperoma finish
28
+ ...
29
+ $ caperoma status
30
+ You are not working on anything now.
31
+ ```
32
+
33
+ `caperoma projects` - shows the list of projects on this computer.
34
+ Example:
35
+ ```bash
36
+ $ caperoma projects
37
+ 1) Good project (jira_project_id: 10000)
38
+ 2) Best project (jira_project_id: 10014)
39
+ 3) Cosmic project (jira_project_id: 10534)
40
+ ```
41
+
42
+ ### Starting Tasks
43
+ #### Start a Feature
44
+ `caperoma feature [options]` - Creates a feature in a new branch:
45
+ - Downloads the latest version of the code from Github.
46
+ - Creates and starts a task in Jira.
47
+ - Creates and starts a task in Pivotal.
48
+ - Generates the name of the branch.
49
+ - Remembers from which branch you started working.
50
+ - Switches into new a branch.
51
+ - Starts the timer.
52
+ - *If the -p parameter is specified, Caperoma starts Pivotal task with this ID.*
53
+ - *If the -p parameter is not specified, Caperoma will create a new task in Pivotal, start it and use its ID.*
54
+ - *The creation of certain types of tasks in Pivotal (when -p is absent) can be turned on or off in Capefile.*
55
+ - *If you are already working on something, you won't be able to start a new task. You will have to finish or pause the current task.*
56
+
57
+ `options`:
58
+ `-t, --title` - The name of the feature (for a commit, pull request, tasks in Jira and Pivotal). ` -t` and `--title` are different versions of the same option.
59
+ `-d, --description` - The description (for a task in Jira and Pivotal).
60
+ `-p, -ptid, --pivotal_task_id` - ID of task in Pivotal (automatically gets started/finished during the work on it in Caperoma).
61
+ `-a, --additional_time` - Additional time (in minutes). Intended for cases when you want to indicate that you started working on it X minutes ago (X minutes before starting Caperoma timer). For example, for 1 hour you tried to reproduce the problem before you realized that you need to start a new task. Or if you forgot to start Caperoma. Additional time is always in minutes. Adding 125 minutes (-a 125) will mean that you spent 2h 5m on the task before turning on Caperoma timer.
62
+
63
+ *The order of options is not important.
64
+ Immediately after the operator must be a value.*
65
+
66
+ Examples:
67
+ ```bash
68
+ caperoma feature -t "my feature"
69
+ # (start the feature in the new branch)
70
+
71
+ caperoma feature -t "my feature" -a 10
72
+ # (start the feature in the new branch, and add 10 minutes to it at the end)
73
+
74
+ caperoma feature -t "title" -d "description" -p 4830184 -a 48
75
+ # (create a feature with the description of "description", Pivotal ID #4830184, and add 48 minutes)
76
+
77
+ caperoma feature --title "title" --description "description" --pivotal_task_id 1000001 --additional_time 5
78
+ # (create the feature "title" with the description of "description" and Pivotal ID #1000001, on which you started working 5 minutes ago)
79
+ ```
80
+
81
+ #### Start a Bug
82
+ `caperoma bug [options]` - Creates a bug in the new branch.
83
+ Does almost the same thing as `caperoma feature`, just starts everywhere the tasks of a type "bug".
84
+ `options`: same as for `caperoma feature`
85
+ Example:
86
+ ```bash
87
+ caperoma bug -t "something isn't working" -a 20
88
+ # (starts a "bug" called "something isn't working" in the new branch and adds 20 minutes to the timer)
89
+ ```
90
+
91
+ #### Start a Fix
92
+ `caperoma fix [options]` - Creates a fix in the CURRENT branch, doing at the end just "git push" into the branch, not a pull request.
93
+ Everything else is almost the same as `caperoma feature`.
94
+ This command is created for the cases when you already have a remote branch, or if you already made a pull request, and you need to go back to it and add something.
95
+ This command considers the specifics of work with open pull requests and remote branches:
96
+ - Downloads the latest version of the current branch before starting the work and again before pushing the changes.
97
+ - Changes are made in a new commit instead of a potentially conflicting amend.
98
+ - Leaves the title and description of pull requests.
99
+ `options`: same as for `caperoma feature`
100
+ Example:
101
+ ```bash
102
+ caperoma fix --title "Spelling fix" -d "Fix the spelling mistake"
103
+ # (in the current branch - into which you manually switched - start a fix with the name "Spelling fix" and the description "Fix the spelling mistake")
104
+ ```
105
+
106
+ #### Start a Meeting
107
+ `caperoma meeting [options]` - Creates a meeting.
108
+ For cases when you need to record to Jira the facts of talking on the phone with your coworkers.
109
+ Jira ID for the meeting (as for other types of tasks) can be set in Capefile (by default it has the same value as a chore).
110
+ In Pivotal creating meetings is off by default. It can be turned on in Capefile. If it is on, Caperoma will create "chores".
111
+ `options`: same as for `caperoma feature`
112
+
113
+ This feature is sometimes used to automate logging phone calls to Jira.
114
+ For example, in Skype, you could configure it to call the command `caperoma meeting -t "meeting"` when you pick up the phone and call `caperoma finish` when you hang up.
115
+ As a result, Skype conversations will automatically be entered into Jira with accuracy up to a minute.
116
+ 5-10 people can participate in a conference call, so if each of them sets up Caperoma, you can save a couple of man-hours for each call.
117
+ Example:
118
+ ```bash
119
+ caperoma meeting -t "title"
120
+ ```
121
+
122
+ #### Start a Chore
123
+ `caperoma chore [options]` - Creates a chore. Without branch and commit.
124
+ For cases when the goal of the task is not committing code.
125
+ For example, you need to configure something on a remote server.
126
+ `options`: same as for `caperoma feature`
127
+ Example:
128
+ ```bash
129
+ caperoma chore -t "going downtown to pick up a new computer" -a 10
130
+ # (create a job without a commit, with the name "going downtown to pick up a new computer", started 10 minutes ago)
131
+ ```
132
+
133
+ ### Finishing tasks
134
+
135
+ #### Finish current task
136
+ `caperoma finish [optional comment]` - ends a task of any type.
137
+ Do everything that you usually do after finishing a task:
138
+ - git commit (feature, bug, fix) [commit name consists of the task title, Jira ID and Pivotal ID]
139
+ - runs style guide checks (rubocop -a)
140
+ - commit style guide corrections
141
+ - git push (feature, bug, fix)
142
+ - makes a pull request into the branch from which you started this task, e.g. if you were in "development" branch when you started a new feature, Caperoma will make a pull request into the "development" branch. (feature, bug) [the name of the pull request is the name of the task]
143
+ - changes the status of Jira task to "done"
144
+ - changes the status of Pivotal task to "finished"
145
+ - Calculates elapsed time.
146
+ - sends the time spent to Jira.
147
+ Examples:
148
+ ```bash
149
+ caperoma finish
150
+ # regular finish of any task
151
+
152
+ caperoma finish "completed"
153
+ # finish, plus send a message "completed" into Jira and the pull request.
154
+ ```
155
+
156
+ #### Abort current task
157
+ `caperoma abort [optional comment]` - finish without committing / pushing changes.
158
+ This command does what you usually need to do to interrupt the task:
159
+ - Logs time to Jira.
160
+ - changes the status of Jira task to "done"
161
+ - changes the status of Pivotal task to "finished"
162
+ - switches to the main branch
163
+ All changes to files remain uncommitted.
164
+ Examples:
165
+ ```bash
166
+ caperoma abort "can't reproduce"
167
+ # interrupt + write a comment "can't reproduce" in Jira
168
+
169
+ caperoma abort
170
+ ```
171
+
172
+ #### Abort current task without logging time
173
+ `caperoma abort_without_time [optional comment]` - same as abort, but does not log time to Jira
174
+ Only changes the status of Jira task to "done".
175
+ Pivotal task remains started.
176
+ Files remain uncommitted.
177
+
178
+ Example:
179
+ Suppose you started a task and fall asleep.
180
+ You wake up, the timer is still running.
181
+ You stop the timer without logging time to Jira:
182
+ ```
183
+ caperoma abort_without_time
184
+ ```
185
+
186
+ #### Pause current task
187
+ `caperoma pause [optional comment]` — stop work on the task, but not consider it completed (don't make a pull request).
188
+ What it will do:
189
+ - git commit (feature, bug, fix) [commit name consists of the task title, Jira ID and Pivotal ID]
190
+ - runs style guide checks (rubocop -a)
191
+ - commit style guide corrections
192
+ - git push (feature, bug, fix)
193
+ - changes the status of Jira task to "done"
194
+ - changes the status of Pivotal task to "finished"
195
+ - Calculates elapsed time.
196
+ - sends the time spent to Jira.
197
+
198
+ To finish the paused task, you will need to manually switch into its branch and inside it do `caperoma fix -t "continuation"`, and then make a pull request manually.
199
+
200
+ Finishing the task will be done by new independent tasks in Jira.
201
+
202
+ Example:
203
+ Suppose you need to urgently switch to another task.
204
+ ```bash
205
+ ...
206
+ caperoma pause
207
+
208
+ # do your urgent thing, say a meeting:
209
+ caperoma meeting -t 'an urgent meeting'
210
+ caperoma finish
211
+
212
+ # go back
213
+ git checkout my-unfinished-feature
214
+ caperoma fix -t "finishing the feature"
215
+ #... do the work
216
+ caperoma finish
217
+ # make a pull request manually
218
+ ```
219
+
220
+ ### Accounts
221
+
222
+ #### List Accounts
223
+ `caperoma accounts` - show the list of accounts (passwords are not shown).
224
+
225
+ #### Adding Accounts
226
+ `caperoma accounts [add command] [account_type] [login] [password] [assignee]` - add (or overwrite) an account of type [account_type] to the database.
227
+ `[add command]`: `-a`, `add`, `--add`, `-c`, `create`, `--create` (all these are equivalent).
228
+ `[account_type]`: One of: `--jira`, `--pivotal` `--git`, `--gmail`
229
+ `[login]` is your account login (email or username).
230
+ `[password]` for --jira and --pivotal should be api_tokens (password won't do). for --git and --gmail it should be your password.
231
+ `[assignee]` is only for --jira, for other types no need to write anything there.
232
+
233
+ Examples:
234
+ ```bash
235
+ caperoma accounts add --git login password # Add Git account
236
+ caperoma accounts create --jira login password # Add Jira account
237
+ caperoma accounts --add --pivotal login password # Add Pivotal account
238
+ caperoma accounts --create --gmail login password # Add Gmail account for reports
239
+ ```
240
+
241
+ * You can have only one account of each type.
242
+ * Adding a new account of the same type (e.g. a new --jira account) will overwrite the old account of the same type.
243
+
244
+ #### Removing accounts
245
+ `caperoma accounts [remove_command] [account_type]` - remove an account of a given type.
246
+ `[remove_command]`: `remove`, `--remove`, `-r`, `delete`, `--delete`, `-d` (all these are equivalent).
247
+ `[account_type]`: One of the following: `--jira`, `--pivotal`, `--git`, `--gmail`
248
+
249
+ Examples:
250
+ ```bash
251
+ caperoma accounts --remove --git # Remove Git account
252
+ caperoma accounts remove --jira # Remove Jira account
253
+ caperoma accounts -d --pivotal # Remove Pivotal account
254
+ caperoma accounts -delete --gmail # Remove Gmail account for reports
255
+ ```
256
+
257
+ ### Deleting all data from this computer
258
+ `caperoma delete_history` - removes the caperoma database, so deletes the information on the tasks, time spent, branch names, account credentials, etc.
259
+ Keeps the folders of your projects intact.
260
+
261
+ ### Version:
262
+ `caperoma -v` - shows Caperoma version
263
+ `caperoma version` - shows Caperoma version
264
+
265
+ ### Recipients
266
+ #### List Recipients
267
+ `caperoma recipients` - shows the list of emails on which reports should be sent.
268
+
269
+ #### Adding Report Recipients:
270
+ `caperoma recipients [add command] [email]` - adds an email of a recipient of your reports to the database.
271
+ `[add command]`: `-a`, `add`, `--add`, `-c`, `create`, `--create` (all these are equivalent).
272
+ `[email]` - the email of the recipient
273
+
274
+ Examples:
275
+ ```bash
276
+ caperoma recipients add "your_boss@domain.com"
277
+ caperoma recipients create "your_boss@domain.com"
278
+ caperoma recipients --create "your_boss@domain.com"
279
+ caperoma recipients -a "your_techlead@domain.com"
280
+ caperoma recipients --add "your_techlead@domain.com"
281
+ ```
282
+
283
+ #### Removing Report Recipients
284
+ `caperoma recipients [remove command] [email]` - removes the `[email]` of the recipient of your reports from the database.
285
+ `[remove command]`: `remove`, `--remove`, `-r`, `delete`, `--delete`, `-d` (all these are equivalent).
286
+
287
+ Examples:
288
+ ```bash
289
+ caperoma recipients remove "your_boss@domain.com"
290
+ caperoma recipients -r "your_techlead@domain.com"
291
+ caperoma recipients --delete "your_supervisor@domain.com"
292
+ ```
293
+
294
+ ### Automatic Reports
295
+ `caperoma report auto on` - turns on automatic report sending to all your recipients.
296
+ `caperoma report auto off` - turn off automatic report sending to all your recipients.
297
+
298
+ ### Sending Reports Manually
299
+ `caperoma report daily` - send a daily report right now
300
+ `caperoma report -d` - send a daily report right now
301
+
302
+ `caperoma report three_day` - send a three-day report right now
303
+ `caperoma report -t` - send a three-day report right now
304
+
305
+ `caperoma report weekly` - send a weekly report right now
306
+ `caperoma report -w` - send a weekly report right now
307
+
308
+ ### Support me on Patreon.
309
+ https://www.patreon.com/sergevinogradoff
310
+
311
+ ### Contributing to caperoma
312
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
313
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
314
+ * Fork the project.
315
+ * Start a feature/bugfix branch.
316
+ * Commit and push until you are happy with your contribution.
317
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
318
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your version, or is otherwise necessary, that is fine, but please isolate to its commit so I can cherry-pick around it.
319
+
320
+ ### Copyright
321
+ Copyright (c) 2014-2019 Serge Vinogradoff. See LICENSE.txt for further details.
data/README.md ADDED
@@ -0,0 +1,528 @@
1
+ # Caperoma
2
+
3
+ ### Automate your workflow with Ruby / Git / Jira / PivotalTracker.
4
+
5
+ ## Support me on Patreon.
6
+ https://www.patreon.com/sergevinogradoff
7
+
8
+ ## The idea.
9
+ Caperoma is a "full-cycle" command.
10
+ It solves everything that you need to do before you start working on the task, and everything you need to do after you finish the feature.
11
+ Caperoma solves for you:
12
+ - pulling the latest code from upstream before you start working
13
+ - remembering from which branch you started the feature to later make a pull request into it
14
+ - creating & starting tasks in Jira
15
+ - creating & starting tasks in Pivotal
16
+ - naming branches
17
+ - adding Jira ID into the branch name
18
+ - style guide checks
19
+ - commits
20
+ - naming commits
21
+ - adding Jira ID into commit name
22
+ - adding Pivotal ID into commit name
23
+ - git pushes
24
+ - pull requests into correct branches
25
+ - stopping tasks in Jira
26
+ - stopping tasks in Pivotal
27
+ - tracking time
28
+ - logging time to Jira
29
+ - switching back into the original branch
30
+ and many more decisions that you often don't realize, and which you can forget hundreds of times during the time of working on the project.
31
+
32
+ This saves a ton of time.
33
+ You don't get distracted on things that you have to do thousands of times per year.
34
+ You focus only on solving tasks.
35
+
36
+ ## Demo
37
+ You need to make a feature.
38
+ ```bash
39
+ caperoma feature -t "your first feature"
40
+ touch ./your_first_feature.rb
41
+ rspec .
42
+ caperoma finish
43
+ ```
44
+ That's it.
45
+ Open Github and you'll see a pull request into the branch from which you started.
46
+ The branch and the commit have correct names.
47
+ PivotalTracker has a new task.
48
+ Jira received the time you spent.
49
+
50
+ Caperoma did tens of steps for you.
51
+
52
+ You would spend about 10 minutes manually pressing the buttons in Github, Jira and Pivotal and entering these commands into the console.
53
+ 10 minutes for each task, in a project with 1000 tasks, you save up to 20% of the project budget that you did not spend on a routine.
54
+ Thanks to Caperoma, you can spend this 20% on new features or fixing bugs.
55
+ Not to mention the invaluable savings of brain resources that allow you to easily work on larger projects.
56
+
57
+ At the same time, tracking systems receive the most accurate information about the work done for further statistics.
58
+
59
+ ## Demo 2
60
+ You urgently need to fix the bug.
61
+ ```bash
62
+ caperoma bug -t "your urgent bugfix"
63
+ touch ./your_urgent_bugfix.rb
64
+ caperoma finish
65
+ ```
66
+ Every second of delay brings company losses which are often much higher than the price of the bug fix.
67
+ Caperoma did all the management for you.
68
+ You did not have to do manually dozens of these steps in a hurry (pull requests, time tracking, etc.).
69
+ You also did not have to sacrifice conventions for the sake of speed (which often turns into a bad habit, driving a project to a standstill).
70
+ You implemented the solution, but on the way to it, you were secured by the Caperoma's algorithms.
71
+
72
+ ## Task types supported by Caperoma
73
+
74
+ - ***Feature*** - a task of a "feature" type with a commit in a new branch.
75
+ - ***Bug*** - a task of a "bug" type with a commit in a new git branch.
76
+ - ***Fix*** - a task with a commit in the current git branch.
77
+ - ***Chore*** - a task without a commit.
78
+ - ***Meeting***
79
+
80
+ Jira IDs for each of them, as well as other settings, can be set in `Capefile`.
81
+
82
+ ## Ubuntu Setup
83
+ ```bash
84
+ sudo apt install -y sqlite3 crontab git
85
+ ```
86
+
87
+ ## Installation
88
+ ```bash
89
+ gem install caperoma
90
+
91
+ caperoma setup # initializes the database
92
+
93
+ # Allow Caperoma to make pull requests and start tasks on your behalf.
94
+ caperoma accounts add --jira login api_access_token assignee
95
+ caperoma accounts add --pivotal login api_access_token
96
+ caperoma accounts add --git login password
97
+ # You can find your API tokens on the settings pages in Jira and PivotalTracker.
98
+ # Usually, on these pages:
99
+ # https://www.pivotaltracker.com/profile
100
+ # https://id.atlassian.com/manage/api-tokens
101
+
102
+ # All the data is stored only on your computer (in the database ~/.caperoma.sqlite3 that was created with `caperoma setup` command).
103
+
104
+ # Also, set up your Github using SSH keys so that when you do "git push", Github wouldn't ask for a password.
105
+ ```
106
+
107
+ ## Setting up your project:
108
+ ```bash
109
+ cd ~/myproject # open your project
110
+ caperoma init # create Capefile
111
+ vim Capefile # open Capefile to enter the settings.
112
+ ```
113
+
114
+ ## Demo 3: A simple feature.
115
+ ```bash
116
+ caperoma feature -t "your first feature"
117
+ # Created a task in Jira with the title "your first feature".
118
+ # Took the ID of the created Jira feature (i.e. PRJ -123).
119
+ # Generated the name of the git branch considering Jira ID and task name (i.e. prj-123-your-first-feature).
120
+ # Pulled the latest version of the current branch from upstream (i.e. git fetch && git rebase origin/master).
121
+ # Switched into a new git branch with the mentioned name (i.e. git checkout -b prj-123-your-first-feature).
122
+ # Status of the task in Jira changed to "in progress".
123
+ # Started the timer.
124
+
125
+ touch ./your_first_feature.rb
126
+ # Created an empty file ./your_first_feature.rb.
127
+
128
+ caperoma finish
129
+ # Generated the name of the commit taking into account the IDs (i.e. "[PRJ-123] Your first feature").
130
+ # Commit changes (i.e. git add -A && git commit -m "[PRJ-123] Your first feature").
131
+ # Running a code check for compliance with standards (i.e. rubocop -a).
132
+ # Commit code standardization (i.e. git add -A && git commit -m "[PRJ-123] Applying good practices").
133
+ # Upload a new branch to the repository (i.e., git push --set-upstream origin prj-123-your-first-feature).
134
+ # Sent a pull request on your behalf into the branch from which you started working on this feature (i.e. if you were in 'develop' branch at the time you called 'caperoma feature', a pull request will be sent into 'develop' branch from the branch prj-123-your-first-feature).
135
+ # Timer stopped.
136
+ # Duration of work sent to Jira.
137
+ # Status of the task in Jira changed to "done".
138
+ # Switched back to the branch from which the work was started (for example, git checkout master).
139
+ ```
140
+
141
+ ## Demo 4: A feature with Pivotal ID and your description:
142
+ ```bash
143
+ caperoma feature --t "your second feature" -p 12345678
144
+ # Same as before, but also:
145
+ # A Pivotal task was launched with ID #12345678.
146
+
147
+ touch ./your_first_feature.rb
148
+
149
+ caperoma finish "I made a new file"
150
+ # Same as before, but also:
151
+ # The Pivotal task #12345678 changed the status to "finished".
152
+ # The commit now contains Pivotal ID: "[PRJ-123][#12345678] Your second feature".
153
+ # In the pull request now contains a link to Pivotal task #12345678 (this link: https://www.pivotaltracker.com/story/show/12345678) and the description "I made a new file".
154
+ # The comment "I made a new file" added to Jira.
155
+ ```
156
+
157
+ ## Demo 5: A feature with adding time (in minutes):
158
+ ```bash
159
+ caperoma feature -t "your third feature" -p 12345678 -a 23
160
+ # same as before (Demo 4), but notice -a 23 parameter.
161
+ # -a 23 says to add 23 minutes on top of time recorded by the timer.
162
+ # The alternative version of this parameter is: --additional_time 23
163
+
164
+ touch ./your_first_feature.rb
165
+ caperoma finish
166
+ # Time sent to Jira will be 23 minutes more than the timer recorded.
167
+ # I.e. if you spent 10 minutes on this task, Jira will receive 33 minutes (10+23, "timer time" + "additional time").
168
+ ```
169
+
170
+ # Caperoma can send reports to your boss about what tasks are finished and how much time was spent on each one and all of them together (every day / every 3 days / every week).
171
+ ```bash
172
+ # Setup:
173
+
174
+ # Add your email (only Gmail is supported):
175
+ caperoma accounts add --gmail email password
176
+
177
+ # Add recipients:
178
+ caperoma recipients add your_supervisor@domain.com
179
+ caperoma recipients add your_team_lead@domain.com
180
+
181
+ # Turn on automatic reports:
182
+ caperoma report auto on
183
+ ```
184
+ The recipients will get:
185
+ - a daily report every day
186
+ - a 3-day report on Wed and Fri
187
+ - a weekly report on Fri
188
+
189
+ (8 reports per week in total)
190
+ (they are sent at 5 pm, so at that time the computer should be on, as the reports are using crontab).
191
+
192
+ The format of the emails is a table that lists all the tasks during the mentioned period:
193
+ - Jira ID (with a link).
194
+ - Pivotal ID (with a link).
195
+ - Task title.
196
+ - The amount of time spent on the task.
197
+ Plus the total amount of time spent on them.
198
+
199
+ Each report includes only the tasks that were not yet included in the previous reports of this type.
200
+ I.e. if you finished the feature "X" and sent a "daily report" that includes it, then your next "daily report" will not include it (even if you send the second one immediately after the first one), however it will still be included in your next "3 day report" and into your next "weekly report".
201
+
202
+ You no longer need to spend 3 to 5 unpaid hours on Friday night, making a report in which you are trying to remember which features you created 4 days ago (by the end of the week there are already so many that you probably lost count of half of them).
203
+
204
+ The reports can be sent manually:
205
+ ```bash
206
+ caperoma report daily # sends daily report now
207
+ caperoma report three_day # sends 3-day report now
208
+ caperoma report weekly # sends weekly report now
209
+ ```
210
+
211
+ ## List of all the commands:
212
+ ### Setup
213
+ `caperoma setup` - creates the database (~/.caperoma.sqlite3) on your computer.
214
+
215
+ ### Initialize
216
+ `caperoma init` - initializes Caperoma inside a project (creates Capefile).
217
+
218
+ ### Get Issue IDs from Jira
219
+ `caperoma get_jira_issue_type_ids` - see what issue IDs does your Jira support, to put them into the Capefile.
220
+
221
+ ### Status
222
+ `caperoma status` - shows a task you are working on now.
223
+ Example:
224
+ ```bash
225
+ $ caperoma status
226
+ You are working on:
227
+ Title: Some task
228
+ Type: Feature
229
+ Jira ID: PRJ-24 (https://example.atlassian.net/browse/PRJ-24)
230
+ Pivotal ID: 167396414 (https://www.pivotaltracker.com/story/show/167396414)
231
+ Time spent at the moment: 2h 50m
232
+ Pull request will be sent to this branch: master
233
+
234
+ $ caperoma finish
235
+ ...
236
+ $ caperoma status
237
+ You are not working on anything now.
238
+ ```
239
+
240
+ `caperoma projects` - shows the list of projects on this computer.
241
+ Example:
242
+ ```bash
243
+ $ caperoma projects
244
+ 1) Good project (jira_project_id: 10000)
245
+ 2) Best project (jira_project_id: 10014)
246
+ 3) Cosmic project (jira_project_id: 10534)
247
+ ```
248
+
249
+ ### Starting Tasks
250
+ #### Start a Feature
251
+ `caperoma feature [options]` - Creates a feature in a new branch:
252
+ - Downloads the latest version of the code from Github.
253
+ - Creates and starts a task in Jira.
254
+ - Creates and starts a task in Pivotal.
255
+ - Generates the name of the branch.
256
+ - Remembers from which branch you started working.
257
+ - Switches into new a branch.
258
+ - Starts the timer.
259
+ - *If the -p parameter is specified, Caperoma starts Pivotal task with this ID.*
260
+ - *If the -p parameter is not specified, Caperoma will create a new task in Pivotal, start it and use its ID.*
261
+ - *The creation of certain types of tasks in Pivotal (when -p is absent) can be turned on or off in Capefile.*
262
+ - *If you are already working on something, you won't be able to start a new task. You will have to finish or pause the current task.*
263
+
264
+ `options`:
265
+ `-t, --title` - The name of the feature (for a commit, pull request, tasks in Jira and Pivotal). ` -t` and `--title` are different versions of the same option.
266
+ `-d, --description` - The description (for a task in Jira and Pivotal).
267
+ `-p, -ptid, --pivotal_task_id` - ID of task in Pivotal (automatically gets started/finished during the work on it in Caperoma).
268
+ `-a, --additional_time` - Additional time (in minutes). Intended for cases when you want to indicate that you started working on it X minutes ago (X minutes before starting Caperoma timer). For example, for 1 hour you tried to reproduce the problem before you realized that you need to start a new task. Or if you forgot to start Caperoma. Additional time is always in minutes. Adding 125 minutes (-a 125) will mean that you spent 2h 5m on the task before turning on Caperoma timer.
269
+
270
+ *The order of options is not important.
271
+ Immediately after the operator must be a value.*
272
+
273
+ Examples:
274
+ ```bash
275
+ caperoma feature -t "my feature"
276
+ # (start the feature in the new branch)
277
+
278
+ caperoma feature -t "my feature" -a 10
279
+ # (start the feature in the new branch, and add 10 minutes to it at the end)
280
+
281
+ caperoma feature -t "title" -d "description" -p 4830184 -a 48
282
+ # (create a feature with the description of "description", Pivotal ID #4830184, and add 48 minutes)
283
+
284
+ caperoma feature --title "title" --description "description" --pivotal_task_id 1000001 --additional_time 5
285
+ # (create the feature "title" with the description of "description" and Pivotal ID #1000001, on which you started working 5 minutes ago)
286
+ ```
287
+
288
+ #### Start a Bug
289
+ `caperoma bug [options]` - Creates a bug in the new branch.
290
+ Does almost the same thing as `caperoma feature`, just starts everywhere the tasks of a type "bug".
291
+ `options`: same as for `caperoma feature`
292
+ Example:
293
+ ```bash
294
+ caperoma bug -t "something isn't working" -a 20
295
+ # (starts a "bug" called "something isn't working" in the new branch and adds 20 minutes to the timer)
296
+ ```
297
+
298
+ #### Start a Fix
299
+ `caperoma fix [options]` - Creates a fix in the CURRENT branch, doing at the end just "git push" into the branch, not a pull request.
300
+ Everything else is almost the same as `caperoma feature`.
301
+ This command is created for the cases when you already have a remote branch, or if you already made a pull request, and you need to go back to it and add something.
302
+ This command considers the specifics of work with open pull requests and remote branches:
303
+ - Downloads the latest version of the current branch before starting the work and again before pushing the changes.
304
+ - Changes are made in a new commit instead of a potentially conflicting amend.
305
+ - Leaves the title and description of pull requests.
306
+ `options`: same as for `caperoma feature`
307
+ Example:
308
+ ```bash
309
+ caperoma fix --title "Spelling fix" -d "Fix the spelling mistake"
310
+ # (in the current branch - into which you manually switched - start a fix with the name "Spelling fix" and the description "Fix the spelling mistake")
311
+ ```
312
+
313
+ #### Start a Meeting
314
+ `caperoma meeting [options]` - Creates a meeting.
315
+ For cases when you need to record to Jira the facts of talking on the phone with your coworkers.
316
+ Jira ID for the meeting (as for other types of tasks) can be set in Capefile (by default it has the same value as a chore).
317
+ In Pivotal creating meetings is off by default. It can be turned on in Capefile. If it is on, Caperoma will create "chores".
318
+ `options`: same as for `caperoma feature`
319
+
320
+ This feature is sometimes used to automate logging phone calls to Jira.
321
+ For example, in Skype, you could configure it to call the command `caperoma meeting -t "meeting"` when you pick up the phone and call `caperoma finish` when you hang up.
322
+ As a result, Skype conversations will automatically be entered into Jira with accuracy up to a minute.
323
+ 5-10 people can participate in a conference call, so if each of them sets up Caperoma, you can save a couple of man-hours for each call.
324
+ Example:
325
+ ```bash
326
+ caperoma meeting -t "title"
327
+ ```
328
+
329
+ #### Start a Chore
330
+ `caperoma chore [options]` - Creates a chore. Without branch and commit.
331
+ For cases when the goal of the task is not committing code.
332
+ For example, you need to configure something on a remote server.
333
+ `options`: same as for `caperoma feature`
334
+ Example:
335
+ ```bash
336
+ caperoma chore -t "going downtown to pick up a new computer" -a 10
337
+ # (create a job without a commit, with the name "going downtown to pick up a new computer", started 10 minutes ago)
338
+ ```
339
+
340
+ ### Finishing tasks
341
+
342
+ #### Finish current task
343
+ `caperoma finish [optional comment]` - ends a task of any type.
344
+ Do everything that you usually do after finishing a task:
345
+ - git commit (feature, bug, fix) [commit name consists of the task title, Jira ID and Pivotal ID]
346
+ - runs style guide checks (rubocop -a)
347
+ - commit style guide corrections
348
+ - git push (feature, bug, fix)
349
+ - makes a pull request into the branch from which you started this task, e.g. if you were in "development" branch when you started a new feature, Caperoma will make a pull request into the "development" branch. (feature, bug) [the name of the pull request is the name of the task]
350
+ - changes the status of Jira task to "done"
351
+ - changes the status of Pivotal task to "finished"
352
+ - Calculates elapsed time.
353
+ - sends the time spent to Jira.
354
+ Examples:
355
+ ```bash
356
+ caperoma finish
357
+ # regular finish of any task
358
+
359
+ caperoma finish "completed"
360
+ # finish, plus send a message "completed" into Jira and the pull request.
361
+ ```
362
+
363
+ #### Abort current task
364
+ `caperoma abort [optional comment]` - finish without committing / pushing changes.
365
+ This command does what you usually need to do to interrupt the task:
366
+ - Logs time to Jira.
367
+ - changes the status of Jira task to "done"
368
+ - changes the status of Pivotal task to "finished"
369
+ - switches to the main branch
370
+ All changes to files remain uncommitted.
371
+ Examples:
372
+ ```bash
373
+ caperoma abort "can't reproduce"
374
+ # interrupt + write a comment "can't reproduce" in Jira
375
+
376
+ caperoma abort
377
+ ```
378
+
379
+ #### Abort current task without logging time
380
+ `caperoma abort_without_time [optional comment]` - same as abort, but does not log time to Jira
381
+ Only changes the status of Jira task to "done".
382
+ Pivotal task remains started.
383
+ Files remain uncommitted.
384
+
385
+ Example:
386
+ Suppose you started a task and fall asleep.
387
+ You wake up, the timer is still running.
388
+ You stop the timer without logging time to Jira:
389
+ ```
390
+ caperoma abort_without_time
391
+ ```
392
+
393
+ #### Pause current task
394
+ `caperoma pause [optional comment]` — stop work on the task, but not consider it completed (don't make a pull request).
395
+ What it will do:
396
+ - git commit (feature, bug, fix) [commit name consists of the task title, Jira ID and Pivotal ID]
397
+ - runs style guide checks (rubocop -a)
398
+ - commit style guide corrections
399
+ - git push (feature, bug, fix)
400
+ - changes the status of Jira task to "done"
401
+ - changes the status of Pivotal task to "finished"
402
+ - Calculates elapsed time.
403
+ - sends the time spent to Jira.
404
+
405
+ To finish the paused task, you will need to manually switch into its branch and inside it do `caperoma fix -t "continuation"`, and then make a pull request manually.
406
+
407
+ Finishing the task will be done by new independent tasks in Jira.
408
+
409
+ Example:
410
+ Suppose you need to urgently switch to another task.
411
+ ```bash
412
+ ...
413
+ caperoma pause
414
+
415
+ # do your urgent thing, say a meeting:
416
+ caperoma meeting -t 'an urgent meeting'
417
+ caperoma finish
418
+
419
+ # go back
420
+ git checkout my-unfinished-feature
421
+ caperoma fix -t "finishing the feature"
422
+ #... do the work
423
+ caperoma finish
424
+ # make a pull request manually
425
+ ```
426
+
427
+ ### Accounts
428
+
429
+ #### List Accounts
430
+ `caperoma accounts` - show the list of accounts (passwords are not shown).
431
+
432
+ #### Adding Accounts
433
+ `caperoma accounts [add command] [account_type] [login] [password] [assignee]` - add (or overwrite) an account of type [account_type] to the database.
434
+ `[add command]`: `-a`, `add`, `--add`, `-c`, `create`, `--create` (all these are equivalent).
435
+ `[account_type]`: One of: `--jira`, `--pivotal` `--git`, `--gmail`
436
+ `[login]` is your account login (email or username).
437
+ `[password]` for --jira and --pivotal should be api_tokens (password won't do). for --git and --gmail it should be your password.
438
+ `[assignee]` is only for --jira, for other types no need to write anything there.
439
+
440
+ Examples:
441
+ ```bash
442
+ caperoma accounts add --git login password # Add Git account
443
+ caperoma accounts create --jira login password # Add Jira account
444
+ caperoma accounts --add --pivotal login password # Add Pivotal account
445
+ caperoma accounts --create --gmail login password # Add Gmail account for reports
446
+ ```
447
+
448
+ * You can have only one account of each type.
449
+ * Adding a new account of the same type (e.g. a new --jira account) will overwrite the old account of the same type.
450
+
451
+ #### Removing accounts
452
+ `caperoma accounts [remove_command] [account_type]` - remove an account of a given type.
453
+ `[remove_command]`: `remove`, `--remove`, `-r`, `delete`, `--delete`, `-d` (all these are equivalent).
454
+ `[account_type]`: One of the following: `--jira`, `--pivotal`, `--git`, `--gmail`
455
+
456
+ Examples:
457
+ ```bash
458
+ caperoma accounts --remove --git # Remove Git account
459
+ caperoma accounts remove --jira # Remove Jira account
460
+ caperoma accounts -d --pivotal # Remove Pivotal account
461
+ caperoma accounts -delete --gmail # Remove Gmail account for reports
462
+ ```
463
+
464
+ ### Deleting all data from this computer
465
+ `caperoma delete_history` - removes the caperoma database, so deletes the information on the tasks, time spent, branch names, account credentials, etc.
466
+ Keeps the folders of your projects intact.
467
+
468
+ ### Version:
469
+ `caperoma -v` - shows Caperoma version
470
+ `caperoma version` - shows Caperoma version
471
+
472
+ ### Recipients
473
+ #### List Recipients
474
+ `caperoma recipients` - shows the list of emails on which reports should be sent.
475
+
476
+ #### Adding Report Recipients:
477
+ `caperoma recipients [add command] [email]` - adds an email of a recipient of your reports to the database.
478
+ `[add command]`: `-a`, `add`, `--add`, `-c`, `create`, `--create` (all these are equivalent).
479
+ `[email]` - the email of the recipient
480
+
481
+ Examples:
482
+ ```bash
483
+ caperoma recipients add "your_boss@domain.com"
484
+ caperoma recipients create "your_boss@domain.com"
485
+ caperoma recipients --create "your_boss@domain.com"
486
+ caperoma recipients -a "your_techlead@domain.com"
487
+ caperoma recipients --add "your_techlead@domain.com"
488
+ ```
489
+
490
+ #### Removing Report Recipients
491
+ `caperoma recipients [remove command] [email]` - removes the `[email]` of the recipient of your reports from the database.
492
+ `[remove command]`: `remove`, `--remove`, `-r`, `delete`, `--delete`, `-d` (all these are equivalent).
493
+
494
+ Examples:
495
+ ```bash
496
+ caperoma recipients remove "your_boss@domain.com"
497
+ caperoma recipients -r "your_techlead@domain.com"
498
+ caperoma recipients --delete "your_supervisor@domain.com"
499
+ ```
500
+
501
+ ### Automatic Reports
502
+ `caperoma report auto on` - turns on automatic report sending to all your recipients.
503
+ `caperoma report auto off` - turn off automatic report sending to all your recipients.
504
+
505
+ ### Sending Reports Manually
506
+ `caperoma report daily` - send a daily report right now
507
+ `caperoma report -d` - send a daily report right now
508
+
509
+ `caperoma report three_day` - send a three-day report right now
510
+ `caperoma report -t` - send a three-day report right now
511
+
512
+ `caperoma report weekly` - send a weekly report right now
513
+ `caperoma report -w` - send a weekly report right now
514
+
515
+ ### Support me on Patreon.
516
+ https://www.patreon.com/sergevinogradoff
517
+
518
+ ### Contributing to caperoma
519
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
520
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
521
+ * Fork the project.
522
+ * Start a feature/bugfix branch.
523
+ * Commit and push until you are happy with your contribution.
524
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
525
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your version, or is otherwise necessary, that is fine, but please isolate to its commit so I can cherry-pick around it.
526
+
527
+ ### Copyright
528
+ Copyright (c) 2014-2019 Serge Vinogradoff. See LICENSE.txt for further details.