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 CHANGED
@@ -27,12 +27,12 @@ Or install it yourself as:
27
27
 
28
28
  ## Available Generators
29
29
 
30
- * view - View
31
- * cell - TableViewCell
32
- * vc - ViewController
33
- * tvc - TableViewController
34
- * tbapp - TabBar app (AppDelegate with two ViewController examples)
35
- * tvapp - TableView app (AppDelegate with a TableViewController example)
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
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
- require 'rubymotion_generators'
2
+ require_relative '../lib/rubymotion_generators'
4
3
 
5
- RubymotionGenerators::Core.new.generate(ARGV)
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(*args)
11
- # unsure why this flatten step is needed
12
- args = args.flatten
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('templates/view.rb', output_path)
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(output_path, class_name, :after => 'class ')
46
+ insert_into_file output_path, class_name, :after => 'class '
47
47
  end
48
48
 
49
- def generate_table_view_controller(name = 'Untitled')
50
- output_path = "app/controllers/#{name}_table_view_controller.rb"
51
- template('templates/table_view_controller.rb', output_path)
52
- class_name = name.capitalize + "TableViewController"
53
- insert_into_file(output_path, class_name, :after => 'class ')
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 generate_view_controller(name = 'Untitled')
57
- output_path = "app/controllers/#{name}_view_controller.rb"
58
- template('templates/view_controller.rb', output_path)
59
- class_name = name.capitalize + "ViewController"
60
- insert_into_file(output_path, class_name, :after => 'class ')
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 = 'Untitled')
64
- output_path = "app/views/cells/#{name}_table_view_cell.rb"
65
- template('templates/table_view_cell.rb', output_path)
66
- class_name = name.capitalize + "TableViewCell"
67
- insert_into_file(output_path, class_name, :after => 'class ')
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
- output_path = "app/app_delegate.rb"
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
- output_path = "app/app_delegate.rb"
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
- output_path = "app/app_delegate.rb"
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
@@ -1,3 +1,3 @@
1
1
  module RubymotionGenerators
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  class < UITableViewCell
2
- def setSelected(selected animated:animated)
2
+ def setSelected(selected, animated:animated)
3
3
  super
4
4
  # Configure the view for the selected state
5
5
  end
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency('thor', '~> 0.15')
20
20
  gem.add_development_dependency('aruba', '~> 0.4')
21
+ gem.add_development_dependency('pry', '~> 0.9.12')
21
22
  end
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
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: 2012-11-11 00:00:00.000000000 Z
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.24
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: