rigit 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/rigit.rb +2 -0
- data/lib/rigit/commands/build.rb +19 -2
- data/lib/rigit/rig.rb +14 -9
- 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: ae750bc5a6bcd7579e93397d0f493ba6c97f6fe7113f3300e4140889bdcf50ea
|
4
|
+
data.tar.gz: 38d60e9d8e133bc5eaeaa88c1f3d66df767f1ce810cb1e840dd209a148846d13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 989498761d02c5066f1b897110bf30956991fbe5c3405add7af598bf325e12c885de0b63f80094c53c3ad689c588449bc03f8024c0e6cc1ca5e9ff7adfcf8786
|
7
|
+
data.tar.gz: 6c86d9888bbe5c16da0c167bfc46b228dd1f28bb070a16b2e688f1cd56c56ee62b19d05b728279e1b43389782a78192850fe2f48bde9ca09168ca324706df5aa
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Rigit
|
2
2
|
==================================================
|
3
3
|
|
4
|
-
[![Gem](https://
|
5
|
-
[![Build](https://
|
6
|
-
[![Maintainability](https://
|
7
|
-
[![
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rigit.svg)](https://badge.fury.io/rb/rigit)
|
5
|
+
[![Build Status](https://travis-ci.com/DannyBen/rigit.svg?branch=master)](https://travis-ci.com/DannyBen/rigit)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/d13abbe6f7601be78cf5/maintainability)](https://codeclimate.com/github/DannyBen/rigit/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/d13abbe6f7601be78cf5/test_coverage)](https://codeclimate.com/github/DannyBen/rigit/test_coverage)
|
8
8
|
|
9
9
|
---
|
10
10
|
|
@@ -375,3 +375,4 @@ params:
|
|
375
375
|
[colsole-colors]: https://github.com/dannyben/colsole#color-codes
|
376
376
|
[colsole]: https://github.com/dannyben/colsole
|
377
377
|
|
378
|
+
|
data/lib/rigit.rb
CHANGED
data/lib/rigit/commands/build.rb
CHANGED
@@ -138,9 +138,26 @@ module Rigit::Commands
|
|
138
138
|
return if Dir.empty?(target_dir) or force
|
139
139
|
|
140
140
|
dirstring = target_dir == '.' ? 'Current directory' : "Directory '#{target_dir}'"
|
141
|
-
|
142
|
-
|
141
|
+
options = { "Abort" => :abort, "Continue here" => :continue, "Continue in a sub directory" => :create }
|
142
|
+
response = tty_prompt.select "#{dirstring} is not empty.", options, marker: '>'
|
143
|
+
|
144
|
+
case response
|
145
|
+
when :abort
|
146
|
+
raise Rigit::Exit, "Goodbye"
|
147
|
+
|
148
|
+
when :create
|
149
|
+
create_subdir
|
150
|
+
verify_target_dir
|
151
|
+
end
|
143
152
|
end
|
153
|
+
|
154
|
+
def create_subdir
|
155
|
+
folder = tty_prompt.ask "Sub directory to create:", default: 'app'
|
156
|
+
@target_dir = "#{target_dir}/#{folder}"
|
157
|
+
Dir.mkdir target_dir unless Dir.exist? target_dir
|
158
|
+
say "Creating in #{target_dir}"
|
159
|
+
end
|
160
|
+
|
144
161
|
end
|
145
162
|
end
|
146
163
|
end
|
data/lib/rigit/rig.rb
CHANGED
@@ -85,18 +85,23 @@ module Rigit
|
|
85
85
|
files.reject! { |file| File.directory? file }
|
86
86
|
|
87
87
|
files.each do |file|
|
88
|
-
target_file =
|
89
|
-
|
88
|
+
target_file = get_target_filename file, arguments, target_dir, dir
|
90
89
|
next if block_given? and !yield target_file
|
91
|
-
|
92
|
-
begin
|
93
|
-
content = File.read(file) % arguments
|
94
|
-
rescue ArgumentError => e
|
95
|
-
raise TemplateError.new file, e.message
|
96
|
-
end
|
97
|
-
|
90
|
+
content = get_file_content file, arguments
|
98
91
|
File.deep_write target_file, content
|
99
92
|
end
|
100
93
|
end
|
94
|
+
|
95
|
+
def get_target_filename(file, arguments, target_dir, source_dir)
|
96
|
+
(file % arguments).sub source_dir, target_dir
|
97
|
+
rescue KeyError => e
|
98
|
+
raise TemplateError.new file, e.message
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_file_content(file, arguments)
|
102
|
+
File.read(file) % arguments
|
103
|
+
rescue ArgumentError, KeyError => e
|
104
|
+
raise TemplateError.new file, e.message
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
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.8
|
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-03
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: super_docopt
|