klipp 0.2.0 → 0.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 392a938e7875756b189025a720be1883cfa03a39
|
4
|
+
data.tar.gz: c5a1494aef85c779577bf6763590b26b8b73d1f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 360cb7ba0a1df9d580656bb97190fc3f8affb7360f3c6a373356a91970e7d117b7df0ae0f5678d3b6079537911c545fc044fdd1094fed204d802c3bf06909140
|
7
|
+
data.tar.gz: 097d223744f66e7693ebb88b8009710aeb02ba95a01969d045b5f27c0bc5c32cd5309a7500220a54f2680bf058a3026c95368da1100414e5105ed646f28844ef
|
data/.gitignore
CHANGED
data/lib/klipp/version.rb
CHANGED
data/lib/template/spec.rb
CHANGED
@@ -155,7 +155,11 @@ module Template
|
|
155
155
|
unless token.hidden
|
156
156
|
kf += " # #{token.comment}\n" if token.comment
|
157
157
|
kf += " # #{token.validation_hint}\n" if token.validation_hint
|
158
|
-
|
158
|
+
if token.type == :bool
|
159
|
+
kf += " tokens[:#{name}] = #{token.default_value ? 'true' : 'false'}\n"
|
160
|
+
else
|
161
|
+
kf += " tokens[:#{name}] = \"#{token.default_value}\"\n"
|
162
|
+
end
|
159
163
|
kf += "\n"
|
160
164
|
end
|
161
165
|
end
|
data/lib/template/token.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
module Template
|
12
12
|
|
13
13
|
class Token
|
14
|
-
attr_accessor :hidden, :value, :type, :bool_strings
|
14
|
+
attr_accessor :hidden, :value, :default_value, :type, :bool_strings
|
15
15
|
attr_accessor :comment, :validation, :validation_hint
|
16
16
|
|
17
17
|
def initialize(value = nil, hidden = false)
|
@@ -41,6 +41,10 @@ module Template
|
|
41
41
|
@value = value
|
42
42
|
end
|
43
43
|
|
44
|
+
def default_value
|
45
|
+
@default_value || (self.type == :string ? '' : false)
|
46
|
+
end
|
47
|
+
|
44
48
|
def bool_strings
|
45
49
|
%w(NO YES)
|
46
50
|
end
|
@@ -54,7 +58,7 @@ module Template
|
|
54
58
|
when self.type == :string then
|
55
59
|
@validation_hint || (validation ? "Match /#{validation.to_s}/ (no custom validation_hint given)." : "Text required")
|
56
60
|
when self.type == :bool then
|
57
|
-
"Boolean value, either 'true' or 'false'"
|
61
|
+
"Boolean value, either 'true' or 'false' (but without the apostrophes)"
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
@@ -21,7 +21,7 @@ create 'template-repository/Example' do |tokens|
|
|
21
21
|
tokens[:CLASS_PREFIX] = ""
|
22
22
|
|
23
23
|
# Secret toggle (to enable/disable that amazing feature)
|
24
|
-
# Boolean value, either 'true' or 'false'
|
25
|
-
tokens[:SECRET_TOGGLE] =
|
24
|
+
# Boolean value, either 'true' or 'false' (but without the apostrophes)
|
25
|
+
tokens[:SECRET_TOGGLE] = true
|
26
26
|
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klipp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric-Paul Lecluse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.
|
196
|
+
rubygems_version: 2.1.11
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Klipp is a command line gem for creating new (Xcode) projects from existing
|