robopigeon 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -3
  4. data/.version +1 -1
  5. data/CHANGELOG.md +18 -0
  6. data/LICENSE.txt +7 -0
  7. data/README.md +34 -131
  8. data/lib/robopigeon/dsl/base.rb +8 -0
  9. data/lib/robopigeon/dsl/initial_jobs.rb +9 -0
  10. data/lib/robopigeon/dsl/job.rb +10 -0
  11. data/lib/robopigeon/dsl.rb +6 -4
  12. data/lib/robopigeon/extend/cli.rb +34 -0
  13. data/lib/robopigeon/extend/template.rb +53 -0
  14. data/lib/robopigeon/extend/templates/default/.gitignore +16 -0
  15. data/lib/robopigeon/extend/templates/default/.gitlab-ci.yml +27 -0
  16. data/lib/robopigeon/extend/templates/default/.rubocop.yml +50 -0
  17. data/lib/robopigeon/extend/templates/default/.version +1 -0
  18. data/lib/robopigeon/extend/templates/default/Gemfile +6 -0
  19. data/lib/robopigeon/extend/templates/default/README.erb.md +35 -0
  20. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/dsl.erb.rb +39 -0
  21. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/helper_dsl.erb.rb +18 -0
  22. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/version.erb.rb +5 -0
  23. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension.erb.rb +25 -0
  24. data/lib/robopigeon/extend/templates/default/robopigeon-extension.erb.gemspec +41 -0
  25. data/lib/robopigeon/extend/templates/default/spec/robopigeon-extension/dsl_spec.erb.rb +33 -0
  26. data/lib/robopigeon/extend/templates/default/spec/robopigeon-extension/helper_dsl_spec.erb.rb +14 -0
  27. data/lib/robopigeon/extend/templates/default/spec/spec_helper.erb.rb +18 -0
  28. data/lib/robopigeon/extend.rb +2 -0
  29. data/lib/robopigeon/gitlab/commit.rb +31 -0
  30. data/lib/robopigeon/gitlab/commit_dsl.rb +67 -0
  31. data/lib/robopigeon/gitlab/dsl.rb +11 -7
  32. data/lib/robopigeon/gitlab.rb +2 -0
  33. data/lib/robopigeon/jenkins/client.rb +18 -0
  34. data/lib/robopigeon/jenkins/dsl.rb +98 -0
  35. data/lib/robopigeon/jenkins/job.rb +69 -0
  36. data/lib/robopigeon/jenkins.rb +22 -0
  37. data/lib/robopigeon/jira/dsl.rb +7 -10
  38. data/lib/robopigeon/jira/helper_dsl.rb +13 -0
  39. data/lib/robopigeon/resources/initial_robopigeon.rb +55 -0
  40. data/lib/robopigeon/slack/attachments_dsl.rb +2 -2
  41. data/lib/robopigeon/slack/dsl.rb +1 -7
  42. data/lib/robopigeon.rb +2 -0
  43. data/robopigeon.gemspec +19 -15
  44. data/robopigeon.rb +55 -0
  45. metadata +121 -47
  46. data/lib/robopigeon/gitlab/jira.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe9a65f475eff9c6c1204035fd2fa3acd934346e59b0562890fa787d70dd63eb
4
- data.tar.gz: 62e54d559418f871ffb4e84a6bca22699f036653c75bf0433158fcdeef017d1e
3
+ metadata.gz: f5f0eb12780af404e3c5d222d9468804f0b7aec1aeef45407980ee90b578d66f
4
+ data.tar.gz: c9947148df1def3093400399632b4fb7225be2c679fd141841ceae2a4b49e908
5
5
  SHA512:
6
- metadata.gz: 19eb5edf119c685f46e81fda2829aae511627d69565a4452f5cad707b955521cf64ff6dd07aa450d7d164605813bd30819ef8547b108c10bd1d636df7a8a7ebc
7
- data.tar.gz: 51583e67e7f97a049bc6f92649f34c91caa1aff8ccab8ed4a82b90dea97312e589d04291e881852ec030ebb20b9abd2d5d85a7b3c199c61c4a1de4eb2e24bf22
6
+ metadata.gz: f8d9516e989b6cbae9a5bd5c6fe41224569be78689288ce35e322cdb15dc35549a706bd37b29e0b3c11440ce7ca4b92a73130a27edb81e9b3579d44ca7661b49
7
+ data.tar.gz: 86704bdca6792091a21231d53ee8aa8c3d5175c77a118b796baf84d05a1aa91c7907b09998b8fe02233863d908654d8e598bd243fd18df897ca7f88b2ec5241a
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  Gemfile.lock
15
15
  .env
16
16
  robopigeon-0.1.0.gem
17
+ coverage
data/.rubocop.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  AllCops:
2
2
  Exclude:
3
- - 'db/**/*'
4
- - 'Vagrantfile'
5
- - 'vendor/**/*'
3
+ - 'lib/robopigeon/extend/templates/**/*'
6
4
  Style/SingleLineBlockParams:
7
5
  Enabled: false
8
6
  Style/MultilineBlockChain:
data/.version CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ ## 0.2.0 (2019-03-29)
2
+
3
+ ### Added (3 changes)
4
+
5
+ - Automatically generate extensions with `robopigoeon new [extension name]`
6
+ - DSL for making commits in gitlab projects via api
7
+ - DSL to trigger and watch jenkins jobs
8
+
9
+ ## 0.1.0 (2019-03-12)
10
+
11
+ ### Added
12
+
13
+ - DSL for creating and merging merge requests in gitlab
14
+ - DSL for creating jira tickets and waiting for them to transition
15
+ - DSL for sending slack messages to a person or channel
16
+ - Helper DSL for looking up slack user names
17
+ - Helper DSL for looking up last deployment information
18
+ - Helper DSL for reading and parsing markdown ERB files
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2019 Alex Ives
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -34,129 +34,9 @@ Best way to get started is by running `robopigeon init` and having it write the
34
34
 
35
35
  Then, you can reference the DSL below to make changes to your file.
36
36
 
37
- ## DSL Reference:
38
- - [Helpers](#helpers)
39
- - [Slack](#slack-1)
40
- - [GitLab](#gitlab-1)
37
+ ## DSL Reference
41
38
 
42
- ### Helpers
43
-
44
- Helpers can be used anywhere in your config! They're useful for things like looking up someone's slack username to mention it in an email, or looking up who's oncall via pagerduty!
45
-
46
- #### Slack
47
- ```ruby
48
- slack_name_for 'Email or Name' # slack username just with the @ sign
49
- slack_user_for 'Email or Name' # slack message formatted slack user
50
- slack_user_group 'Group id' # slack message group mention with an id
51
- ```
52
-
53
- #### Git
54
- ```ruby
55
- git_committer_name # name of the person who made the last commit
56
- git_committer_email # email address of the person who made the last commit
57
- git_merger_name # name of the person who made the last merge
58
- git_merger_email # email address of the person who made the last merge
59
- git_branch_merged_source # source branch of the last merge
60
- git_branch_merged_target # target branch of the last merge
61
- ```
62
-
63
- #### GitLab
64
- ```ruby
65
- deployment_sha 'environment name' # the current deployed sha for a given environment
66
- deployment_ref 'environment name' # the current deploy ref for a given environment
67
- deployment_shortlog 'environment name' # the shortlog comparison between head and an environment
68
- ```
69
-
70
- ### Slack
71
-
72
- Here's an example of how to use the slack integration!
73
-
74
- There are two basic parts of the slack integration, there's the top level with the api_key, bot name, and emoji icon. And the job configuration that let's you select channels, users, and specify the text and attachments.
75
-
76
- ```ruby
77
- slack do
78
- api_key ENV['SLACK_API_KEY'] # Sets the api key, I like to set it as an env var, defaults to ENV['SLACK_API_KEY']
79
- name 'RoboPigeon 9000' # The name that Slack displays in the chat
80
- emoji ':robot:' # The emoji icon that the bot uses
81
- end
82
-
83
- job 'super basic' do
84
- slack do
85
- channel '#testing-slackbots'
86
- text 'some information you want to relate'
87
- end
88
- end
89
-
90
- job 'mention a user' do
91
- slack do
92
- channel '#testing-slackbots'
93
- text "#{slack_user_for ENV['GITLAB_USER_EMAIL']} did something awesome!"
94
- end
95
- end
96
-
97
- job 'test failed' do
98
- slack do
99
- channel '#testing-slackbots' # A channel to post the message to
100
- channel '#testing-more-slackbots' # Another channel to post the message to
101
- user 'someone@example.com' # A user that it also sends the message to
102
- user 'someone-else@example.com' # Another user that it also sends the message to
103
- text "Test on #{ENV['CI_MERGE_REQUEST_SOURCE_BRANCH_NAME']} has failed!"
104
- attachment do
105
- title 'Website'
106
- title_link 'http://alex.ives.mn'
107
- pretext 'Here is a button!'
108
- color 'danger'
109
- # Actions take type, text, url, and style
110
- action 'button', 'Website', 'https://alex.ives.mn', 'danger'
111
- end
112
- end
113
- end
114
-
115
- job 'in a different workspace' do
116
- slack do
117
- api_key ENV['SLACK_KEY_FOR_SECOND_SPACE']
118
- name 'SadBot 9000'
119
- emoji ':sad-pigeon:'
120
- channel '#testing-slackbots'
121
- user 'someone@example.com'
122
- text 'Sent to a different workspace'
123
- end
124
- end
125
-
126
- job 'with complex attachments' do
127
- slack do
128
- user ENV['GITLAB_USER_EMAIL']
129
- attachment do
130
- color 'good'
131
- fallback "Stuff is happening! <#{ENV['CI_PIPELINE_URL']}|Pipeline> <#{ENV['CI_PROJECT_URL']}|Project>"
132
- action 'button', 'Pipeline', ENV['CI_PIPELINE_URL'], 'primary'
133
- action 'button', 'Project', ENV['CI_PROJECT_URL'], 'primary'
134
- end
135
- attachment do
136
- color 'danger'
137
- fallback "Stuff is happening! <#{ENV['CI_PIPELINE_URL']}|Pipeline> <#{ENV['CI_PROJECT_URL']}|Project>"
138
- action 'button', 'Bad Pipeline', ENV['CI_PIPELINE_URL'], 'danger'
139
- action 'button', 'Bad Project', ENV['CI_PROJECT_URL']
140
- end
141
- end
142
- end
143
- ```
144
-
145
- ### GitLab
146
-
147
- ```ruby
148
- gitlab do
149
- api_url 'https://gitlab.example.com/api/v4' # api endpoint for your gitlab server, defaults to ENV['CI_API_V4_URL']
150
- api_key ENV['GITLAB_API_KEY'] # api key for your gitlab server, defaults to ENV['GITLAB_API_KEY']
151
- end
152
-
153
- job 'comment on a merge request' do
154
- gitlab do
155
- branch ENV['CI_COMMIT_REF_NAME']
156
- merge_request_comment 'This comment will appear on all merge requests for the current specified branch'
157
- end
158
- end
159
- ```
39
+ Coming soon, stay tuned. In the mean time you can [look at our example file](https://gitlab.com/pigeons/robopigeon/blob/master/lib/robopigeon/resources/initial_robopigeon.rb).
160
40
 
161
41
  ## Development
162
42
 
@@ -166,7 +46,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
166
46
 
167
47
  ## Contributing
168
48
 
169
- Bug reports and pull requests are welcome on GitLab at https://gitlab.com/robopigeon/robopigeon.
49
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/pigeons/robopigeon.
170
50
 
171
51
  ### Contributors
172
52
 
@@ -187,9 +67,9 @@ GitLab
187
67
  - [x] Get data from the gitlab deployments api as a helper
188
68
  - [x] Add helpers to get a list of jira tickets since the provided deployment
189
69
  - [x] Create Tag
190
- - [ ] Create Commits
70
+ - [x] Create Commits
191
71
 
192
- Semver Helpers
72
+ Semver
193
73
  - [ ] Read a version from a file
194
74
  - [ ] Update version files
195
75
 
@@ -209,10 +89,22 @@ Git
209
89
  - [x] Add helpers to get information about changes since the last release
210
90
 
211
91
  Jenkins
212
- - [ ] Kick off and monitor a jenkins job until it is completed
92
+ - [x] Kick off and monitor a jenkins job until it is completed
213
93
 
214
94
  Extensions
215
- - [ ] Create basic example dsl extension gem template
95
+ - [x] Create basic example dsl extension gem template
96
+
97
+ PagerDuty
98
+ - [ ] Get current oncall user from pagerduty api
99
+
100
+ Risk Metrics Helpers
101
+ - [ ] Globally configure deploy risk metrics
102
+ - [ ] Output risk metrics as markdown via kramdown
103
+
104
+ Changelog
105
+ - [ ] Aggregates changes into log
106
+ - [ ] Helpers provide changes since last deployment
107
+ - [ ] Changelog yaml front matter informs risk of change
216
108
 
217
109
  ### Features for future version
218
110
 
@@ -226,6 +118,8 @@ GitLab
226
118
  - [ ] Create Issue
227
119
  - [ ] Update issue tags
228
120
  - [ ] Assign Issue
121
+ - [ ] Write file to wiki page
122
+ - [ ] Write to snippet
229
123
 
230
124
  GitHub
231
125
  - [ ] Create, comment on, and merge pull requests
@@ -236,18 +130,27 @@ GitHub
236
130
  - [ ] Create Issue
237
131
  - [ ] Update issue tags
238
132
  - [ ] Assign Issue
133
+ - [ ] Write to Gist
134
+
135
+ Gitter
136
+ - [ ] Post notifications to channels or users
137
+ - [ ] Post notifications and wait for a response
138
+
139
+ Confluence
140
+ - [ ] Write Content to Confluence Page
141
+
142
+ MediaWiki
143
+ - [ ] Write Content to Wiki Page
239
144
 
240
145
  Slack
241
146
  - [ ] Migrate to block syntax for messages
242
147
 
243
- Changelog
244
- - [ ] Aggregates changes into log
245
- - [ ] Helpers provide changes since last deployment
246
-
247
148
  Extensions
248
149
  - [ ] Default jobs extension
249
150
  - [ ] Jira ticket configuration extension
250
151
  - [ ] Slack action template
152
+ - [ ] Gitlab issue configuration extension
153
+ - [ ] GitHub issue configuration extension
251
154
 
252
155
  ### Technical Debt
253
156
 
@@ -0,0 +1,8 @@
1
+ module RoboPigeon::Dsl
2
+ # this inherits from job, so that the job dsls are available in
3
+ # extensions. That's very helpful if you're trying to write an
4
+ # extension that interfaces with another extension or built in.
5
+ class Base < RoboPigeon::Dsl::Job
6
+ include RoboPigeon::Dsl::Helpers
7
+ end
8
+ end
@@ -23,6 +23,15 @@ module RoboPigeon::Dsl::InitialJobs
23
23
  }
24
24
  end
25
25
 
26
+ def init_new
27
+ jobs['new'] = {
28
+ desc: 'Create a new extension for RoboPigeon',
29
+ action: proc do
30
+ RoboPigeon::Extensions::Cli.invoke(ARGV)
31
+ end
32
+ }
33
+ end
34
+
26
35
  def init_help
27
36
  this_job = {
28
37
  desc: 'Show usage information',
@@ -12,11 +12,21 @@ RoboPigeon::Documentarian.add_block(
12
12
  module RoboPigeon::Dsl
13
13
  class Job
14
14
  include RoboPigeon::Dsl::Helpers
15
+
16
+ def self.run(&block)
17
+ instance = new
18
+ instance.instance_eval(&block)
19
+ end
15
20
  end
16
21
  end
17
22
 
18
23
  module RoboPigeon::Dsl
19
24
  class Root
25
+ def self.run(&block)
26
+ instance = new
27
+ instance.instance_eval(&block)
28
+ end
29
+
20
30
  def job(*args, &block)
21
31
  this_job = {
22
32
  desc: args.pop,
@@ -1,6 +1,7 @@
1
1
  require 'robopigeon/dsl/helpers'
2
- require 'robopigeon/dsl/initial_jobs'
3
2
  require 'robopigeon/dsl/job'
3
+ require 'robopigeon/dsl/base'
4
+ require 'robopigeon/dsl/initial_jobs'
4
5
 
5
6
  module RoboPigeon::Dsl
6
7
  class Root
@@ -12,6 +13,7 @@ module RoboPigeon::Dsl
12
13
  self.jobs = {}
13
14
  base
14
15
  init_help
16
+ init_new
15
17
  if File.exist?(file)
16
18
  instance_exec do
17
19
  eval(File.read(file))
@@ -30,16 +32,16 @@ module RoboPigeon::Dsl
30
32
  end
31
33
 
32
34
  def usage
33
- max_size = jobs.keys.max_by(&:length).size
35
+ max_size = jobs.keys.reject(&:nil?).max_by(&:length).size
34
36
  jobs_strings = jobs.keys.reject do |key|
35
- jobs[key][:hidden]
37
+ key.nil? || jobs[key][:hidden]
36
38
  end.map do |name|
37
39
  padding = ' ' * (max_size - name.length)
38
40
  " '#{name}' #{padding}- #{jobs[name][:desc]}"
39
41
  end.join("\n")
40
42
  puts "Usage: robopigeon 'job name'"
41
43
  puts "Jobs are configured in #{file}"
42
- puts 'See https://gitlab.com/robopigeon/robopigeon for configuration'
44
+ puts 'See https://gitlab.com/pigeons/robopigeon for configuration'
43
45
  puts "Configured Jobs:\n#{jobs_strings}"
44
46
  end
45
47
  end
@@ -0,0 +1,34 @@
1
+ require 'optparse'
2
+
3
+ module RoboPigeon::Extensions
4
+ class Cli
5
+ class << self
6
+ def invoke(args)
7
+ template = 'default'
8
+ path = FileUtils.pwd
9
+ optparse = OptionParser.new do |opts|
10
+ opts.banner = 'Usage: robopigeon new [options] name'
11
+
12
+ opts.on('-d', '--default', 'use the default template') do
13
+ template = 'default'
14
+ end
15
+
16
+ opts.on('-h', '--help', 'Show help message') do
17
+ puts opts
18
+ exit 1
19
+ end
20
+
21
+ opts.on('-p', '--path [path]', 'path to where the gem should be created') do |selected_path|
22
+ path = selected_path
23
+ end
24
+ end
25
+
26
+ args.shift
27
+ options = optparse.parse(args)
28
+ name = options.shift
29
+
30
+ RoboPigeon::Extensions::Template.render(name, path, template)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,53 @@
1
+ require 'fileutils'
2
+ require 'erb'
3
+
4
+ module RoboPigeon::Extensions
5
+ class Template
6
+ TEMPLATE_PATH = File.expand_path('../templates/', __FILE__).freeze
7
+ attr_accessor :name, :template
8
+
9
+ def self.render(name, path, template='default')
10
+ to_render = new
11
+ to_render.name = name
12
+ to_render.template = template
13
+ raise "No template with name #{template}" unless File.directory?("#{TEMPLATE_PATH}/#{template}")
14
+
15
+ to_render.render_to(path)
16
+ end
17
+
18
+ def render_to(path)
19
+ cwd = FileUtils.pwd
20
+ base = File.expand_path("#{path}/robopigeon-#{name}")
21
+ FileUtils.cd "#{TEMPLATE_PATH}/#{template}"
22
+ FileUtils.mkdir_p base.to_s
23
+ Dir.glob('{**{,/*/**},.*}') do |file|
24
+ new_filename = file.gsub('extension', name).gsub('.erb', '')
25
+ if File.directory?(file)
26
+ FileUtils.mkdir("#{base}/#{new_filename}") unless File.exist? "#{base}/#{new_filename}"
27
+ puts "Created directory #{base}/#{new_filename}"
28
+ else
29
+ content = ERB.new(File.read(file)).result(binding)
30
+ File.write("#{base}/#{new_filename}", content)
31
+ puts "Created #{base}/#{new_filename}"
32
+ end
33
+ end
34
+ FileUtils.cd cwd
35
+ end
36
+
37
+ def extension_name_lower
38
+ name.downcase
39
+ end
40
+
41
+ def extension_name_upper
42
+ name.capitalize
43
+ end
44
+
45
+ def user_email
46
+ `git config user.email`.strip
47
+ end
48
+
49
+ def user_name
50
+ `git config user.name`.strip
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,16 @@
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
12
+
13
+ # Ignore this so that we get up to date stuff.
14
+ Gemfile.lock
15
+ .env
16
+ robopigeon-0.1.0.gem
@@ -0,0 +1,27 @@
1
+ .rspec: &rspec
2
+ stage: test
3
+ script:
4
+ - bundle install
5
+ - bundle exec rspec
6
+
7
+ stages:
8
+ - test
9
+
10
+ Rspec:2.5:
11
+ <<: *rspec
12
+ image: ruby:2.5
13
+
14
+ Rspec:2.3:
15
+ <<: *rspec
16
+ image: ruby:2.3
17
+
18
+ Rspec:2.1:
19
+ <<: *rspec
20
+ image: ruby:2.1
21
+
22
+ Rubocop:
23
+ image: ruby:2.5
24
+ stage: test
25
+ script:
26
+ - bundle install
27
+ - bundle exec rubocop
@@ -0,0 +1,50 @@
1
+ Style/SingleLineBlockParams:
2
+ Enabled: false
3
+ Style/MultilineBlockChain:
4
+ Enabled: false
5
+ Metrics/LineLength:
6
+ Enabled: false
7
+ Metrics/ClassLength:
8
+ Enabled: false
9
+ Documentation:
10
+ Enabled: false
11
+ Style/ClassAndModuleChildren:
12
+ Enabled: false
13
+ Metrics/ParameterLists:
14
+ Enabled: false
15
+ Style/CommentAnnotation:
16
+ Enabled: false
17
+ Style/GuardClause:
18
+ Enabled: false
19
+ Style/EachWithObject:
20
+ Enabled: false
21
+ Style/ExpandPathArguments:
22
+ Enabled: false
23
+ Metrics/CyclomaticComplexity:
24
+ Enabled: false
25
+ Metrics/PerceivedComplexity:
26
+ Enabled: false
27
+ Metrics/AbcSize:
28
+ Enabled: false
29
+ Metrics/MethodLength:
30
+ Enabled: false
31
+ Naming/AccessorMethodName:
32
+ Enabled: false
33
+ Style/SignalException:
34
+ Enabled: false
35
+ Style/RegexpLiteral:
36
+ Enabled: false
37
+ Style/Next:
38
+ Enabled: false
39
+ Lint/AssignmentInCondition:
40
+ Enabled: false
41
+ Style/PercentLiteralDelimiters:
42
+ Enabled: false
43
+ Layout/SpaceAroundEqualsInParameterDefault:
44
+ Enabled: false
45
+ Metrics/BlockLength:
46
+ Enabled: false
47
+ Style/FrozenStringLiteralComment:
48
+ Enabled: false
49
+ Layout/IndentHeredoc:
50
+ Enabled: false
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in robopigeon.gemspec
4
+ gemspec
5
+
6
+ gem 'robopigeon', path: '../robopigeon'
@@ -0,0 +1,35 @@
1
+ # RoboPigeon-<%= extension_name_upper %>
2
+
3
+ TODO: Add a description of what dsls/helpers this adds.
4
+
5
+ ## Installation
6
+
7
+ This Gem is developed against ruby 2.5, but is tested in CI against the latest versions of `2.1`, `2.3`, and `2.5`
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'robopigeon-<%= extension_name_lower %>'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install robopigeon-<%= extension_name_lower %>
22
+
23
+ ## Usage
24
+
25
+ TODO: Add usage instructions for your new DSLs
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bundle install`
30
+
31
+ Then run `bundle exec rspec` to run the tests.
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/{gitlab_username}/robopigeon-<%= extension_name_lower %>.
@@ -0,0 +1,39 @@
1
+ module RoboPigeon::Dsl
2
+ class <%= extension_name_upper %>Root < RoboPigeon::Dsl::Base
3
+ # This is where you include your top level dsls used for configuring
4
+ # global settings like api keys or api urls. In general, it is useful
5
+ # to also include them in the individual job settings in case a job
6
+ # needs to override them.
7
+ # For example, you might set your api key for a service to talk to:
8
+ # def api_key(key)
9
+ # <%= extension_name_upper %>::Client.api_key = key
10
+ # end
11
+ def do_some_global_thing
12
+ 'some global thing'
13
+ end
14
+ end
15
+
16
+ class <%= extension_name_upper %> < <%= extension_name_upper %>Root
17
+ # This is where you include job specific dsls! This is used for actions
18
+ # that only take place when running a job, this could be something like
19
+ # pre-configured slack notifications or more complex things.
20
+ # For example, if you wanted a dsl that always sends a slack message to
21
+ # a certain channel:
22
+ # def request_approval(description, ticket_number)
23
+ # slack do
24
+ # channel '#approval-requests'
25
+ # message "#{slack_approvers_mention}: #{slack_user_for ENV['GITLAB_USER_EMAIL'] would like approval for #{jira_slack_link} - #{description}"
26
+ # end
27
+ # end
28
+
29
+ # Alternately, you can add whole new services, like say you wanted an
30
+ # alert in your alerting software, you could write code to trigger it
31
+ # in here!
32
+ # def trigger_alert(description, team)
33
+ # # Code goes here to trigger the alert
34
+ # end
35
+ def do_something
36
+ 'nothing happens yet...'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ module RoboPigeon::Dsl::Helpers
2
+ module <%= extension_name_upper %>
3
+ # This file contains methods that are added to all levels of the DSL, you can
4
+ # add new ones of your own in here! For example, if you wanted something that
5
+ # holds a specific slack subteam name, you could do something like:
6
+ # def slack_approvers_mention
7
+ # "<!subteam^A1342B>"
8
+ # end
9
+ # Then you could reference it in a slack notification:
10
+ # slack do
11
+ # channel "#request-approval"
12
+ # message "#{slack_approvers_mention} - I would like approval for my life!"
13
+ # end
14
+ def some_helper_dsl
15
+ 'nothing happens here yet'
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module RoboPigeon
2
+ module <%= extension_name_upper %>
3
+ VERSION = File.read(File.join(__dir__, '../../.version')).freeze
4
+ end
5
+ end