rubymotion_generators 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -6
- data/bin/motion_g +2 -3
- data/lib/rubymotion_generators.rb +27 -30
- data/lib/rubymotion_generators/version.rb +1 -1
- data/lib/templates/table_view_cell.rb +1 -1
- data/rubymotion_generators.gemspec +1 -0
- metadata +20 -5
data/README.md
CHANGED
@@ -27,12 +27,12 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
## Available Generators
|
29
29
|
|
30
|
-
* view -
|
31
|
-
* cell -
|
32
|
-
* vc -
|
33
|
-
* tvc -
|
34
|
-
* tbapp -
|
35
|
-
* tvapp -
|
30
|
+
* view - UIView
|
31
|
+
* cell - UITableViewCell
|
32
|
+
* vc - UIViewController
|
33
|
+
* tvc - UITableViewController
|
34
|
+
* tbapp - UITabBar app (AppDelegate with two ViewController examples)
|
35
|
+
* tvapp - UITableView app (AppDelegate with a TableViewController example)
|
36
36
|
|
37
37
|
## ToDo
|
38
38
|
|
data/bin/motion_g
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubymotion_generators'
|
2
|
+
require_relative '../lib/rubymotion_generators'
|
4
3
|
|
5
|
-
RubymotionGenerators::Core.new.generate
|
4
|
+
RubymotionGenerators::Core.new.generate ARGV
|
@@ -7,11 +7,9 @@ module RubymotionGenerators
|
|
7
7
|
|
8
8
|
desc "generate", "Generate a new file of the specified type"
|
9
9
|
|
10
|
-
def generate(
|
11
|
-
|
12
|
-
|
13
|
-
template_name = args[0]
|
14
|
-
name = args[1]
|
10
|
+
def generate(args)
|
11
|
+
template_name, name = args
|
12
|
+
|
15
13
|
case template_name
|
16
14
|
when 'view'
|
17
15
|
generate_view name
|
@@ -20,7 +18,9 @@ module RubymotionGenerators
|
|
20
18
|
when 'tvc'
|
21
19
|
generate_table_view_controller name
|
22
20
|
when 'cell'
|
23
|
-
generate_table_view_cell
|
21
|
+
generate_table_view_cell name
|
22
|
+
when 'app'
|
23
|
+
generate_basic_app
|
24
24
|
when 'tbapp'
|
25
25
|
generate_tab_bar_app_delegate
|
26
26
|
generate_view_controller 'first'
|
@@ -40,46 +40,43 @@ module RubymotionGenerators
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def generate_view(name)
|
43
|
-
output_path = "app/views/#{name}_view.rb"
|
44
|
-
template
|
43
|
+
output_path = "app/views/#{name.downcase}_view.rb"
|
44
|
+
template 'templates/view.rb', output_path
|
45
45
|
class_name = name.capitalize + "View"
|
46
|
-
insert_into_file
|
46
|
+
insert_into_file output_path, class_name, :after => 'class '
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
output_path = "app/controllers/#{name}
|
51
|
-
template
|
52
|
-
class_name = name.capitalize + "
|
53
|
-
insert_into_file
|
49
|
+
def generate_view_controller(name)
|
50
|
+
output_path = "app/controllers/#{name.downcase}_view_controller.rb"
|
51
|
+
template 'templates/view_controller.rb', output_path
|
52
|
+
class_name = name.capitalize + "ViewController"
|
53
|
+
insert_into_file output_path, class_name, :after => 'class '
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
57
|
-
output_path = "app/controllers/#{name}
|
58
|
-
template
|
59
|
-
class_name = name.capitalize + "
|
60
|
-
insert_into_file
|
56
|
+
def generate_table_view_controller(name)
|
57
|
+
output_path = "app/controllers/#{name.downcase}_table_view_controller.rb"
|
58
|
+
template 'templates/table_view_controller.rb', output_path
|
59
|
+
class_name = name.capitalize + "TableViewController"
|
60
|
+
insert_into_file output_path, class_name, :after => 'class '
|
61
61
|
end
|
62
62
|
|
63
|
-
def generate_table_view_cell(name
|
64
|
-
output_path = "app/views
|
65
|
-
template
|
66
|
-
class_name = name.capitalize + "
|
67
|
-
insert_into_file
|
63
|
+
def generate_table_view_cell(name)
|
64
|
+
output_path = "app/views/#{name.downcase}_cell.rb"
|
65
|
+
template 'templates/table_view_cell.rb', output_path
|
66
|
+
class_name = name.capitalize + "Cell"
|
67
|
+
insert_into_file output_path, class_name, :after => 'class '
|
68
68
|
end
|
69
69
|
|
70
70
|
def generate_tab_bar_app_delegate
|
71
|
-
|
72
|
-
template('templates/tab_bar_app_delegate.rb', output_path)
|
71
|
+
template 'templates/tab_bar_app_delegate.rb', "app/app_delegate.rb"
|
73
72
|
end
|
74
73
|
|
75
74
|
def generate_table_view_app_delegate
|
76
|
-
|
77
|
-
template('templates/table_view_app_delegate.rb', output_path)
|
75
|
+
template 'templates/table_view_app_delegate.rb', "app/app_delegate.rb"
|
78
76
|
end
|
79
77
|
|
80
78
|
def generate_single_view_app_delegate
|
81
|
-
|
82
|
-
template('templates/single_view_app_delegate.rb', output_path)
|
79
|
+
template 'templates/single_view_app_delegate.rb', "app/app_delegate.rb"
|
83
80
|
end
|
84
81
|
|
85
82
|
def self.source_root
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubymotion_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0.4'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: pry
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.12
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.12
|
46
62
|
description: RubyMotion generators
|
47
63
|
email:
|
48
64
|
- github.aw@andywaite.com
|
@@ -57,6 +73,7 @@ files:
|
|
57
73
|
- LICENSE
|
58
74
|
- README.md
|
59
75
|
- Rakefile
|
76
|
+
- bin/motion_g
|
60
77
|
- lib/rubymotion_generators.rb
|
61
78
|
- lib/rubymotion_generators/version.rb
|
62
79
|
- lib/templates/single_view_app_delegate.rb
|
@@ -67,7 +84,6 @@ files:
|
|
67
84
|
- lib/templates/view.rb
|
68
85
|
- lib/templates/view_controller.rb
|
69
86
|
- rubymotion_generators.gemspec
|
70
|
-
- bin/motion_g
|
71
87
|
homepage: https://github.com/andyw8/rubymotion_generators
|
72
88
|
licenses: []
|
73
89
|
post_install_message:
|
@@ -88,9 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
104
|
version: '0'
|
89
105
|
requirements: []
|
90
106
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.23
|
92
108
|
signing_key:
|
93
109
|
specification_version: 3
|
94
110
|
summary: RubyMotion generators
|
95
111
|
test_files: []
|
96
|
-
has_rdoc:
|