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 +4 -4
- data/README.md +35 -9
- data/lib/rigit/commands/build.rb +5 -4
- data/lib/rigit/docopt.txt +12 -2
- data/lib/rigit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccfcfa55f8ac5a419d07a9936e7e0cfce9e736aa6a8e729f27c266e76aaa44d0
|
4
|
+
data.tar.gz: 7d83ac30e1574f5b78e8f6e48c22f98949e9e2d160dffa1c94f2ca536bd36505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
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
|
-
|
227
|
-
|
228
|
-
|
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
|
+
|
data/lib/rigit/commands/build.rb
CHANGED
@@ -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
|
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
|
data/lib/rigit/docopt.txt
CHANGED
@@ -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
|
data/lib/rigit/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: super_docopt
|