devkitkat 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bc6a0d1d9391ed516c87cb476931a62d59c56ebeec5e52f4efad719f5e79581
4
- data.tar.gz: a6bfa8f5bc4a49f0d83be3ac9d395432c7cb841cadf4380509d3f6a7d9a4cf09
3
+ metadata.gz: dd732b290dba1a084ac162b2051b2a330039f4cd3d4ee29722dbaf0727512545
4
+ data.tar.gz: 1d2e08a9f0ee07756027eb1e89c78033653819ddb6381906fab07ee0424adc64
5
5
  SHA512:
6
- metadata.gz: f4e14b24694cb58569e815c6ce86afbb467bffda9b3a4702387cc4c30c35a41844ed4cbde5fb8f967795c7e532979cf381406bef391a6670a5359fdee76f6eb9
7
- data.tar.gz: 55cd17e6bef92bc24abbd1dadc76c342231a190f1ad0a49720d2c26c79e80e1b48593a0824549e860c55ef67080e5e44badc451ee9a9eb532501261c35eba944
6
+ metadata.gz: 955b9030e45a72faeff84a960556b78968f32e2d402e1ebc52c9a52cd599bd71a29063193af56bd439dd9ed0479e7f1d3fd0e3938ad2d737cb82868b9244ca85
7
+ data.tar.gz: 56b093d253840f1787df90d3932bfcb6e94af61fbca3d1cb1693e07bd0c843b7465e40ce7b7ccf9a0956f26735e75f4010ab9ede8cbbe404410c53b42778fda6
data/.gitlab-ci.yml CHANGED
@@ -22,8 +22,7 @@ release:
22
22
  script:
23
23
  - bin/release
24
24
  only:
25
- changes:
26
- - lib/devkitkat/version.rb
25
+ - tags
27
26
 
28
27
  # services:
29
28
  # - docker:19.03.1-dind
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devkitkat (0.1.3)
4
+ devkitkat (0.1.6)
5
5
  activesupport (~> 6.0.0)
6
6
  colorize (~> 0.8.1)
7
7
  docker-api (~> 1.34.2)
@@ -31,7 +31,7 @@ GEM
31
31
  concurrent-ruby (~> 1.0)
32
32
  method_source (0.9.2)
33
33
  minitest (5.12.2)
34
- multi_json (1.14.0)
34
+ multi_json (1.14.1)
35
35
  parallel (1.17.0)
36
36
  pry (0.12.2)
37
37
  coderay (~> 1.1.0)
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![pipeline status](https://gitlab.com/dosuken123/devkitkat/badges/master/pipeline.svg)](https://gitlab.com/dosuken123/devkitkat/commits/master)
2
+ [![Gem Version](https://badge.fury.io/rb/devkitkat.svg)](https://badge.fury.io/rb/devkitkat)
2
3
 
3
4
  # Devkitkat
4
5
 
@@ -151,23 +152,40 @@ source ${MI_SYSTEM_SCRIPT_SHARED_DIR}
151
152
  # Call a function defiend in the `shared` script
152
153
  ```
153
154
 
154
- ## Predefined scripts
155
+ ## Utility commands, Predefined scripts and Options
155
156
 
156
157
  Devkitkat provides predefined scripts that are useful in common development scenarios.
157
158
 
158
- |Script name |Available options |Description|
159
- |--- |--- |---|
160
- |`clone` |`GIT_DEPTH` ... Speicify git-depth|Clone source code from the `services:<name>:repo:`|
161
- |`pull` |`GIT_DEPTH` ... Speicify git-depth|Pull source code from the `services:<name>:repo:`|
162
- |`download` |N/A |Download source code from the `services:<name>:repo:`|
163
- |`clean` |N/A |Remove all files from `data`, `cache`, `log` and `src` dirs|
164
- |`docker-build` |`TAG` |Build a docker image|
165
- |`docker-push` |`REGISTRY` |Push a docker image|
166
- |`add-user` |`TAG` |Add a user to the current system (It's useful for containerized images)|
167
- |`add-script` |`--basic` |Add a script to services|
168
- |`help` |N/A |Show help|
169
- |`version` |N/A |Show version|
170
- |`poop` |N/A |:poop:|
159
+ ```
160
+ Usage: devkitkat <command/script> <target> [args] [options]
161
+
162
+ Options:
163
+ -p, --path PATH The root path of the .devkitkat.yml
164
+ --exclude SERVICE Exclude serviced from the specified target
165
+ -e, --env-var VARIABLE additional environment variables
166
+ -d, --depth DEPTH Git depth for pull/fetch
167
+ -r, --remote REMOTE Git remote
168
+ -b, --branch BRANCH Git branch
169
+ -t, --tty TTY mode. In this mode, log won't be emitted.
170
+ -v, --version Show version
171
+ -h, --help Show help
172
+
173
+ Utility Commands:
174
+ add-script - Add a script file
175
+ add-example - Add an example file
176
+ add-shared-script - Add s shared script
177
+ help - Show help
178
+
179
+ Predefined scripts:
180
+ clone - Clone repository
181
+ pull - Pull latest source code
182
+ clean - Clean the service dir
183
+ poop - Poop
184
+ ```
185
+
186
+ Example:
187
+
188
+ `devkitkat start rails --path $HOME/awesome-app-dev-kit/ --env-var AWS_CRED=XXXXX`
171
189
 
172
190
  ## Predefined group names
173
191
 
@@ -220,7 +238,7 @@ For example, if you want to start `rails` service, your command would look like
220
238
 
221
239
  `devkitkat start backend --exclude redis`
222
240
 
223
- ## Sample commands
241
+ ## Workflow example
224
242
 
225
243
  ```
226
244
  devkitkat pull default # Pull source code for the default group
@@ -230,16 +248,6 @@ devkitkat seed rails # It Seeds for `rails` service
230
248
  devkitkat start default # It starts services of the `default` group
231
249
  ```
232
250
 
233
- ## Options for `devkitkat`
234
-
235
- - `--path /path/to/the` ... The root directory that contains `.devkitkat.yml` and manage the service dirs.
236
- - `--variables KEY=VAR` ... The additional environment variables for services.
237
- - `--exclude <name>` ... The excluded service from the group.
238
-
239
- Example:
240
-
241
- `devkitkat start rails --path $HOME/awesome-app-dev-kit/ --variables AWS_CRED=XXXXX`
242
-
243
251
  ## Installation
244
252
 
245
253
  $ gem install devkitkat
@@ -35,7 +35,7 @@ module Devkitkat
35
35
 
36
36
  def option_parser
37
37
  @option_parser ||= OptionParser.new do |opts|
38
- opts.banner = "Usage: devkitkat <script> <target> [options]"
38
+ opts.banner = "Usage: devkitkat <command/script> <target> [args] [options]"
39
39
  opts.separator ""
40
40
  opts.separator "Options:"
41
41
 
@@ -79,15 +79,17 @@ module Devkitkat
79
79
  end
80
80
 
81
81
  opts.separator ""
82
- opts.separator "Commands:"
82
+ opts.separator "Utility Commands:"
83
83
  opts.separator "add-script - Add a script file"
84
84
  opts.separator "add-example - Add an example file"
85
85
  opts.separator "add-shared-script - Add s shared script"
86
+ opts.separator "help - Show help"
87
+ opts.separator ""
88
+ opts.separator "Predefined scripts:"
86
89
  opts.separator "clone - Clone repository"
87
90
  opts.separator "pull - Pull latest source code"
88
91
  opts.separator "clean - Clean the service dir"
89
92
  opts.separator "poop - Poop"
90
- opts.separator "help - Show help"
91
93
  end
92
94
  end
93
95
 
@@ -106,7 +106,7 @@ module Devkitkat
106
106
  end
107
107
 
108
108
  def group_id
109
- @group_id ||= `id -u`
109
+ @group_id ||= `id -u`.delete("\n")
110
110
  end
111
111
 
112
112
  def user_id
@@ -14,13 +14,13 @@ module Devkitkat
14
14
 
15
15
  results = []
16
16
 
17
+ print_log_paths
18
+
17
19
  if target_services.count == 1
18
20
  # If the target is only one, it could be console access (TTY)
19
21
  # so we can't run in parallel.
20
22
  results << target_services.first.execute
21
23
  else
22
- print_log_paths
23
-
24
24
  results = Parallel.map(target_services, progress: 'Executing', in_processes: 8) do |service|
25
25
  service.execute.tap do |success|
26
26
  raise Parallel::Kill unless success
@@ -39,6 +39,8 @@ module Devkitkat
39
39
  end
40
40
 
41
41
  def print_log_paths
42
+ return if command.tty?
43
+
42
44
  log_paths = target_services.map(&:log_path)
43
45
  puts %Q{See the log at \n#{log_paths.join("\n")}}
44
46
  end
@@ -246,6 +246,11 @@ See the log file: #{log_path}]
246
246
  executor.write(%Q{echo "💩"})
247
247
  end
248
248
 
249
+ def exec
250
+ executor.write(%Q{cd #{src_dir}})
251
+ executor.write(%Q{#{args.join(' ')}})
252
+ end
253
+
249
254
  def executor
250
255
  @executor ||= Executor.new(self)
251
256
  end
@@ -1,3 +1,3 @@
1
1
  module Devkitkat
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devkitkat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinya Maeda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-17 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler