motion-generators 0.1.2 → 0.1.3

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: 4e881160d18d8ccbc8207274d64184a25e3b13c2
4
- data.tar.gz: 81249d85243d993ec591b572d4aa2c7e0b11dd01
3
+ metadata.gz: 3f5d5384930782128143b0ed83db15a961daabaf
4
+ data.tar.gz: 838d01c178acd80611b233fe8eeb25c1e0d06380
5
5
  SHA512:
6
- metadata.gz: b2e7564cb34e99134a2093bd4c2434e589bd6c34bafb3ce2181d6aa5582fdc86e701951fee3fe075ff76f0a6cfb320712fe9db6d0d1955b1edc10c2343c34264
7
- data.tar.gz: bab339e13aaec41435d6758819736b92d152b5441efe04bbf99901b8bfc49ad5b60f906663bbce4b1fc3c0ecc6bd788822eea15a4ea5e3c872600140405f7b01
6
+ metadata.gz: c7b2f8034b94949d593315b6acc706911d82b451964520278630afb2e489aeb98d7c810628f12dd2840483ff3eef2b5391e71d708197830840f6084bf031cf87
7
+ data.tar.gz: 0d6aa8f69f6ab0050f6fe9da12e1a4006b935208d2aea3149cf69b1feb171878cb9acad5e717fe2e91b8918243d3f053a40b728936ca477dea8ea322903e9a0e
@@ -25,6 +25,7 @@ module Motion
25
25
  desc "ui_view_controller", "Creates a UIViewController subclass in app/controllers"
26
26
  def ui_view_controller(name)
27
27
  @name = name
28
+ @class_name = "%sController" % @name.camelize
28
29
  template "ui_view_controller.rb.erb", "app/controllers/#{name}_controller.rb"
29
30
  end
30
31
 
@@ -38,9 +39,23 @@ module Motion
38
39
  desc "ui_table_view_controller", "Creates a UITableViewController subclass in app/controllers"
39
40
  def ui_table_view_controller(name)
40
41
  @name = name
41
- template "ui_view_controller.rb.erb", "app/controllers/#{name}_controller.rb"
42
+ @class_name = "%sController" % @name.camelize
43
+ template "ui_table_view_controller.rb.erb", "app/controllers/#{name}_controller.rb"
42
44
  end
43
45
 
46
+ option :name
47
+ option :parent_class, {
48
+ desc: "The name of the class to inherit from",
49
+ aliases: ["-p", "--parent"],
50
+ default: "UITableViewCell",
51
+ type: :string,
52
+ }
53
+ desc "ui_table_view_cell", "Creates a UITableViewCell subclass in app/view/table_cells"
54
+ def ui_table_view_cell(name)
55
+ @name = name
56
+ @class_name = "%sCell" % @name.camelize
57
+ template "ui_table_view_cell.rb.erb", "app/views/table_cells/#{name}_cell.rb"
58
+ end
44
59
 
45
60
 
46
61
  private
@@ -51,7 +66,15 @@ module Motion
51
66
  end
52
67
 
53
68
  def class_name
54
- "%sController" % @name.camelize
69
+ @class_name
70
+ end
71
+
72
+ def singular_name
73
+ @name.to_s.underscore.singularize
74
+ end
75
+
76
+ def plural_name
77
+ @name.to_s.underscore.pluralize
55
78
  end
56
79
 
57
80
  end
@@ -1,5 +1,5 @@
1
1
  module Motion
2
2
  module Generators
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -0,0 +1,20 @@
1
+ class <%= class_name %> < <%= parent_class_name %>
2
+
3
+
4
+ attr_accessor :<%= singular_name %>
5
+
6
+
7
+ def prepare_for_<%= singular_name %>(<%= singular_name %>)
8
+ self.<%= singular_name %> = <%= singular_name %>
9
+ # Set up cell here
10
+ end
11
+
12
+ # def prepareForReuse
13
+ # super
14
+ # end
15
+
16
+ # def awakeFromNib
17
+ # super
18
+ # end
19
+
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodacious
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -87,6 +87,7 @@ files:
87
87
  - lib/motion/generate.rb
88
88
  - lib/motion/generators.rb
89
89
  - lib/motion/generators/version.rb
90
+ - lib/motion/templates/ui_table_view_cell.rb.erb
90
91
  - lib/motion/templates/ui_table_view_controller.rb.erb
91
92
  - lib/motion/templates/ui_view_controller.rb.erb
92
93
  - motion-generators.gemspec