motion-dryer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/lib/motion-dryer.rb +5 -0
- data/lib/motion-dryer/controllers_extension.rb +32 -0
- data/lib/motion-dryer/version.rb +5 -0
- data/motion-dryer.gemspec +19 -0
- metadata +68 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# motion-dryer
|
2
|
+
|
3
|
+
List of helpers/utilities help you to keep your RubyMotion project DRY.
|
4
|
+
|
5
|
+
## Automatic Controller Dependency
|
6
|
+
|
7
|
+
Getting tired of setting up file_dependnecies on your projects? Just
|
8
|
+
keep your project with following structure:
|
9
|
+
|
10
|
+
```
|
11
|
+
app/
|
12
|
+
- controllers/
|
13
|
+
- sample_controller.rb
|
14
|
+
- views/
|
15
|
+
- sample/
|
16
|
+
sample_view.rb
|
17
|
+
sample_table_view.rb
|
18
|
+
- helpers/
|
19
|
+
- sample_helper.rb
|
20
|
+
```
|
21
|
+
|
22
|
+
Add following to your project Rakefile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Motion::Project::App.setup do |app|
|
26
|
+
app.name = 'clipbook'
|
27
|
+
app.controllers = ['sample']
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
Sample controller will automatically depends on corresponding helpers and views.
|
32
|
+
|
33
|
+
## What next?
|
34
|
+
|
35
|
+
Thats all for now. if you have more idea, please contact me or send a pull request!
|
data/Rakefile
ADDED
data/lib/motion-dryer.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# add controllers
|
2
|
+
|
3
|
+
module Motion; module Project
|
4
|
+
class Config
|
5
|
+
variable :controllers
|
6
|
+
|
7
|
+
def add_dependency(app)
|
8
|
+
@controllers ||= []
|
9
|
+
@controllers = [@controllers] unless @controllers.is_a?(Array)
|
10
|
+
common_views = Dir.glob("app/views/common/*.rb")
|
11
|
+
common_helpers = Dir.glob("app/helpers/application_helper.rb")
|
12
|
+
@controllers.each do |controller|
|
13
|
+
controller_file = Dir.glob("app/*/#{controller}_controller.rb").first
|
14
|
+
helper_files = Dir.glob("app/helpers/#{controller}_helper.rb")
|
15
|
+
views_files = Dir.glob("app/views/#{controller}/*.rb")
|
16
|
+
app.file_dependencies controller_file => (common_helpers + common_views + helper_files + views_files)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class App
|
22
|
+
class << self
|
23
|
+
def setup_add_dependency
|
24
|
+
config.add_dependency(self)
|
25
|
+
setup_before_add_dependency
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :setup_before_add_dependency, :setup
|
29
|
+
alias_method :setup, :setup_add_dependency
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end; end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/motion-dryer/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Francis Chong"]
|
6
|
+
gem.email = ["francis@ignition.hk"]
|
7
|
+
gem.description = %q{DRY your RubyMotion project}
|
8
|
+
gem.summary = %q{DRY your RubyMotion project}
|
9
|
+
gem.homepage = "https://github.com/siuying/motion-dryer"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "motion-dryer"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Motion::Dryer::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency "rspec", ">= 2.0"
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-dryer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Francis Chong
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
description: DRY your RubyMotion project
|
31
|
+
email:
|
32
|
+
- francis@ignition.hk
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- Gemfile
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- lib/motion-dryer.rb
|
41
|
+
- lib/motion-dryer/controllers_extension.rb
|
42
|
+
- lib/motion-dryer/version.rb
|
43
|
+
- motion-dryer.gemspec
|
44
|
+
homepage: https://github.com/siuying/motion-dryer
|
45
|
+
licenses: []
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.8.24
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: DRY your RubyMotion project
|
68
|
+
test_files: []
|