renuo-cli 3.0.0 → 3.1.2
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/.ruby-version +1 -1
- data/.semaphore/{master-deploy.yml → main-deploy.yml} +3 -3
- data/.semaphore/semaphore.yml +3 -3
- data/lib/renuo/cli/app/command_helper.rb +18 -0
- 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 +57 -38
- data/lib/renuo/cli/app/templates/semaphore/bin/cache_restore.erb +10 -10
- data/lib/renuo/cli/app/templates/semaphore/bin/cache_store.erb +1 -1
- 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 +3 -0
- metadata +5 -5
- 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: b15431d56265376a769e662fd9b467c0c1b0753a5b27e4429821ec37e87f9e01
|
4
|
+
data.tar.gz: 29a10806d01da5cbb8b2a2946fdeb5226fd3cdafc36c4bec15cf0cc20a6f88ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a90927c91e4b854c7cf2d9ed57ac4d3a27573c446c9232d951815e36e66cdc46cbdeecf299579837cedaa1536ab9190610645e747626628d713cb61af0fc23
|
7
|
+
data.tar.gz: ce3f379d8e365792f82024d3aa12a1d13ed697ffd85b50ff41bc10f112ee230a3c2c78991fb9b484faaf716906624f2786114b035c63d0f3cb9ca9598c887382
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.5
|
@@ -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
|
@@ -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,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,15 +1,18 @@
|
|
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
|
5
9
|
|
6
10
|
def run(args)
|
7
11
|
@project_name, @update_type, @version = args
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
compare_develop_main
|
12
|
+
validate_args
|
13
|
+
open_comparison_page
|
14
|
+
checkout_project # in the meantime
|
15
|
+
veto_comparison
|
13
16
|
@version ||= calculate_version
|
14
17
|
release
|
15
18
|
ensure
|
@@ -18,6 +21,12 @@ class ReleaseProject
|
|
18
21
|
|
19
22
|
private
|
20
23
|
|
24
|
+
def validate_args
|
25
|
+
validate_project_name
|
26
|
+
validate_update_type
|
27
|
+
validate_custom_version_format
|
28
|
+
end
|
29
|
+
|
21
30
|
def validate_project_name
|
22
31
|
abort('>> No project name given.') unless @project_name
|
23
32
|
end
|
@@ -49,29 +58,20 @@ class ReleaseProject
|
|
49
58
|
abort('>> Invalid Version Number. Use format X.Y.Z for your version.')
|
50
59
|
end
|
51
60
|
|
52
|
-
def
|
53
|
-
|
54
|
-
open_comparison_page
|
55
|
-
abort unless agree('Are you fine with those changes?')
|
61
|
+
def veto_comparison
|
62
|
+
abort unless agree('Are you fine with the changes you just reviewed in your browser?')
|
56
63
|
end
|
57
64
|
|
58
65
|
def open_comparison_page
|
59
|
-
|
60
|
-
|
61
|
-
'start'
|
62
|
-
when /darwin/
|
63
|
-
'open'
|
64
|
-
when /linux|bsd/
|
65
|
-
'xdg-open'
|
66
|
-
end
|
67
|
-
system "#{system_command} https://github.com/#{@project_name}/compare/#{main_branch}...develop"
|
66
|
+
puts 'Opening browser to double-check what is going to be deployed…'
|
67
|
+
open_path "https://github.com/#{@project_name}/compare/#{main_branch}...develop"
|
68
68
|
end
|
69
69
|
|
70
70
|
def checkout_project
|
71
71
|
abort('>> Project not found on Github.') unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}")
|
72
72
|
|
73
73
|
system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
|
74
|
-
|
74
|
+
"git checkout #{develop_branch} && git pull origin #{develop_branch}"))
|
75
75
|
end
|
76
76
|
|
77
77
|
def calculate_version
|
@@ -80,7 +80,6 @@ class ReleaseProject
|
|
80
80
|
|
81
81
|
def release
|
82
82
|
ask_for_final_confirmation
|
83
|
-
start_release_branch
|
84
83
|
bump_version
|
85
84
|
if finish_release_branch
|
86
85
|
puts ">> Project successfully released with version #{@version}."
|
@@ -90,14 +89,12 @@ class ReleaseProject
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def current_version
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
sorted_tags.find { |tag| tag =~ RenuoVersion::SEMVER_SCHEMA }.strip
|
100
|
-
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
|
101
98
|
end
|
102
99
|
|
103
100
|
def bump_version
|
@@ -105,7 +102,7 @@ class ReleaseProject
|
|
105
102
|
|
106
103
|
return unless version_bumped
|
107
104
|
|
108
|
-
system(cmd_in_folder(
|
105
|
+
system(cmd_in_folder('git add . && git commit -m "bump version"'))
|
109
106
|
end
|
110
107
|
|
111
108
|
def find_and_replace_version
|
@@ -135,26 +132,43 @@ class ReleaseProject
|
|
135
132
|
system(cmd_in_folder("sed -i '' 's|#{current_version}|#{@version}|g' #{file_name}"))
|
136
133
|
end
|
137
134
|
|
138
|
-
def
|
139
|
-
|
135
|
+
def finish_release_branch
|
136
|
+
merge_branches
|
137
|
+
push_branches_and_tags
|
140
138
|
end
|
141
139
|
|
142
|
-
def
|
143
|
-
system(
|
144
|
-
|
145
|
-
|
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}",
|
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}"))
|
146
160
|
end
|
147
161
|
|
148
162
|
def ask_for_final_confirmation
|
149
163
|
unless agree(">> Are you sure you wish to deploy '#{@project_name}' " \
|
150
|
-
|
164
|
+
"as a #{@update_type} release (#{current_version} => #{@version})?")
|
151
165
|
abort('>> Cancelling Release.')
|
152
166
|
end
|
153
167
|
|
154
168
|
return unless Time.now.friday? && Time.now.hour >= 16
|
155
169
|
|
156
170
|
unless agree('>> Are you sure you want to deploy on late Friday afternoon? ' \
|
157
|
-
|
171
|
+
'Did you think about your family...waiting for you at home?')
|
158
172
|
abort('>> Very good. Go home now.')
|
159
173
|
end
|
160
174
|
end
|
@@ -176,6 +190,11 @@ class ReleaseProject
|
|
176
190
|
end
|
177
191
|
|
178
192
|
def main_branch
|
179
|
-
|
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'
|
180
199
|
end
|
181
200
|
end
|
@@ -5,22 +5,22 @@ do
|
|
5
5
|
case $cache_group in
|
6
6
|
|
7
7
|
rails)
|
8
|
-
cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop
|
9
|
-
cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$
|
10
|
-
cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop
|
11
|
-
cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop
|
8
|
+
cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop
|
9
|
+
cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)-$(checksum Gemfile.lock),gems-develop-$(checksum .ruby-version)
|
10
|
+
cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop
|
11
|
+
cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop
|
12
12
|
;;
|
13
13
|
|
14
14
|
python)
|
15
|
-
cache restore requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop
|
15
|
+
cache restore requirements-$SEMAPHORE_GIT_BRANCH-$(checksum requirements.txt),requirements-$SEMAPHORE_GIT_BRANCH,requirements-develop
|
16
16
|
;;
|
17
17
|
|
18
18
|
assets)
|
19
|
-
cache restore packs-$SEMAPHORE_GIT_BRANCH,packs-develop
|
20
|
-
cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop
|
21
|
-
cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop
|
22
|
-
cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop
|
23
|
-
cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop
|
19
|
+
cache restore packs-$SEMAPHORE_GIT_BRANCH,packs-develop
|
20
|
+
cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop
|
21
|
+
cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop
|
22
|
+
cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop
|
23
|
+
cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop
|
24
24
|
;;
|
25
25
|
|
26
26
|
*)
|
@@ -6,7 +6,7 @@ do
|
|
6
6
|
|
7
7
|
rails)
|
8
8
|
cache store nvm-$SEMAPHORE_GIT_BRANCH-$(checksum .nvmrc) $HOME/.nvm
|
9
|
-
cache store gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock) vendor/bundle
|
9
|
+
cache store gems-$SEMAPHORE_GIT_BRANCH-$(checksum .ruby-version)-$(checksum Gemfile.lock) vendor/bundle
|
10
10
|
cache store yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock) $HOME/.cache/yarn
|
11
11
|
cache store node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock) node_modules
|
12
12
|
;;
|
@@ -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
|
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.
|
4
|
+
version: 3.1.2
|
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-12 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
|
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
378
378
|
- !ruby/object:Gem::Version
|
379
379
|
version: '0'
|
380
380
|
requirements: []
|
381
|
-
rubygems_version: 3.
|
381
|
+
rubygems_version: 3.2.32
|
382
382
|
signing_key:
|
383
383
|
specification_version: 4
|
384
384
|
summary: The Renuo CLI automates some common workflows.
|