renuo-cli 3.1.7 → 4.2.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 +4 -4
- data/.rubocop.yml +4 -37
- data/.ruby-version +1 -1
- data/.semaphore/main-deploy.yml +1 -1
- data/.semaphore/semaphore.yml +2 -2
- data/.tool-versions +1 -0
- data/Gemfile +2 -0
- data/README.md +3 -3
- data/Rakefile +2 -0
- data/lib/renuo/cli/app/command_helper.rb +2 -0
- data/lib/renuo/cli/app/commit_leaderboard.rb +130 -0
- data/lib/renuo/cli/app/commit_leaderboard_sync.rb +107 -0
- data/lib/renuo/cli/app/configure_semaphore.rb +14 -6
- data/lib/renuo/cli/app/configure_sentry.rb +4 -4
- data/lib/renuo/cli/app/create_aws_project.rb +5 -3
- data/lib/renuo/cli/app/create_heroku_app.rb +3 -3
- data/lib/renuo/cli/app/create_new_logins.rb +2 -0
- data/lib/renuo/cli/app/create_slidev_presentation.rb +46 -0
- data/lib/renuo/cli/app/environments.rb +5 -3
- data/lib/renuo/cli/app/fetch_emails.rb +3 -1
- data/lib/renuo/cli/app/generate_password.rb +2 -0
- data/lib/renuo/cli/app/heroku_apps.rb +3 -3
- data/lib/renuo/cli/app/heroku_users.rb +3 -3
- data/lib/renuo/cli/app/list_large_git_files.rb +4 -2
- data/lib/renuo/cli/app/local_storage.rb +2 -0
- data/lib/renuo/cli/app/name_display.rb +7 -5
- data/lib/renuo/cli/app/package.json +14 -0
- data/lib/renuo/cli/app/redmine/csv_base_service.rb +4 -2
- data/lib/renuo/cli/app/redmine/issue.rb +2 -0
- data/lib/renuo/cli/app/release_project.rb +8 -4
- data/lib/renuo/cli/app/release_xing.rb +2 -0
- data/lib/renuo/cli/app/renuo_version.rb +6 -4
- data/lib/renuo/cli/app/services/cloudfront_config_service.rb +66 -67
- data/lib/renuo/cli/app/services/markdown_parser_service.rb +2 -0
- data/lib/renuo/cli/app/services/renuo_cli_config.rb +2 -0
- data/lib/renuo/cli/app/setup_uptimerobot.rb +1 -1
- data/lib/renuo/cli/app/templates/semaphore/semaphore-deploy.yml.erb +3 -3
- data/lib/renuo/cli/app/templates/semaphore/semaphore.yml.erb +38 -63
- data/lib/renuo/cli/app/templates/slidev/README.md.erb +11 -0
- data/lib/renuo/cli/app/templates/slidev/package.json.erb +16 -0
- data/lib/renuo/cli/app/toggl/detail.rb +2 -0
- data/lib/renuo/cli/app/toggl/time_entry.rb +2 -0
- data/lib/renuo/cli/app/toggl/user.rb +2 -0
- data/lib/renuo/cli/app/toggl/workspace.rb +2 -0
- data/lib/renuo/cli/app/toggl_redmine_comparator.rb +9 -5
- data/lib/renuo/cli/app/upgrade_laptop/upgrade_laptop_execution.rb +2 -0
- data/lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb +3 -1
- data/lib/renuo/cli/app/upgrade_laptop.rb +2 -0
- data/lib/renuo/cli/app/work.rb +3 -1
- data/lib/renuo/cli/version.rb +4 -2
- data/lib/renuo/cli.rb +78 -21
- data/renuo-cli.gemspec +12 -7
- metadata +39 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32e7195714b090ac3c9288984191e946e2f19b23b8edbc4dd996acb48861cc4f
|
4
|
+
data.tar.gz: b39a490ac91d15099381d980591b49704ebfe3d3e33b27f31021cef89a1cfc54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f002ed372032ca450b89f2ac6049bcac0a66d77cd219cbac72df50a6f35926e9d175fdb7df22cdfa4dca3c2fdbff0a702e6a31379ab8c4cbf0655b4f1a7727d
|
7
|
+
data.tar.gz: d720553fad38e6c1ecfde475823e3535e7e003505bb9d27db6ce1bdd8bd74b2d3d4a12755a483438afb7e2edd8749e0daef276262371350ef1895d9866910021
|
data/.rubocop.yml
CHANGED
@@ -1,43 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
- 'lib/**/*.rb'
|
4
|
-
- 'spec/**/*'
|
5
|
-
- '*.gemspec'
|
6
|
-
Exclude:
|
7
|
-
- 'bin/**/*'
|
8
|
-
- 'lib/renuo/cli.rb'
|
9
|
-
- 'lib/renuo/cli/app/heroku_users'
|
10
|
-
- 'lib/renuo/cli/app/fetch_all_emails'
|
11
|
-
- 'lib/renuo/cli/app/create_heroku_app'
|
12
|
-
- 'vendor/**/*'
|
1
|
+
inherit_gem:
|
2
|
+
renuocop: config/base.yml
|
13
3
|
|
14
|
-
|
15
|
-
Max: 120
|
16
|
-
|
17
|
-
Naming/FileName:
|
18
|
-
Exclude:
|
19
|
-
- 'Gemfile'
|
20
|
-
- 'Rakefile'
|
21
|
-
|
22
|
-
Metrics/BlockLength:
|
23
|
-
Exclude:
|
24
|
-
- 'Rakefile'
|
25
|
-
- '**/*.rake'
|
26
|
-
- 'spec/**/*.rb'
|
27
|
-
|
28
|
-
Metrics/ClassLength:
|
29
|
-
Max: 160
|
30
|
-
|
31
|
-
Style/Documentation:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Style/NonNilCheck:
|
35
|
-
IncludeSemanticChanges: true
|
36
|
-
|
37
|
-
Style/FormatStringToken:
|
4
|
+
RSpec/MessageSpies:
|
38
5
|
Enabled: false
|
39
6
|
|
40
|
-
|
7
|
+
Rails/Output:
|
41
8
|
Enabled: false
|
42
9
|
|
43
10
|
Style/GlobalVars:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.0
|
data/.semaphore/main-deploy.yml
CHANGED
data/.semaphore/semaphore.yml
CHANGED
@@ -3,7 +3,7 @@ name: renuo-cli
|
|
3
3
|
agent:
|
4
4
|
machine:
|
5
5
|
type: e1-standard-2
|
6
|
-
os_image:
|
6
|
+
os_image: ubuntu2004
|
7
7
|
auto_cancel:
|
8
8
|
running:
|
9
9
|
when: "true"
|
@@ -28,7 +28,7 @@ blocks:
|
|
28
28
|
jobs:
|
29
29
|
- name: tests
|
30
30
|
commands:
|
31
|
-
- bin/check
|
31
|
+
- ENV=CI bin/check
|
32
32
|
promotions:
|
33
33
|
- name: main
|
34
34
|
pipeline_file: main-deploy.yml
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Renuo CLI
|
2
2
|
|
3
|
-
The [Renuo](
|
3
|
+
The [Renuo](https://www.renuo.ch) command line. Used for various Renuo tasks
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -49,8 +49,8 @@ gem push renuo-cli-*.gem
|
|
49
49
|
|
50
50
|
Bug reports and pull requests are welcome on GitHub at <https://github.com/renuo/renuo-cli>. This project is intended to
|
51
51
|
be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
52
|
-
the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
52
|
+
the [Contributor Covenant](https://www.contributor-covenant.org) code of conduct.
|
53
53
|
|
54
54
|
## License
|
55
55
|
|
56
|
-
The gem is available as open source under the terms of the [MIT License](
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/license/MIT).
|
data/Rakefile
CHANGED
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CommitLeaderboard
|
4
|
+
attr_accessor :queue_file_path, :author_username, :auhor_avatar_url
|
5
|
+
|
6
|
+
def run(args)
|
7
|
+
abort 'No author username given.' if args[0].nil?
|
8
|
+
abort 'No author avatar url given.' if args[1].nil?
|
9
|
+
|
10
|
+
@author_username = args[0]
|
11
|
+
@author_avatar_url = args[1]
|
12
|
+
|
13
|
+
@queue_file_path = args[2] || '~/.renuo-commit-leaderboard.json'
|
14
|
+
@queue_file_path = File.expand_path(@queue_file_path)
|
15
|
+
|
16
|
+
check_required_tools
|
17
|
+
check_if_repository_is_present
|
18
|
+
check_if_commit_is_present
|
19
|
+
|
20
|
+
append_to_queue(build_commit_payload)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def check_required_tools
|
26
|
+
return if system('git --version', out: File::NULL)
|
27
|
+
|
28
|
+
abort('>> Git is not installed. Please install it first.')
|
29
|
+
end
|
30
|
+
|
31
|
+
def check_if_repository_is_present
|
32
|
+
return if system('git rev-parse --is-inside-work-tree', out: File::NULL)
|
33
|
+
|
34
|
+
abort('>> Not a git repository. Please run this command in a git repository.')
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_if_commit_is_present
|
38
|
+
return if system('git rev-parse --verify HEAD', out: File::NULL)
|
39
|
+
|
40
|
+
abort('>> No commits found. Please commit your changes first.')
|
41
|
+
end
|
42
|
+
|
43
|
+
def build_commit_payload
|
44
|
+
{
|
45
|
+
sha: `git rev-parse HEAD`.strip,
|
46
|
+
message: `git log -1 --pretty=%B`.strip,
|
47
|
+
repository: `basename $(git rev-parse --show-toplevel)`.strip,
|
48
|
+
branch: `git rev-parse --abbrev-ref HEAD`.strip,
|
49
|
+
author: {
|
50
|
+
username: @author_username,
|
51
|
+
avatar_url: @author_avatar_url
|
52
|
+
}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def append_to_queue(payload)
|
57
|
+
`echo [] > #{@queue_file_path}` unless File.exist?(@queue_file_path)
|
58
|
+
|
59
|
+
commits = read_commits_from_queue(payload)
|
60
|
+
|
61
|
+
puts '>> Adding commit to the queue:'
|
62
|
+
|
63
|
+
print_queue_item(payload)
|
64
|
+
File.open(@queue_file_path, 'w') do |file|
|
65
|
+
commits << payload
|
66
|
+
file.write(JSON.generate(commits))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def read_commits_from_queue(payload)
|
71
|
+
commits = nil
|
72
|
+
|
73
|
+
File.open(@queue_file_path, 'r') do |file|
|
74
|
+
commits = JSON.parse(file.read)
|
75
|
+
|
76
|
+
if commits.any? { |commit| commit['sha'] == payload[:sha] }
|
77
|
+
abort('>> Commit has already been added to the queue')
|
78
|
+
end
|
79
|
+
rescue JSON::ParserError
|
80
|
+
abort('>> Invalid JSON format in the queue file.')
|
81
|
+
end
|
82
|
+
|
83
|
+
commits
|
84
|
+
end
|
85
|
+
|
86
|
+
# rubocop:disable Metrics/AbcSize
|
87
|
+
def print_queue_item(payload)
|
88
|
+
sha = format_text_truncate(payload[:sha], COLOR_CODES[:green], 6)
|
89
|
+
repository = format_text("#{payload[:repository]}##{payload[:branch]}", COLOR_CODES[:blue])
|
90
|
+
message = format_text_elipsis(payload[:message], COLOR_CODES[:yellow], 50)
|
91
|
+
username = format_text(payload[:author][:username], COLOR_CODES[:magenta])
|
92
|
+
avatar_url = format_text(payload[:author][:avatar_url], COLOR_CODES[:cyan])
|
93
|
+
|
94
|
+
puts "#{sha} #{repository} - #{username} (#{avatar_url}) - #{message}"
|
95
|
+
end
|
96
|
+
# rubocop:enable Metrics/AbcSize
|
97
|
+
|
98
|
+
def format_text(text, color)
|
99
|
+
"\e[#{color}m#{text}\e[0m"
|
100
|
+
end
|
101
|
+
|
102
|
+
def wrap_in_color(text, color)
|
103
|
+
"\e[#{color}m#{text}\e[0m"
|
104
|
+
end
|
105
|
+
|
106
|
+
def format_text_truncate(text, color, truncate_length)
|
107
|
+
format_text(text[0..truncate_length], color)
|
108
|
+
end
|
109
|
+
|
110
|
+
def format_text_elipsis(text, color, truncate_length)
|
111
|
+
if text.length > truncate_length
|
112
|
+
format_text("#{truncate_text(text, truncate_length)}...", color)
|
113
|
+
else
|
114
|
+
format_text(text, color)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def truncate_text(text, truncate_length)
|
119
|
+
text[0..truncate_length]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
COLOR_CODES = {
|
124
|
+
red: 31,
|
125
|
+
green: 32,
|
126
|
+
yellow: 33,
|
127
|
+
blue: 34,
|
128
|
+
magenta: 35,
|
129
|
+
cyan: 36
|
130
|
+
}.freeze
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
class SyncError < StandardError; end
|
6
|
+
|
7
|
+
class CommitLeaderboardSync
|
8
|
+
attr_accessor :queue_file_path, :leaderboard_api_url, :api_secret
|
9
|
+
|
10
|
+
def run(args)
|
11
|
+
process_args(args)
|
12
|
+
|
13
|
+
unless File.exist?(@queue_file_path)
|
14
|
+
abort('>> Commit queue file does not exist.')
|
15
|
+
end
|
16
|
+
|
17
|
+
unless @leaderboard_api_url.match?(URI::DEFAULT_PARSER.make_regexp)
|
18
|
+
abort('>> Invalid API URL.')
|
19
|
+
end
|
20
|
+
|
21
|
+
commits = JSON.parse(File.read(@queue_file_path))
|
22
|
+
send_commits(commits)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def process_args(args)
|
28
|
+
if args[0].blank?
|
29
|
+
abort('>> No API secret given.')
|
30
|
+
end
|
31
|
+
|
32
|
+
@api_secret = args[0]
|
33
|
+
@queue_file_path = File.expand_path(args[1] || '~/.renuo_commit_leaderboard.json')
|
34
|
+
@leaderboard_api_url = args[2] || 'https://dashboard.renuo.ch/api/v1/add_commits'
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_configuration
|
38
|
+
puts 'Running commit leaderboard sync with:'
|
39
|
+
puts '-----------------------------'
|
40
|
+
puts "API secret: #{@api_secret}"
|
41
|
+
puts "Queue file path: #{@queue_file_path}"
|
42
|
+
puts "Leaderboard API URL: #{@leaderboard_api_url}"
|
43
|
+
end
|
44
|
+
|
45
|
+
# rubocop:disable Metrics/MethodLength
|
46
|
+
def send_commits(commits)
|
47
|
+
next_queue = []
|
48
|
+
|
49
|
+
until commits.empty?
|
50
|
+
commit = commits.shift
|
51
|
+
payload = { commit: commit }.to_json
|
52
|
+
|
53
|
+
puts 'Sending commit to leaderboard...'
|
54
|
+
print_payload(payload)
|
55
|
+
|
56
|
+
begin
|
57
|
+
handle_response(send_commit(payload))
|
58
|
+
rescue SyncError => e
|
59
|
+
puts e.message
|
60
|
+
next_queue << commit
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
File.write(@queue_file_path, JSON.generate(next_queue))
|
65
|
+
end
|
66
|
+
# rubocop:enable Metrics/MethodLength
|
67
|
+
|
68
|
+
def send_commit(payload)
|
69
|
+
uri = URI(@leaderboard_api_url)
|
70
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
71
|
+
request = Net::HTTP::Post.new(uri.path, { 'Content-Type' => 'application/json', 'Accept' => 'application/json' })
|
72
|
+
request['LEADERBOARD_SIGNATURE'] = generate_signature_for_payload(@api_secret, payload)
|
73
|
+
request.body = payload
|
74
|
+
|
75
|
+
http.request(request)
|
76
|
+
end
|
77
|
+
|
78
|
+
def print_payload(payload)
|
79
|
+
puts JSON.pretty_generate(payload)
|
80
|
+
end
|
81
|
+
|
82
|
+
# rubocop:disable Metrics/MethodLength
|
83
|
+
def handle_response(response)
|
84
|
+
case response.code.to_i
|
85
|
+
when 200
|
86
|
+
puts '>> Successfully sent commits to the leaderboard.'
|
87
|
+
when 401
|
88
|
+
abort('>> Unauthorized. Please check your secret.')
|
89
|
+
when 403
|
90
|
+
abort('>> Forbidden. Please check your secret.')
|
91
|
+
when 404
|
92
|
+
abort('>> Not found. Please check the URL.')
|
93
|
+
else
|
94
|
+
raise SyncError, "Failed to send commits to the leaderboard:\n#{response.code} - #{response.body}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
# rubocop:enable Metrics/MethodLength
|
98
|
+
|
99
|
+
def clear_queue
|
100
|
+
File.write(@queue_file_path, '[]')
|
101
|
+
end
|
102
|
+
|
103
|
+
def generate_signature_for_payload(secret_key, payload)
|
104
|
+
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret_key, payload)
|
105
|
+
"sig=#{signature}"
|
106
|
+
end
|
107
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'commander'
|
2
|
-
require_relative '
|
4
|
+
require_relative 'environments'
|
3
5
|
|
4
6
|
class ConfigureSemaphore
|
5
7
|
attr_accessor :project_name, :environment
|
@@ -24,6 +26,7 @@ class ConfigureSemaphore
|
|
24
26
|
|
25
27
|
create_semaphore_notification
|
26
28
|
create_semaphore_secrets
|
29
|
+
create_semaphore_deployment_targets
|
27
30
|
end
|
28
31
|
# rubocop:enable Metrics/MethodLength
|
29
32
|
|
@@ -36,15 +39,20 @@ class ConfigureSemaphore
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def create_semaphore_notification
|
39
|
-
system("sem create notifications #{project_name} "\
|
40
|
-
"--projects #{project_name} "\
|
41
|
-
'--branches "main,develop" '\
|
42
|
-
"--slack-channels \"#project-#{project_name}\" "\
|
42
|
+
system("sem create notifications #{project_name} " \
|
43
|
+
"--projects #{project_name} " \
|
44
|
+
'--branches "main,develop" ' \
|
45
|
+
"--slack-channels \"#project-#{project_name}\" " \
|
43
46
|
'--slack-endpoint "https://hooks.slack.com/services/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"')
|
44
47
|
end
|
45
48
|
|
46
49
|
def create_semaphore_secrets
|
47
|
-
system("sem create secret #{project_name}")
|
50
|
+
system("sem create secret -p #{project_name} #{project_name}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_semaphore_deployment_targets
|
54
|
+
system("sem create dt main -p #{project_name}")
|
55
|
+
system("sem create dt develop -p #{project_name}")
|
48
56
|
end
|
49
57
|
|
50
58
|
def render(template_file)
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'commander'
|
2
|
-
require_relative '
|
4
|
+
require_relative 'environments'
|
3
5
|
|
4
6
|
class ConfigureSentry
|
5
|
-
ADMIN_EMAIL = 'admin@renuo.ch'
|
6
|
-
|
7
|
-
def initialize; end
|
7
|
+
ADMIN_EMAIL = 'admin@renuo.ch'
|
8
8
|
|
9
9
|
def run(args)
|
10
10
|
project_name = args[0]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'renuo/cli/app/services/cloudfront_config_service'
|
2
4
|
|
3
5
|
class CreateAwsProject
|
@@ -39,7 +41,7 @@ class CreateAwsProject
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def collect_cloudfront_information
|
42
|
-
@setup_cloudfront = agree('Would you like to setup also AWS CloudFront? '\
|
44
|
+
@setup_cloudfront = agree('Would you like to setup also AWS CloudFront? ' \
|
43
45
|
'(Default: yes, if you want to deliver assets/images from S3)')
|
44
46
|
end
|
45
47
|
|
@@ -52,7 +54,7 @@ class CreateAwsProject
|
|
52
54
|
def ensure_aws_profile_existing?
|
53
55
|
ensure_is_setup?('aws configure --profile renuo-app-setup list > /dev/null',
|
54
56
|
'aws configure --profile renuo-app-setup',
|
55
|
-
'Would you like set up a profile for AWS '\
|
57
|
+
'Would you like set up a profile for AWS ' \
|
56
58
|
'`aws configure --profile renuo-app-setup`? (User/Password in keystore)')
|
57
59
|
end
|
58
60
|
|
@@ -105,7 +107,7 @@ class CreateAwsProject
|
|
105
107
|
end
|
106
108
|
|
107
109
|
def aws_cloudfront_setup(profile, bucket, redmine_project)
|
108
|
-
tags = [{
|
110
|
+
tags = [{ Key: 'redmine_project', Value: redmine_project }]
|
109
111
|
cloudfront_config_string = CloudfrontConfigService.new(bucket, tags).to_s
|
110
112
|
|
111
113
|
<<~CLOUDFRONT_COMMANDS
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'commander'
|
4
|
+
|
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'
|
9
|
+
|
10
|
+
attr_accessor :presentation_name, :presentation_author
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@presentation_name = nil
|
14
|
+
@presentation_author = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def run(args)
|
18
|
+
presentation_name = args[0]
|
19
|
+
abort('>> No presentation name given.') unless presentation_name
|
20
|
+
|
21
|
+
say '# Commands to setup Slidev project with the Renuo theme:'.colorize :green
|
22
|
+
@presentation_name = presentation_name
|
23
|
+
@presentation_author = args[1] || 'Renuo AG'
|
24
|
+
print_slidev_project_commands
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def print_slidev_project_commands
|
30
|
+
say "mkdir #{@presentation_name}"
|
31
|
+
say "cd #{@presentation_name}"
|
32
|
+
say "curl -o slides.md #{EXAMPLE_SLIDES_URL}"
|
33
|
+
say "echo '#{render('README.md.erb')}' > README.md"
|
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'
|
38
|
+
end
|
39
|
+
|
40
|
+
def render(filename)
|
41
|
+
file_path = File.join(File.dirname(__FILE__), TEMPLATE_DIRECTORY, filename)
|
42
|
+
template = File.read(file_path)
|
43
|
+
renderer = ERB.new(template)
|
44
|
+
renderer.result(binding)
|
45
|
+
end
|
46
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'uri'
|
3
5
|
|
@@ -30,6 +32,6 @@ class FetchEmails
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def format_response(response)
|
33
|
-
response.body.gsub(
|
35
|
+
response.body.gsub("\r\n", "\n").split("\n").reject { |add| add == 'n/a' }
|
34
36
|
end
|
35
37
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
def initialize; end
|
3
|
+
require_relative 'heroku_apps'
|
5
4
|
|
5
|
+
class HerokuUsers
|
6
6
|
def run(args)
|
7
7
|
action, email_address = args
|
8
8
|
abort('>> action is either add or remove') unless %w[add remove].include? action
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ListLargeGitFiles
|
2
4
|
def run
|
3
|
-
cmd = 'bash -c "join -o \'1.1 1.2 2.3\' <(git rev-list --objects --all | sort) '\
|
4
|
-
|
5
|
+
cmd = 'bash -c "join -o \'1.1 1.2 2.3\' <(git rev-list --objects --all | sort) ' \
|
6
|
+
'<(git verify-pack -v objects/pack/*.idx | sort -k3 -n | tail -5 | sort) | sort -k3 -n"'
|
5
7
|
puts `#{cmd}`
|
6
8
|
end
|
7
9
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'command_helper'
|
2
4
|
|
3
5
|
class NameDisplay
|
@@ -15,11 +17,11 @@ class NameDisplay
|
|
15
17
|
|
16
18
|
private
|
17
19
|
|
18
|
-
HEROKU_APP_NAME = '-a renuo-dashboard-main'
|
19
|
-
HEROKU_CLI = 'heroku run'
|
20
|
-
RENUO_CLI = 'rails renuo:welcome'
|
21
|
-
SLIDES = 'https://docs.google.com/presentation/d/1mPhQjArZnlUWUa2ik5R9IlGmdCKCwc2_H8Qq-AWgV-A/edit'
|
22
|
-
WELCOME_MESSAGE = 'Welcome to Renuo'
|
20
|
+
HEROKU_APP_NAME = '-a renuo-dashboard-main'
|
21
|
+
HEROKU_CLI = 'heroku run'
|
22
|
+
RENUO_CLI = 'rails renuo:welcome'
|
23
|
+
SLIDES = 'https://docs.google.com/presentation/d/1mPhQjArZnlUWUa2ik5R9IlGmdCKCwc2_H8Qq-AWgV-A/edit'
|
24
|
+
WELCOME_MESSAGE = 'Welcome to Renuo'
|
23
25
|
|
24
26
|
def display_name(name)
|
25
27
|
text_message = [WELCOME_MESSAGE, name, '🥳🔥'].compact.join(' ')
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "app",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "https://github.com/renuo/renuo-cli.git"
|
12
|
+
},
|
13
|
+
"private": true
|
14
|
+
}
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'csv'
|
2
4
|
|
3
5
|
module Redmine
|
4
6
|
class CsvBaseService
|
5
|
-
API_LOCATION = 'https://redmine.renuo.ch'
|
7
|
+
API_LOCATION = 'https://redmine.renuo.ch'
|
6
8
|
|
7
9
|
def initialize(token)
|
8
10
|
@token = token
|
@@ -40,7 +42,7 @@ module Redmine
|
|
40
42
|
separated_csv_entries = CSV.parse(body, col_sep: ',')
|
41
43
|
keys = separated_csv_entries.shift[1..-2]
|
42
44
|
entries = separated_csv_entries.shift[1..-2]
|
43
|
-
|
45
|
+
keys.zip(entries).to_h
|
44
46
|
rescue CSV::MalformedCSVError
|
45
47
|
raise_bad_data_error
|
46
48
|
end
|