roko 0.2.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 013c4ee53e530601ab0aabdc0c6ca3157a77f10aa89245a0afef5c30b4fff1f5
4
+ data.tar.gz: 61b7d06cf58ed0ce1227ab05d5cbff77ebaf0250a5820ed7455eff1d2c1be493
5
+ SHA512:
6
+ metadata.gz: 11b457465df19d24dff56bf330ecc9e8a5867cde98463d34104951cb57a4657252a05ce64eb24c1ba72b5a3bb5d119f221317054a7879c74373b8f857d51ce15
7
+ data.tar.gz: 825349fe22dfe6c38d94d1fed12cc2f141f0fbcfbab067928f84bcfc6f75705849640d8afba562e0a63d7024dc6db04a4adc6167d4adbc75cc5a87f4986a9d50
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,3 @@
1
+ DuplicateMethodCall:
2
+ exclude:
3
+ - "EventAdapter#extract_from_payload"
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,15 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - rubocop
13
+ - require_not_found
14
+ require_paths: []
15
+ max_files: 5000
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,17 @@
1
+ // 既定の設定とユーザー設定を上書きするには、このファイル内に設定を挿入します
2
+ {
3
+ "ruby.useBundler": true, //run non-lint commands with bundle exec
4
+ "ruby.useLanguageServer": true, // use the internal language server (see below)
5
+ "ruby.lint": {
6
+ "rubocop": {
7
+ "useBundler": true // enable rubocop via bundler
8
+ },
9
+ "reek": {
10
+ "useBundler": true // enable reek via bundler
11
+ }
12
+ },
13
+ "ruby.format": "rubocop", // use rubocop for formatting
14
+ "[ruby]": {
15
+ "editor.tabSize": 2
16
+ }
17
+ }
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in roko.gemspec
6
+ gemspec
7
+
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'climate_control', '~> 0.1.0'
10
+ gem 'octokit', '~> 4.0'
11
+ gem 'google-api-client', '~> 0.34'
12
+ gem 'jira-ruby', '~> 1.7.1'
13
+ gem 'slack-ruby-client', '~> 0.14.5'
14
+ gem 'faraday', '~> 1.0'
15
+ gem 'pry', '~> 0.12.2'
16
+ gem 'thor', '~> 1.0.1'
17
+ gem 'netrc', '~> 0.11.0'
18
+ gem 'rubocop', '~> 0.80.0', require: false
19
+ gem 'solargraph', group: :development
20
+ gem 'pry-byebug', '~> 1.3', '>= 1.3.1', group: :development
21
+ gem 'reek', '~> 5.6.0', require: false
@@ -0,0 +1,210 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ roko (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (6.0.2.1)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ zeitwerk (~> 2.2)
15
+ addressable (2.7.0)
16
+ public_suffix (>= 2.0.2, < 5.0)
17
+ ast (2.4.0)
18
+ atlassian-jwt (0.2.0)
19
+ jwt (~> 2.1.0)
20
+ axiom-types (0.1.1)
21
+ descendants_tracker (~> 0.0.4)
22
+ ice_nine (~> 0.11.0)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ backport (1.1.2)
25
+ benchmark (0.1.0)
26
+ byebug (2.7.0)
27
+ columnize (~> 0.3)
28
+ debugger-linecache (~> 1.2)
29
+ climate_control (0.1.0)
30
+ codeclimate-engine-rb (0.4.1)
31
+ virtus (~> 1.0)
32
+ coderay (1.1.2)
33
+ coercible (1.0.0)
34
+ descendants_tracker (~> 0.0.1)
35
+ columnize (0.9.0)
36
+ concurrent-ruby (1.1.6)
37
+ debugger-linecache (1.2.0)
38
+ declarative (0.0.10)
39
+ declarative-option (0.1.0)
40
+ descendants_tracker (0.0.4)
41
+ thread_safe (~> 0.3, >= 0.3.1)
42
+ diff-lcs (1.3)
43
+ e2mmap (0.1.0)
44
+ equalizer (0.0.11)
45
+ faraday (1.0.0)
46
+ multipart-post (>= 1.2, < 3)
47
+ faraday_middleware (1.0.0.rc1)
48
+ faraday (~> 1.0)
49
+ gli (2.19.0)
50
+ google-api-client (0.37.2)
51
+ addressable (~> 2.5, >= 2.5.1)
52
+ googleauth (~> 0.9)
53
+ httpclient (>= 2.8.1, < 3.0)
54
+ mini_mime (~> 1.0)
55
+ representable (~> 3.0)
56
+ retriable (>= 2.0, < 4.0)
57
+ signet (~> 0.12)
58
+ googleauth (0.11.0)
59
+ faraday (>= 0.17.3, < 2.0)
60
+ jwt (>= 1.4, < 3.0)
61
+ memoist (~> 0.16)
62
+ multi_json (~> 1.11)
63
+ os (>= 0.9, < 2.0)
64
+ signet (~> 0.12)
65
+ hashie (4.1.0)
66
+ httpclient (2.8.3)
67
+ i18n (1.8.2)
68
+ concurrent-ruby (~> 1.0)
69
+ ice_nine (0.11.2)
70
+ jaro_winkler (1.5.4)
71
+ jira-ruby (1.7.1)
72
+ activesupport
73
+ atlassian-jwt
74
+ multipart-post
75
+ oauth (~> 0.5, >= 0.5.0)
76
+ jwt (2.1.0)
77
+ kwalify (0.7.2)
78
+ maruku (0.7.3)
79
+ memoist (0.16.2)
80
+ method_source (0.9.2)
81
+ mini_mime (1.0.2)
82
+ mini_portile2 (2.4.0)
83
+ minitest (5.14.0)
84
+ multi_json (1.14.1)
85
+ multipart-post (2.1.1)
86
+ netrc (0.11.0)
87
+ nokogiri (1.10.9)
88
+ mini_portile2 (~> 2.4.0)
89
+ oauth (0.5.4)
90
+ octokit (4.16.0)
91
+ faraday (>= 0.9)
92
+ sawyer (~> 0.8.0, >= 0.5.3)
93
+ os (1.0.1)
94
+ parallel (1.19.1)
95
+ parser (2.7.0.4)
96
+ ast (~> 2.4.0)
97
+ pry (0.12.2)
98
+ coderay (~> 1.1.0)
99
+ method_source (~> 0.9.0)
100
+ pry-byebug (1.3.3)
101
+ byebug (~> 2.7)
102
+ pry (~> 0.10)
103
+ psych (3.1.0)
104
+ public_suffix (4.0.3)
105
+ rainbow (3.0.0)
106
+ reek (5.6.0)
107
+ codeclimate-engine-rb (~> 0.4.0)
108
+ kwalify (~> 0.7.0)
109
+ parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
110
+ psych (~> 3.1.0)
111
+ rainbow (>= 2.0, < 4.0)
112
+ representable (3.0.4)
113
+ declarative (< 0.1.0)
114
+ declarative-option (< 0.2.0)
115
+ uber (< 0.2.0)
116
+ retriable (3.1.2)
117
+ reverse_markdown (1.4.0)
118
+ nokogiri
119
+ rexml (3.2.4)
120
+ rspec (3.9.0)
121
+ rspec-core (~> 3.9.0)
122
+ rspec-expectations (~> 3.9.0)
123
+ rspec-mocks (~> 3.9.0)
124
+ rspec-core (3.9.1)
125
+ rspec-support (~> 3.9.1)
126
+ rspec-expectations (3.9.0)
127
+ diff-lcs (>= 1.2.0, < 2.0)
128
+ rspec-support (~> 3.9.0)
129
+ rspec-mocks (3.9.1)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.9.0)
132
+ rspec-support (3.9.2)
133
+ rubocop (0.80.1)
134
+ jaro_winkler (~> 1.5.1)
135
+ parallel (~> 1.10)
136
+ parser (>= 2.7.0.1)
137
+ rainbow (>= 2.2.2, < 4.0)
138
+ rexml
139
+ ruby-progressbar (~> 1.7)
140
+ unicode-display_width (>= 1.4.0, < 1.7)
141
+ ruby-progressbar (1.10.1)
142
+ sawyer (0.8.2)
143
+ addressable (>= 2.3.5)
144
+ faraday (> 0.8, < 2.0)
145
+ signet (0.13.0)
146
+ addressable (~> 2.3)
147
+ faraday (>= 0.17.3, < 2.0)
148
+ jwt (>= 1.5, < 3.0)
149
+ multi_json (~> 1.10)
150
+ slack-ruby-client (0.14.5)
151
+ activesupport
152
+ faraday (>= 0.9)
153
+ faraday_middleware
154
+ gli
155
+ hashie
156
+ websocket-driver
157
+ solargraph (0.38.5)
158
+ backport (~> 1.1)
159
+ benchmark
160
+ bundler (>= 1.17.2)
161
+ e2mmap
162
+ jaro_winkler (~> 1.5)
163
+ maruku (~> 0.7, >= 0.7.3)
164
+ nokogiri (~> 1.9, >= 1.9.1)
165
+ parser (~> 2.3)
166
+ reverse_markdown (~> 1.0, >= 1.0.5)
167
+ rubocop (~> 0.52)
168
+ thor (~> 1.0)
169
+ tilt (~> 2.0)
170
+ yard (~> 0.9)
171
+ thor (1.0.1)
172
+ thread_safe (0.3.6)
173
+ tilt (2.0.10)
174
+ tzinfo (1.2.6)
175
+ thread_safe (~> 0.1)
176
+ uber (0.1.0)
177
+ unicode-display_width (1.6.1)
178
+ virtus (1.0.5)
179
+ axiom-types (~> 0.1)
180
+ coercible (~> 1.0)
181
+ descendants_tracker (~> 0.0, >= 0.0.3)
182
+ equalizer (~> 0.0, >= 0.0.9)
183
+ websocket-driver (0.7.1)
184
+ websocket-extensions (>= 0.1.0)
185
+ websocket-extensions (0.1.4)
186
+ yard (0.9.24)
187
+ zeitwerk (2.3.0)
188
+
189
+ PLATFORMS
190
+ ruby
191
+
192
+ DEPENDENCIES
193
+ climate_control (~> 0.1.0)
194
+ faraday (~> 1.0)
195
+ google-api-client (~> 0.34)
196
+ jira-ruby (~> 1.7.1)
197
+ netrc (~> 0.11.0)
198
+ octokit (~> 4.0)
199
+ pry (~> 0.12.2)
200
+ pry-byebug (~> 1.3, >= 1.3.1)
201
+ reek (~> 5.6.0)
202
+ roko!
203
+ rspec (~> 3.0)
204
+ rubocop (~> 0.80.0)
205
+ slack-ruby-client (~> 0.14.5)
206
+ solargraph
207
+ thor (~> 1.0.1)
208
+
209
+ BUNDLED WITH
210
+ 2.1.4
@@ -0,0 +1,94 @@
1
+ # Roko
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/roko`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'roko'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install roko
22
+
23
+ ### Authenticate each services
24
+
25
+ Service | environment variable | description
26
+ :-- | :-- | :--
27
+ Github | `NETRC_FILE_PATH` | Path for netrc file.
28
+ Google Calendar | `GOOGLE_API_CREDENTIALS_PATH` | Path for google api credentials file.
29
+ Slack | `SLACK_API_TOKEN` | Slack API token.
30
+ Confluence | `CONFLUENCE_USER`<br>`CONFLUENCE_PASSWORD`<br>`CONFLUENCE_URL` | User and password for confluence.
31
+
32
+ #### Github
33
+
34
+ Write netrc file like below.
35
+
36
+ ```
37
+ machine api.github.com
38
+ login your_username
39
+ password password_or_your_api_token
40
+ ```
41
+
42
+ Set the netrc file's path imn environment variable `NETRC_FILE_PATH`.
43
+ Or use `~/.netrc` by default.
44
+
45
+ #### Google Calendar
46
+
47
+ Create your service account and download a credential file.
48
+
49
+ see: https://cloud.google.com/docs/authentication/getting-started?hl=en
50
+
51
+ Set the credential file's path in environment variable `GOOGLE_API_CREDENTIALS_PATH`.
52
+ Or use `~/credentials.json` by default.
53
+
54
+ #### Slack
55
+
56
+ Set your slack API access token as environment variable `SLACK_API_TOKEN`.
57
+
58
+ #### Confluence
59
+
60
+ Set your user name and password as environment variable `CONFLUENCE_USER`, `CONFLUENCE_PASSWORD`.
61
+
62
+ This gem access `CONFLUENCE_URL` as confluence host.
63
+
64
+ ## Report Template
65
+
66
+ You can change report template to set `ROKO_ONELINE_TEMPLATE`.
67
+ The template is looks like `%{Y}/%{m}/%{d} %{H}:%{M} %{event_type} [%{summary}](%{url})`.
68
+
69
+ key | description
70
+ :-- | :--
71
+ `Y` | year
72
+ `m` | month
73
+ `d` | day
74
+ `H` | hour of the day
75
+ `M` | minute
76
+ `event_type` | event type
77
+ `summary` | the summary of the event
78
+ `url` | url of this event
79
+ `detail` | detail of this event
80
+
81
+ ## Usage
82
+
83
+ ```
84
+ $ bundle exec ruby exec/roko help
85
+ ```
86
+
87
+ ## Development
88
+
89
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
90
+
91
+ ## Contributing
92
+
93
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hmiyado/roko.
94
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "roko"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "pry"
10
+ Pry.start
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'roko/cli'
4
+
5
+ Roko::Cli.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require "roko/version"
2
+
3
+ module Roko
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'roko/source/events'
5
+
6
+ module Roko
7
+ # cli definitions
8
+ class Cli < Thor
9
+ package_name 'daily report generator'
10
+ class_option :from,
11
+ banner: 'YYYY/mm/dd',
12
+ type: :string,
13
+ desc: 'start date of report'
14
+ class_option :to,
15
+ banner: 'YYYY/mm/dd',
16
+ type: :string,
17
+ desc: 'end date of report'
18
+
19
+ desc 'github', 'generate github daily report'
20
+ def github
21
+ setup_configuration
22
+ github_events = Roko::Source::Events.github
23
+ github_events.each { |event| puts event.oneline }
24
+ end
25
+
26
+ desc 'google_calendar', 'generate google calendar report'
27
+ def google_calendar
28
+ setup_configuration
29
+ google_calendar_events = Roko::Source::Events.google_calendar
30
+ google_calendar_events.each { |event| puts event.oneline }
31
+ end
32
+
33
+ desc 'jira', 'generate jira report'
34
+ def jira
35
+ setup_configuration
36
+ events = Roko::Source::Events.jira
37
+ events.each { |event| puts event.oneline }
38
+ end
39
+
40
+ desc 'slack', 'generate slack report'
41
+ def slack
42
+ setup_configuration
43
+ events = Roko::Source::Events.slack
44
+ events.map { |event| puts event.oneline }
45
+ end
46
+
47
+ desc 'confluence', 'generate confluence report'
48
+ def confluence
49
+ setup_configuration
50
+ events = Roko::Source::Events.confluence
51
+ events.map { |event| puts event.oneline }
52
+ end
53
+
54
+ desc 'all', 'generate report'
55
+ def all
56
+ setup_configuration
57
+
58
+ today_events = Roko::Source::Events.all
59
+ today_events.map { |event| puts event.oneline }
60
+ end
61
+ map today: :all
62
+
63
+ private
64
+
65
+ def setup_configuration
66
+ Source::Events.setup(options)
67
+ end
68
+ end
69
+ end