renuo-cli 0.0.13 → 0.1.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.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/bin/check +0 -4
- data/bin/run +7 -0
- data/lib/renuo/cli/app/create_aws_project.rb +26 -27
- data/lib/renuo/cli/app/release_project.rb +25 -14
- data/lib/renuo/cli/app/services/cloudfront_config_service.rb +5 -1
- data/lib/renuo/cli/version.rb +1 -1
- data/renuo-cli.gemspec +4 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 41b05b933185d067661c4c49c8705d9fc0307300
|
4
|
+
data.tar.gz: 07f8c22d60a2ef4f42fe1a56662e83b163876db5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db13152572f6e31b41868b4f7c0d404b5377b1ecae20d56e98bde27d922e343fc761c39cb41240e47e1b33b62e8dd1c65d15295c3afa57c076550e33913be33a
|
7
|
+
data.tar.gz: 3c5b4bfb4581dbafe2c639fbb1f4984757479dbbd6759a7f2bbb097136a491afbb34344efb5e3db1faaff56d3a9fcf231655b3914e51b5fc2dc70cda89989785
|
data/README.md
CHANGED
data/bin/check
CHANGED
@@ -1,27 +1,23 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
|
4
3
|
if ! bundle exec rubocop -D -c .rubocop.yml
|
5
4
|
then
|
6
5
|
echo 'rubocop detected issues!'
|
7
6
|
exit 1
|
8
7
|
fi
|
9
8
|
|
10
|
-
|
11
9
|
if ! bundle exec mdl .
|
12
10
|
then
|
13
11
|
echo 'Violated markdown rules, see https://github.com/mivok/markdownlint/blob/master/docs/RULES.md, commit aborted'
|
14
12
|
exit 1
|
15
13
|
fi
|
16
14
|
|
17
|
-
|
18
15
|
if ! bundle exec rspec
|
19
16
|
then
|
20
17
|
echo 'rspec errors'
|
21
18
|
exit 1
|
22
19
|
fi
|
23
20
|
|
24
|
-
|
25
21
|
if ! bundle exec cucumber
|
26
22
|
then
|
27
23
|
echo 'cucumber errors'
|
data/bin/run
ADDED
@@ -76,21 +76,22 @@ class CreateAwsProject
|
|
76
76
|
# wrap_at inserts newlines, after that, the command is no longer copyable
|
77
77
|
# rubocop:disable Style/GlobalVars
|
78
78
|
$terminal.wrap_at = nil
|
79
|
-
say aws_iam_setup(@aws_profile,
|
80
|
-
say
|
81
|
-
say
|
82
|
-
cloudfront_setup(branch)
|
79
|
+
say aws_iam_setup(@aws_profile, aws_user(branch), @aws_app_group)
|
80
|
+
say aws_s3_setup(@aws_profile, aws_user(branch), @aws_region, @redmine_project)
|
81
|
+
say aws_s3_versioning_setup(@aws_profile, aws_user(branch)) if branch == 'master'
|
82
|
+
cloudfront_setup(aws_user(branch), branch)
|
83
83
|
$terminal.wrap_at = :auto
|
84
84
|
# rubocop:enable Style/GlobalVars
|
85
85
|
end
|
86
86
|
|
87
|
-
def cloudfront_setup(branch)
|
87
|
+
def cloudfront_setup(bucket, branch)
|
88
88
|
return unless @setup_cloudfront
|
89
|
-
say
|
89
|
+
say aws_cloudfront_setup(@aws_profile, bucket, branch, @redmine_project)
|
90
90
|
if @cloudfront_alias[branch.to_sym]
|
91
|
-
say "\
|
91
|
+
say "\n# Warning: Don't forget to set up `#{cloudfront_alias(branch)}` on the DNS "\
|
92
|
+
'if not yet done'.colorize :yellow
|
92
93
|
else
|
93
|
-
say "\
|
94
|
+
say "\n# Hint: The domain name for your S3 files, can be found after running the" \
|
94
95
|
' commands on https://console.aws.amazon.com/cloudfront/home'.colorize :yellow
|
95
96
|
end
|
96
97
|
end
|
@@ -103,35 +104,33 @@ class CreateAwsProject
|
|
103
104
|
@cloudfront_alias[branch.to_sym]
|
104
105
|
end
|
105
106
|
|
106
|
-
def aws_iam_setup(profile,
|
107
|
-
<<-
|
107
|
+
def aws_iam_setup(profile, user, app_group)
|
108
|
+
<<-IAM_COMMANDS
|
108
109
|
aws --profile #{profile} iam create-user --user-name #{user}
|
109
110
|
aws --profile #{profile} iam add-user-to-group --user-name #{user} --group-name #{app_group}
|
110
111
|
aws --profile #{profile} iam create-access-key --user-name #{user}
|
111
|
-
|
112
|
-
SETUP_COMMANDS
|
112
|
+
IAM_COMMANDS
|
113
113
|
end
|
114
114
|
|
115
|
-
def
|
116
|
-
<<-
|
117
|
-
aws
|
118
|
-
|
115
|
+
def aws_s3_setup(profile, bucket, region, redmine_project)
|
116
|
+
<<-S3_COMMANDS
|
117
|
+
aws --profile #{profile} s3 mb s3://#{bucket} --region #{region}
|
118
|
+
aws --profile #{profile} s3api put-bucket-tagging --bucket #{bucket} --tagging "TagSet=[{Key=redmine_project,Value=#{redmine_project}}]"
|
119
|
+
S3_COMMANDS
|
119
120
|
end
|
120
121
|
|
121
|
-
def
|
122
|
-
<<-
|
122
|
+
def aws_s3_versioning_setup(profile, bucket)
|
123
|
+
<<-S3_VERSIONING_COMMANDS
|
123
124
|
aws --profile #{profile} s3api put-bucket-versioning --bucket #{bucket} --versioning-configuration Status=Enabled
|
124
|
-
|
125
|
+
S3_VERSIONING_COMMANDS
|
125
126
|
end
|
126
127
|
|
127
|
-
def
|
128
|
-
|
129
|
-
|
130
|
-
aws --profile #{@aws_profile} s3api put-bucket-tagging --bucket #{bucket} --tagging "TagSet=#{tag_set}"
|
131
|
-
TAGGING_COMMANDS
|
132
|
-
end
|
128
|
+
def aws_cloudfront_setup(profile, bucket, branch, redmine_project)
|
129
|
+
tags = [{ "redmine_project": redmine_project }]
|
130
|
+
cloudfront_config_string = CloudfrontConfigService.new(bucket, cloudfront_alias(branch), tags).to_s
|
133
131
|
|
134
|
-
|
135
|
-
|
132
|
+
<<-CLOUDFRONT_COMMANDS
|
133
|
+
aws --profile #{profile} cloudfront create-distribution-with-tags --cli-input-json '#{cloudfront_config_string}'
|
134
|
+
CLOUDFRONT_COMMANDS
|
136
135
|
end
|
137
136
|
end
|
@@ -16,8 +16,9 @@ class ReleaseProject
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def validate_update_type(update_type, version)
|
19
|
-
|
20
|
-
version
|
19
|
+
if version && update_type != UPDATE_TYPES[3]
|
20
|
+
say('>> Do not specify a version for a non-custom release. Given version will be ignored.')
|
21
|
+
end
|
21
22
|
|
22
23
|
if !version && update_type == UPDATE_TYPES[3]
|
23
24
|
@version = ask('>> Please enter your desired version for your custom release (X.Y.Z):')
|
@@ -40,7 +41,7 @@ class ReleaseProject
|
|
40
41
|
def validate_project_name(project_name)
|
41
42
|
abort('>> No project name given.') unless project_name
|
42
43
|
unless system("#{MOVE_TO_TEMP} && hub clone #{project_name} && " \
|
43
|
-
"cd #{project_name} && git checkout master && git flow init -d")
|
44
|
+
"cd #{folder_name(project_name)} && git checkout master && git flow init -d")
|
44
45
|
cleanup
|
45
46
|
abort('>> Project not found on Github.')
|
46
47
|
end
|
@@ -51,20 +52,23 @@ class ReleaseProject
|
|
51
52
|
|
52
53
|
release_start project_name, update_type, version
|
53
54
|
|
54
|
-
say
|
55
|
+
say ">> Project successfully released with version #{version}."
|
55
56
|
end
|
56
57
|
|
57
58
|
def release_start(project_name, update_type, version)
|
58
59
|
abort('>> Unable to pull from Github. Cancelling release.') unless checkout? project_name
|
59
60
|
|
60
|
-
|
61
|
-
|
61
|
+
if update_type != UPDATE_TYPES[3] && !version_bump?(project_name, current_version(project_name))
|
62
|
+
abort('>> Please bump the version in files manually. Cancelling release.')
|
63
|
+
end
|
62
64
|
|
63
|
-
|
64
|
-
agree(">> Are you sure you wish to deploy '#{project_name}' " \
|
65
|
+
unless agree(">> Are you sure you wish to deploy '#{project_name}' " \
|
65
66
|
"as a #{update_type} release (#{current_version(project_name)} => #{version})?")
|
66
|
-
|
67
|
-
|
67
|
+
abort('>> Cancelling Release.')
|
68
|
+
end
|
69
|
+
|
70
|
+
return if release_flow(project_name, version)
|
71
|
+
abort('>> Unable to finish release and push to master. Cancelling release.')
|
68
72
|
end
|
69
73
|
|
70
74
|
def checkout?(project_name)
|
@@ -74,9 +78,12 @@ class ReleaseProject
|
|
74
78
|
end
|
75
79
|
|
76
80
|
def version_bump?(project_name, current_version)
|
77
|
-
|
78
|
-
|
79
|
-
|
81
|
+
if system("#{move_and_cd(project_name)} && grep -R -F --color --exclude-dir=.git '#{current_version}' .")
|
82
|
+
agree(">> Current version number (#{current_version}) found in above files. " \
|
83
|
+
' Do you wish to continue without changing it?')
|
84
|
+
else
|
85
|
+
true
|
86
|
+
end
|
80
87
|
end
|
81
88
|
|
82
89
|
def release_flow(project_name, version)
|
@@ -107,7 +114,11 @@ class ReleaseProject
|
|
107
114
|
end
|
108
115
|
|
109
116
|
def move_and_cd(project_name)
|
110
|
-
"#{MOVE_TO_TEMP} && cd #{project_name}"
|
117
|
+
"#{MOVE_TO_TEMP} && cd #{folder_name(project_name)}"
|
118
|
+
end
|
119
|
+
|
120
|
+
def folder_name(project_name)
|
121
|
+
project_name.split('/').last
|
111
122
|
end
|
112
123
|
|
113
124
|
def cleanup
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class CloudfrontConfigService
|
2
|
-
def initialize(bucket, bucket_alias)
|
2
|
+
def initialize(bucket, bucket_alias, tags = [])
|
3
3
|
@bucket = bucket
|
4
4
|
@bucket_alias = bucket_alias
|
5
|
+
@tags = tags
|
5
6
|
end
|
6
7
|
|
7
8
|
def to_s
|
@@ -103,6 +104,9 @@ class CloudfrontConfigService
|
|
103
104
|
"WebACLId": '',
|
104
105
|
"HttpVersion": 'http2',
|
105
106
|
"IsIPV6Enabled": true
|
107
|
+
},
|
108
|
+
"Tags": {
|
109
|
+
"Items": @tags
|
106
110
|
}
|
107
111
|
}
|
108
112
|
end
|
data/lib/renuo/cli/version.rb
CHANGED
data/renuo-cli.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'renuo/cli/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'renuo-cli'
|
7
7
|
spec.version = Renuo::Cli::VERSION
|
8
|
-
spec.authors = ['
|
9
|
-
spec.email = ['
|
8
|
+
spec.authors = ['Renuo AG']
|
9
|
+
spec.email = ['info@renuo.ch']
|
10
10
|
|
11
11
|
spec.summary = 'The Renuo CLI automates some commonly used workflows by providing a command line interface.'
|
12
12
|
spec.description = 'The Renuo CLI automates some commonly used workflows by providing a command line interface.'
|
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'pry'
|
31
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
32
32
|
spec.add_development_dependency 'rspec'
|
33
|
-
spec.add_development_dependency 'rubocop', '0.
|
33
|
+
spec.add_development_dependency 'rubocop', '0.55'
|
34
34
|
spec.add_development_dependency 'simplecov', '0.10.0' # TODO: update and fix coverage
|
35
35
|
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: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Renuo AG
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: '0.55'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: '0.55'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: simplecov
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,7 +195,7 @@ dependencies:
|
|
195
195
|
description: The Renuo CLI automates some commonly used workflows by providing a command
|
196
196
|
line interface.
|
197
197
|
email:
|
198
|
-
-
|
198
|
+
- info@renuo.ch
|
199
199
|
executables:
|
200
200
|
- renuo
|
201
201
|
extensions: []
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- Rakefile
|
217
217
|
- bin/check
|
218
218
|
- bin/console
|
219
|
+
- bin/run
|
219
220
|
- bin/setup
|
220
221
|
- exe/renuo
|
221
222
|
- lib/renuo/cli.rb
|
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
259
|
version: '0'
|
259
260
|
requirements: []
|
260
261
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.
|
262
|
+
rubygems_version: 2.5.1
|
262
263
|
signing_key:
|
263
264
|
specification_version: 4
|
264
265
|
summary: The Renuo CLI automates some commonly used workflows by providing a command
|