gnarails 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -90
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +50 -0
  5. data/README.md +1 -34
  6. data/bin/ci_pronto +1 -1
  7. data/gnarails.gemspec +2 -3
  8. data/gnarly.rb +44 -137
  9. data/lib/gnarails/version.rb +1 -1
  10. data/templates/.circleci/config.yml +7 -2
  11. data/templates/Procfile +1 -0
  12. data/templates/{script → bin}/brakeman +1 -1
  13. data/templates/{script → bin}/ci_pronto +1 -1
  14. data/test-app/app/views/layouts/application.html.erb +4 -2
  15. data/test-app/spec/factories/job_postings.rb +1 -1
  16. metadata +9 -64
  17. data/bin/generate-react-test-app.sh +0 -2
  18. data/templates/.ruby-version +0 -1
  19. data/templates/Dockerfile-assets +0 -24
  20. data/templates/docker-compose.yml/docker-compose-webpack.yml +0 -26
  21. data/templates/react/.babelrc +0 -18
  22. data/templates/react/.eslintrc.js +0 -45
  23. data/templates/react/controllers/home_controller.rb +0 -4
  24. data/templates/react/js/Router/Router.jsx +0 -22
  25. data/templates/react/js/Router/index.js +0 -3
  26. data/templates/react/js/api/index.js +0 -17
  27. data/templates/react/js/api/sessions.js +0 -8
  28. data/templates/react/js/app_constants/index.js +0 -6
  29. data/templates/react/js/components/App/App.jsx +0 -15
  30. data/templates/react/js/components/App/App.tests.jsx +0 -15
  31. data/templates/react/js/components/App/_styles.scss +0 -3
  32. data/templates/react/js/components/App/index.js +0 -3
  33. data/templates/react/js/index.scss +0 -2
  34. data/templates/react/js/packs/main.jsx +0 -13
  35. data/templates/react/js/redux/entity_getter.js +0 -7
  36. data/templates/react/js/redux/history.js +0 -5
  37. data/templates/react/js/redux/initial_state.js +0 -5
  38. data/templates/react/js/redux/middlewares/authentication_middleware/authentication_middleware.tests.js +0 -109
  39. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.js +0 -21
  40. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.tests.js +0 -84
  41. data/templates/react/js/redux/middlewares/authentication_middleware/index.js +0 -20
  42. data/templates/react/js/redux/middlewares/index.js +0 -11
  43. data/templates/react/js/redux/nodes/app/actions.js +0 -36
  44. data/templates/react/js/redux/nodes/app/config.js +0 -12
  45. data/templates/react/js/redux/nodes/app/reducer.js +0 -35
  46. data/templates/react/js/redux/nodes/app/reducer.tests.js +0 -78
  47. data/templates/react/js/redux/reducers.js +0 -11
  48. data/templates/react/js/redux/store.js +0 -14
  49. data/templates/react/js/storage.js +0 -15
  50. data/templates/react/js/styles/_variables.scss +0 -1
  51. data/templates/react/js/test/.setup.js +0 -51
  52. data/templates/react/js/test/connect_wrapper.jsx +0 -28
  53. data/templates/react/js/test/create_request_mock.js +0 -29
  54. data/templates/react/js/test/mock_store.js +0 -12
  55. data/templates/react/layout.html.erb +0 -16
  56. data/templates/react/rails_routes.rb +0 -5
  57. data/templates/react/views/home/default.html.erb +0 -1
@@ -1,11 +0,0 @@
1
- import { combineReducers } from 'redux';
2
- import { reducer as formReducer } from 'redux-form';
3
- import { routerReducer } from 'react-router-redux';
4
-
5
- import app from 'redux/nodes/app/reducer';
6
-
7
- export default combineReducers({
8
- app,
9
- form: formReducer,
10
- router: routerReducer,
11
- });
@@ -1,14 +0,0 @@
1
- import { applyMiddleware, compose, createStore } from 'redux';
2
- import Es6ObjectAssign from 'es6-object-assign';
3
- import Es6Promise from 'es6-promise';
4
- import middlewares from 'redux/middlewares';
5
- import reducers from 'redux/reducers';
6
- import InitialState from 'redux/initial_state';
7
-
8
- const appliedMiddleware = applyMiddleware(...middlewares);
9
-
10
- // ie polyfills
11
- Es6ObjectAssign.polyfill();
12
- Es6Promise.polyfill();
13
-
14
- export default createStore(reducers, InitialState, compose(appliedMiddleware));
@@ -1,15 +0,0 @@
1
- import appConstants from 'app_constants';
2
-
3
- const prefix = appConstants.APP_NAME;
4
-
5
- export default {
6
- getItem: (key) => {
7
- return global.window.localStorage.getItem(`${prefix}:${key}`);
8
- },
9
- removeItem: (key) => {
10
- return global.window.localStorage.removeItem(`${prefix}:${key}`);
11
- },
12
- setItem: (key, value) => {
13
- return global.window.localStorage.setItem(`${prefix}:${key}`, value);
14
- },
15
- };
@@ -1 +0,0 @@
1
- $black: #000000;
@@ -1,51 +0,0 @@
1
- var jsdom = require('jsdom').JSDOM;
2
- var exposedProperties = ['window', 'navigator', 'document'];
3
- var Enzyme = require('enzyme');
4
- var Adapter = require('enzyme-adapter-react-16');
5
-
6
- Enzyme.configure({ adapter: new Adapter() });
7
-
8
- jsdom = new jsdom('<!DOCTYPE html><html><body></body></html>');
9
-
10
- global.document = jsdom.window.document;
11
- global.window = document.defaultView;
12
-
13
- Object.keys(document.defaultView).forEach((property) => {
14
- if (typeof global[property] === 'undefined') {
15
- exposedProperties.push(property);
16
- global[property] = document.defaultView[property];
17
- }
18
- });
19
-
20
- function mockStorage() {
21
- let storage = {};
22
-
23
- return {
24
- setItem(key, value = '') {
25
- storage[key] = value;
26
- },
27
- getItem(key) {
28
- return storage[key];
29
- },
30
- removeItem(key) {
31
- delete storage[key];
32
- },
33
- get length() {
34
- return Object.keys(storage).length;
35
- },
36
- key(i) {
37
- return Object.keys(storage)[i] || null;
38
- },
39
- clear () {
40
- storage = {};
41
- },
42
- };
43
- }
44
-
45
- global.navigator = {
46
- userAgent: 'node.js'
47
- };
48
-
49
- global.window = {
50
- localStorage: mockStorage(),
51
- };
@@ -1,28 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { has } from 'lodash';
3
- import { Provider } from 'react-redux';
4
- import { MemoryRouter } from 'react-router';
5
-
6
- import createStore from 'test/mock_store';
7
-
8
- const defaultStore = { router: { location: { pathname: '/' } } };
9
-
10
- const connectWrapper = (WrappedComponent, store = defaultStore) => {
11
- class Wrapper extends Component {
12
- render() {
13
- const providerStore = has(store, 'getState') ? store : createStore(store);
14
-
15
- return (
16
- <Provider store={providerStore}>
17
- <MemoryRouter>
18
- <WrappedComponent {...this.props} />
19
- </MemoryRouter>
20
- </Provider>
21
- );
22
- }
23
- }
24
-
25
- return Wrapper;
26
- };
27
-
28
- export default connectWrapper;
@@ -1,29 +0,0 @@
1
- import nock from 'nock';
2
-
3
- const createRequestMock = ({
4
- bearerToken,
5
- host,
6
- method,
7
- params,
8
- path,
9
- responseStatus = 200,
10
- response,
11
- }) => {
12
- const reqheaders = { Authorization: `Bearer ${bearerToken}` };
13
- const req = bearerToken ? nock(host, { reqheaders }) : nock(host);
14
-
15
- if (params) {
16
- return req[method](path, JSON.stringify(params))
17
- .reply(responseStatus, response);
18
- }
19
-
20
- if (responseStatus >= 300) {
21
- return req[method](path)
22
- .replyWithError(response);
23
- }
24
-
25
- return req[method](path)
26
- .reply(responseStatus, response);
27
- };
28
-
29
- export default createRequestMock;
@@ -1,12 +0,0 @@
1
- import configureStore from 'redux-mock-store';
2
- import thunkMiddleware from 'redux-thunk';
3
-
4
- import authenticationMiddleware from 'redux/middlewares/authentication_middleware';
5
-
6
- export const middlewares = [thunkMiddleware, authenticationMiddleware];
7
-
8
- export default (store) => {
9
- const mockStore = configureStore(middlewares);
10
-
11
- return mockStore(store);
12
- };
@@ -1,16 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>placeholder_application_title</title>
5
- <%= csrf_meta_tags %>
6
-
7
- <%= stylesheet_link_tag 'application', media: 'all' %>
8
- <%= javascript_include_tag 'application' %>
9
- <%= javascript_pack_tag 'main' %>
10
- <%= stylesheet_pack_tag 'main' %>
11
- </head>
12
-
13
- <body>
14
- <div id="react"></div>
15
- </body>
16
- </html>
@@ -1,5 +0,0 @@
1
- Rails.application.routes.draw do
2
- root to: "home#default"
3
-
4
- get "/*path", to: "home#default"
5
- end
@@ -1 +0,0 @@
1
- <div></div>