renuo-cli 3.1.0 → 3.1.3
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.
- checksums.yaml +4 -4
- data/.semaphore/{master-deploy.yml → main-deploy.yml} +3 -3
- data/.semaphore/semaphore.yml +3 -3
- data/README.md +2 -2
- data/lib/renuo/cli/app/command_helper.rb +18 -0
- data/lib/renuo/cli/app/create_heroku_app.rb +2 -2
- data/lib/renuo/cli/app/create_new_logins.rb +2 -3
- data/lib/renuo/cli/app/name_display.rb +21 -5
- data/lib/renuo/cli/app/release_project.rb +44 -29
- data/lib/renuo/cli/app/templates/semaphore/semaphore-deploy.yml.erb +1 -2
- data/lib/renuo/cli/app/templates/semaphore/semaphore.yml.erb +9 -0
- data/lib/renuo/cli/app/upgrade_laptop/upgrade_laptop_execution.rb +1 -1
- data/lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb +1 -1
- data/lib/renuo/cli/app/upgrade_laptop.rb +1 -1
- data/lib/renuo/cli/version.rb +1 -1
- data/lib/renuo/cli.rb +4 -1
- metadata +4 -4
- data/lib/renuo/cli/app/upgrade_laptop/run_command.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae956670e74e092cce3f2161073efebe67b18f87e6de498c967a10f8f6109327
|
4
|
+
data.tar.gz: 7cd7137d5ffcb4975dbbf39adc523b25f7271b01ac4551af353a2ca022489143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ac196c93c183a57423b65873b15351e60c03eee3f4f67cbb65d37604c181cf1ea5905af409fbd9710037f9977d3abb1c6f3874138ad494836ef50f884a95d5
|
7
|
+
data.tar.gz: 7acedf79bb2198ae72e3b9d637e09070e0fdf652948ddb5f80caf7856f7bfc05ba143374350cd3807b311f3c3940605fb8fb2d4c7aa17ea4acbd86e81d417ff6
|
@@ -1,17 +1,17 @@
|
|
1
1
|
version: v1.0
|
2
|
-
name:
|
2
|
+
name: main-deploy
|
3
3
|
agent:
|
4
4
|
machine:
|
5
5
|
type: e1-standard-2
|
6
6
|
os_image: ubuntu1804
|
7
7
|
|
8
8
|
blocks:
|
9
|
-
- name:
|
9
|
+
- name: main-deploy
|
10
10
|
task:
|
11
11
|
secrets:
|
12
12
|
- name: rubygems-deploy
|
13
13
|
jobs:
|
14
|
-
- name:
|
14
|
+
- name: main-deploy
|
15
15
|
commands:
|
16
16
|
- checkout --use-cache
|
17
17
|
- gem build renuo-cli
|
data/.semaphore/semaphore.yml
CHANGED
@@ -9,7 +9,7 @@ auto_cancel:
|
|
9
9
|
when: "true"
|
10
10
|
fail_fast:
|
11
11
|
cancel:
|
12
|
-
when: "branch != '
|
12
|
+
when: "branch != 'main'"
|
13
13
|
|
14
14
|
blocks:
|
15
15
|
- name: tests
|
@@ -30,5 +30,5 @@ blocks:
|
|
30
30
|
commands:
|
31
31
|
- bin/check
|
32
32
|
promotions:
|
33
|
-
- name:
|
34
|
-
pipeline_file:
|
33
|
+
- name: main
|
34
|
+
pipeline_file: main-deploy.yml
|
data/README.md
CHANGED
@@ -32,11 +32,11 @@ To release a new version, update the version number in `version.rb`, and then ru
|
|
32
32
|
|
33
33
|
## Release
|
34
34
|
|
35
|
-
* Bump the version number in `lib/renuo/cli/version.rb` and commit to `
|
35
|
+
* Bump the version number in `lib/renuo/cli/version.rb` and commit to `main`
|
36
36
|
|
37
37
|
### Automatic
|
38
38
|
|
39
|
-
* Deploy through Semaphore console by starting a promotion to
|
39
|
+
* Deploy through Semaphore console by starting a promotion to main
|
40
40
|
|
41
41
|
### Manual
|
42
42
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CommandHelper
|
2
|
+
def run_command(command)
|
3
|
+
say "\n#{command.yellow}"
|
4
|
+
system command
|
5
|
+
end
|
6
|
+
|
7
|
+
def open_path(path)
|
8
|
+
system_command = case RbConfig::CONFIG['host_os']
|
9
|
+
when /mswin|mingw|cygwin/
|
10
|
+
'start'
|
11
|
+
when /darwin/
|
12
|
+
'open'
|
13
|
+
when /linux|bsd/
|
14
|
+
'xdg-open'
|
15
|
+
end
|
16
|
+
run_command "#{system_command} #{path}"
|
17
|
+
end
|
18
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class CreateHerokuApp
|
2
|
-
ADMIN_EMAIL = '
|
2
|
+
ADMIN_EMAIL = 'operations@renuo.ch'.freeze
|
3
3
|
|
4
4
|
def initialize; end
|
5
5
|
|
6
|
-
def run(
|
6
|
+
def run(args)
|
7
7
|
project_name = args[0]
|
8
8
|
abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
|
9
9
|
emails = FetchEmails.new.fetch_emails
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class CreateNewLogins
|
2
|
-
include
|
2
|
+
include CommandHelper
|
3
3
|
|
4
4
|
@logins = [{ name: 'Sentry', sign_up_url: 'https://sentry.io/organizations/renuo/members/new/',
|
5
5
|
steps: ['Click on add new Member'] },
|
@@ -20,8 +20,7 @@ class CreateNewLogins
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def open_site(website)
|
23
|
-
|
24
|
-
system "open '#{website}'"
|
23
|
+
open_path(website)
|
25
24
|
wait_to_continue
|
26
25
|
end
|
27
26
|
|
@@ -1,17 +1,33 @@
|
|
1
|
+
require_relative 'command_helper'
|
2
|
+
|
1
3
|
class NameDisplay
|
4
|
+
include CommandHelper
|
5
|
+
|
2
6
|
def run(args, options)
|
3
|
-
return
|
7
|
+
return open_path(SLIDES) if options.monitor
|
8
|
+
return display_name(nil) if options.delete
|
9
|
+
return say('empty argument') if args.empty?
|
4
10
|
|
5
|
-
return
|
11
|
+
return run_heroku_command(args.join(' ')) if options.override
|
6
12
|
|
7
13
|
display_name(args.join(' '))
|
8
14
|
end
|
9
15
|
|
16
|
+
private
|
17
|
+
|
18
|
+
HEROKU_APP_NAME = '-a renuo-dashboard-master'.freeze
|
19
|
+
HEROKU_CLI = 'heroku run'.freeze
|
20
|
+
RENUO_CLI = 'rails renuo:welcome'.freeze
|
21
|
+
SLIDES = 'https://docs.google.com/presentation/d/1mPhQjArZnlUWUa2ik5R9IlGmdCKCwc2_H8Qq-AWgV-A/edit'.freeze
|
22
|
+
WELCOME_MESSAGE = 'Welcome to Renuo'.freeze
|
23
|
+
|
10
24
|
def display_name(name)
|
11
|
-
|
25
|
+
text_message = [WELCOME_MESSAGE, name, '🥳🔥'].compact.join(' ')
|
26
|
+
run_heroku_command(text_message)
|
12
27
|
end
|
13
28
|
|
14
|
-
def
|
15
|
-
|
29
|
+
def run_heroku_command(text_message)
|
30
|
+
rails_command = "\"#{RENUO_CLI}['#{text_message}']\""
|
31
|
+
run_command([HEROKU_CLI, rails_command, HEROKU_APP_NAME].join(' '))
|
16
32
|
end
|
17
33
|
end
|
@@ -1,4 +1,8 @@
|
|
1
|
+
require_relative 'command_helper'
|
2
|
+
|
1
3
|
class ReleaseProject
|
4
|
+
include CommandHelper
|
5
|
+
|
2
6
|
UPDATE_TYPES = %w[major minor patch custom].freeze
|
3
7
|
TMP_FOLDER_NAME = "_RENUO_RELEASE_TEMP_#{rand(100_000_000)}".freeze
|
4
8
|
MOVE_TO_TMP_FOLDER = "mkdir -p #{TMP_FOLDER_NAME} && cd #{TMP_FOLDER_NAME}".freeze
|
@@ -60,22 +64,14 @@ class ReleaseProject
|
|
60
64
|
|
61
65
|
def open_comparison_page
|
62
66
|
puts 'Opening browser to double-check what is going to be deployed…'
|
63
|
-
|
64
|
-
when /mswin|mingw|cygwin/
|
65
|
-
'start'
|
66
|
-
when /darwin/
|
67
|
-
'open'
|
68
|
-
when /linux|bsd/
|
69
|
-
'xdg-open'
|
70
|
-
end
|
71
|
-
system "#{system_command} https://github.com/#{@project_name}/compare/#{main_branch}...develop"
|
67
|
+
open_path "https://github.com/#{@project_name}/compare/#{main_branch}...develop"
|
72
68
|
end
|
73
69
|
|
74
70
|
def checkout_project
|
75
71
|
abort('>> Project not found on Github.') unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}")
|
76
72
|
|
77
73
|
system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
|
78
|
-
|
74
|
+
"git checkout #{develop_branch} && git pull origin #{develop_branch}"))
|
79
75
|
end
|
80
76
|
|
81
77
|
def calculate_version
|
@@ -84,7 +80,6 @@ class ReleaseProject
|
|
84
80
|
|
85
81
|
def release
|
86
82
|
ask_for_final_confirmation
|
87
|
-
start_release_branch
|
88
83
|
bump_version
|
89
84
|
if finish_release_branch
|
90
85
|
puts ">> Project successfully released with version #{@version}."
|
@@ -94,14 +89,12 @@ class ReleaseProject
|
|
94
89
|
end
|
95
90
|
|
96
91
|
def current_version
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
sorted_tags.find { |tag| tag =~ RenuoVersion::SEMVER_SCHEMA }.strip
|
104
|
-
end
|
92
|
+
@current_version ||= if `#{cmd_in_folder('git tag')}` == ''
|
93
|
+
'0.0.0'
|
94
|
+
else
|
95
|
+
sorted_tags = `#{cmd_in_folder('git tag --sort=taggerdate')}`.split("\n").reverse
|
96
|
+
sorted_tags.find { |tag| tag =~ RenuoVersion::SEMVER_SCHEMA }.strip
|
97
|
+
end
|
105
98
|
end
|
106
99
|
|
107
100
|
def bump_version
|
@@ -109,7 +102,7 @@ class ReleaseProject
|
|
109
102
|
|
110
103
|
return unless version_bumped
|
111
104
|
|
112
|
-
system(cmd_in_folder(
|
105
|
+
system(cmd_in_folder('git add . && git commit -m "bump version"'))
|
113
106
|
end
|
114
107
|
|
115
108
|
def find_and_replace_version
|
@@ -139,26 +132,43 @@ class ReleaseProject
|
|
139
132
|
system(cmd_in_folder("sed -i '' 's|#{current_version}|#{@version}|g' #{file_name}"))
|
140
133
|
end
|
141
134
|
|
142
|
-
def
|
143
|
-
|
135
|
+
def finish_release_branch
|
136
|
+
merge_branches
|
137
|
+
push_branches_and_tags
|
144
138
|
end
|
145
139
|
|
146
|
-
def
|
147
|
-
system(
|
148
|
-
|
149
|
-
|
140
|
+
def merge_branches
|
141
|
+
system(
|
142
|
+
cmd_in_folder(
|
143
|
+
[
|
144
|
+
"GIT_MERGE_AUTOEDIT=no git checkout #{main_branch}",
|
145
|
+
"git merge #{develop_branch} --no-edit",
|
146
|
+
"git tag -a #{@version} -m \"Release with versioin: #{@version}\""
|
147
|
+
].join(' && ')
|
148
|
+
)
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
def push_branches_and_tags
|
153
|
+
push_branch(develop_branch)
|
154
|
+
push_branch(main_branch)
|
155
|
+
system(cmd_in_folder("git checkout #{main_branch} && git push origin #{main_branch} --tags"))
|
156
|
+
end
|
157
|
+
|
158
|
+
def push_branch(branch)
|
159
|
+
system(cmd_in_folder("git checkout #{branch} && git push origin #{branch}"))
|
150
160
|
end
|
151
161
|
|
152
162
|
def ask_for_final_confirmation
|
153
163
|
unless agree(">> Are you sure you wish to deploy '#{@project_name}' " \
|
154
|
-
|
164
|
+
"as a #{@update_type} release (#{current_version} => #{@version})?")
|
155
165
|
abort('>> Cancelling Release.')
|
156
166
|
end
|
157
167
|
|
158
168
|
return unless Time.now.friday? && Time.now.hour >= 16
|
159
169
|
|
160
170
|
unless agree('>> Are you sure you want to deploy on late Friday afternoon? ' \
|
161
|
-
|
171
|
+
'Did you think about your family...waiting for you at home?')
|
162
172
|
abort('>> Very good. Go home now.')
|
163
173
|
end
|
164
174
|
end
|
@@ -180,6 +190,11 @@ class ReleaseProject
|
|
180
190
|
end
|
181
191
|
|
182
192
|
def main_branch
|
183
|
-
|
193
|
+
remote_repo = "git@github.com:#{@project_name}.git"
|
194
|
+
@main_branch ||= `git ls-remote --heads #{remote_repo} main`.empty? ? 'master' : 'main'
|
195
|
+
end
|
196
|
+
|
197
|
+
def develop_branch
|
198
|
+
'develop'
|
184
199
|
end
|
185
200
|
end
|
@@ -23,5 +23,4 @@ blocks:
|
|
23
23
|
- git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
|
24
24
|
- git remote add heroku $HEROKU_REMOTE
|
25
25
|
- git push heroku -f $SEMAPHORE_GIT_BRANCH:main
|
26
|
-
- heroku run -x rails db:migrate
|
27
|
-
- heroku dyno:restart
|
26
|
+
- if heroku run -x rails db:migrate; then heroku dyno:restart; else heroku rollback; exit -1; fi
|
@@ -92,6 +92,15 @@ blocks:
|
|
92
92
|
- name: tests
|
93
93
|
commands:
|
94
94
|
- bin/check
|
95
|
+
epilogue:
|
96
|
+
on_fail:
|
97
|
+
commands:
|
98
|
+
- mkdir -p log
|
99
|
+
- mkdir -p tmp/screenshots
|
100
|
+
- mkdir -p coverage
|
101
|
+
- artifact push job log --expire-in 2w
|
102
|
+
- artifact push job tmp/screenshots --expire-in 2w
|
103
|
+
- artifact push job coverage --expire-in 2w
|
95
104
|
promotions:
|
96
105
|
- name: develop
|
97
106
|
pipeline_file: develop-deploy.yml
|
data/lib/renuo/cli/version.rb
CHANGED
data/lib/renuo/cli.rb
CHANGED
@@ -46,7 +46,10 @@ module Renuo
|
|
46
46
|
c.description = 'Sets the name of a customer on the Renuo dashboard'
|
47
47
|
c.example 'Display "Peter Muster" on the dashboard', 'renuo display-name "Peter Muster"'
|
48
48
|
c.example 'Remove the current name from the dashboard', 'renuo display-name --delete'
|
49
|
+
c.example 'Override the current message on the dashboard', 'renuo display-name Happy friday 🍻 --override'
|
49
50
|
c.option '--delete', 'Deletes the current name'
|
51
|
+
c.option '--override', 'Overrides the entire message'
|
52
|
+
c.option '--monitor', 'Open the Google slides'
|
50
53
|
c.action do |args, options|
|
51
54
|
NameDisplay.new.run(args, options)
|
52
55
|
end
|
@@ -108,7 +111,7 @@ module Renuo
|
|
108
111
|
command 'create-aws-project' do |c|
|
109
112
|
c.syntax = 'renuo create-aws-project'
|
110
113
|
c.summary = 'Generates necessary commands for our project setup on AWS incl. necessary installations.'
|
111
|
-
c.description =
|
114
|
+
c.description = <<~DESCRIPTION
|
112
115
|
This creates commands for creating AWS users, buckets an versioning policies and CloudFront.
|
113
116
|
It also guides you to set up the necessary environment.
|
114
117
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renuo-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renuo AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -307,7 +307,7 @@ files:
|
|
307
307
|
- ".ruby-version"
|
308
308
|
- ".semaphore/bin/cache_restore"
|
309
309
|
- ".semaphore/bin/cache_store"
|
310
|
-
- ".semaphore/
|
310
|
+
- ".semaphore/main-deploy.yml"
|
311
311
|
- ".semaphore/semaphore.yml"
|
312
312
|
- Gemfile
|
313
313
|
- LICENSE.txt
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- bin/run
|
320
320
|
- bin/setup
|
321
321
|
- lib/renuo/cli.rb
|
322
|
+
- lib/renuo/cli/app/command_helper.rb
|
322
323
|
- lib/renuo/cli/app/configure_semaphore.rb
|
323
324
|
- lib/renuo/cli/app/configure_sentry.rb
|
324
325
|
- lib/renuo/cli/app/create_aws_project.rb
|
@@ -351,7 +352,6 @@ files:
|
|
351
352
|
- lib/renuo/cli/app/toggl/workspace.rb
|
352
353
|
- lib/renuo/cli/app/toggl_redmine_comparator.rb
|
353
354
|
- lib/renuo/cli/app/upgrade_laptop.rb
|
354
|
-
- lib/renuo/cli/app/upgrade_laptop/run_command.rb
|
355
355
|
- lib/renuo/cli/app/upgrade_laptop/upgrade_laptop_execution.rb
|
356
356
|
- lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb
|
357
357
|
- lib/renuo/cli/app/work.rb
|