klipp 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 65f854ee8a77a48f90783f08804f8e9f98d854fd
4
- data.tar.gz: b361e5e190a5cd52039de0f5fd470ca193808944
3
+ metadata.gz: 392a938e7875756b189025a720be1883cfa03a39
4
+ data.tar.gz: c5a1494aef85c779577bf6763590b26b8b73d1f5
5
5
  SHA512:
6
- metadata.gz: 78cbc60461c33266df988e6786016ff039f8c3a4d0aec50dccf0541568cc7cac322459f649ba351f63db223a604c960784ecdff51681a6912e239649832925b3
7
- data.tar.gz: de1ddee465b7b099eb8196c8286dfc38445aad486b06d831d91e4e4fa765fe315ce4a6c3bf9aacc66665e53770cf82746e2a2dc50df593b719b068eaf88c0e32
6
+ metadata.gz: 360cb7ba0a1df9d580656bb97190fc3f8affb7360f3c6a373356a91970e7d117b7df0ae0f5678d3b6079537911c545fc044fdd1094fed204d802c3bf06909140
7
+ data.tar.gz: 097d223744f66e7693ebb88b8009710aeb02ba95a01969d045b5f27c0bc5c32cd5309a7500220a54f2680bf058a3026c95368da1100414e5105ed646f28844ef
data/.gitignore CHANGED
@@ -16,4 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .idea
19
- Sandbox
19
+ Sandbox
20
+ .DS_Store
data/lib/klipp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Klipp
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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
- kf += " tokens[:#{name}] = #{token.type == :bool ? 'false' : "\"\""}\n"
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
@@ -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] = false
24
+ # Boolean value, either 'true' or 'false' (but without the apostrophes)
25
+ tokens[:SECRET_TOGGLE] = true
26
26
 
27
27
  end
@@ -36,5 +36,6 @@ spec 'Example' do |s|
36
36
  s.token :SECRET_TOGGLE do |t|
37
37
  t.comment = 'Secret toggle (to enable/disable that amazing feature)'
38
38
  t.type = :bool
39
+ t.default_value = true
39
40
  end
40
41
  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.0
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-15 00:00:00.000000000 Z
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.0.3
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