motion-generators 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/motion-generate +7 -0
- data/bin/setup +8 -0
- data/lib/motion/generate.rb +61 -0
- data/lib/motion/generators.rb +10 -0
- data/lib/motion/generators/version.rb +5 -0
- data/lib/motion/templates/ui_table_view_controller.rb.erb +87 -0
- data/lib/motion/templates/ui_view_controller.rb.erb +41 -0
- data/motion-generators.gemspec +31 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6446840ec0f1c810d97213132d2093d25059d3a6
|
4
|
+
data.tar.gz: 05675c143e798dd1ddf193220265db336995bde9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4337117028e008d6ea48c9122da9e591943bfddccc53076e7167dac664e8268419159f9599d5c09af7c597d0beefedbad43918174c9fd8e8e0d7f067542bedd
|
7
|
+
data.tar.gz: beac13452a0142b35f18d9008984352ee29fb609cfcd1918a8db5f2eb6b49ba39b968fcd88d2e831cbe2dd2613a9f8b3e62c30c88d8e4c45a2f0c75a1b9fe1e6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Katana Code Ltd.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Bodacious
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Motion::Generators
|
2
|
+
|
3
|
+
This gem is still a work in progress, but should be very useful to iOS developers in its current form.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'motion-generators'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install motion-generators
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
This gem provides a CLI command to help generate new files automatically for your app.
|
25
|
+
|
26
|
+
$ motion-generate [GENERATOR] [OPTIONS]
|
27
|
+
|
28
|
+
To see a full list of what's available, do
|
29
|
+
|
30
|
+
$ motion-generate help
|
31
|
+
|
32
|
+
### Currently supported
|
33
|
+
|
34
|
+
Commands:
|
35
|
+
motion-generate help [COMMAND] # Describe available commands or one specific command
|
36
|
+
motion-generate ui_table_view_controller # Creates a UIViewController subclass in app/controllers
|
37
|
+
motion-generate ui_view_controller # Creates a UIViewController subclass in app/controllers
|
38
|
+
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/motion-generators.
|
49
|
+
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
54
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "motion/generators"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/motion-generate
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module Motion
|
2
|
+
|
3
|
+
class Generate < Thor
|
4
|
+
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
File.join File.dirname(__FILE__), "templates"
|
9
|
+
end
|
10
|
+
|
11
|
+
MASTER_COMMAND = "motion-generate".freeze
|
12
|
+
|
13
|
+
|
14
|
+
# ===========
|
15
|
+
# = Actions =
|
16
|
+
# ===========
|
17
|
+
|
18
|
+
option :name
|
19
|
+
option :parent_class, {
|
20
|
+
desc: "The name of the class to inherit from",
|
21
|
+
aliases: ["-p", "--parent"],
|
22
|
+
default: "UIViewController",
|
23
|
+
type: :string,
|
24
|
+
}
|
25
|
+
desc "ui_view_controller", "Creates a UIViewController subclass in app/controllers"
|
26
|
+
def ui_view_controller(name)
|
27
|
+
@name = name
|
28
|
+
@parent_class_name = options[:parent_class].camelize
|
29
|
+
template "ui_view_controller.rb.erb", "app/controllers/#{name}_controller.rb"
|
30
|
+
end
|
31
|
+
|
32
|
+
option :name
|
33
|
+
option :parent_class, {
|
34
|
+
desc: "The name of the class to inherit from",
|
35
|
+
aliases: ["-p", "--parent"],
|
36
|
+
default: "UITableViewController",
|
37
|
+
type: :string,
|
38
|
+
}
|
39
|
+
desc "ui_table_view_controller", "Creates a UITableViewController subclass in app/controllers"
|
40
|
+
def ui_table_view_controller(name)
|
41
|
+
@name = name
|
42
|
+
@parent_class_name = options[:parent_class].camelize
|
43
|
+
template "ui_view_controller.rb.erb", "app/controllers/#{name}_controller.rb"
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
|
51
|
+
def parent_class_name
|
52
|
+
@parent_class_name
|
53
|
+
end
|
54
|
+
|
55
|
+
def class_name
|
56
|
+
@name.camelize
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class <%= class_name %>Controller < <%= parent_class_name %>
|
2
|
+
|
3
|
+
# ==================
|
4
|
+
# = View Lifecycle =
|
5
|
+
# ==================
|
6
|
+
|
7
|
+
# def viewDidLoad
|
8
|
+
# super
|
9
|
+
# end
|
10
|
+
|
11
|
+
# def viewWillAppear(animated)
|
12
|
+
# super
|
13
|
+
# end
|
14
|
+
|
15
|
+
# def viewDidAppear(animated)
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# def viewWillDisappear(animated)
|
20
|
+
# super
|
21
|
+
# end
|
22
|
+
|
23
|
+
# def viewDidDisappear(animated)
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# ===========
|
28
|
+
# = Actions =
|
29
|
+
# ===========
|
30
|
+
|
31
|
+
# Define your custom actions here...
|
32
|
+
|
33
|
+
# =======================
|
34
|
+
# = UITableViewDelegate =
|
35
|
+
# =======================
|
36
|
+
|
37
|
+
|
38
|
+
# def tableView(table_view, heightForRowAtIndexPath: index_path)
|
39
|
+
# end
|
40
|
+
|
41
|
+
# def tableView(table_view, estimatedHeightForRowAtIndexPath: index_path)
|
42
|
+
# end
|
43
|
+
|
44
|
+
# def tableView(table_view, willDisplayCell: cell, forRowAtIndexPath: index_path)
|
45
|
+
# end
|
46
|
+
|
47
|
+
# def tableView(table_view, willSelectRowAtIndexPath: index_path)
|
48
|
+
# end
|
49
|
+
|
50
|
+
# def tableView(table_view, didSelectRowAtIndexPath: index_path)
|
51
|
+
# end
|
52
|
+
|
53
|
+
# def tableView(table_view, willDeselectRowAtIndexPath: index_path)
|
54
|
+
# end
|
55
|
+
|
56
|
+
# def tableView(table_view, didDeselectRowAtIndexPath: index_path)
|
57
|
+
# end
|
58
|
+
|
59
|
+
|
60
|
+
# =========================
|
61
|
+
# = UITableViewDataSource =
|
62
|
+
# =========================
|
63
|
+
|
64
|
+
|
65
|
+
def tableView(table_view, cellForRowAtIndexPath: index_path)
|
66
|
+
super
|
67
|
+
end
|
68
|
+
|
69
|
+
def tableView(table_view, numberOfRowsInSection: section)
|
70
|
+
super
|
71
|
+
end
|
72
|
+
|
73
|
+
# def numberOfSectionsInTableView(table_view)
|
74
|
+
# end
|
75
|
+
|
76
|
+
# def tableView(table_view, titleForHeaderInSection: section)
|
77
|
+
# end
|
78
|
+
|
79
|
+
|
80
|
+
# ===========
|
81
|
+
# = Private =
|
82
|
+
# ===========
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class <%= class_name %>Controller < <%= parent_class_name %>
|
2
|
+
|
3
|
+
# ==================
|
4
|
+
# = View Lifecycle =
|
5
|
+
# ==================
|
6
|
+
|
7
|
+
# def viewDidLoad
|
8
|
+
# super
|
9
|
+
# end
|
10
|
+
|
11
|
+
# def viewWillAppear(animated)
|
12
|
+
# super
|
13
|
+
# end
|
14
|
+
|
15
|
+
# def viewDidAppear(animated)
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# def viewWillDisappear(animated)
|
20
|
+
# super
|
21
|
+
# end
|
22
|
+
|
23
|
+
# def viewDidDisappear(animated)
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# ===========
|
28
|
+
# = Actions =
|
29
|
+
# ===========
|
30
|
+
|
31
|
+
# Define your custom actions here...
|
32
|
+
|
33
|
+
|
34
|
+
# ===========
|
35
|
+
# = Private =
|
36
|
+
# ===========
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'motion/generators/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "motion-generators"
|
8
|
+
spec.version = Motion::Generators::VERSION
|
9
|
+
|
10
|
+
spec.authors = ["Bodacious"]
|
11
|
+
spec.email = ["gavin@katanacode.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Generators for RubyMotion iOS apps}
|
14
|
+
spec.description = %q{Generate view controllers and views from the CLI}
|
15
|
+
spec.homepage = "https://github.com/katanacode/motion-generators"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "thor"
|
27
|
+
spec.add_dependency "activesupport"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-generators
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bodacious
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: Generate view controllers and views from the CLI
|
70
|
+
email:
|
71
|
+
- gavin@katanacode.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/console
|
83
|
+
- bin/motion-generate
|
84
|
+
- bin/setup
|
85
|
+
- lib/motion/generate.rb
|
86
|
+
- lib/motion/generators.rb
|
87
|
+
- lib/motion/generators/version.rb
|
88
|
+
- lib/motion/templates/ui_table_view_controller.rb.erb
|
89
|
+
- lib/motion/templates/ui_view_controller.rb.erb
|
90
|
+
- motion-generators.gemspec
|
91
|
+
homepage: https://github.com/katanacode/motion-generators
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.5.1
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Generators for RubyMotion iOS apps
|
115
|
+
test_files: []
|