renuo-cli 4.5.0 → 4.5.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Rakefile +3 -3
  4. data/lib/renuo/cli/app/command_helper.rb +4 -4
  5. data/lib/renuo/cli/app/commit_leaderboard_stage.rb +109 -0
  6. data/lib/renuo/cli/app/commit_leaderboard_sync.rb +20 -20
  7. data/lib/renuo/cli/app/configure_semaphore.rb +8 -8
  8. data/lib/renuo/cli/app/configure_sentry.rb +5 -5
  9. data/lib/renuo/cli/app/create_aws_project.rb +23 -23
  10. data/lib/renuo/cli/app/create_heroku_app.rb +2 -3
  11. data/lib/renuo/cli/app/create_new_logins.rb +5 -5
  12. data/lib/renuo/cli/app/create_slidev_presentation.rb +11 -11
  13. data/lib/renuo/cli/app/environments.rb +3 -3
  14. data/lib/renuo/cli/app/fetch_emails.rb +6 -6
  15. data/lib/renuo/cli/app/generate_password.rb +2 -2
  16. data/lib/renuo/cli/app/heroku_apps.rb +1 -1
  17. data/lib/renuo/cli/app/heroku_users.rb +3 -3
  18. data/lib/renuo/cli/app/local_storage.rb +5 -5
  19. data/lib/renuo/cli/app/name_display.rb +11 -11
  20. data/lib/renuo/cli/app/redmine/csv_base_service.rb +5 -5
  21. data/lib/renuo/cli/app/redmine/issue.rb +3 -3
  22. data/lib/renuo/cli/app/release_project.rb +25 -25
  23. data/lib/renuo/cli/app/release_xing.rb +5 -5
  24. data/lib/renuo/cli/app/renuo_version.rb +2 -2
  25. data/lib/renuo/cli/app/secrets_fetcher.rb +18 -18
  26. data/lib/renuo/cli/app/services/cloudfront_config_service.rb +13 -13
  27. data/lib/renuo/cli/app/services/markdown_parser_service.rb +3 -3
  28. data/lib/renuo/cli/app/services/renuo_cli_config.rb +4 -4
  29. data/lib/renuo/cli/app/setup_uptimerobot.rb +17 -17
  30. data/lib/renuo/cli/app/toggl/detail.rb +4 -4
  31. data/lib/renuo/cli/app/toggl/time_entry.rb +4 -4
  32. data/lib/renuo/cli/app/toggl/user.rb +3 -3
  33. data/lib/renuo/cli/app/toggl/workspace.rb +3 -3
  34. data/lib/renuo/cli/app/toggl_redmine_comparator.rb +26 -26
  35. data/lib/renuo/cli/app/upgrade_laptop/upgrade_laptop_execution.rb +4 -4
  36. data/lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb +4 -4
  37. data/lib/renuo/cli/app/upgrade_laptop.rb +4 -4
  38. data/lib/renuo/cli/app/work.rb +12 -12
  39. data/lib/renuo/cli/version.rb +2 -2
  40. data/lib/renuo/cli.rb +148 -146
  41. data/renuo-cli.gemspec +33 -33
  42. metadata +3 -3
  43. data/lib/renuo/cli/app/commit_leaderboard.rb +0 -130
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7719cb71e8a8aab40c7459249bd4426a853941db2c8301d28c1d834b0476dec
4
- data.tar.gz: 457354d9afee1f9ec6038e16d7ad7437706d713484ea95d8db051d437ddf402e
3
+ metadata.gz: 9f2cb5713f6f049b35d15ebc362cb5acd4fa1a3913f5d31778b9f1d4e13cadc2
4
+ data.tar.gz: adb87d01d322c63f852f21e96fa7756b922a4293ad5dc9723ce0379d3c3f36f7
5
5
  SHA512:
6
- metadata.gz: 2e25d235c6048a4f10f9bd9f920cdc4ce29ebd8c4ae3004b7401518629d7dfeb4630e58958ebfc3d572b421524fc23fdc63323528c135d26a0632b7522fa5c3e
7
- data.tar.gz: a27729d6491bdd2683c026f4efd742fdd3e952af44eedce1664b21212bbfd078c774d2e4db901f289c7e8f8e4ae25304d1d2fecc7b453e91783e8d3a3ae0ee35
6
+ metadata.gz: 942ef0596dec68f0e67b1965731bf1c1c00eba543722cb3a5e43ccb9adabd70567c1fa49fbc9bf56ad79d8a52356c10d2b2a497fa20db3345403bb77d8987eff
7
+ data.tar.gz: 2813073dc97cff3c376ff8a5b65158ae48c618be4afe63a1374e55c58b32fd791f3651e4cf4af9134de574d9d9d4164ce408a9130e172d0f5a6f52f980e042ed
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  gemspec
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
- require 'cucumber/rake/task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "cucumber/rake/task"
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
  Cucumber::Rake::Task.new
@@ -7,13 +7,13 @@ module CommandHelper
7
7
  end
8
8
 
9
9
  def open_path(path)
10
- system_command = case RbConfig::CONFIG['host_os']
10
+ system_command = case RbConfig::CONFIG["host_os"]
11
11
  when /mswin|mingw|cygwin/
12
- 'start'
12
+ "start"
13
13
  when /darwin/
14
- 'open'
14
+ "open"
15
15
  when /linux|bsd/
16
- 'xdg-open'
16
+ "xdg-open"
17
17
  end
18
18
  run_command "#{system_command} #{path}"
19
19
  end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CommitLeaderboardStage
4
+ attr_accessor :queue_file_path, :author_username, :auhor_avatar_url, :options
5
+
6
+ def run(args, options)
7
+ abort "No author username given." if args[0].nil?
8
+ abort "No author avatar url given." if args[1].nil?
9
+
10
+ process_params(args, options)
11
+
12
+ check_required_tools
13
+ check_if_repository_is_present
14
+ check_if_commit_is_present
15
+
16
+ append_to_queue(build_commit_payload)
17
+ end
18
+
19
+ private
20
+
21
+ def process_params(args, options)
22
+ @options = options
23
+
24
+ @author_username = args[0]
25
+ @author_avatar_url = args[1]
26
+
27
+ @queue_file_path = args[2] || "~/.renuo-commit-leaderboard.json"
28
+ @queue_file_path = File.expand_path(@queue_file_path)
29
+ end
30
+
31
+ def check_required_tools
32
+ return if system("git --version", out: File::NULL)
33
+
34
+ abort(">> Git is not installed. Please install it first.")
35
+ end
36
+
37
+ def check_if_repository_is_present
38
+ return if system("git rev-parse --is-inside-work-tree", out: File::NULL)
39
+
40
+ abort(">> Not a git repository. Please run this command in a git repository.")
41
+ end
42
+
43
+ def check_if_commit_is_present
44
+ return if system("git rev-parse --verify HEAD", out: File::NULL)
45
+
46
+ abort(">> No commits found. Please commit your changes first.")
47
+ end
48
+
49
+ def build_commit_payload
50
+ {
51
+ sha: `git rev-parse HEAD`.strip,
52
+ message: `git log -1 --pretty=%B`.strip,
53
+ repository: `basename $(git rev-parse --show-toplevel)`.strip,
54
+ branch: `git rev-parse --abbrev-ref HEAD`.strip,
55
+ author: {
56
+ username: @author_username,
57
+ avatar_url: @author_avatar_url
58
+ }
59
+ }
60
+ end
61
+
62
+ def append_to_queue(payload)
63
+ `echo [] > #{@queue_file_path}` unless File.exist?(@queue_file_path)
64
+
65
+ commits = read_commits_from_queue(payload)
66
+ if @options.verbose
67
+ puts ">> Adding commit to the queue:"
68
+ print_queue_item(payload)
69
+ end
70
+ File.open(@queue_file_path, "w") do |file|
71
+ commits << payload
72
+ file.write(JSON.generate(commits))
73
+ end
74
+ end
75
+
76
+ def read_commits_from_queue(payload)
77
+ commits = nil
78
+
79
+ File.open(@queue_file_path, "r") do |file|
80
+ commits = JSON.parse(file.read)
81
+
82
+ if commits.any? { |commit| commit["sha"] == payload[:sha] }
83
+ abort(">> Commit has already been added to the queue")
84
+ end
85
+ rescue JSON::ParserError
86
+ abort(">> Invalid JSON format in the queue file.")
87
+ end
88
+
89
+ commits
90
+ end
91
+
92
+ def print_queue_item(payload)
93
+ sha = payload[:sha]
94
+ repository = "#{payload[:repository]}##{payload[:branch]}"
95
+ message = payload[:message]
96
+ username = payload[:author][:username]
97
+ avatar_url = payload[:author][:avatar_url]
98
+
99
+ puts "sha: #{sha}"
100
+ puts "repository: #{repository}"
101
+ puts "message: #{message}"
102
+ puts "username: #{username}"
103
+ puts "avatar_url: #{avatar_url}"
104
+ end
105
+
106
+ def truncate_text(text, truncate_length)
107
+ text[0..truncate_length]
108
+ end
109
+ end
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http'
3
+ require "net/http"
4
4
 
5
5
  class SyncError < StandardError; end
6
6
 
7
7
  class CommitLeaderboardSync
8
8
  attr_accessor :queue_file_path, :leaderboard_api_url, :api_secret
9
9
 
10
- def run(args)
10
+ def run(args, options)
11
11
  process_args(args)
12
- print_configuration
12
+ print_configuration if options.verbose
13
13
 
14
14
  unless File.exist?(@queue_file_path)
15
- abort('>> Commit queue file does not exist.')
15
+ abort(">> Commit queue file does not exist.")
16
16
  end
17
17
 
18
18
  unless @leaderboard_api_url.match?(URI::DEFAULT_PARSER.make_regexp)
19
- abort('>> Invalid API URL.')
19
+ abort(">> Invalid API URL.")
20
20
  end
21
21
 
22
22
  commits = JSON.parse(File.read(@queue_file_path))
@@ -27,17 +27,17 @@ class CommitLeaderboardSync
27
27
 
28
28
  def process_args(args)
29
29
  if args[0].blank?
30
- abort('>> No API secret given.')
30
+ abort(">> No API secret given.")
31
31
  end
32
32
 
33
33
  @api_secret = args[0]
34
- @queue_file_path = File.expand_path(args[1] || '~/.renuo_commit_leaderboard.json')
35
- @leaderboard_api_url = args[2] || 'https://dashboard.renuo.ch/api/v1/add_commits'
34
+ @queue_file_path = File.expand_path(args[1] || "~/.renuo_commit_leaderboard.json")
35
+ @leaderboard_api_url = args[2] || "https://dashboard.renuo.ch/api/v1/commit_leaderboard"
36
36
  end
37
37
 
38
38
  def print_configuration
39
- puts 'Running commit leaderboard sync with:'
40
- puts '-----------------------------'
39
+ puts "Running commit leaderboard sync with:"
40
+ puts "-----------------------------"
41
41
  puts "API secret: #{@api_secret}"
42
42
  puts "Queue file path: #{@queue_file_path}"
43
43
  puts "Leaderboard API URL: #{@leaderboard_api_url}"
@@ -51,7 +51,7 @@ class CommitLeaderboardSync
51
51
  commit = commits.shift
52
52
  payload = { commit: commit }.to_json
53
53
 
54
- puts 'Sending commit to leaderboard...'
54
+ puts "Sending commit to leaderboard..."
55
55
  print_payload(payload)
56
56
 
57
57
  begin
@@ -69,9 +69,9 @@ class CommitLeaderboardSync
69
69
  def send_commit(payload)
70
70
  uri = URI(@leaderboard_api_url)
71
71
  http = Net::HTTP.new(uri.host, uri.port)
72
- http.use_ssl = uri.scheme == 'https'
73
- request = Net::HTTP::Post.new(uri.path, { 'Content-Type' => 'application/json', 'Accept' => 'application/json' })
74
- request['LEADERBOARD_SIGNATURE'] = generate_signature_for_payload(@api_secret, payload)
72
+ http.use_ssl = uri.scheme == "https"
73
+ request = Net::HTTP::Post.new(uri.path, { "Content-Type" => "application/json", "Accept" => "application/json" })
74
+ request["LEADERBOARD_SIGNATURE"] = generate_signature_for_payload(@api_secret, payload)
75
75
  request.body = payload
76
76
 
77
77
  http.request(request)
@@ -85,13 +85,13 @@ class CommitLeaderboardSync
85
85
  def handle_response(response)
86
86
  case response.code.to_i
87
87
  when 200
88
- puts '>> Successfully sent commits to the leaderboard.'
88
+ puts ">> Successfully sent commits to the leaderboard."
89
89
  when 401
90
- abort('>> Unauthorized. Please check your secret.')
90
+ abort(">> Unauthorized. Please check your secret.")
91
91
  when 403
92
- abort('>> Forbidden. Please check your secret.')
92
+ abort(">> Forbidden. Please check your secret.")
93
93
  when 404
94
- abort('>> Not found. Please check the URL.')
94
+ abort(">> Not found. Please check the URL.")
95
95
  else
96
96
  raise SyncError, "Failed to send commits to the leaderboard:\n#{response.code} - #{response.body}"
97
97
  end
@@ -99,11 +99,11 @@ class CommitLeaderboardSync
99
99
  # rubocop:enable Metrics/MethodLength
100
100
 
101
101
  def clear_queue
102
- File.write(@queue_file_path, '[]')
102
+ File.write(@queue_file_path, "[]")
103
103
  end
104
104
 
105
105
  def generate_signature_for_payload(secret_key, payload)
106
- signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret_key, payload)
106
+ signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), secret_key, payload)
107
107
  "sig=#{signature}"
108
108
  end
109
109
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'commander'
4
- require_relative 'environments'
3
+ require "commander"
4
+ require_relative "environments"
5
5
 
6
6
  class ConfigureSemaphore
7
7
  attr_accessor :project_name, :environment
@@ -16,13 +16,13 @@ class ConfigureSemaphore
16
16
 
17
17
  FileUtils.mkdir_p(%w[.semaphore .semaphore/bin])
18
18
 
19
- write_or_warn('.semaphore/semaphore.yml', render('templates/semaphore/semaphore.yml.erb'))
19
+ write_or_warn(".semaphore/semaphore.yml", render("templates/semaphore/semaphore.yml.erb"))
20
20
  %w[main develop].each do |environment|
21
21
  @environment = environment
22
- write_or_warn(".semaphore/#{environment}-deploy.yml", render('templates/semaphore/semaphore-deploy.yml.erb'))
22
+ write_or_warn(".semaphore/#{environment}-deploy.yml", render("templates/semaphore/semaphore-deploy.yml.erb"))
23
23
  end
24
- write_or_warn('.semaphore/bin/cache_restore', render('templates/semaphore/bin/cache_restore.erb'))
25
- write_or_warn('.semaphore/bin/cache_store', render('templates/semaphore/bin/cache_store.erb'))
24
+ write_or_warn(".semaphore/bin/cache_restore", render("templates/semaphore/bin/cache_restore.erb"))
25
+ write_or_warn(".semaphore/bin/cache_store", render("templates/semaphore/bin/cache_store.erb"))
26
26
 
27
27
  create_semaphore_notification
28
28
  create_semaphore_secrets
@@ -33,8 +33,8 @@ class ConfigureSemaphore
33
33
  private
34
34
 
35
35
  def semaphore_cli_installed?
36
- semaphore_cli_installed = `sem context | grep '*'`.strip == '* renuo_semaphoreci_com'
37
- warn('You need to install and configure Semaphore CLI to run this command.') unless semaphore_cli_installed
36
+ semaphore_cli_installed = `sem context | grep '*'`.strip == "* renuo_semaphoreci_com"
37
+ warn("You need to install and configure Semaphore CLI to run this command.") unless semaphore_cli_installed
38
38
  semaphore_cli_installed
39
39
  end
40
40
 
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'commander'
4
- require_relative 'environments'
3
+ require "commander"
4
+ require_relative "environments"
5
5
 
6
6
  class ConfigureSentry
7
- ADMIN_EMAIL = 'admin@renuo.ch'
7
+ ADMIN_EMAIL = "admin@renuo.ch"
8
8
 
9
9
  def run(args)
10
10
  project_name = args[0]
11
11
  sentry_dsn = args[1]
12
- abort('>> No project name given.') unless project_name
13
- abort('>> No sentry DSN name given.') unless sentry_dsn
12
+ abort(">> No project name given.") unless project_name
13
+ abort(">> No sentry DSN name given.") unless sentry_dsn
14
14
 
15
15
  say "# Commands to setup Sentry on Heroku\n".colorize :green
16
16
  ENVIRONMENTS.each { |env| print_environment_commands(env, project_name, sentry_dsn) }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'renuo/cli/app/services/cloudfront_config_service'
3
+ require "renuo/cli/app/services/cloudfront_config_service"
4
4
 
5
5
  class CreateAwsProject
6
6
  def initialize
@@ -18,44 +18,44 @@ class CreateAwsProject
18
18
  private
19
19
 
20
20
  def collect_project_information
21
- say 'We need now some informations to create your s3-bucket:'.colorize :green
21
+ say "We need now some informations to create your s3-bucket:".colorize :green
22
22
  collect_general_information
23
23
  collect_s3_information
24
24
  collect_cloudfront_information
25
25
  end
26
26
 
27
27
  def collect_general_information
28
- @project_name = ask('Project name (eg: renuo-cli): ') { |q| q.validate = /.+/ }
28
+ @project_name = ask("Project name (eg: renuo-cli): ") { |q| q.validate = /.+/ }
29
29
  end
30
30
 
31
31
  def collect_s3_information
32
- @project_purpose = ask('Suffix describing a non-default purpose (eg: "archives"): ') { |q| q.default = 'none' }
33
- @project_purpose = nil if @project_purpose.empty? || @project_purpose == 'none'
34
- @redmine_project = ask('Redmine project name for billing (eg: internal): ') do |q|
32
+ @project_purpose = ask('Suffix describing a non-default purpose (eg: "archives"): ') { |q| q.default = "none" }
33
+ @project_purpose = nil if @project_purpose.empty? || @project_purpose == "none"
34
+ @redmine_project = ask("Redmine project name for billing (eg: internal): ") do |q|
35
35
  q.default = @project_name
36
36
  q.validate = /.+/
37
37
  end
38
- @aws_profile = 'renuo-app-setup'
39
- @aws_region = ask('AWS bucket region: ') { |q| q.default = 'eu-central-1' }
40
- @aws_app_group = 'renuo-apps-v2'
38
+ @aws_profile = "renuo-app-setup"
39
+ @aws_region = ask("AWS bucket region: ") { |q| q.default = "eu-central-1" }
40
+ @aws_app_group = "renuo-apps-v2"
41
41
  end
42
42
 
43
43
  def collect_cloudfront_information
44
- @setup_cloudfront = agree('Would you like to setup also AWS CloudFront? ' \
45
- '(Default: yes, if you want to deliver assets/images from S3)')
44
+ @setup_cloudfront = agree("Would you like to setup also AWS CloudFront? " \
45
+ "(Default: yes, if you want to deliver assets/images from S3)")
46
46
  end
47
47
 
48
48
  def ensure_aws_setup?
49
- ensure_is_setup?('aws --version > /dev/null',
50
- 'brew install awscli',
51
- 'Would you like to install aws-cli via `brew install awscli`?')
49
+ ensure_is_setup?("aws --version > /dev/null",
50
+ "brew install awscli",
51
+ "Would you like to install aws-cli via `brew install awscli`?")
52
52
  end
53
53
 
54
54
  def ensure_aws_profile_existing?
55
- ensure_is_setup?('aws configure --profile renuo-app-setup list > /dev/null',
56
- 'aws configure --profile renuo-app-setup',
57
- 'Would you like set up a profile for AWS ' \
58
- '`aws configure --profile renuo-app-setup`? (User/Password in keystore)')
55
+ ensure_is_setup?("aws configure --profile renuo-app-setup list > /dev/null",
56
+ "aws configure --profile renuo-app-setup",
57
+ "Would you like set up a profile for AWS " \
58
+ "`aws configure --profile renuo-app-setup`? (User/Password in keystore)")
59
59
  end
60
60
 
61
61
  def ensure_is_setup?(installation_check_command, installation_command, agree_text)
@@ -68,8 +68,8 @@ class CreateAwsProject
68
68
  $terminal.wrap_at = nil if $terminal
69
69
  puts aws_iam_setup(@aws_profile, aws_user(branch), @aws_app_group)
70
70
  puts aws_s3_setup(@aws_profile, aws_user(branch), @aws_region, @redmine_project)
71
- say '# Hint: Don\'t forget to copy SecretAccessKey and AccessKeyId'.colorize :yellow
72
- puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'main'
71
+ say "# Hint: Don't forget to copy SecretAccessKey and AccessKeyId".colorize :yellow
72
+ puts aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == "main"
73
73
  cloudfront_setup(aws_user(branch))
74
74
  $terminal.wrap_at = :auto if $terminal
75
75
  end
@@ -78,11 +78,11 @@ class CreateAwsProject
78
78
  return unless @setup_cloudfront
79
79
 
80
80
  puts aws_cloudfront_setup(@aws_profile, bucket, @redmine_project)
81
- say '# Hint: Find the distribution domain name under Distribution.DomainName'.colorize :yellow
81
+ say "# Hint: Find the distribution domain name under Distribution.DomainName".colorize :yellow
82
82
  end
83
83
 
84
84
  def aws_user(branch)
85
- [@project_name, branch, @project_purpose].compact.join('-')
85
+ [@project_name, branch, @project_purpose].compact.join("-")
86
86
  end
87
87
 
88
88
  def aws_iam_setup(profile, user, app_group)
@@ -107,7 +107,7 @@ class CreateAwsProject
107
107
  end
108
108
 
109
109
  def aws_cloudfront_setup(profile, bucket, redmine_project)
110
- tags = [{ Key: 'redmine_project', Value: redmine_project }]
110
+ tags = [{ Key: "redmine_project", Value: redmine_project }]
111
111
  cloudfront_config_string = CloudfrontConfigService.new(bucket, tags).to_s
112
112
 
113
113
  <<~CLOUDFRONT_COMMANDS
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class CreateHerokuApp
4
- ADMIN_EMAIL = 'operations@renuo.ch'
4
+ ADMIN_EMAIL = "operations@renuo.ch"
5
5
 
6
6
  def run(args)
7
7
  project_name = args[0]
8
- abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
8
+ abort(">> Project name must be between 2 and 22 characters.") unless project_name&.length&.between?(2, 22)
9
9
 
10
10
  say "# Commands to setup your Heroku application\n".colorize :green
11
11
  ENVIRONMENTS.each do |env|
@@ -22,7 +22,6 @@ class CreateHerokuApp
22
22
  say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
23
23
  say "heroku domains:add #{project_name}-#{MASTER}.renuoapp.ch --app #{heroku_name}" if env == MAIN
24
24
  say "heroku addons:create heroku-postgresql --app #{heroku_name}"
25
- say "heroku addons:create papertrail --app #{heroku_name}"
26
25
  say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
27
26
  say "heroku pg:backups:schedule DATABASE_URL --at '02:00 Europe/Zurich' --app #{heroku_name}"
28
27
  end
@@ -3,10 +3,10 @@
3
3
  class CreateNewLogins
4
4
  include CommandHelper
5
5
 
6
- @logins = [{ name: 'Sentry', sign_up_url: 'https://sentry.io/organizations/renuo/members/new/',
7
- steps: ['Click on add new Member'] },
8
- { name: 'NewRelic', sign_up_url: 'https://rpm.newrelic.com/',
9
- steps: ['Click on Renuo', 'Account Settings > Add user'] }]
6
+ @logins = [{ name: "Sentry", sign_up_url: "https://sentry.io/organizations/renuo/members/new/",
7
+ steps: ["Click on add new Member"] },
8
+ { name: "NewRelic", sign_up_url: "https://rpm.newrelic.com/",
9
+ steps: ["Click on Renuo", "Account Settings > Add user"] }]
10
10
 
11
11
  def run
12
12
  @logins.each do |login|
@@ -16,7 +16,7 @@ class CreateNewLogins
16
16
  end
17
17
  open_site login[:sign_up_url]
18
18
  end
19
- say 'every thing is set up'.green
19
+ say "every thing is set up".green
20
20
  end
21
21
 
22
22
  private
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'commander'
3
+ require "commander"
4
4
 
5
5
  class CreateSlidevPresentation
6
- EXAMPLE_SLIDES_URL = 'https://raw.githubusercontent.com/renuo/slidev-theme-renuo/main/example.md'
7
- SLIDEV_THEME_NAME = 'renuo'
8
- TEMPLATE_DIRECTORY = 'templates/slidev'
6
+ EXAMPLE_SLIDES_URL = "https://raw.githubusercontent.com/renuo/slidev-theme-renuo/main/example.md"
7
+ SLIDEV_THEME_NAME = "renuo"
8
+ TEMPLATE_DIRECTORY = "templates/slidev"
9
9
 
10
10
  attr_accessor :presentation_name, :presentation_author
11
11
 
@@ -16,11 +16,11 @@ class CreateSlidevPresentation
16
16
 
17
17
  def run(args)
18
18
  presentation_name = args[0]
19
- abort('>> No presentation name given.') unless presentation_name
19
+ abort(">> No presentation name given.") unless presentation_name
20
20
 
21
- say '# Commands to setup Slidev project with the Renuo theme:'.colorize :green
21
+ say "# Commands to setup Slidev project with the Renuo theme:".colorize :green
22
22
  @presentation_name = presentation_name
23
- @presentation_author = args[1] || 'Renuo AG'
23
+ @presentation_author = args[1] || "Renuo AG"
24
24
  print_slidev_project_commands
25
25
  end
26
26
 
@@ -30,11 +30,11 @@ class CreateSlidevPresentation
30
30
  say "mkdir #{@presentation_name}"
31
31
  say "cd #{@presentation_name}"
32
32
  say "curl -o slides.md #{EXAMPLE_SLIDES_URL}"
33
- say "echo '#{render('README.md.erb')}' > README.md"
33
+ say "echo '#{render("README.md.erb")}' > README.md"
34
34
  say "sed -ig 's/theme: .\\//theme: renuo/' slides.md"
35
- say "echo '#{render('package.json.erb')}' > package.json"
36
- say 'npm install'
37
- say 'npm run dev'
35
+ say "echo '#{render("package.json.erb")}' > package.json"
36
+ say "npm install"
37
+ say "npm run dev"
38
38
  end
39
39
 
40
40
  def render(filename)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- MAIN = 'main'
4
- MASTER = 'master'
5
- DEVELOP = 'develop'
3
+ MAIN = "main"
4
+ MASTER = "master"
5
+ DEVELOP = "develop"
6
6
  ENVIRONMENTS = [MAIN, DEVELOP].freeze
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http'
4
- require 'uri'
3
+ require "net/http"
4
+ require "uri"
5
5
 
6
6
  class FetchEmails
7
7
  def initialize
8
- @email_list_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSqPiedBeGk0N75cxZApEohj5LrIWlHWUxTjfhkmK9aOsUltcqCn24sD1haIasUjVfd8UT8VdUKUc4h/pub?gid=703649940&single=true&output=csv'
8
+ @email_list_url = "https://docs.google.com/spreadsheets/d/e/2PACX-1vSqPiedBeGk0N75cxZApEohj5LrIWlHWUxTjfhkmK9aOsUltcqCn24sD1haIasUjVfd8UT8VdUKUc4h/pub?gid=703649940&single=true&output=csv"
9
9
  end
10
10
 
11
11
  def fetch_emails
@@ -15,7 +15,7 @@ class FetchEmails
15
15
  end
16
16
 
17
17
  def run(_args)
18
- say '# Here is a complete list of Renuo email addresses'.colorize :green
18
+ say "# Here is a complete list of Renuo email addresses".colorize :green
19
19
  say fetch_emails.join("\n")
20
20
  end
21
21
 
@@ -27,11 +27,11 @@ class FetchEmails
27
27
  end
28
28
 
29
29
  def handle_redirection(response)
30
- location = response['location']
30
+ location = response["location"]
31
31
  get_emails(location)
32
32
  end
33
33
 
34
34
  def format_response(response)
35
- response.body.gsub("\r\n", "\n").split("\n").reject { |add| add == 'n/a' }
35
+ response.body.gsub("\r\n", "\n").split("\n").reject { |add| add == "n/a" }
36
36
  end
37
37
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  class GeneratePassword
6
6
  def run
7
- say SecureRandom.base64(200).gsub(%r{[+/=]}, '')[0...100]
7
+ say SecureRandom.base64(200).gsub(%r{[+/=]}, "")[0...100]
8
8
  end
9
9
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class HerokuApps
4
4
  def run
5
- JSON.parse(run_command).pluck('name')
5
+ JSON.parse(run_command).pluck("name")
6
6
  end
7
7
 
8
8
  private
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'heroku_apps'
3
+ require_relative "heroku_apps"
4
4
 
5
5
  class HerokuUsers
6
6
  def run(args)
7
7
  action, email_address = args
8
- abort('>> action is either add or remove') unless %w[add remove].include? action
9
- abort('>> specify an email address') unless email_address
8
+ abort(">> action is either add or remove") unless %w[add remove].include? action
9
+ abort(">> specify an email address") unless email_address
10
10
  heroku_apps = HerokuApps.new.run
11
11
  heroku_apps.each do |app|
12
12
  say "heroku access:#{action} #{email_address} --app #{app}"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
3
+ require "json"
4
4
 
5
5
  class LocalStorage
6
6
  def store(key, value)
@@ -18,15 +18,15 @@ class LocalStorage
18
18
  private
19
19
 
20
20
  def load_config
21
- JSON.parse(File.read('.local_storage'))
21
+ JSON.parse(File.read(".local_storage"))
22
22
  end
23
23
 
24
24
  def write_config(config)
25
- File.write('.local_storage', config.to_json)
26
- File.chmod(0o600, '.local_storage')
25
+ File.write(".local_storage", config.to_json)
26
+ File.chmod(0o600, ".local_storage")
27
27
  end
28
28
 
29
29
  def setup
30
- write_config({}) unless File.exist? '.local_storage'
30
+ write_config({}) unless File.exist? ".local_storage"
31
31
  end
32
32
  end