reactive-ruby 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +101 -0
  3. data/README.md +19 -11
  4. data/example/{tutorial → rails-tutorial}/.gitignore +0 -0
  5. data/example/{tutorial → rails-tutorial}/Gemfile +0 -0
  6. data/example/{tutorial → rails-tutorial}/Gemfile.lock +2 -2
  7. data/example/{tutorial → rails-tutorial}/README.rdoc +0 -0
  8. data/example/{tutorial → rails-tutorial}/Rakefile +0 -0
  9. data/example/{tutorial → rails-tutorial}/app/assets/images/.keep +0 -0
  10. data/example/rails-tutorial/app/assets/javascripts/application.rb +15 -0
  11. data/example/{tutorial → rails-tutorial}/app/assets/stylesheets/application.css +0 -0
  12. data/example/{tutorial → rails-tutorial}/app/controllers/application_controller.rb +0 -0
  13. data/example/{tutorial → rails-tutorial}/app/controllers/concerns/.keep +0 -0
  14. data/example/{tutorial → rails-tutorial}/app/controllers/home_controller.rb +0 -0
  15. data/example/{tutorial → rails-tutorial}/app/helpers/application_helper.rb +0 -0
  16. data/example/{tutorial → rails-tutorial}/app/mailers/.keep +0 -0
  17. data/example/{tutorial → rails-tutorial}/app/models/.keep +0 -0
  18. data/example/{tutorial → rails-tutorial}/app/models/concerns/.keep +0 -0
  19. data/example/{tutorial → rails-tutorial}/app/views/components.rb +0 -0
  20. data/example/{tutorial → rails-tutorial}/app/views/components/home/show.rb +0 -0
  21. data/example/{tutorial → rails-tutorial}/app/views/layouts/application.html.erb +0 -0
  22. data/example/{tutorial → rails-tutorial}/bin/bundle +0 -0
  23. data/example/{tutorial → rails-tutorial}/bin/rails +0 -0
  24. data/example/{tutorial → rails-tutorial}/bin/rake +0 -0
  25. data/example/{tutorial → rails-tutorial}/bin/setup +0 -0
  26. data/example/{tutorial → rails-tutorial}/bin/spring +0 -0
  27. data/example/{tutorial → rails-tutorial}/config.ru +0 -0
  28. data/example/{tutorial → rails-tutorial}/config/application.rb +0 -0
  29. data/example/{tutorial → rails-tutorial}/config/boot.rb +0 -0
  30. data/example/{tutorial → rails-tutorial}/config/database.yml +0 -0
  31. data/example/{tutorial → rails-tutorial}/config/environment.rb +0 -0
  32. data/example/{tutorial → rails-tutorial}/config/environments/development.rb +0 -0
  33. data/example/{tutorial → rails-tutorial}/config/environments/production.rb +0 -0
  34. data/example/{tutorial → rails-tutorial}/config/environments/test.rb +0 -0
  35. data/example/{tutorial → rails-tutorial}/config/initializers/assets.rb +0 -0
  36. data/example/{tutorial → rails-tutorial}/config/initializers/backtrace_silencers.rb +0 -0
  37. data/example/{tutorial → rails-tutorial}/config/initializers/cookies_serializer.rb +0 -0
  38. data/example/{tutorial → rails-tutorial}/config/initializers/filter_parameter_logging.rb +0 -0
  39. data/example/{tutorial → rails-tutorial}/config/initializers/inflections.rb +0 -0
  40. data/example/{tutorial → rails-tutorial}/config/initializers/mime_types.rb +0 -0
  41. data/example/{tutorial → rails-tutorial}/config/initializers/session_store.rb +0 -0
  42. data/example/{tutorial → rails-tutorial}/config/initializers/wrap_parameters.rb +0 -0
  43. data/example/{tutorial → rails-tutorial}/config/locales/en.yml +0 -0
  44. data/example/{tutorial → rails-tutorial}/config/routes.rb +0 -0
  45. data/example/{tutorial → rails-tutorial}/config/secrets.yml +0 -0
  46. data/example/{tutorial → rails-tutorial}/db/seeds.rb +0 -0
  47. data/example/{tutorial → rails-tutorial}/lib/assets/.keep +0 -0
  48. data/example/{tutorial → rails-tutorial}/lib/tasks/.keep +0 -0
  49. data/example/{tutorial → rails-tutorial}/log/.keep +0 -0
  50. data/example/{tutorial → rails-tutorial}/public/404.html +0 -0
  51. data/example/{tutorial → rails-tutorial}/public/422.html +0 -0
  52. data/example/{tutorial → rails-tutorial}/public/500.html +0 -0
  53. data/example/{tutorial → rails-tutorial}/public/favicon.ico +0 -0
  54. data/example/{tutorial → rails-tutorial}/public/robots.txt +0 -0
  55. data/example/{tutorial → rails-tutorial}/test/controllers/.keep +0 -0
  56. data/example/{tutorial → rails-tutorial}/test/fixtures/.keep +0 -0
  57. data/example/{tutorial → rails-tutorial}/test/helpers/.keep +0 -0
  58. data/example/{tutorial → rails-tutorial}/test/integration/.keep +0 -0
  59. data/example/{tutorial → rails-tutorial}/test/mailers/.keep +0 -0
  60. data/example/{tutorial → rails-tutorial}/test/models/.keep +0 -0
  61. data/example/{tutorial → rails-tutorial}/test/test_helper.rb +0 -0
  62. data/example/{tutorial → rails-tutorial}/vendor/assets/javascripts/.keep +0 -0
  63. data/example/{tutorial → rails-tutorial}/vendor/assets/stylesheets/.keep +0 -0
  64. data/example/sinatra-tutorial/.DS_Store +0 -0
  65. data/example/sinatra-tutorial/Gemfile +5 -0
  66. data/example/sinatra-tutorial/Gemfile.lock +101 -0
  67. data/example/{react-tutorial → sinatra-tutorial}/README.md +0 -0
  68. data/example/sinatra-tutorial/_comments.json +38 -0
  69. data/example/{react-tutorial/example.js.rb → sinatra-tutorial/app/example.rb} +3 -2
  70. data/example/sinatra-tutorial/app/jquery.js +5 -0
  71. data/example/{react-tutorial → sinatra-tutorial}/config.ru +1 -6
  72. data/example/{react-tutorial → sinatra-tutorial}/public/base.css +0 -0
  73. data/lib/reactive-ruby.rb +1 -7
  74. data/lib/reactive-ruby/version.rb +1 -1
  75. data/lib/sources/react.js +19801 -0
  76. data/reactive-ruby.gemspec +3 -2
  77. metadata +74 -85
  78. data/example/react-tutorial/Gemfile +0 -7
  79. data/example/react-tutorial/Gemfile.lock +0 -49
  80. data/example/react-tutorial/_comments.json +0 -14
  81. data/example/tutorial/Gemfile.xlock +0 -211
  82. data/example/tutorial/app/assets/javascripts/application.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6e7e4fc40600191b0985643a430eca77bbc7816
4
- data.tar.gz: 35c09c919ba8ceaabd2165960fcc963a4f2c57c1
3
+ metadata.gz: 5aafd11f2c53f8653e3572bd568320daace5f4a6
4
+ data.tar.gz: 9c7142108c3ba5289d2a5f08dd4d7eb5f4db3d15
5
5
  SHA512:
6
- metadata.gz: 6cc80309ecd3a8115eeef622a7f61e96188fc2e52e3e3b03ba6c5b6d672ccdd2588db5100894fb4763dd38e74f31737d76ff586337d7c65db0c2f92b63f2d7a2
7
- data.tar.gz: b1321b290e26ca408b04143d0a3f29e4e0d5efd33b119224eeb9c2bdffc5d05410652cdd9e3cec0b4643faf08d6a6a0f1b957091d619d5bc63f4cd0ef2a94d83
6
+ metadata.gz: 2122b457f0f408e113d449ca0170f31c75ed3bf9725a5593f1fb7937c6fab9e4d8a14e23907ac1cb1596288b3e0139464f9e13bc429c22446accbd74018ffbb8
7
+ data.tar.gz: ee2c90bfd899ca3455216a8f777db05f31fc3053910a5458bfbaafa15d52bdec02b217352eeacc6b6acc066c127c6499777debbe572aa2399b6d5eeb9b9fb4ae
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ reactive-ruby (0.7.5)
5
+ jquery-rails
6
+ opal
7
+ opal-activesupport
8
+ opal-browser
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionpack (4.2.3)
14
+ actionview (= 4.2.3)
15
+ activesupport (= 4.2.3)
16
+ rack (~> 1.6)
17
+ rack-test (~> 0.6.2)
18
+ rails-dom-testing (~> 1.0, >= 1.0.5)
19
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
+ actionview (4.2.3)
21
+ activesupport (= 4.2.3)
22
+ builder (~> 3.1)
23
+ erubis (~> 2.7.0)
24
+ rails-dom-testing (~> 1.0, >= 1.0.5)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ activesupport (4.2.3)
27
+ i18n (~> 0.7)
28
+ json (~> 1.7, >= 1.7.7)
29
+ minitest (~> 5.1)
30
+ thread_safe (~> 0.3, >= 0.3.4)
31
+ tzinfo (~> 1.1)
32
+ builder (3.2.2)
33
+ erubis (2.7.0)
34
+ hike (1.2.3)
35
+ i18n (0.7.0)
36
+ jquery-rails (4.0.4)
37
+ rails-dom-testing (~> 1.0)
38
+ railties (>= 4.2.0)
39
+ thor (>= 0.14, < 2.0)
40
+ json (1.8.3)
41
+ loofah (2.0.3)
42
+ nokogiri (>= 1.5.9)
43
+ mini_portile (0.6.2)
44
+ minitest (5.8.0)
45
+ nokogiri (1.6.6.2)
46
+ mini_portile (~> 0.6.0)
47
+ opal (0.8.0)
48
+ hike (~> 1.2)
49
+ sourcemap (~> 0.1.0)
50
+ sprockets (~> 3.1)
51
+ tilt (>= 1.4)
52
+ opal-activesupport (0.1.0)
53
+ opal (>= 0.5.0, < 1.0.0)
54
+ opal-browser (0.2.0)
55
+ opal
56
+ paggio
57
+ opal-rspec (0.4.3)
58
+ opal (>= 0.7.0, < 0.9)
59
+ paggio (0.2.4)
60
+ rack (1.6.4)
61
+ rack-protection (1.5.3)
62
+ rack
63
+ rack-test (0.6.3)
64
+ rack (>= 1.0)
65
+ rails-deprecated_sanitizer (1.0.3)
66
+ activesupport (>= 4.2.0.alpha)
67
+ rails-dom-testing (1.0.7)
68
+ activesupport (>= 4.2.0.beta, < 5.0)
69
+ nokogiri (~> 1.6.0)
70
+ rails-deprecated_sanitizer (>= 1.0.1)
71
+ rails-html-sanitizer (1.0.2)
72
+ loofah (~> 2.0)
73
+ railties (4.2.3)
74
+ actionpack (= 4.2.3)
75
+ activesupport (= 4.2.3)
76
+ rake (>= 0.8.7)
77
+ thor (>= 0.18.1, < 2.0)
78
+ rake (10.4.2)
79
+ sinatra (1.4.6)
80
+ rack (~> 1.4)
81
+ rack-protection (~> 1.4)
82
+ tilt (>= 1.3, < 3)
83
+ sourcemap (0.1.1)
84
+ sprockets (3.3.3)
85
+ rack (~> 1.0)
86
+ thor (0.19.1)
87
+ thread_safe (0.3.5)
88
+ tilt (2.0.1)
89
+ tzinfo (1.2.2)
90
+ thread_safe (~> 0.1)
91
+
92
+ PLATFORMS
93
+ ruby
94
+
95
+ DEPENDENCIES
96
+ opal-rspec
97
+ reactive-ruby!
98
+ sinatra
99
+
100
+ BUNDLED WITH
101
+ 1.10.6
data/README.md CHANGED
@@ -4,11 +4,13 @@
4
4
 
5
5
  It lets you write reactive UI components, with Ruby's elegance using the tried and true React.js engine. :heart:
6
6
 
7
- This fork of the original react.rb gem is a work in progress. Currently it is being used in a large rails app, so until a better guide can be written we will just assume you will use it a rails app too. However the gem itself has no dependency on rails, and there are people using the gem in other environments.
7
+ This fork of the original react.rb gem is a work in progress. Currently it is being used in a large rails app. However the gem itself has no dependency on rails, and there are people using the gem in other environments.
8
8
 
9
9
  ## Quick Overview
10
10
 
11
- A react app is built from one or more trees of components. A react component can live side by side with other non-react html. A react component is just like a rails view or a partial. Reactive-Ruby takes advantage of this by letting you add Reactive-Ruby components as views, and call them directly from your controller like any other view.
11
+ A react app is built from one or more trees of components. React components can live side by side with other non-react html and javascript. A react component is just like a rails view or a partial. Reactive-Ruby takes advantage of these features by letting you add Reactive-Ruby components as views, and call them directly from your controller like any other view.
12
+
13
+ By design Reactive-Ruby allows reactive components to be easily added to existing Rails projects, as well in new development.
12
14
 
13
15
  Components are first rendered to HTML on the server (called pre-rendering) this is no different from what happens when your ERB or HAML templates are translated to HTML.
14
16
 
@@ -16,10 +18,7 @@ A copy of the react engine, and your components follows the rendered HTML to the
16
18
 
17
19
  The beauty is you now have one markup description, written in the same language as your server code, that works both as the HTML template and as an interactive component.
18
20
 
19
- By design Reactive-Ruby allows reactive components to be easily added to existing Rails projects, as well in new development.
20
-
21
-
22
- ## Installation and setup
21
+ ## Installation and Setup with Rails
23
22
 
24
23
  In your gem file:
25
24
 
@@ -50,14 +49,19 @@ Then your `assets/javascript/application.rb` file looks like this:
50
49
 
51
50
  ```
52
51
  #assets/javascript/application.rb
52
+
53
53
  # only put files that are browser side only.
54
54
 
55
55
  require 'components' # this pulls in your components from the components.rb manifest file
56
- require 'jquery' # you need both these files to access jQuery from Opal
57
- require 'opal-jquery' # they must be in this order, and after the components require
58
- require 'browser' # opal access to browser specific methods (such as setTimer)
59
- require 'react_ujs' # this is required and is part of the prerendering system
60
- # whatever else you might need here
56
+ require 'react_ujs' # this is required on the client side only and is part of the prerendering system
57
+
58
+ # require any thing else that is browser side only, typically these 4 are all you need. If you
59
+ # have client only sections of code that that do not contain requires wrap them in
60
+ # if React::IsomorphicHelpers.on_opal_client? blocks.
61
+
62
+ require 'jquery' # you need both these files to access jQuery from Opal
63
+ require 'opal-jquery' # they must be in this order, and after the components require
64
+ require 'browser/interval' # for #every, and #after methods
61
65
  ```
62
66
 
63
67
  Okay that is your setup.
@@ -102,6 +106,10 @@ Open up the js console in the browser and you will see a log showing what went o
102
106
 
103
107
  Have a look at the sources in the console, and notice your ruby code is there, and you can set break points etc.
104
108
 
109
+ ## Integration with Sinatra
110
+
111
+ See the sinatra-tutorial folder
112
+
105
113
  ## Typical Problems
106
114
 
107
115
  `Uncaught TypeError: Cannot read property 'toUpperCase' of undefined` This means the thing you are trying to render is not actually a react component. Often is because the top level component name is wrong. For example if you are in controller Foo and the method is `bar`, but you have named the component Foo::Bars then you would see this message.
@@ -13,11 +13,11 @@ GIT
13
13
  PATH
14
14
  remote: ../..
15
15
  specs:
16
- reactive-ruby (0.7.3)
16
+ reactive-ruby (0.7.5)
17
+ jquery-rails
17
18
  opal
18
19
  opal-activesupport
19
20
  opal-browser
20
- opal-jquery
21
21
 
22
22
  GEM
23
23
  remote: https://rubygems.org/
@@ -0,0 +1,15 @@
1
+ #assets/javascript/application.rb
2
+
3
+ # only put files that are browser side only.
4
+
5
+ require 'components' # this pulls in your components from the components.rb manifest file
6
+ require 'react_ujs' # this is required on the client side only and is part of the prerendering system
7
+
8
+ # require any thing else that is browser side only, typically these 4 are all you need. If you
9
+ # have client only sections of code that that do not contain requires wrap them in
10
+ # if React::IsomorphicHelpers.on_opal_client? blocks.
11
+
12
+ require 'jquery' # you need both these files to access jQuery from Opal
13
+ require 'opal-jquery' # they must be in this order, and after the components require
14
+ require 'browser/interval' # for #every, and #after methods
15
+
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'reactive-ruby', :path => '../..'
4
+ gem 'sinatra'
5
+ gem 'opal-jquery'
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ reactive-ruby (0.7.4)
5
+ jquery-rails
6
+ opal
7
+ opal-activesupport
8
+ opal-browser
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionpack (4.2.3)
14
+ actionview (= 4.2.3)
15
+ activesupport (= 4.2.3)
16
+ rack (~> 1.6)
17
+ rack-test (~> 0.6.2)
18
+ rails-dom-testing (~> 1.0, >= 1.0.5)
19
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
+ actionview (4.2.3)
21
+ activesupport (= 4.2.3)
22
+ builder (~> 3.1)
23
+ erubis (~> 2.7.0)
24
+ rails-dom-testing (~> 1.0, >= 1.0.5)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ activesupport (4.2.3)
27
+ i18n (~> 0.7)
28
+ json (~> 1.7, >= 1.7.7)
29
+ minitest (~> 5.1)
30
+ thread_safe (~> 0.3, >= 0.3.4)
31
+ tzinfo (~> 1.1)
32
+ builder (3.2.2)
33
+ erubis (2.7.0)
34
+ hike (1.2.3)
35
+ i18n (0.7.0)
36
+ jquery-rails (4.0.4)
37
+ rails-dom-testing (~> 1.0)
38
+ railties (>= 4.2.0)
39
+ thor (>= 0.14, < 2.0)
40
+ json (1.8.3)
41
+ loofah (2.0.3)
42
+ nokogiri (>= 1.5.9)
43
+ mini_portile (0.6.2)
44
+ minitest (5.8.0)
45
+ nokogiri (1.6.6.2)
46
+ mini_portile (~> 0.6.0)
47
+ opal (0.8.0)
48
+ hike (~> 1.2)
49
+ sourcemap (~> 0.1.0)
50
+ sprockets (~> 3.1)
51
+ tilt (>= 1.4)
52
+ opal-activesupport (0.1.0)
53
+ opal (>= 0.5.0, < 1.0.0)
54
+ opal-browser (0.2.0)
55
+ opal
56
+ paggio
57
+ opal-jquery (0.4.0)
58
+ opal (>= 0.7.0, < 0.9.0)
59
+ paggio (0.2.4)
60
+ rack (1.6.4)
61
+ rack-protection (1.5.3)
62
+ rack
63
+ rack-test (0.6.3)
64
+ rack (>= 1.0)
65
+ rails-deprecated_sanitizer (1.0.3)
66
+ activesupport (>= 4.2.0.alpha)
67
+ rails-dom-testing (1.0.7)
68
+ activesupport (>= 4.2.0.beta, < 5.0)
69
+ nokogiri (~> 1.6.0)
70
+ rails-deprecated_sanitizer (>= 1.0.1)
71
+ rails-html-sanitizer (1.0.2)
72
+ loofah (~> 2.0)
73
+ railties (4.2.3)
74
+ actionpack (= 4.2.3)
75
+ activesupport (= 4.2.3)
76
+ rake (>= 0.8.7)
77
+ thor (>= 0.18.1, < 2.0)
78
+ rake (10.4.2)
79
+ sinatra (1.4.6)
80
+ rack (~> 1.4)
81
+ rack-protection (~> 1.4)
82
+ tilt (>= 1.3, < 3)
83
+ sourcemap (0.1.1)
84
+ sprockets (3.3.3)
85
+ rack (~> 1.0)
86
+ thor (0.19.1)
87
+ thread_safe (0.3.5)
88
+ tilt (2.0.1)
89
+ tzinfo (1.2.2)
90
+ thread_safe (~> 0.1)
91
+
92
+ PLATFORMS
93
+ ruby
94
+
95
+ DEPENDENCIES
96
+ opal-jquery
97
+ reactive-ruby!
98
+ sinatra
99
+
100
+ BUNDLED WITH
101
+ 1.10.6
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "author": "Pete Hunt",
4
+ "text": "Hey there!"
5
+ },
6
+ {
7
+ "author": "Mitch",
8
+ "text": "i ***am*** saying something!"
9
+ },
10
+ {
11
+ "author": "Jan",
12
+ "text": "well what are you saying *dear*"
13
+ },
14
+ {
15
+ "author": "Mitch",
16
+ "text": "I am saying something"
17
+ },
18
+ {
19
+ "author": "Mitch",
20
+ "text": "I did say something"
21
+ },
22
+ {
23
+ "author": "Mitch",
24
+ "text": "said make a brandy Alexander"
25
+ },
26
+ {
27
+ "author": "Jan",
28
+ "text": "No **I Said** make the alexander! - You make it"
29
+ },
30
+ {
31
+ "author": "Cool Fred",
32
+ "text": "Just do it!"
33
+ },
34
+ {
35
+ "author": "foo",
36
+ "text": "to you"
37
+ }
38
+ ]