rails-js 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. metadata +7 -71
  3. data/.gitignore +0 -6
  4. data/.travis.yml +0 -3
  5. data/Gemfile +0 -14
  6. data/Gemfile.lock +0 -127
  7. data/MIT-LICENSE +0 -20
  8. data/README.md +0 -158
  9. data/Rakefile +0 -25
  10. data/VERSION +0 -1
  11. data/app/assets/javascripts/rails.js +0 -327
  12. data/lib/rails/js.rb +0 -8
  13. data/lib/rails/js/engine.rb +0 -10
  14. data/lib/rails/js/version.rb +0 -5
  15. data/lib/rails/js/view_helpers.rb +0 -23
  16. data/rails-js.gemspec +0 -24
  17. data/test/dummy/README.rdoc +0 -28
  18. data/test/dummy/Rakefile +0 -6
  19. data/test/dummy/app/assets/images/.keep +0 -0
  20. data/test/dummy/app/assets/javascripts/application.js +0 -14
  21. data/test/dummy/app/assets/javascripts/testing.js +0 -2
  22. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  23. data/test/dummy/app/controllers/application_controller.rb +0 -5
  24. data/test/dummy/app/controllers/concerns/.keep +0 -0
  25. data/test/dummy/app/controllers/testing_controller.rb +0 -6
  26. data/test/dummy/app/helpers/application_helper.rb +0 -2
  27. data/test/dummy/app/helpers/testing_helper.rb +0 -2
  28. data/test/dummy/app/mailers/.keep +0 -0
  29. data/test/dummy/app/models/.keep +0 -0
  30. data/test/dummy/app/models/concerns/.keep +0 -0
  31. data/test/dummy/app/views/layouts/application.html.erb +0 -15
  32. data/test/dummy/app/views/testing/index.html.erb +0 -0
  33. data/test/dummy/bin/bundle +0 -3
  34. data/test/dummy/bin/rails +0 -4
  35. data/test/dummy/bin/rake +0 -4
  36. data/test/dummy/config.ru +0 -4
  37. data/test/dummy/config/application.rb +0 -22
  38. data/test/dummy/config/boot.rb +0 -5
  39. data/test/dummy/config/database.yml +0 -25
  40. data/test/dummy/config/environment.rb +0 -5
  41. data/test/dummy/config/environments/development.rb +0 -37
  42. data/test/dummy/config/environments/production.rb +0 -83
  43. data/test/dummy/config/environments/test.rb +0 -39
  44. data/test/dummy/config/initializers/assets.rb +0 -3
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  46. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  47. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  48. data/test/dummy/config/initializers/inflections.rb +0 -16
  49. data/test/dummy/config/initializers/mime_types.rb +0 -4
  50. data/test/dummy/config/initializers/session_store.rb +0 -3
  51. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  52. data/test/dummy/config/locales/en.yml +0 -23
  53. data/test/dummy/config/routes.rb +0 -4
  54. data/test/dummy/config/secrets.yml +0 -22
  55. data/test/dummy/lib/assets/.keep +0 -0
  56. data/test/dummy/public/404.html +0 -67
  57. data/test/dummy/public/422.html +0 -67
  58. data/test/dummy/public/500.html +0 -66
  59. data/test/dummy/public/favicon.ico +0 -0
  60. data/test/dummy/spec/javascripts/rails-js_spec.js +0 -165
  61. data/test/dummy/spec/javascripts/spec_helper.js +0 -31
  62. data/test/dummy/spec/teaspoon_env.rb +0 -13
  63. data/test/dummy/test/helpers/testing_helper_test.rb +0 -4
  64. data/test/teaspoon_env.rb +0 -24
  65. data/test/test_helper.rb +0 -18
  66. data/test/testing_controller_test.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86b7da8b9fa0f2625715bf5f3f8d12a0787db532
4
- data.tar.gz: 2b8c703e25250fb05a26764b74231f91186074dc
3
+ metadata.gz: 54b67d83d3ac7a3b677beccb0501332e7dadcde9
4
+ data.tar.gz: 3cca8770fd49d26296ee617529d936521c07e2a0
5
5
  SHA512:
6
- metadata.gz: 842ee769ced2bc2287870556218fe6c1c5fe6c26dbb50b148d15cc97670ddec18fdfadec30b5559c4053a40657f99b6adbcc8a92203dfef1e6a2028f491ffc68
7
- data.tar.gz: 68ffb370e5f535cb2d307e7af75482effe4ae276c81f9d86b6ccbfe3dfa2b97b427f952fc03f7eace1707af806eb41d3494077426acf1f5f858cd6bf94481e1e
6
+ metadata.gz: 05e423dfff72d36f97aacfd1050141ddb8e10c8ce465b065cec3fc2887ae4f84857cede8aa8e527d4d683da08b56b57d4f601bf3234882a8b0e2e4b7dbace051
7
+ data.tar.gz: 15d50884e1c8902aaed9e23fe22a7df27bd4643c73a867e5ea3cc2804534a13586136c5cf247708400bf193b77c8190a7187eb9a79546dac82aef989f36de5a8
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finn-Lenanrt Heemeyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,78 +80,14 @@ dependencies:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.7'
83
- description: Divide your javascript like you divide your ruby code. Put it in controllers
84
- and actions and write clean, scalable code.
83
+ description: 'Divide your javascript like you divide your ruby code. Put it in controllers
84
+ and actions and write clean, scalable code. DEPRECATION WARNING: Gem has been renamed
85
+ to ''rails-js-routes'' for better findability.'
85
86
  email: finn@heemeyer.net
86
87
  executables: []
87
88
  extensions: []
88
89
  extra_rdoc_files: []
89
- files:
90
- - .gitignore
91
- - .travis.yml
92
- - Gemfile
93
- - Gemfile.lock
94
- - MIT-LICENSE
95
- - README.md
96
- - Rakefile
97
- - VERSION
98
- - app/assets/javascripts/rails.js
99
- - lib/rails/js.rb
100
- - lib/rails/js/engine.rb
101
- - lib/rails/js/version.rb
102
- - lib/rails/js/view_helpers.rb
103
- - rails-js.gemspec
104
- - test/dummy/README.rdoc
105
- - test/dummy/Rakefile
106
- - test/dummy/app/assets/images/.keep
107
- - test/dummy/app/assets/javascripts/application.js
108
- - test/dummy/app/assets/javascripts/testing.js
109
- - test/dummy/app/assets/stylesheets/application.css
110
- - test/dummy/app/controllers/application_controller.rb
111
- - test/dummy/app/controllers/concerns/.keep
112
- - test/dummy/app/controllers/testing_controller.rb
113
- - test/dummy/app/helpers/application_helper.rb
114
- - test/dummy/app/helpers/testing_helper.rb
115
- - test/dummy/app/mailers/.keep
116
- - test/dummy/app/models/.keep
117
- - test/dummy/app/models/concerns/.keep
118
- - test/dummy/app/views/layouts/application.html.erb
119
- - test/dummy/app/views/testing/index.html.erb
120
- - test/dummy/bin/bundle
121
- - test/dummy/bin/rails
122
- - test/dummy/bin/rake
123
- - test/dummy/config.ru
124
- - test/dummy/config/application.rb
125
- - test/dummy/config/boot.rb
126
- - test/dummy/config/database.yml
127
- - test/dummy/config/environment.rb
128
- - test/dummy/config/environments/development.rb
129
- - test/dummy/config/environments/production.rb
130
- - test/dummy/config/environments/test.rb
131
- - test/dummy/config/initializers/assets.rb
132
- - test/dummy/config/initializers/backtrace_silencers.rb
133
- - test/dummy/config/initializers/cookies_serializer.rb
134
- - test/dummy/config/initializers/filter_parameter_logging.rb
135
- - test/dummy/config/initializers/inflections.rb
136
- - test/dummy/config/initializers/mime_types.rb
137
- - test/dummy/config/initializers/session_store.rb
138
- - test/dummy/config/initializers/wrap_parameters.rb
139
- - test/dummy/config/locales/en.yml
140
- - test/dummy/config/routes.rb
141
- - test/dummy/config/secrets.yml
142
- - test/dummy/db/test.sqlite3
143
- - test/dummy/lib/assets/.keep
144
- - test/dummy/public/404.html
145
- - test/dummy/public/422.html
146
- - test/dummy/public/500.html
147
- - test/dummy/public/favicon.ico
148
- - test/dummy/spec/javascripts/rails-js_spec.js
149
- - test/dummy/spec/javascripts/spec_helper.js
150
- - test/dummy/spec/teaspoon_env.rb
151
- - test/dummy/test/helpers/testing_helper_test.rb
152
- - test/teaspoon_env.rb
153
- - test/test_helper.rb
154
- - test/testing_controller_test.rb
90
+ files: []
155
91
  homepage: http://rubygems.org/gems/rails-js
156
92
  licenses:
157
93
  - MIT
@@ -172,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
108
  version: '0'
173
109
  requirements: []
174
110
  rubyforge_project:
175
- rubygems_version: 2.0.14
111
+ rubygems_version: 2.3.0
176
112
  signing_key:
177
113
  specification_version: 4
178
114
  summary: A new approach to structure your javascript in non single-page Rails apps
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.gem
2
- test/dummy/tmp/
3
- test/dummy/log/
4
- coverage
5
- .DS_STORE
6
- test/dummy/db
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.1
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Declare your gem's dependencies in penis.gemspec.
4
- # Bundler will treat runtime dependencies like base dependencies, and
5
- # development dependencies will be added by default to the :development group.
6
- gemspec
7
-
8
- # Declare any dependencies that are still in development here instead of in
9
- # your gemspec. These might include edge Rails or gems from your path or
10
- # Git. Remember to move these dependencies to your gemspec before releasing
11
- # your gem to rubygems.org.
12
-
13
- # To use debugger
14
- # gem 'debugger'
@@ -1,127 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rails-js (0.1.0)
5
- rails (~> 4)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionmailer (4.1.8)
11
- actionpack (= 4.1.8)
12
- actionview (= 4.1.8)
13
- mail (~> 2.5, >= 2.5.4)
14
- actionpack (4.1.8)
15
- actionview (= 4.1.8)
16
- activesupport (= 4.1.8)
17
- rack (~> 1.5.2)
18
- rack-test (~> 0.6.2)
19
- actionview (4.1.8)
20
- activesupport (= 4.1.8)
21
- builder (~> 3.1)
22
- erubis (~> 2.7.0)
23
- activemodel (4.1.8)
24
- activesupport (= 4.1.8)
25
- builder (~> 3.1)
26
- activerecord (4.1.8)
27
- activemodel (= 4.1.8)
28
- activesupport (= 4.1.8)
29
- arel (~> 5.0.0)
30
- activesupport (4.1.8)
31
- i18n (~> 0.6, >= 0.6.9)
32
- json (~> 1.7, >= 1.7.7)
33
- minitest (~> 5.1)
34
- thread_safe (~> 0.1)
35
- tzinfo (~> 1.1)
36
- arel (5.0.1.20140414130214)
37
- builder (3.2.2)
38
- capybara (2.4.4)
39
- mime-types (>= 1.16)
40
- nokogiri (>= 1.3.3)
41
- rack (>= 1.0.0)
42
- rack-test (>= 0.5.4)
43
- xpath (~> 2.0)
44
- cliver (0.3.2)
45
- coveralls (0.7.2)
46
- multi_json (~> 1.3)
47
- rest-client (= 1.6.7)
48
- simplecov (>= 0.7)
49
- term-ansicolor (= 1.2.2)
50
- thor (= 0.18.1)
51
- docile (1.1.5)
52
- erubis (2.7.0)
53
- hike (1.2.3)
54
- i18n (0.6.11)
55
- json (1.8.1)
56
- mail (2.6.3)
57
- mime-types (>= 1.16, < 3)
58
- mime-types (2.4.3)
59
- mini_portile (0.6.1)
60
- minitest (5.4.3)
61
- multi_json (1.10.1)
62
- nokogiri (1.6.4.1)
63
- mini_portile (~> 0.6.0)
64
- poltergeist (1.5.1)
65
- capybara (~> 2.1)
66
- cliver (~> 0.3.1)
67
- multi_json (~> 1.0)
68
- websocket-driver (>= 0.2.0)
69
- rack (1.5.2)
70
- rack-test (0.6.2)
71
- rack (>= 1.0)
72
- rails (4.1.8)
73
- actionmailer (= 4.1.8)
74
- actionpack (= 4.1.8)
75
- actionview (= 4.1.8)
76
- activemodel (= 4.1.8)
77
- activerecord (= 4.1.8)
78
- activesupport (= 4.1.8)
79
- bundler (>= 1.3.0, < 2.0)
80
- railties (= 4.1.8)
81
- sprockets-rails (~> 2.0)
82
- railties (4.1.8)
83
- actionpack (= 4.1.8)
84
- activesupport (= 4.1.8)
85
- rake (>= 0.8.7)
86
- thor (>= 0.18.1, < 2.0)
87
- rake (10.3.2)
88
- rest-client (1.6.7)
89
- mime-types (>= 1.16)
90
- simplecov (0.9.1)
91
- docile (~> 1.1.0)
92
- multi_json (~> 1.0)
93
- simplecov-html (~> 0.8.0)
94
- simplecov-html (0.8.0)
95
- sprockets (2.12.3)
96
- hike (~> 1.2)
97
- multi_json (~> 1.0)
98
- rack (~> 1.0)
99
- tilt (~> 1.1, != 1.3.0)
100
- sprockets-rails (2.2.0)
101
- actionpack (>= 3.0)
102
- activesupport (>= 3.0)
103
- sprockets (>= 2.8, < 4.0)
104
- sqlite3 (1.3.10)
105
- teaspoon (0.8.0)
106
- railties (>= 3.2.5, < 5)
107
- term-ansicolor (1.2.2)
108
- tins (~> 0.8)
109
- thor (0.18.1)
110
- thread_safe (0.3.4)
111
- tilt (1.4.1)
112
- tins (0.13.2)
113
- tzinfo (1.2.2)
114
- thread_safe (~> 0.1)
115
- websocket-driver (0.4.0)
116
- xpath (2.0.0)
117
- nokogiri (~> 1.3)
118
-
119
- PLATFORMS
120
- ruby
121
-
122
- DEPENDENCIES
123
- coveralls (~> 0.7)
124
- poltergeist (~> 1.5)
125
- rails-js!
126
- sqlite3 (~> 1.3)
127
- teaspoon (~> 0.8)
@@ -1,20 +0,0 @@
1
- Copyright 2014 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 DELETED
@@ -1,158 +0,0 @@
1
- rails-js
2
- ========
3
- [![Build Status](https://travis-ci.org/tonekk/rails-js.svg)](https://travis-ci.org/tonekk/rails-js)
4
- [![Dependency Status](https://gemnasium.com/tonekk/rails-js.svg)](https://gemnasium.com/tonekk/rails-js)
5
- [![Gem Version](http://img.shields.io/gem/v/rails-js.svg)](https://rubygems.org/gems/rails-js)
6
- [![License](http://img.shields.io/:license-mit-blue.svg)](http://tonekk.mit-license.org)
7
-
8
-
9
- [Check out the blog post!](http://finn.heemeyer.net/2014/10/18/rails-js/)
10
-
11
-
12
- I worked on several Rails projects and there were many cases when it felt overkill to use a framework like ``Angular`` or ``Ember``, because javascript was only needed in some parts of the application.
13
- But by not using these frameworks I had to think of a way to *structure* the code by myself.
14
- I came up with the conclusion to organize the javascript code like the ruby code is organized, that means: __Split up in controllers, which are split up in actions.__
15
-
16
- ## How it works
17
- * In ``rails-js`` we are able to define ``controllers``, as well as ``helpers``.
18
- * Controllers have ``actions`` which are executed when the matching rails action is executed.
19
- * Helpers should be clear. Pretty much like the rails helpers. There are helper per controller and global helpers.
20
- * The gem also provides a ``view helper`` to use in your layouts, which passes the routing information to ``rails-js``.
21
-
22
- #### You start by creating an app.
23
-
24
- ```js
25
- //= require rails
26
-
27
- /*
28
- * app/assets/javascripts/application.js
29
- */
30
-
31
- Rails.app({
32
- // Define global helpers here
33
- helper: function() {
34
- }
35
- },
36
- // Put in initial data
37
- {
38
- foo: 'bar'
39
- },
40
- // A function that is executed before every action
41
- function() {
42
- console.log('beforeAll() executed');
43
- });
44
-
45
- ```
46
- #### Create controllers accordingly.
47
-
48
- ```js
49
-
50
- /*
51
- * app/assets/javascripts/controllers/users.js
52
- */
53
-
54
- Rails.controller('users', {
55
- // actions here
56
- new: function(h) {
57
- // execute helper
58
- h.awesomeHelper();
59
- },
60
-
61
- index: function(h) {
62
- // Do the same as in new()
63
- this.index(h);
64
- }
65
- },
66
- {
67
- // helpers here
68
- awesomeHelper: function() {
69
- }
70
- });
71
-
72
- ```
73
-
74
-
75
- #### Use code from other controllers.
76
- ```js
77
-
78
- /*
79
- * app/assets/javascripts/controllers/admin/users.js
80
- */
81
-
82
- Rails.controller('admin/users', {
83
- new: function(h) {
84
- // Execute action of foreign controller
85
- R.action('users#new');
86
- },
87
-
88
- index: function(h) {
89
- // Execute foreign helper with arguments
90
- R.helper('users', 'awesomeHelper', 1, 2, 3);
91
-
92
- // Execute global helper with arguments
93
- R.global('helper', 1, 2, 3);
94
- }
95
- },{});
96
-
97
- ```
98
-
99
-
100
- #### Global variables without the mess.
101
- ```js
102
- /*
103
- * Use R singleton everywhere
104
- */
105
-
106
- // Setting
107
- R('answer', 42);
108
- // Multiple levels
109
- R('a.global.variable', 'foo');
110
-
111
- // Getting
112
- console.log(R('a.global.variable'));
113
- ```
114
-
115
-
116
- #### Define hooks for namespaces.
117
- ```js
118
- /*
119
- * app/assets/javascripts/namespaces/admin.js
120
- */
121
-
122
- Rails.namespace('admin', function() {
123
- // Will be executed on all admin routes (e.g. admin/users#new)
124
- console.log('Hello Mr. Admin');
125
- });
126
- ```
127
-
128
- #### For more info...
129
- ...just read in ``app/assets/javascripts/rails.js``. I tried my best and documented nearly every line of code :)
130
-
131
- Installing
132
- ==========
133
-
134
- Install it as any other gem by putting this to your ``Gemfile``:
135
- ```ruby
136
- gem 'rails-js'
137
- ```
138
- In your layouts, put this line into the ``head``:
139
- ```erb
140
- <%= rails_js %>
141
- ```
142
- Also make sure to include ``rails`` in your ``application.js``. If you are using [Turbolinks](https://github.com/rails/turbolinks), make sure to include ``rails`` after ``turbolinks``.
143
-
144
- Testing
145
- =======
146
-
147
- Javascript tests are in ``test/dummy/spec/javascripts/rails-js_spec.js``.
148
- They are executed using ``rake teaspoon`` (by using the [teaspoon runner](https://github.com/modeset/teaspoon)).
149
- I'm still trying to get [travis to execute the teaspoon tests properly...](https://travis-ci.org/tonekk/rails-js/builds/37740824)
150
-
151
- Contributing
152
- ============
153
-
154
- [Fork](https://github.com/tonekk/rails-js/fork) -> Commit -> Pull Request
155
-
156
- This project uses the [Airbnb Styleguide](https://github.com/airbnb/javascript) as our coding guideline.
157
- We think this is a good piece of work and worth spreading.
158
- In case of any doubts refer to the style used around.