toy-locomotive 0.2.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ ToyLocomotive
2
+ =============
3
+
4
+ This project rocks and uses MIT-LICENSE.
data/Rakefile CHANGED
@@ -1,3 +1,27 @@
1
- require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
3
- RSpec::Core::RakeTask.new('spec')
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'ToyLocomotive'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :toy-locomotive do
3
+ # # Task goes here
4
+ # end
@@ -1,23 +1,5 @@
1
- require "rails/all"
2
- require "toy-locomotive/version"
1
+ module ToyLocomotive; end
3
2
 
4
- module ToyLocomotive
5
-
6
- module Router; end
7
- module Resources; end
8
- module Attributes; end
9
- module AutoViews; end
10
- mattr_accessor :routes
11
-
12
- end
13
-
14
- require "toy-locomotive/router/model"
15
- require "toy-locomotive/router/controller"
16
- require "toy-locomotive/router/block"
17
- require "toy-locomotive/resources/controller"
18
- require "toy-locomotive/attributes/chain"
19
- require "toy-locomotive/attributes/model"
20
- require "toy-locomotive/attributes/observer"
21
- require "toy-locomotive/auto_views/show"
22
- require "toy-locomotive/auto_views/form"
23
- require "toy-locomotive/initializer"
3
+ require 'toy-attributes'
4
+ require 'toy-verbs'
5
+ require 'toy-resources'
@@ -0,0 +1,10 @@
1
+ module ToyLocomotive::Router
2
+
3
+ def toy_locomotive
4
+ toy_resources if responds_to(:toy_resources)
5
+ toy_verbs if responds_to(:toy_verbs)
6
+ end
7
+
8
+ end
9
+
10
+ ActionDispatch::Routing::Mapper.send :include, ToyLocomotive::Router
@@ -1,3 +1,3 @@
1
1
  module ToyLocomotive
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toy-locomotive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-12 00:00:00.000000000 Z
12
+ date: 2013-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &27370488 !ruby/object:Gem::Requirement
15
+ name: toy-attributes
16
+ requirement: &29211228 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,32 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *27370488
24
+ version_requirements: *29211228
25
25
  - !ruby/object:Gem::Dependency
26
- name: rspec-rails
27
- requirement: &27366084 !ruby/object:Gem::Requirement
26
+ name: toy-verbs
27
+ requirement: &29210772 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *29210772
36
+ - !ruby/object:Gem::Dependency
37
+ name: toy-resources
38
+ requirement: &29210388 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *29210388
47
+ - !ruby/object:Gem::Dependency
48
+ name: rails
49
+ requirement: &29210028 !ruby/object:Gem::Requirement
28
50
  none: false
29
51
  requirements:
30
52
  - - ! '>='
@@ -32,10 +54,10 @@ dependencies:
32
54
  version: '0'
33
55
  type: :development
34
56
  prerelease: false
35
- version_requirements: *27366084
57
+ version_requirements: *29210028
36
58
  - !ruby/object:Gem::Dependency
37
- name: sqlite3
38
- requirement: &27365832 !ruby/object:Gem::Requirement
59
+ name: rspec-rails
60
+ requirement: &29209764 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,10 +65,10 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *27365832
68
+ version_requirements: *29209764
47
69
  - !ruby/object:Gem::Dependency
48
- name: shoulda
49
- requirement: &27365580 !ruby/object:Gem::Requirement
70
+ name: sqlite3
71
+ requirement: &29209512 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ! '>='
@@ -54,44 +76,22 @@ dependencies:
54
76
  version: '0'
55
77
  type: :development
56
78
  prerelease: false
57
- version_requirements: *27365580
58
- description: a Different aproach to Rails applications
79
+ version_requirements: *29209512
80
+ description: Uses its submodules to add new behaviors on Rails.
59
81
  email:
60
- - mortaro@towsta.com
82
+ - christian@mortaro.me
61
83
  executables: []
62
84
  extensions: []
63
85
  extra_rdoc_files: []
64
86
  files:
65
- - .gitignore
66
- - Gemfile
67
- - Gemfile.lock
68
- - Rakefile
69
- - lib/toy-locomotive.rb
70
- - lib/toy-locomotive/attributes/chain.rb
71
- - lib/toy-locomotive/attributes/model.rb
72
- - lib/toy-locomotive/attributes/observer.rb
73
- - lib/toy-locomotive/auto_views/form.rb
74
- - lib/toy-locomotive/auto_views/show.rb
75
- - lib/toy-locomotive/initializer.rb
76
- - lib/toy-locomotive/resources/controller.rb
77
- - lib/toy-locomotive/router/block.rb
78
- - lib/toy-locomotive/router/controller.rb
79
- - lib/toy-locomotive/router/model.rb
87
+ - lib/tasks/toy-locomotive_tasks.rake
88
+ - lib/toy-locomotive/router.rb
80
89
  - lib/toy-locomotive/version.rb
81
- - readme
82
- - spec/lib/attribute_chain_spec.rb
83
- - spec/lib/attribute_model_spec.rb
84
- - spec/lib/resources_controller_spec.rb
85
- - spec/lib/router_controller_spec.rb
86
- - spec/lib/router_model_spec.rb
87
- - spec/lib/toy_locomotive_spec.rb
88
- - spec/spec_helper.rb
89
- - spec/support/controllers.rb
90
- - spec/support/models.rb
91
- - spec/support/schema.rb
92
- - spec/support/seeds.rb
93
- - toy-locomotive.gemspec
94
- homepage: ''
90
+ - lib/toy-locomotive.rb
91
+ - MIT-LICENSE
92
+ - Rakefile
93
+ - README.md
94
+ homepage: https://github.com/Mortaro/Toy-Locomotive
95
95
  licenses: []
96
96
  post_install_message:
97
97
  rdoc_options: []
@@ -103,16 +103,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  - - ! '>='
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
+ segments:
107
+ - 0
108
+ hash: -468821165
106
109
  required_rubygems_version: !ruby/object:Gem::Requirement
107
110
  none: false
108
111
  requirements:
109
112
  - - ! '>='
110
113
  - !ruby/object:Gem::Version
111
114
  version: '0'
115
+ segments:
116
+ - 0
117
+ hash: -468821165
112
118
  requirements: []
113
- rubyforge_project: toy-locomotive
119
+ rubyforge_project:
114
120
  rubygems_version: 1.8.16
115
121
  signing_key:
116
122
  specification_version: 3
117
- summary: a Toy Locomotive to run over Rails
123
+ summary: A Locomotive full of inovations running on Rails.
118
124
  test_files: []
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- pkg/*
2
- *.gem
3
- .bundle
4
- *.swp
5
- *.swo
6
- *.sqlite3
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in toy-locomotive.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,114 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- toy-locomotive (0.0.9)
5
- rails
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- actionmailer (3.2.3)
11
- actionpack (= 3.2.3)
12
- mail (~> 2.4.4)
13
- actionpack (3.2.3)
14
- activemodel (= 3.2.3)
15
- activesupport (= 3.2.3)
16
- builder (~> 3.0.0)
17
- erubis (~> 2.7.0)
18
- journey (~> 1.0.1)
19
- rack (~> 1.4.0)
20
- rack-cache (~> 1.2)
21
- rack-test (~> 0.6.1)
22
- sprockets (~> 2.1.2)
23
- activemodel (3.2.3)
24
- activesupport (= 3.2.3)
25
- builder (~> 3.0.0)
26
- activerecord (3.2.3)
27
- activemodel (= 3.2.3)
28
- activesupport (= 3.2.3)
29
- arel (~> 3.0.2)
30
- tzinfo (~> 0.3.29)
31
- activeresource (3.2.3)
32
- activemodel (= 3.2.3)
33
- activesupport (= 3.2.3)
34
- activesupport (3.2.3)
35
- i18n (~> 0.6)
36
- multi_json (~> 1.0)
37
- arel (3.0.2)
38
- builder (3.0.0)
39
- diff-lcs (1.1.3)
40
- erubis (2.7.0)
41
- hike (1.2.1)
42
- i18n (0.6.0)
43
- journey (1.0.3)
44
- json (1.7.0)
45
- mail (2.4.4)
46
- i18n (>= 0.4.0)
47
- mime-types (~> 1.16)
48
- treetop (~> 1.4.8)
49
- mime-types (1.19)
50
- multi_json (1.3.4)
51
- polyglot (0.3.3)
52
- rack (1.4.1)
53
- rack-cache (1.2)
54
- rack (>= 0.4)
55
- rack-ssl (1.3.2)
56
- rack
57
- rack-test (0.6.1)
58
- rack (>= 1.0)
59
- rails (3.2.3)
60
- actionmailer (= 3.2.3)
61
- actionpack (= 3.2.3)
62
- activerecord (= 3.2.3)
63
- activeresource (= 3.2.3)
64
- activesupport (= 3.2.3)
65
- bundler (~> 1.0)
66
- railties (= 3.2.3)
67
- railties (3.2.3)
68
- actionpack (= 3.2.3)
69
- activesupport (= 3.2.3)
70
- rack-ssl (~> 1.3.2)
71
- rake (>= 0.8.7)
72
- rdoc (~> 3.4)
73
- thor (~> 0.14.6)
74
- rake (0.9.2.2)
75
- rdoc (3.12)
76
- json (~> 1.4)
77
- rspec (2.9.0)
78
- rspec-core (~> 2.9.0)
79
- rspec-expectations (~> 2.9.0)
80
- rspec-mocks (~> 2.9.0)
81
- rspec-core (2.9.0)
82
- rspec-expectations (2.9.1)
83
- diff-lcs (~> 1.1.3)
84
- rspec-mocks (2.9.0)
85
- rspec-rails (2.9.0)
86
- actionpack (>= 3.0)
87
- activesupport (>= 3.0)
88
- railties (>= 3.0)
89
- rspec (~> 2.9.0)
90
- shoulda (3.0.1)
91
- shoulda-context (~> 1.0.0)
92
- shoulda-matchers (~> 1.0.0)
93
- shoulda-context (1.0.0)
94
- shoulda-matchers (1.0.0)
95
- sprockets (2.1.3)
96
- hike (~> 1.2)
97
- rack (~> 1.0)
98
- tilt (~> 1.1, != 1.3.0)
99
- sqlite3 (1.3.6-x86-mingw32)
100
- thor (0.14.6)
101
- tilt (1.3.3)
102
- treetop (1.4.10)
103
- polyglot
104
- polyglot (>= 0.3.1)
105
- tzinfo (0.3.33)
106
-
107
- PLATFORMS
108
- x86-mingw32
109
-
110
- DEPENDENCIES
111
- rspec-rails
112
- shoulda
113
- sqlite3
114
- toy-locomotive!
@@ -1,65 +0,0 @@
1
- module ToyLocomotive::Attributes
2
- class AttributeChain
3
-
4
- attr_accessor :column, :parent, :_as, :_helper, :_options
5
-
6
- def initialize column, parent
7
- @column = column
8
- @parent = parent
9
- @_as = :string
10
- end
11
-
12
- def as value
13
- @_as = value
14
- @parent.send @_as, @column if [:has_many, :has_and_belongs_to_many, :has_one, :belongs_to].include? @_as
15
- self
16
- end
17
-
18
- def options *args
19
- @_options = (args.any? && args.first.is_a?(Array)) ? args.first : args
20
- self
21
- end
22
-
23
- def presence bool
24
- parent.send :validates_presence_of, column
25
- self
26
- end
27
-
28
- def uniqueness value
29
- return parent.send :validates_uniqueness_of, column if value == true
30
- parent.send :validates_uniqueness_of, column, {scope: value}
31
- self
32
- end
33
-
34
- def helper value
35
- @_helper = value
36
- self
37
- end
38
-
39
- def to_table_column
40
- return nil if skip_table_column?
41
- return :"#{@column}_id" if @_as == :belongs_to
42
- @column
43
- end
44
-
45
- def to_table_type
46
- return nil if skip_table_column?
47
- return :integer if @_as == :belongs_to
48
- @_as
49
- end
50
-
51
- def skip_table_column?
52
- [:has_many, :has_and_belongs_to_many, :has_one].include? @_as
53
- end
54
-
55
- def to_helper
56
- return @_helper if @_helper
57
- return :text_area if @_as == :text
58
- return :hidden_field if @column == :id || @_as == :belongs_to
59
- return :check_box if @_as == :boolean
60
- return :date_select if @_as == :date
61
- :text_field
62
- end
63
-
64
- end
65
- end