KMQToolKitGem 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: ab99c279f432ce664950842eb51f94f3553f0999
4
- data.tar.gz: bf4558127b9a6e68087211dc5333f11f682f497a
3
+ metadata.gz: eb69743e041093534339859bd774ca6805205956
4
+ data.tar.gz: 7a582b146fff75ad4a2d18cf1452abad5aa7867a
5
5
  SHA512:
6
- metadata.gz: 2963329ca86df4129149c3b8ceab262527f2b95d90a5ddd1436addf55d37978f99214f2962ebaa5b513f4590249e343f68d2bed7d94a1a2f7efb24c40212e482
7
- data.tar.gz: 203fc7a266150edd0ed9d4b8873042cfaf2698f69048f16d612b0b6d12891a15b7cda8462a92b804f24fbdf68d758ad9d1f7c58048fe3fd55dedd447a48e5ea7
6
+ metadata.gz: 26515b34fe0f232701041830970999e9d83c9955b4934b9820902591ca1fbcf49982a9ab8d1ac9f506534c29570c9e525f5063f69474a02b8c232450ad4acb8e
7
+ data.tar.gz: 8101ecb319fdfc09485dfd9131a8b8ec9410b50bdd677f8f151749e312c8b884f7f76f333732705ffb3360df1869fb326cfaf833b9519103e1fba77849388434
data/README.md CHANGED
@@ -26,6 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ```bash
28
28
  kmqtoolkitcodegen errorgen --prefix KMQ --path ~/Desktop sample/errors.plist
29
+ kmqtoolkitcodegen colorgen --prefix KMQ --path ~/Desktop --keys colors sample/colors.plist
29
30
  ```
30
31
 
31
32
  ## Contributing
@@ -5,6 +5,7 @@ class ColorPlistGenerator
5
5
  attr_reader :plist_hash, :prefix, :base_path
6
6
 
7
7
  def initialize(plist_hash, prefix, base_path)
8
+ @template_folder = File.expand_path('../../templates', __FILE__)
8
9
  @plist_hash = plist_hash
9
10
  @prefix = prefix
10
11
  @base_path = base_path
@@ -21,7 +22,7 @@ class ColorPlistGenerator
21
22
 
22
23
  def create_color_name_file(names, type)
23
24
  file_name = "UIColor+#{@prefix}ColorName.#{type}"
24
- template_path = "#{Dir.pwd}/templates/UIColor+ColorName.#{type}.erb"
25
+ template_path = "#{@template_folder}/UIColor+ColorName.#{type}.erb"
25
26
  absolute_file_path = "#{@base_path}/#{file_name}"
26
27
  variables = OpenStruct.new(names: names, prefix: @prefix)
27
28
  Helper.write_to_file(absolute_file_path, template_path, variables.instance_eval{ binding })
@@ -5,6 +5,7 @@ class ErrorPlistGenerator
5
5
  attr_reader :plist_hash, :prefix, :base_path
6
6
 
7
7
  def initialize(plist_hash, prefix, base_path)
8
+ @template_folder = File.expand_path('../../templates', __FILE__)
8
9
  @plist_hash = plist_hash
9
10
  @prefix = prefix
10
11
  @base_path = base_path
@@ -39,7 +40,7 @@ class ErrorPlistGenerator
39
40
  # Generic NSError+ErrorCode.h and NSError+ErrorCode.m
40
41
  def create_error_code_file(codes, type)
41
42
  file_name = "NSError+#{@prefix}ErrorCode.#{type}"
42
- template_path = "#{Dir.pwd}/templates/NSError+ErrorCode.#{type}.erb"
43
+ template_path = "#{@template_folder}/NSError+ErrorCode.#{type}.erb"
43
44
  absolute_file_path = "#{@base_path}/#{file_name}"
44
45
  variables = OpenStruct.new(codes: codes, prefix: @prefix)
45
46
  Helper.write_to_file(absolute_file_path, template_path, variables.instance_eval{ binding })
@@ -55,7 +56,7 @@ class ErrorPlistGenerator
55
56
  # Generic NSError+ErrorDomain.h and NSError+ErrorDomain.m
56
57
  def create_error_domain_file(domains, type)
57
58
  file_name = "NSError+#{@prefix}ErrorDomain.#{type}"
58
- template_path = "#{Dir.pwd}/templates/NSError+ErrorDomain.#{type}.erb"
59
+ template_path = "#{@template_folder}/NSError+ErrorDomain.#{type}.erb"
59
60
  absolute_file_path = "#{@base_path}/#{file_name}"
60
61
  variables = OpenStruct.new(domains: domains, prefix: @prefix)
61
62
  Helper.write_to_file(absolute_file_path, template_path, variables.instance_eval{ binding })
@@ -1,3 +1,3 @@
1
1
  module KMQToolKitGem
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: KMQToolKitGem
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
  - Weinan Qiu
@@ -106,14 +106,14 @@ files:
106
106
  - lib/KMQToolKitGem/error_plist_generator.rb
107
107
  - lib/KMQToolKitGem/helper.rb
108
108
  - lib/KMQToolKitGem/version.rb
109
+ - lib/templates/NSError+ErrorCode.h.erb
110
+ - lib/templates/NSError+ErrorCode.m.erb
111
+ - lib/templates/NSError+ErrorDomain.h.erb
112
+ - lib/templates/NSError+ErrorDomain.m.erb
113
+ - lib/templates/UIColor+ColorName.h.erb
114
+ - lib/templates/UIColor+ColorName.m.erb
109
115
  - sample/colors.plist
110
116
  - sample/errors.plist
111
- - templates/NSError+ErrorCode.h.erb
112
- - templates/NSError+ErrorCode.m.erb
113
- - templates/NSError+ErrorDomain.h.erb
114
- - templates/NSError+ErrorDomain.m.erb
115
- - templates/UIColor+ColorName.h.erb
116
- - templates/UIColor+ColorName.m.erb
117
117
  homepage: https://github.com/davidiamyou/KMQToolKitGem
118
118
  licenses:
119
119
  - MIT