redux_rails 0.1.1 → 0.1.2
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 +4 -4
- data/lib/generators/redux_rails/install_generator.rb +47 -47
- data/lib/redux_rails/version.rb +1 -1
- data/redux_rails.gemspec +1 -6
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49a8ea0a58f79e7a4f41f8f90889e39c47c3b25
|
4
|
+
data.tar.gz: 07a27fa4221f637df04524f78c6e84106d3ad3b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3e5a1627ab759817ffa8ffaebaa669296a00a35679b6922def59c8cc8cc4aa3eb0536f5fe5820fa21504b4f29ebf467bd4ec67ff168fd4fb6c3de5ee3340e6
|
7
|
+
data.tar.gz: 61d3e933a7d2f81497777144b3b843e53d7cd76b8fbb5d00820a0e283806968811aebad5921b3387de6872935c1bc9ebad6e5d5cf5584cc981a744d3e94fd430
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ReduxRails
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
|
-
source_root File.expand_path('
|
4
|
-
|
5
|
-
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
argument :name, :type => :string, :default => "app"
|
5
|
+
|
6
6
|
def create_src_directory
|
7
7
|
empty_directory("app/javascript/src")
|
8
8
|
end
|
@@ -75,53 +75,53 @@ export default #{name}Reducer;"
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def create_pack
|
78
|
-
create_file "app/javascript/packs/#{name}.jsx",
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
78
|
+
create_file "app/javascript/packs/#{name}.jsx",
|
79
|
+
"import React from 'react'
|
80
|
+
import { render } from 'react-dom'
|
81
|
+
import { Provider } from 'react-redux'
|
82
|
+
import { createStore, combineReducers, applyMiddleware } from 'redux'
|
83
|
+
|
84
|
+
//this allows you to use the redux devtool in chrome
|
85
|
+
import { devToolsEnhancer } from 'redux-devtools-extension'
|
86
|
+
|
87
|
+
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
88
|
+
|
89
|
+
import #{name} from './src/components/#{name}/#{name}'
|
90
|
+
|
91
|
+
import rootReducer from '../src/reducer'
|
92
|
+
|
93
|
+
//this is for devToolsEnhancer otherwise would be 'let store = createStore(todoApp)'
|
94
|
+
let store = createStore(todoApp, /* preloadedState, */ devToolsEnhancer(
|
95
|
+
// Specify name here, actionsBlacklist, actionsCreators and other options if needed
|
96
|
+
));
|
97
|
+
console.log(store.getState())
|
98
|
+
|
99
|
+
// Note that subscribe() returns a function for unregistering the listener
|
100
|
+
let unsubscribe = store.subscribe(() =>
|
101
|
+
console.log(store.getState())
|
102
|
+
)
|
103
|
+
|
104
|
+
// Stop listening to state updates
|
105
|
+
unsubscribe()
|
106
|
+
|
107
|
+
document.addEventListener('DOMContentLoaded', () => {
|
108
|
+
render(
|
109
|
+
<Provider store={store}>
|
110
|
+
<Router>
|
111
|
+
<div>
|
112
|
+
<Route exact path='/' component={#{name}} />
|
113
|
+
</div>
|
114
|
+
</Router>
|
115
|
+
</Provider>,
|
116
|
+
document.body.appendChild(document.createElement('div')),
|
117
|
+
)
|
118
|
+
})"
|
119
119
|
end
|
120
120
|
|
121
121
|
def insert_into_manifest
|
122
|
-
inject_into_file "public/packs/manifest.json", "
|
123
|
-
inject_into_file "public/packs/manifest.json", "'#{name}.css': 'http://0.0.0.0:8080/packs/#{name}.css',\n", :after => "'#{name}.js': 'http://0.0.0.0:8080/packs/#{name}.js',\n"
|
124
|
-
end
|
122
|
+
inject_into_file "public/packs/manifest.json", "\"#{name}.js\" : \"http://0.0.0.0:8080/packs/#{name}.js\",\n", :after => "{\n"
|
125
123
|
|
124
|
+
inject_into_file "public/packs/manifest.json", "\"#{name}.css\" : \"http://0.0.0.0:8080/packs/#{name}.css\",\n", :after => "\"#{name}.js\" : \"http://0.0.0.0:8080/packs/#{name}.js\",\n"
|
125
|
+
end
|
126
126
|
end
|
127
127
|
end
|
data/lib/redux_rails/version.rb
CHANGED
data/redux_rails.gemspec
CHANGED
@@ -8,13 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = ReduxRails::VERSION
|
9
9
|
spec.authors = ["Luke Popwell"]
|
10
10
|
spec.email = ["lukepopwell@mac.com"]
|
11
|
-
|
12
11
|
spec.summary = %q{Setup React and Redux for Rails 5.1}
|
13
|
-
spec.description = %q{
|
14
|
-
Complete setup for React and Redux into Rails 5.1 pipeline or later.
|
15
|
-
Includes initial install generator, component and container generator.
|
16
|
-
Full description of install located at https://github.com/Luke-Popwell/redux_rails
|
17
|
-
}
|
12
|
+
spec.description = %q{Complete setup for React and Redux into Rails 5.1 pipeline or later. Includes initial install generator, component and container generator. Full description of install located at https://github.com/Luke-Popwell/redux_rails }
|
18
13
|
spec.homepage = "https://github.com/Luke-Popwell/redux_rails"
|
19
14
|
spec.license = "MIT"
|
20
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redux_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Popwell
|
@@ -52,10 +52,9 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
56
|
-
|
57
|
-
|
58
|
-
\ "
|
55
|
+
description: 'Complete setup for React and Redux into Rails 5.1 pipeline or later.
|
56
|
+
Includes initial install generator, component and container generator. Full description
|
57
|
+
of install located at https://github.com/Luke-Popwell/redux_rails '
|
59
58
|
email:
|
60
59
|
- lukepopwell@mac.com
|
61
60
|
executables: []
|