renuo-cli 1.8.0 → 3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1eea3c5df45adf1359cb93a9b1b41f70f37193174bee321249d4749a1d5ebdcb
4
- data.tar.gz: 5984e0ab5a47c433ba42326f4737feb0ad1d12f87847f3540d7784edd1cdaf34
3
+ metadata.gz: 708171502068c3d1748c92b702a7e0af0c550607bf2b950a8ef082b225996a2d
4
+ data.tar.gz: 550e4ec36dbfa189ea34bcb2e2e7295ad701ad587b05142d3839484175853194
5
5
  SHA512:
6
- metadata.gz: 5297398c47861cf1974097075be3b973c347277fc56431ff3383037e6b7c172f5266627d4b42fc7b71d72013f8b7a7e98cd512246920e83a80c541f58e90b8d7
7
- data.tar.gz: 95edee563ba860d322f13071180a99df516c54170d64f39daa83e6f8fe4e4176257428549806117683cba749e7438aa0a487ab38714cf5866470e073e8a06ecc
6
+ metadata.gz: a6a524f253a75c50eedea23a7ac02070897e0c4e5d80256536e390f8b6206dfe78b9400e5ec34f9514b1d62f94a8194b3521ca0f9c097ac64cf4f441bed3bbf9
7
+ data.tar.gz: '0991a1fe20fae345363b140e671b0ece06a44e3dc4c4d20b788db531d64eb2c24ee924407bd2a405fa6654cc888ea07d4fcc25f02da6a0a73eb956fa9e93917c'
data/.gitignore CHANGED
@@ -101,4 +101,3 @@ build/
101
101
  /pkg/
102
102
  /spec/reports/
103
103
  /tmp/
104
- .rubocop-https---raw-githubusercontent-com-renuo-applications-setup-guide-master-templates--rubocop-yml
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 2.7.5
@@ -15,5 +15,4 @@ blocks:
15
15
  commands:
16
16
  - checkout --use-cache
17
17
  - gem build renuo-cli
18
- - chmod 0600 ~/.gem/credentials
19
18
  - gem push renuo-cli-*.gem
@@ -15,7 +15,7 @@ class ConfigureSemaphore
15
15
  FileUtils.mkdir_p(%w[.semaphore .semaphore/bin])
16
16
 
17
17
  write_or_warn('.semaphore/semaphore.yml', render('templates/semaphore/semaphore.yml.erb'))
18
- %w[master develop testing].each do |environment|
18
+ %w[main develop testing].each do |environment|
19
19
  @environment = environment
20
20
  write_or_warn(".semaphore/#{environment}-deploy.yml", render('templates/semaphore/semaphore-deploy.yml.erb'))
21
21
  end
@@ -38,7 +38,7 @@ class ConfigureSemaphore
38
38
  def create_semaphore_notification
39
39
  system("sem create notifications #{project_name} "\
40
40
  "--projects #{project_name} "\
41
- '--branches "master,develop,testing" '\
41
+ '--branches "main,develop,testing" '\
42
42
  "--slack-channels \"#project-#{project_name}\" "\
43
43
  '--slack-endpoint "https://hooks.slack.com/services/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"')
44
44
  end
@@ -8,7 +8,7 @@ class CreateAwsProject
8
8
  end
9
9
 
10
10
  def run
11
- %w[master develop testing].each do |branch|
11
+ %w[main develop testing].each do |branch|
12
12
  print_setup_commands branch
13
13
  end
14
14
  end
@@ -46,7 +46,7 @@ class CreateAwsProject
46
46
  @cloudfront_alias = {}
47
47
  return unless agree('Would you like to use an alias to call your assets/images on S3? (Default: no)')
48
48
 
49
- %i[master develop testing].each do |branch|
49
+ %i[main develop testing].each do |branch|
50
50
  cloudfront_alias_for branch
51
51
  end
52
52
  end
@@ -78,7 +78,7 @@ class CreateAwsProject
78
78
  $terminal.wrap_at = nil if $terminal
79
79
  puts aws_iam_setup(@aws_profile, aws_user(branch), @aws_app_group)
80
80
  puts aws_s3_setup(@aws_profile, aws_user(branch), @aws_region, @redmine_project)
81
- puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'master'
81
+ puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'main'
82
82
  cloudfront_setup(aws_user(branch), branch)
83
83
  $terminal.wrap_at = :auto if $terminal
84
84
  end
@@ -1,15 +1,11 @@
1
- require 'commander'
2
- require_relative './environments'
3
- require_relative './fetch_emails'
4
-
5
1
  class CreateHerokuApp
6
2
  ADMIN_EMAIL = 'admin@renuo.ch'.freeze
7
3
 
8
4
  def initialize; end
9
5
 
10
- def run(args)
6
+ def run(*args)
11
7
  project_name = args[0]
12
- abort('>> No project name given.') unless project_name
8
+ abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
13
9
  emails = FetchEmails.new.fetch_emails
14
10
 
15
11
  say "# Commands to setup your Heroku application\n".colorize :green
@@ -25,6 +21,7 @@ class CreateHerokuApp
25
21
  heroku_name = "#{project_name}-#{env}"
26
22
  say "heroku apps:create --region eu #{heroku_name}"
27
23
  say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
24
+ say "heroku domains:add #{project_name}-#{MASTER}.renuoapp.ch --app #{heroku_name}" if env == MAIN
28
25
  say "heroku addons:create heroku-postgresql --app #{heroku_name}"
29
26
  say "heroku addons:create papertrail --app #{heroku_name}"
30
27
  say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
@@ -33,7 +30,7 @@ class CreateHerokuApp
33
30
  end
34
31
 
35
32
  def print_pipelines_commands(project_name)
36
- say "heroku pipelines:create #{project_name} --app #{project_name}-#{MASTER} -s production"
33
+ say "heroku pipelines:create #{project_name} --app #{project_name}-#{MAIN} -s production"
37
34
  say "heroku pipelines:add #{project_name} --app #{project_name}-#{DEVELOP} -s staging"
38
35
  say "heroku pipelines:add #{project_name} --app #{project_name}-#{TESTING} -s staging"
39
36
  say "\n"
@@ -1,4 +1,5 @@
1
+ MAIN = 'main'.freeze
1
2
  MASTER = 'master'.freeze
2
3
  DEVELOP = 'develop'.freeze
3
4
  TESTING = 'testing'.freeze
4
- ENVIRONMENTS = [MASTER, DEVELOP, TESTING].freeze
5
+ ENVIRONMENTS = [MAIN, DEVELOP, TESTING].freeze
@@ -5,11 +5,10 @@ class ReleaseProject
5
5
 
6
6
  def run(args)
7
7
  @project_name, @update_type, @version = args
8
- validate_project_name
9
- validate_update_type
10
- validate_custom_version_format
11
- compare_develop_master
12
- checkout_project
8
+ validate_args
9
+ open_comparison_page
10
+ checkout_project # in the meantime
11
+ veto_comparison
13
12
  @version ||= calculate_version
14
13
  release
15
14
  ensure
@@ -18,6 +17,12 @@ class ReleaseProject
18
17
 
19
18
  private
20
19
 
20
+ def validate_args
21
+ validate_project_name
22
+ validate_update_type
23
+ validate_custom_version_format
24
+ end
25
+
21
26
  def validate_project_name
22
27
  abort('>> No project name given.') unless @project_name
23
28
  end
@@ -49,22 +54,28 @@ class ReleaseProject
49
54
  abort('>> Invalid Version Number. Use format X.Y.Z for your version.')
50
55
  end
51
56
 
52
- def compare_develop_master
53
- puts 'Please double-check what is going to be deployed.'
54
- open_comparison_page
55
- abort unless agree('Are you fine with those changes?')
57
+ def veto_comparison
58
+ abort unless agree('Are you fine with the changes you just reviewed in your browser?')
56
59
  end
57
60
 
58
61
  def open_comparison_page
59
- system "open https://github.com/#{@project_name}/compare/master...develop"
62
+ puts 'Opening browser to double-check what is going to be deployed…'
63
+ system_command = case RbConfig::CONFIG['host_os']
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"
60
72
  end
61
73
 
62
74
  def checkout_project
63
- unless system("#{MOVE_TO_TMP_FOLDER} && hub clone #{@project_name} && " \
64
- "cd #{folder_name} && git checkout master && git pull origin master &&" \
65
- 'git checkout develop && git pull origin develop && git flow init -d')
66
- abort('>> Project not found on Github.')
67
- end
75
+ abort('>> Project not found on Github.') unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}")
76
+
77
+ system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
78
+ 'git checkout develop && git pull origin develop && git flow init -d'))
68
79
  end
69
80
 
70
81
  def calculate_version
@@ -78,7 +89,7 @@ class ReleaseProject
78
89
  if finish_release_branch
79
90
  puts ">> Project successfully released with version #{@version}."
80
91
  else
81
- abort('>> Unable to finish release and push to master. Cancelling release.')
92
+ abort(">> Unable to finish release and push to #{main_branch}. Cancelling release.")
82
93
  end
83
94
  end
84
95
 
@@ -135,7 +146,7 @@ class ReleaseProject
135
146
  def finish_release_branch
136
147
  system(cmd_in_folder("GIT_MERGE_AUTOEDIT=no git flow release finish -m #{@version} #{@version} && " \
137
148
  'git checkout develop && git push origin develop && ' \
138
- 'git checkout master && git push origin master --tags'))
149
+ "git checkout #{main_branch} && git push origin #{main_branch} --tags"))
139
150
  end
140
151
 
141
152
  def ask_for_final_confirmation
@@ -167,4 +178,8 @@ class ReleaseProject
167
178
  def cleanup
168
179
  system("rm -rf #{TMP_FOLDER_NAME}")
169
180
  end
181
+
182
+ def main_branch
183
+ @main_branch ||= system(cmd_in_folder('git checkout main && git show-ref refs/heads/main')) ? 'main' : 'master'
184
+ end
170
185
  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,nvm-master
9
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH,gems-develop,gems-master
10
- cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-master
11
- cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop,node-modules-master
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,requirements-master
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,packs-master
20
- cache restore packstest-$SEMAPHORE_GIT_BRANCH,packstest-develop,packstest-master
21
- cache restore assets-$SEMAPHORE_GIT_BRANCH,assets-develop,assets-master
22
- cache restore sprocketscache-$SEMAPHORE_GIT_BRANCH,sprocketscache-develop,sprocketscache-master
23
- cache restore webpackercache-$SEMAPHORE_GIT_BRANCH,webpackercache-develop,webpackercache-master
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
  ;;
@@ -22,4 +22,6 @@ blocks:
22
22
  - ssh-add ~/.ssh/id_rsa_semaphore_heroku
23
23
  - git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
24
24
  - git remote add heroku $HEROKU_REMOTE
25
- - git push heroku -f $SEMAPHORE_GIT_BRANCH:master
25
+ - git push heroku -f $SEMAPHORE_GIT_BRANCH:main
26
+ - heroku run -x rails db:migrate
27
+ - heroku dyno:restart
@@ -9,7 +9,7 @@ auto_cancel:
9
9
  when: "true"
10
10
  fail_fast:
11
11
  cancel:
12
- when: "branch != 'master'"
12
+ when: "branch != 'main'"
13
13
 
14
14
  blocks:
15
15
  - name: cache
@@ -23,8 +23,11 @@ blocks:
23
23
  - name: cache
24
24
  commands:
25
25
  - checkout --use-cache
26
+ - gem update --system --no-document
26
27
  - source .semaphore/bin/cache_restore rails
27
- - bundle install --deployment -j 4 --path vendor/bundle
28
+ - bundle config set deployment 'true'
29
+ - bundle config set path 'vendor/bundle'
30
+ - bundle install -j 4
28
31
  - nvm install
29
32
  - bin/yarn install --cache-folder ~/.cache/yarn
30
33
  - source .semaphore/bin/cache_store rails
@@ -41,14 +44,26 @@ blocks:
41
44
  prologue:
42
45
  commands:
43
46
  - checkout --use-cache
47
+ - gem update --system --no-document
44
48
  - source .semaphore/bin/cache_restore rails
45
- - bundle install --deployment --path vendor/bundle
49
+ - bundle config set deployment 'true'
50
+ - bundle config set path 'vendor/bundle'
51
+ - bundle install -j 4
46
52
  - nvm install
47
53
  - bin/yarn install --cache-folder ~/.cache/yarn
48
54
  jobs:
49
55
  - name: linting
50
56
  commands:
51
57
  - bin/fastcheck
58
+ epilogue:
59
+ on_fail:
60
+ commands:
61
+ - mkdir -p log
62
+ - mkdir -p tmp/screenshots
63
+ - mkdir -p coverage
64
+ - artifact push job --expire-in 2w log
65
+ - artifact push job --expire-in 2w tmp/screenshots
66
+ - artifact push job --expire-in 2w coverage
52
67
  - name: tests
53
68
  execution_time_limit:
54
69
  minutes: 10
@@ -64,8 +79,11 @@ blocks:
64
79
  prologue:
65
80
  commands:
66
81
  - checkout --use-cache
82
+ - gem update --system --no-document
67
83
  - source .semaphore/bin/cache_restore rails
68
- - bundle install --deployment --path vendor/bundle
84
+ - bundle config set deployment 'true'
85
+ - bundle config set path 'vendor/bundle'
86
+ - bundle install -j 4
69
87
  - nvm install
70
88
  - bin/yarn install --cache-folder ~/.cache/yarn
71
89
  - sem-service start postgres
@@ -79,10 +97,10 @@ promotions:
79
97
  pipeline_file: develop-deploy.yml
80
98
  auto_promote:
81
99
  when: "result = 'passed' and branch = 'develop'"
82
- - name: master
83
- pipeline_file: master-deploy.yml
100
+ - name: main
101
+ pipeline_file: main-deploy.yml
84
102
  auto_promote:
85
- when: "result = 'passed' and branch = 'master'"
103
+ when: "result = 'passed' and branch = 'main'"
86
104
  - name: testing
87
105
  pipeline_file: testing-deploy.yml
88
106
  auto_promote:
@@ -1,6 +1,6 @@
1
1
  module Renuo
2
2
  module Cli
3
- VERSION = '1.8.0'.freeze
3
+ VERSION = '3.1.0'.freeze
4
4
  NAME = 'renuo-cli'.freeze
5
5
  end
6
6
  end
data/lib/renuo/cli.rb CHANGED
@@ -38,7 +38,6 @@ module Renuo
38
38
  abort 'Nice! I updated myself. 🤩 Now you can run the command again.'
39
39
  end
40
40
  abort('Good. Just do it yourself then...😒')
41
- exit
42
41
  end
43
42
 
44
43
  command 'display-name'.to_sym do |c|
@@ -121,10 +120,10 @@ module Renuo
121
120
  - whether you want to setup CloudFront to deliver assets via S3
122
121
 
123
122
  The generated commands do the following:
124
- - create an IAM user for each environment (master, develop, testing) and add it to the renuo apps group.
123
+ - create an IAM user for each environment (main, develop, testing) and add it to the renuo apps group.
125
124
  - create S3 buckets for each user who owns it
126
125
  - tag the buckets
127
- - enable versioning for master buckets
126
+ - enable versioning for main buckets
128
127
  (- set up a CloudFront distribution for each environment with the default config or plus alias if configured)
129
128
  DESCRIPTION
130
129
  c.example 'Setup a project (you will be asked for details)', 'renuo create-aws-project'
@@ -148,8 +147,8 @@ module Renuo
148
147
 
149
148
  command 'release' do |c|
150
149
  c.syntax = 'renuo release'
151
- c.summary = 'Release a projects state of develop (on github) to master in one command.'
152
- c.description = 'Creates a new release version of a project on master as either a Major, Minor, '\
150
+ c.summary = 'Release a projects state of develop (on github) to main in one command.'
151
+ c.description = 'Creates a new release version of a project on main as either a Major, Minor, '\
153
152
  'Patch or Custom release based on the current state of develop on Github'
154
153
  c.example 'renuo release my-project minor', 'release a minor release of my-project'
155
154
  c.example 'renuo release my-project custom 2.5.0', 'release my-project as release 2.5.0'
data/renuo-cli.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency 'aruba', '~> 0.14.5'
30
30
  spec.add_development_dependency 'bundler', '~> 2.0'
31
+ spec.add_development_dependency 'byebug'
31
32
  spec.add_development_dependency 'cucumber', '~> 3.1'
32
33
  spec.add_development_dependency 'dotenv', '~> 2.7.2'
33
34
  spec.add_development_dependency 'mdl', '~> 0.4.0'
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: 1.8.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '2.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: byebug
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: cucumber
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -349,7 +363,7 @@ homepage: https://github.com/renuo/renuo-cli
349
363
  licenses:
350
364
  - MIT
351
365
  metadata: {}
352
- post_install_message:
366
+ post_install_message:
353
367
  rdoc_options: []
354
368
  require_paths:
355
369
  - lib
@@ -364,8 +378,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
364
378
  - !ruby/object:Gem::Version
365
379
  version: '0'
366
380
  requirements: []
367
- rubygems_version: 3.1.4
368
- signing_key:
381
+ rubygems_version: 3.2.32
382
+ signing_key:
369
383
  specification_version: 4
370
384
  summary: The Renuo CLI automates some common workflows.
371
385
  test_files: []