rigit 0.1.1 → 0.1.2

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: 587a5ce7b7cc4f78aed7b500eebc77d6a8cde3f0203dd662473bda17b6fd2dd4
4
- data.tar.gz: 21317d234a17a214cc14cd4909916b91912beb4da5e72f99bf62becd8d7fd6c3
3
+ metadata.gz: ccfcfa55f8ac5a419d07a9936e7e0cfce9e736aa6a8e729f27c266e76aaa44d0
4
+ data.tar.gz: 7d83ac30e1574f5b78e8f6e48c22f98949e9e2d160dffa1c94f2ca536bd36505
5
5
  SHA512:
6
- metadata.gz: 1589fb24b1c56af3bd893c381466bdc59bd81e946b4108554b0b3faca4e5f3f05057cd73de3cd36b5a1c0813bbca50363360496c3f11ae7918006360c18ae609
7
- data.tar.gz: 86969745861ee54ec697c5429bd0523dffd21f07f89651cc1b01bb1c76fded36486544e009bac3bdfa51d75b0bd88c0cae41cb04c31f7db05d3dc25571e775e9
6
+ metadata.gz: d93c6c0fb5baff1d193f03bb1c896cf9f3fcfd222d49dae80fbceccf518ffb898dc39a99d49f8b9b2327f5f22416bf291cee218c0547410779463bf707aab213
7
+ data.tar.gz: c4a8ccc46524722846a6ccfa76c7a5271dfbfcef037dab46728fcee733e6ed1c37ce0a9671c2a8ef636229cb1f05cae3b89bb601520cb6823a7a2eed16cd85e8
data/README.md CHANGED
@@ -28,7 +28,9 @@ Table of Contents
28
28
  * [Directory Structure](#directory-structure)
29
29
  * [Dynamic Tokens](#dynamic-tokens)
30
30
  * [Config File](#config-file)
31
-
31
+ * [`intro`](#intro)
32
+ * [`outro`](#outro)
33
+ * [`params`](#params)
32
34
 
33
35
 
34
36
  Installation
@@ -59,7 +61,7 @@ Usage
59
61
  ```
60
62
  $ rig
61
63
  Usage:
62
- rig build RIG [PARAMS...]
64
+ rig build RIG [--force] [PARAMS...]
63
65
  rig install RIG REPO
64
66
  rig uninstall RIG
65
67
  rig update RIG
@@ -201,6 +203,8 @@ A typical config file looks like this:
201
203
  ```yaml
202
204
  intro: A sample generator
203
205
 
206
+ outro: Something to say after scaffolding is done
207
+
204
208
  params:
205
209
  name:
206
210
  prompt: "Name your project:"
@@ -218,14 +222,33 @@ params:
218
222
  list: [irb, pry]
219
223
  ```
220
224
 
221
- | Key | Purpose |
222
- |----------|---------------------------------------------------------|
223
- | `intro` | A short message to display when building (Optional) |
224
- | `params` | A list of parameters required by the rig |
225
+ #### `intro`
226
+
227
+ A short optional message to display before building.
228
+
229
+ This string is displayed using the [Colsole][colsole] gem, so
230
+ you can use [color markers][colsole-colors]
231
+
232
+ Example: `intro: Welcome to my blue !txtblu!rig!txtrst!`
233
+
234
+
235
+ #### `outro`
225
236
 
226
- The `params` key should start with the name of the variable (`name`,
227
- `spec` and `console` in the above example), and contain the below
228
- specifications:
237
+ A short optional message to display after building.
238
+
239
+ This string is displayed using the [Colsole][colsole] gem, so
240
+ you can use [color markers][colsole-colors]
241
+
242
+ Example: `outro: "!txtgrn!Thank you!txtrst!\nGoodbye."`
243
+
244
+
245
+ #### `params`
246
+
247
+ A list of parameters required by the rig.
248
+
249
+ Each definition in the `params` key should start with the name of the
250
+ variable (`name`, `spec` and `console` in the above example), and contain
251
+ the below specifications:
229
252
 
230
253
  | Key | Purpose |
231
254
  |-----------|----------------------------------------------------------|
@@ -237,3 +260,6 @@ specifications:
237
260
  ---
238
261
 
239
262
  [example-rig]: https://github.com/DannyBen/example-rig
263
+ [colsole-colors]: https://github.com/dannyben/colsole#color-codes
264
+ [colsole]: https://github.com/dannyben/colsole
265
+
@@ -10,29 +10,30 @@ module Rigit::Commands
10
10
 
11
11
  # Internal class to handle scaffolding for the {CommandLine} class.
12
12
  class BuildHandler
13
- attr_reader :args, :rig_name, :target_dir
13
+ attr_reader :args, :rig_name, :target_dir, :force
14
14
 
15
15
  include Colsole
16
16
 
17
17
  def initialize(args)
18
18
  @args = args
19
19
  @rig_name = args['RIG']
20
+ @force = args['--force']
20
21
  @target_dir = '.'
21
22
  end
22
23
 
23
24
  def execute
24
25
  say "Building !txtgrn!#{rig_name}"
25
- say "!txtblu!#{config.intro}" if config.has_key? :intro
26
+ say config.intro if config.has_key? :intro
26
27
  verify_dirs
27
28
  arguments = prompt.get_input params
28
29
  rig.scaffold arguments:arguments, target_dir: target_dir do |file|
29
- if File.exist? file
30
+ if File.exist? file and !force
30
31
  tty_prompt.yes? "Overwrite #{file}?", default: false
31
32
  else
32
33
  true
33
34
  end
34
35
  end
35
- say "Done"
36
+ say config.has_key?(:outro) ? config.outro : "Done"
36
37
  end
37
38
 
38
39
  private
@@ -1,7 +1,7 @@
1
1
  Rigit
2
2
 
3
3
  Usage:
4
- rig build RIG [PARAMS...]
4
+ rig build RIG [--force] [PARAMS...]
5
5
  rig install RIG REPO
6
6
  rig uninstall RIG
7
7
  rig update RIG
@@ -48,9 +48,19 @@ Parameters:
48
48
  SUBFOLDER
49
49
  A folder inside your rigs directory.
50
50
 
51
+ Options:
52
+ -f --force
53
+ Overwrite existing files without prompting.
54
+
55
+ -h --help
56
+ Show this screen.
57
+
58
+ --version
59
+ Show version number.
60
+
51
61
  Environment Variables:
52
62
  RIG_HOME
53
- The path where your local rigs are installed (default: ~/.rigs)
63
+ The path where your local rigs are installed (default: ~/.rigs).
54
64
 
55
65
  Examples:
56
66
  rig build gem name=mygem spec=y
@@ -1,3 +1,3 @@
1
1
  module Rigit
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rigit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: super_docopt