cocoapods-aomi-bin 0.1.15 → 0.1.16

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
  SHA256:
3
- metadata.gz: ed246e9a0f0e2f98e30932e84961ac9134201400e7b699264faf3f1f0cc122ae
4
- data.tar.gz: 80944ebf177b7dcfebc249d45effba91be1072988261a841f19cf89000928a44
3
+ metadata.gz: 8f9ff1941c6a02f6e30fded1d370fedd44b658e3cb91970dcbfbc5a19241076f
4
+ data.tar.gz: 2bf6fef91f8ba2e53be60d814eafc1b1f83153a0a23b0d9716af8b6acdf194b1
5
5
  SHA512:
6
- metadata.gz: 8704818341ad7763e15195dcc3f6a925d1a530fac67f027303cdab6ded57ebff868a1f84572999d44b35538dbe8d6d99d92d953ce3befe32d7055377b02c6eb1
7
- data.tar.gz: f869b158e0a6cd7f5ae359e349a9547c0159bd4a72095af484308c1a2528cb2dd096c76acbbcfa53e65d0f5b1c982eeff8e5a1be1c2bb6a4513fde10634c80ed
6
+ metadata.gz: 369fafb90bc74dbd9e234f2d4da1a98cfc46579673041129d874b73d448953bb566c94dc2ee45ebb877fd93ffc5a29780f75b00dd1968d877cae514f85da4447
7
+ data.tar.gz: 204cdff62de43760770fd3c2a5ccf1370451dc01f39bb623550eb679f7a5cdaa7a3fad85419abc67f20abc91af73956c639e83c85d8a281efc5fd4ad5096e0a7
@@ -15,6 +15,7 @@ require 'cocoapods-lhj-bin/command/bin/local/upload'
15
15
  require 'cocoapods-lhj-bin/command/bin/trans'
16
16
  require 'cocoapods-lhj-bin/command/bin/lhj'
17
17
  require 'cocoapods-lhj-bin/command/bin/model'
18
+ require 'cocoapods-lhj-bin/command/bin/view'
18
19
  require 'cocoapods-lhj-bin/command/bin/config/push'
19
20
  require 'cocoapods-lhj-bin/command/bin/oss/list'
20
21
  require 'cocoapods-lhj-bin/command/bin/oss/del'
@@ -57,7 +58,7 @@ module Pod
57
58
  end
58
59
 
59
60
  def validate!
60
- super
61
+ # super
61
62
  # 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效
62
63
  # pod lib create 也有这个问题
63
64
  banner! if @help
@@ -115,6 +115,16 @@ module Pod
115
115
  result
116
116
  end
117
117
 
118
+ =begin
119
+ def format_string(file, line)
120
+ result = line
121
+ if /(\W)(TicketList)(\W)/ =~ line
122
+ result = result.gsub(/(\W)(TicketList)(\W)/, '\1TKTicketModel\3')
123
+ end
124
+ result
125
+ end
126
+ =end
127
+
118
128
  def exist_in_file(file, header)
119
129
  folder_name = @header_folder_map[header.to_sym]
120
130
  Regexp.new("/Pods/#{folder_name}") =~ File.path(file) if folder_name
@@ -0,0 +1,97 @@
1
+ module Pod
2
+ class Command
3
+ class Bin < Command
4
+ class View < Bin
5
+ self.summary = '生成源码'
6
+
7
+ def initialize(argv)
8
+ @name = argv.option('name', 'titleLabel')
9
+ @type = argv.option('type', 'UILabel')
10
+ end
11
+
12
+ def names
13
+ @name.split(",").map(&:strip)
14
+ end
15
+
16
+ def run
17
+ print_declare
18
+ puts "\n\n"
19
+ print_instance
20
+ puts "\n\n"
21
+ print_layout
22
+ end
23
+
24
+ def print_declare
25
+ names.each do |name|
26
+ puts "///"
27
+ puts "@property (nonatomic, strong) #{@type} *#{name};"
28
+ end
29
+ end
30
+
31
+ def print_instance
32
+ names.each do |name|
33
+ puts "-(#{@type} *)#{name}"
34
+ puts "{"
35
+ puts " if(!_#{name}){"
36
+ print_alloc(name)
37
+ puts " _#{name}.translatesAutoresizingMaskIntoConstraints = NO;"
38
+ print_property(name)
39
+ puts " }"
40
+ puts " return _#{name}"
41
+ puts "}"
42
+ puts "\n"
43
+ end
44
+ end
45
+
46
+ def print_alloc(name)
47
+ if @type.eql?('UIImageView')
48
+ puts " _#{name} = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@\"xxxx\"]];"
49
+ elsif @type.eql?('UIButton')
50
+ puts " _#{name} = [UIButton buttonWithType:UIButtonTypeCustom];"
51
+ else
52
+ puts " _#{name} = [[#{@type} alloc] init];"
53
+ end
54
+ end
55
+
56
+ def print_property(name)
57
+ if @type.eql?('UILabel')
58
+ puts " _#{name}.textColor = kSetCOLOR(0x333333);"
59
+ puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
60
+ puts " _#{name}.textAlignment = NSTextAlignmentCenter;"
61
+ elsif @type.eql?('UIImageView')
62
+ puts " _#{name}.backgroundColor = kBackgroundColor;"
63
+ puts " _#{name}.contentMode = UIViewContentModeScaleAspectFit;"
64
+ puts " _#{name}.clipsToBounds = YES;"
65
+ puts " _#{name}.layer.cornerRadius = 6.0f;"
66
+ puts " _#{name}.layer.borderColor = kLineColor.CGColor;"
67
+ puts " _#{name}.layer.borderWidth = 0.5;"
68
+ elsif @type.eql?('UITextField')
69
+ puts " _#{name}.textColor = kSetCOLOR(0x333333);"
70
+ puts " _#{name}.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];"
71
+ elsif @type.eql?('UIView')
72
+ puts " _#{name}.backgroundColor = kBackgroundColor;"
73
+ elsif @type.eql?('UIButton')
74
+ puts " _#{name}.backgroundColor = kBackgroundColor;"
75
+ puts " [_#{name} setTitle:@\"xxx\" forState:UIControlStateNormal];"
76
+ puts " [_#{name} setTitleColor:kSetCOLOR(0x999999) forState:UIControlStateNormal];"
77
+ puts " [_#{name} setImage:[UIImage imageNamed:@\"xx\"] forState:UIControlStateNormal];"
78
+ puts " [_#{name} setImage:[UIImage imageNamed:@\"xx\"] forState:UIControlStateSelected];"
79
+ puts " [_#{name} addTarget:self action:@selector(actionHandler:) forControlEvents:UIControlEventTouchUpInside];"
80
+ end
81
+ end
82
+
83
+ def print_layout
84
+ names.each do |name|
85
+ puts "[contentView addSubview:self.#{name}];"
86
+ puts "[self.#{name}.leadingAnchor constraintEqualToAnchor:contentView.leadingAnchor constant:0].active = YES;"
87
+ puts "[self.#{name}.trailingAnchor constraintEqualToAnchor:contentView.trailingAnchor constant:0].active = YES;"
88
+ puts "[self.#{name}.topAnchor constraintEqualToAnchor:contentView.topAnchor].active = YES;"
89
+ puts "[self.#{name}.bottomAnchor constraintEqualToAnchor:contentView.bottomAnchor].active = YES;"
90
+ puts "\n\n"
91
+ end
92
+ end
93
+
94
+ end
95
+ end
96
+ end
97
+ end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = '0.1.15'
2
+ VERSION = '0.1.16'
3
3
  end
4
4
 
5
5
  module Pod
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-aomi-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -131,6 +131,7 @@ files:
131
131
  - lib/cocoapods-lhj-bin/command/bin/spec/push.rb
132
132
  - lib/cocoapods-lhj-bin/command/bin/trans.rb
133
133
  - lib/cocoapods-lhj-bin/command/bin/update.rb
134
+ - lib/cocoapods-lhj-bin/command/bin/view.rb
134
135
  - lib/cocoapods-lhj-bin/config/config.rb
135
136
  - lib/cocoapods-lhj-bin/config/config_asker.rb
136
137
  - lib/cocoapods-lhj-bin/config/config_builder.rb