lazylead 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/ .dockerignore +12 -0
  3. data/.0pdd.yml +5 -0
  4. data/.circleci/config.yml +50 -0
  5. data/.circleci/release_image.sh +13 -0
  6. data/.circleci/validate.sh +10 -0
  7. data/.docker/Dockerfile +31 -0
  8. data/.docker/build.sh +6 -0
  9. data/.docker/docker-compose.yml +23 -0
  10. data/.docker/readme.md +21 -0
  11. data/.gitattributes +9 -0
  12. data/.github/CODE_OF_CONDUCT.md +76 -0
  13. data/.github/CONTRIBUTING.md +9 -0
  14. data/.github/ISSUE_TEMPLATE.md +14 -0
  15. data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  16. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  17. data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  18. data/.github/tasks.yml +24 -0
  19. data/.github/trello.md +18 -0
  20. data/.gitignore +12 -0
  21. data/.pdd +5 -0
  22. data/.rubocop.yml +87 -0
  23. data/.ruby-version +1 -0
  24. data/.rultor.yml +31 -0
  25. data/.simplecov +16 -0
  26. data/.travis.yml +16 -0
  27. data/Gemfile +27 -0
  28. data/Guardfile +33 -0
  29. data/Rakefile +93 -0
  30. data/appveyor.yml +50 -0
  31. data/bin/.ruby-version +1 -0
  32. data/bin/lazylead +99 -0
  33. data/build.sh +6 -0
  34. data/deploy.sh +16 -0
  35. data/lazylead.gemspec +106 -0
  36. data/lib/lazylead.rb +52 -0
  37. data/lib/lazylead/allocated.rb +56 -0
  38. data/lib/lazylead/cli/app.rb +87 -0
  39. data/lib/lazylead/confluence.rb +157 -0
  40. data/lib/lazylead/email.rb +74 -0
  41. data/lib/lazylead/exchange.rb +83 -0
  42. data/lib/lazylead/log.rb +71 -0
  43. data/lib/lazylead/model.rb +140 -0
  44. data/lib/lazylead/postman.rb +78 -0
  45. data/lib/lazylead/salt.rb +91 -0
  46. data/lib/lazylead/schedule.rb +88 -0
  47. data/lib/lazylead/smtp.rb +82 -0
  48. data/lib/lazylead/system/empty.rb +36 -0
  49. data/lib/lazylead/system/fake.rb +41 -0
  50. data/lib/lazylead/system/jira.rb +249 -0
  51. data/lib/lazylead/system/synced.rb +41 -0
  52. data/lib/lazylead/task/alert.rb +105 -0
  53. data/lib/lazylead/task/confluence_ref.rb +59 -0
  54. data/lib/lazylead/task/echo.rb +38 -0
  55. data/lib/lazylead/task/fix_version.rb +79 -0
  56. data/lib/lazylead/task/missing_comment.rb +53 -0
  57. data/lib/lazylead/version.rb +27 -0
  58. data/lib/messages/due_date_expired.erb +96 -0
  59. data/lib/messages/illegal_fixversion_change.erb +120 -0
  60. data/lib/messages/missing_comment.erb +128 -0
  61. data/license.txt +21 -0
  62. data/readme.md +160 -0
  63. data/test/lazylead/allocated_test.rb +51 -0
  64. data/test/lazylead/cli/app_test.rb +74 -0
  65. data/test/lazylead/confluence_test.rb +55 -0
  66. data/test/lazylead/exchange_test.rb +68 -0
  67. data/test/lazylead/model_test.rb +65 -0
  68. data/test/lazylead/salt_test.rb +42 -0
  69. data/test/lazylead/smoke_test.rb +38 -0
  70. data/test/lazylead/smtp_test.rb +65 -0
  71. data/test/lazylead/system/jira_test.rb +110 -0
  72. data/test/lazylead/task/confluence_ref_test.rb +66 -0
  73. data/test/lazylead/task/duedate_test.rb +126 -0
  74. data/test/lazylead/task/echo_test.rb +34 -0
  75. data/test/lazylead/task/fix_version_test.rb +52 -0
  76. data/test/lazylead/task/missing_comment_test.rb +56 -0
  77. data/test/lazylead/version_test.rb +36 -0
  78. data/test/sqlite_test.rb +80 -0
  79. data/test/test.rb +103 -0
  80. data/todo.yml +16 -0
  81. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +63 -0
  82. data/upgrades/sqlite/999.testdata.sql +39 -0
  83. metadata +815 -0
@@ -0,0 +1,120 @@
1
+ <html>
2
+ <head>
3
+ <style>
4
+ /* CSS styles taken from https://github.com/yegor256/tacit */
5
+ th {
6
+ font-weight: 600
7
+ }
8
+
9
+ table tr {
10
+ border-bottom-width: 2.16px
11
+ }
12
+
13
+ table tr th {
14
+ border-bottom-width: 2.16px
15
+ }
16
+
17
+ table tr td, table tr th {
18
+ overflow: hidden;
19
+ padding: 5.4px 3.6px
20
+ }
21
+
22
+ a {
23
+ color: #275a90;
24
+ text-decoration: none
25
+ }
26
+
27
+ a:hover {
28
+ text-decoration: underline
29
+ }
30
+
31
+ pre, code, kbd, samp, var, output {
32
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
33
+ font-size: 13px
34
+ }
35
+
36
+ pre code {
37
+ background: none;
38
+ border: 0;
39
+ line-height: 29.7px;
40
+ padding: 0
41
+ }
42
+
43
+ code, kbd {
44
+ background: #daf1e0;
45
+ border-radius: 3.6px;
46
+ color: #2a6f3b;
47
+ display: inline-block;
48
+ line-height: 18px;
49
+ padding: 3.6px 6.3px 2.7px
50
+ }
51
+
52
+ * {
53
+ border: 0;
54
+ border-collapse: separate;
55
+ border-spacing: 0;
56
+ box-sizing: border-box;
57
+ margin: 0;
58
+ max-width: 100%;
59
+ padding: 0;
60
+ vertical-align: baseline;
61
+ font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
62
+ font-size: 13px;
63
+ font-stretch: normal;
64
+ font-style: normal;
65
+ font-weight: 400;
66
+ line-height: 29.7px
67
+ }
68
+
69
+ html, body {
70
+ width: 100%
71
+ }
72
+
73
+ html {
74
+ height: 100%
75
+ }
76
+
77
+ body {
78
+ background: #fff;
79
+ color: #1a1919;
80
+ padding: 36px
81
+ }
82
+ </style>
83
+ <title>Not authorized "Fix Version" change</title>
84
+ </head>
85
+ <body>
86
+ <p>Hi,</p>
87
+
88
+ <p>The <span style='font-weight:bold'>'Fix Version'</span> for the following
89
+ ticket(s) changed by not authorized person(s):</p>
90
+ <table>
91
+ <tr>
92
+ <th>Key</th>
93
+ <th>Priority</th>
94
+ <th>When</th>
95
+ <th>Who</th>
96
+ <th>Reporter</th>
97
+ <th>Summary</th>
98
+ </tr>
99
+ <% versions.each do |v| %>
100
+ <tr>
101
+ <td><a href='<%= v.issue.url %>'><%= v.issue.key %></a></td>
102
+ <td><%= v.issue.priority %></td>
103
+ <td><%= DateTime.parse(v.last["created"])
104
+ .strftime('%d-%b-%Y %I:%M:%S %p') %></td>
105
+ <td><span style='color: red'><%= v.last["author"]["displayName"] %></span>
106
+ (<%= v.last["author"]["name"] %>)
107
+ </td>
108
+ <td><%= v.issue.reporter.name %></td>
109
+ <td><%= v.issue.summary %></td>
110
+ </tr>
111
+ <% end %>
112
+ </table>
113
+
114
+ <p>Authorized person(s) are: <code><%= allowed %></code>.</p>
115
+
116
+ <p>Posted by
117
+ <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
118
+ </p>
119
+ </body>
120
+ </html>
@@ -0,0 +1,128 @@
1
+ <html>
2
+ <head>
3
+ <style> /* CSS styles taken from https://github.com/yegor256/tacit */
4
+ th {
5
+ font-weight: 600
6
+ }
7
+
8
+ table tr {
9
+ border-bottom-width: 2.16px
10
+ }
11
+
12
+ table tr th {
13
+ border-bottom-width: 2.16px
14
+ }
15
+
16
+ table tr td, table tr th {
17
+ overflow: hidden;
18
+ padding: 5.4px 3.6px
19
+ }
20
+
21
+ td:nth-child(1), td:nth-child(2), td:nth-child(4), td:nth-child(5) {
22
+ width: 100px;
23
+ min-width: 30px;
24
+ }
25
+
26
+ pre, code, kbd, samp, var, output {
27
+ font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;
28
+ font-size: 14.4px
29
+ }
30
+
31
+ pre code {
32
+ background: none;
33
+ border: 0;
34
+ line-height: 29.7px;
35
+ padding: 0
36
+ }
37
+
38
+ code, kbd {
39
+ background: #daf1e0;
40
+ border-radius: 3.6px;
41
+ color: #2a6f3b;
42
+ display: inline-block;
43
+ line-height: 18px;
44
+ padding: 3.6px 6.3px 2.7px;
45
+ text-align: left;
46
+ }
47
+
48
+ a {
49
+ color: #275a90;
50
+ text-decoration: none
51
+ }
52
+
53
+ a:hover {
54
+ text-decoration: underline
55
+ }
56
+
57
+ td {
58
+ vertical-align: top;
59
+ }
60
+
61
+ * {
62
+ border: 0;
63
+ border-collapse: separate;
64
+ border-spacing: 0;
65
+ box-sizing: border-box;
66
+ margin: 0;
67
+ max-width: 100%;
68
+ padding: 0;
69
+ vertical-align: baseline;
70
+ font-family: system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif;
71
+ font-size: 13px;
72
+ font-stretch: normal;
73
+ font-style: normal;
74
+ font-weight: 400;
75
+ line-height: 29.7px
76
+ }
77
+
78
+ html, body {
79
+ width: 100%
80
+ }
81
+
82
+ html {
83
+ height: 100%
84
+ }
85
+
86
+ body {
87
+ background: #fff;
88
+ color: #1a1919;
89
+ padding: 36px
90
+ }
91
+ </style>
92
+ <title>Missing comments</title>
93
+ </head>
94
+ <body>
95
+ <p>Hi <%= addressee %>,</p>
96
+
97
+ <p>The following ticket(s) has missing <%= details %>:</p>
98
+ <table>
99
+ <tr>
100
+ <th>Key</th>
101
+ <th>Due date</th>
102
+ <th>Priority</th>
103
+ <th>Assignee</th>
104
+ <th>Reporter</th>
105
+ <th>Summary</th>
106
+ <th>Last comments</th>
107
+ </tr>
108
+ <% comments.each do |comment| %>
109
+ <tr>
110
+ <td><a href="<%= comment.issue.url %>"><%= comment.issue.key %></a></td>
111
+ <td><%= comment.issue.duedate %></td>
112
+ <td><%= comment.issue.priority %></td>
113
+ <td><%= comment.issue.assignee.name %></td>
114
+ <td><%= comment.issue.reporter.name %></td>
115
+ <td><%= comment.issue.summary %></td>
116
+ <td>
117
+ <% comment.last(5).each do |c| %>
118
+ <code><%= c.split("\r\n").map(&:strip).reject(&:blank?).join("<br/>") %></code>
119
+ <% end %>
120
+ </td>
121
+ </tr>
122
+ <% end %>
123
+ </table>
124
+ <p>Posted by
125
+ <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
126
+ </p>
127
+ </body>
128
+ </html>
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2019-2020 Yurii Dubinka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"),
7
+ to deal in the Software without restriction, including without limitation
8
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ and/or sell copies of the Software, and to permit persons to whom
10
+ the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21
+ OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,160 @@
1
+ [![Versions](https://img.shields.io/badge/semver-2.0-green)](https://semver.org/spec/v2.0.0.html)
2
+ [![Gem Version](https://badge.fury.io/rb/lazylead.svg)](https://rubygems.org/gems/lazylead)
3
+ [![Downloads](https://ruby-gem-downloads-badge.herokuapp.com/lazylead?type=total)](https://rubygems.org/gems/lazylead)
4
+ [![](https://img.shields.io/docker/pulls/dgroup/lazylead.svg)](https://hub.docker.com/r/dgroup/lazylead "Image pulls")
5
+ [![](https://images.microbadger.com/badges/image/dgroup/lazylead.svg)](https://microbadger.com/images/dgroup/lazylead "Image layers")
6
+ [![](https://images.microbadger.com/badges/version/dgroup/lazylead.svg)](https://microbadger.com/images/dgroup/lazylead "Image version")
7
+ [![Commit activity](https://img.shields.io/github/commit-activity/y/dgroup/lazylead.svg?style=flat-square)](https://github.com/dgroup/lazylead/graphs/commit-activity)
8
+ [![Hits-of-Code](https://hitsofcode.com/github/dgroup/lazylead)](https://hitsofcode.com/view/github/dgroup/lazylead)
9
+ [![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](./license.txt)
10
+
11
+ [![Build status circleci](https://circleci.com/gh/dgroup/lazylead.svg?style=shield)](https://circleci.com/gh/dgroup/lazylead)
12
+ [![0pdd](http://www.0pdd.com/svg?name=dgroup/lazylead)](http://www.0pdd.com/p?name=dgroup/lazylead)
13
+ [![Dependency Status](https://requires.io/github/dgroup/lazylead/requirements.svg?branch=master)](https://requires.io/github/dgroup/lazylead/requirements/?branch=master)
14
+ [![Maintainability](https://api.codeclimate.com/v1/badges/e873a41b1c76d7b2d6ae/maintainability)](https://codeclimate.com/github/dgroup/lazylead/maintainability)
15
+
16
+ [![DevOps By Rultor.com](http://www.rultor.com/b/dgroup/lazylead)](http://www.rultor.com/p/dgroup/lazylead)
17
+ [![EO badge](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org/#principles)
18
+
19
+ ### Overview
20
+ Ticketing systems (Github, Jira, etc.) are strongly integrated into our processes and everyone understands their necessity. As soon as a developer becomes a lead/technical manager, he or she faces a set of routine tasks that are related to ticketing work. On large projects this becomes a problem, more and more you spend time running around on dashboards and tickets, looking for incorrect deviations in tickets and performing routine tasks instead of solving technical problems.
21
+
22
+ The idea of automatic management is not new, for example [Zerocracy](https://www.zerocracy.com/) is available on the market.
23
+ I like this idea, but large companies/projects are not ready yet for such a decisive breakthrough and need step-by-step solutions such as [lazylead](https://github.com/dgroup/lazylead).
24
+ I think you remember how [static code analysis](https://en.wikipedia.org/wiki/Static_program_analysis) treated at in the past; today we have a huge toolkit (pmd, checkstyle, qulice, rubocop, etc) for each language that allows you to avoid routine/known issues and remove from the code reviewer the unnecessary load.
25
+
26
+ Join our [telegram group](https://t.me/lazyleads) for discussions.
27
+
28
+ | Daily annoying task | Jira | Github | Trello |
29
+ | :--------------------------------------------------------------------- | :----------------: | :---------: | :---------: |
30
+ | [Notify ticket's assignee](lib/lazylead/task/alert.rb) | :white_check_mark: | :hourglass: | :hourglass: |
31
+ | [Notify ticket's reporter](lib/lazylead/task/alert.rb) | :white_check_mark: | :hourglass: | :hourglass: |
32
+ | [Notify ticket's manager](lib/lazylead/task/alert.rb) | :white_check_mark: | :hourglass: | :hourglass: |
33
+ | [Notify about illegal "Fix Version" modification](lib/lazylead/task/fix_version.rb) | :white_check_mark: | :x: | :x: |
34
+ | [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb) | :white_check_mark: | :hourglass: | :hourglass: |
35
+ | Propagate some fields from parent ticket into sub-tasks | :hourglass: | :x: | :x: |
36
+ | Print the current capacity of team into newly created tasks | :hourglass: | :hourglass: | :hourglass: |
37
+ | Create/retrofit the defect automatically into latest release | :hourglass: | :hourglass: | :x: |
38
+ | Notify about expired(ing) due dates | :hourglass: | :hourglass: | :hourglass: |
39
+ | Notify about absent original estimations | :hourglass: | :hourglass: | :hourglass: |
40
+ | Notify about 'Hot potato' tickets | :hourglass: | :hourglass: | :hourglass: |
41
+ | Notify about long live tickets (aging) | :hourglass: | :hourglass: | :hourglass: |
42
+ | Notify about tickets with invalid format (missing url/stacktrace, etc) | :hourglass: | :hourglass: | :hourglass: |
43
+ | Create a meeting(s) automatically in case some tickets appeared (group by assignee/reporters/component/ticket type/etc) | :hourglass: | :hourglass: | :hourglass: |
44
+
45
+ :white_check_mark: - implemented, :hourglass: - planned, :x: - not supported by ticketing system.
46
+
47
+ | Integration | Type | Status |
48
+ | :---------------------------------------------------- | :-----------: | :----------------: |
49
+ | [Microsoft Exchange Server](lib/lazylead/exchange.rb) | Emails | :white_check_mark: |
50
+ | [Microsoft Exchange Server](lib/lazylead/exchange.rb) | Calendar | :hourglass: |
51
+ | [mail.yandex.ru](lib/lazylead/postman.rb) | Emails | :white_check_mark: |
52
+ | [mail.google.ru](lib/lazylead/postman.rb) | Emails | :cactus: |
53
+ | slack | Notifications | :hourglass: |
54
+
55
+ :white_check_mark: - implemented, :hourglass: - planned, :cactus: - implemented, but not tested.
56
+
57
+ New ideas, bugs, suggestions or questions are welcome [via GitHub issues](https://github.com/dgroup/lazylead/issues/new)!
58
+
59
+ ### Get started
60
+ :warning: We're still in a very early alpha version, the API may change frequently until we release version 1.0.
61
+
62
+ Let's assume that:
63
+ - your team is using jira as a ticketing system
64
+ - you defined a jira filter with tickets where actions need. The filter id is `555` and it has JQL like `project=XXXX and type=Bug and status not in (Closed, Cancelled, "Ready For Testing", "On Hold) and parent = YYYY and duedate < startOfDay()`
65
+ - you have `MS Exchange` server for email notifications
66
+ - you want to notify your developers during working days at `8am (UTC)` time about tickets where due dates are expired
67
+
68
+ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
69
+ 1. Define yml file with configuration [tasks.yml](.github/tasks.yml):
70
+ ```yml
71
+ version: '2.3'
72
+ services:
73
+
74
+ lazylead:
75
+ image: dgroup/lazylead:latest
76
+ container_name: lazylead
77
+ mem_limit: 128m
78
+ environment:
79
+ # The jira server details.
80
+ # Please ensure that your jira filter(s) grants this user to see issues.
81
+ # Sometimes jira filter(s) may be created with restricted visibility, thus
82
+ # lazylead can't find the issues.
83
+ jira_url: https://your.jira.com
84
+ jira_user: theuser
85
+ jira_password: thepass
86
+ # The MS Exchange server details, please ensure that '/ews/Exchange.asm`
87
+ # will be after your server url. Just change the url to your server.
88
+ exchange_url: https://your.ms.exchange.server/ews/Exchange.asmx
89
+ exchange_user: theuser
90
+ exchange_password: the password
91
+ volumes:
92
+ - ./:/lazylead/db
93
+ # db/ll.db is sqlite file with jira related annoying tasks
94
+ entrypoint: bin/lazylead --sqlite db/ll.db --trace --verbose
95
+ ```
96
+ or just download the project using git
97
+ ```bash
98
+ git clone https://github.com/dgroup/lazylead.git ll && cd ll && pwd && ls -lah
99
+ ```
100
+ 2. Create a container, using `docker-compose -f .github/tasks.yml up`
101
+ The container will stop as there were no tasks provided:
102
+ ```bash
103
+ ll > docker-compose -f .github/tasks.yml up  100% 🔋  13:35:04
104
+ Creating lazylead ... done
105
+ Attaching to lazylead
106
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at start is 52MB
107
+ lazylead | [2020-06-06T10:35:13] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
108
+ lazylead | [2020-06-06T10:35:13] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
109
+ lazylead | [2020-06-06T10:35:13] DEBUG Database connection established
110
+ lazylead | [2020-06-06T10:35:13] WARN SMTP connection enabled in test mode.
111
+ lazylead | [2020-06-06T10:35:13] WARN ll-001: No tasks found.
112
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at the end is 66MB
113
+ lazylead exited with code 0
114
+ ll >
115
+ ```
116
+ 3. Define your team and tasks in database.
117
+ Yes, there are no UI yet, but its planned. Pull requests are welcome!
118
+ The tables structure defined [here](upgrades/sqlite/001-install-main-lazylead-tables.sql).
119
+ Modify you [sqlite](https://sqlite.com/index.html) file(`ll.db`) using [DB Browser](https://sqlitebrowser.org/) or any similar tool.
120
+ Please change the `<youremail.com>` to your email address in order to be in CC when developer get the notification:
121
+ ```sql
122
+ insert into teams (id, name, properties)
123
+ values (1, 'Dream team with lazylead', '{}');
124
+ insert into systems(id, properties)
125
+ values (1,'{"type":"Lazylead::Jira", "username":"${jira_user}", "password":"${jira_password}", "site":"${jira_url}", "context_path":""}');
126
+ insert into tasks (name, cron, enabled, id, system, team_id, action, properties)
127
+ values ('Expired due dates',
128
+ '0 8 * * 1-5',
129
+ 'true',
130
+ 1, 1, 1,
131
+ 'Lazylead::Task::AssigneeAlert',
132
+ '{"sql":"filter=555", "cc":"<youremail.com>", "subject":"[LL] Expired due dates", "template":"lib/messages/due_date_expired.erb", "postman":"Lazylead::Exchange"}');
133
+
134
+ ```
135
+ Yes, for task scheduling we are using [cron](https://crontab.guru).
136
+ 4. Once you changed `./ll.db`, please restart the container using `docker-compose -f .github/tasks.yml restart`
137
+ ```bash
138
+ ll > docker-compose -f .github/tasks.yml restart  100% 🔋  14:37:19
139
+ Restarting lazylead ... done
140
+ ```
141
+ check the logs and stop container if needed
142
+ ```bash
143
+ ll > docker logs lazylead
144
+ 2020-06-06T11:37:36] DEBUG Memory footprint at start is 52MB
145
+ [2020-06-06T11:37:37] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
146
+ [2020-06-06T11:37:37] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
147
+ [2020-06-06T11:37:37] DEBUG Database connection established
148
+ [2020-06-06T11:37:37] WARN SMTP connection enabled in test mode.
149
+ [2020-06-06T11:37:37] DEBUG Task scheduled: id='1', name='Expired due dates', cron='0 8 * * 1-5', system='1', action='Lazylead::Task::AssigneeAlert', team_id='1', description='', enabled='true', properties='{"sql":"filter=555", "cc":"my.email@google.com", "subject":"[LL] Expired due dates", "template":"lib/messages/due_date_expired.erb", "postman":"Lazylead::Exchange"}'
150
+ ll > docker stop lazylead
151
+ lazylead
152
+ ```
153
+
154
+ #### Contribution guide
155
+ Pull requests are welcome!
156
+ Don't forget to run this, beforehand:
157
+ ```
158
+ bundle exec rake
159
+ ```
160
+ Everyone interacting in this project’s codebases, issue trackers, chat rooms is expected to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../test"
26
+ require_relative "../../lib/lazylead/allocated"
27
+
28
+ module Lazylead
29
+ class AllocatedTest < Lazylead::Test
30
+ test "bytes transformed to string have labels (B, KB, MB, etc)" do
31
+ {
32
+ "1B": 1,
33
+ "1KB": 1024,
34
+ "1MB": 1024 * 1024,
35
+ "1GB": 1024 * 1024 * 1024,
36
+ "1024GB": 1024 * 1024 * 1024 * 1024
37
+ }.each do |label, bytes|
38
+ assert_equal label.to_s,
39
+ Allocated.new(bytes).to_s
40
+ end
41
+ end
42
+
43
+ test "default ctor evaluates a memory" do
44
+ greater_then Allocated.new.to_i, 0
45
+ end
46
+
47
+ test "pass a nil (null) value" do
48
+ assert_equal "?", Allocated.new(nil).to_s
49
+ end
50
+ end
51
+ end