react_on_rails 2.0.0.beta.1 → 2.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.dockerignore +2 -0
- data/.eslintignore +7 -0
- data/.eslintrc +19 -0
- data/.gitignore +28 -0
- data/.jscsrc +27 -0
- data/.npmignore +20 -0
- data/.rspec +2 -0
- data/.rubocop.yml +70 -0
- data/.scss-lint.yml +205 -0
- data/.travis.yml +43 -0
- data/CHANGELOG.md +34 -0
- data/Dockerfile_tests +12 -0
- data/Gemfile +40 -0
- data/README.md +365 -0
- data/Rakefile +5 -0
- data/app/helpers/react_on_rails_helper.rb +215 -0
- data/docker-compose.yml +11 -0
- data/docs/LICENSE +21 -0
- data/docs/additional_reading/heroku_deployment.md +23 -0
- data/docs/additional_reading/manual_installation.md +118 -0
- data/docs/additional_reading/node_dependencies_and_npm.md +29 -0
- data/docs/additional_reading/optional_configuration.md +33 -0
- data/docs/additional_reading/react-and-redux.md +36 -0
- data/docs/additional_reading/react_router.md +45 -0
- data/docs/additional_reading/server_rendering_tips.md +11 -0
- data/docs/additional_reading/tips.md +10 -0
- data/docs/additional_reading/webpack.md +46 -0
- data/docs/code_of_conduct.md +13 -0
- data/docs/coding-style/linters.md +64 -0
- data/docs/coding-style/style.md +42 -0
- data/docs/contributing.md +157 -0
- data/docs/generator_testing.md +20 -0
- data/docs/releasing.md +29 -0
- data/lib/generators/USAGE +99 -0
- data/lib/generators/react_on_rails/base_generator.rb +191 -0
- data/lib/generators/react_on_rails/bootstrap_generator.rb +89 -0
- data/lib/generators/react_on_rails/dev_tests_generator.rb +39 -0
- data/lib/generators/react_on_rails/generator_helper.rb +50 -0
- data/lib/generators/react_on_rails/heroku_deployment_generator.rb +30 -0
- data/lib/generators/react_on_rails/install_generator.rb +99 -0
- data/lib/generators/react_on_rails/js_linters_generator.rb +19 -0
- data/lib/generators/react_on_rails/react_no_redux_generator.rb +40 -0
- data/lib/generators/react_on_rails/react_with_redux_generator.rb +51 -0
- data/lib/generators/react_on_rails/ruby_linters_generator.rb +33 -0
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +4 -0
- data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +16 -0
- data/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb +5 -0
- data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +4 -0
- data/lib/generators/react_on_rails/templates/base/base/client/.babelrc +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/clientRegistration.jsx.tt +5 -0
- data/lib/generators/react_on_rails/templates/base/base/client/index.jade +15 -0
- data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +104 -0
- data/lib/generators/react_on_rails/templates/base/base/client/server.js +64 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js.tt +62 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js.tt +69 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +42 -0
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +26 -0
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt +26 -0
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/linters.rake.tt +88 -0
- data/lib/generators/react_on_rails/templates/base/base/package.json +31 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverRegistration.jsx +4 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +39 -0
- data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +63 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +10 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +8 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +19 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +89 -0
- data/lib/generators/react_on_rails/templates/dev_tests/.rspec +2 -0
- data/lib/generators/react_on_rails/templates/dev_tests/spec/features/hello_world_spec.rb +25 -0
- data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +57 -0
- data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +21 -0
- data/lib/generators/react_on_rails/templates/dev_tests/spec/spec_helper.rb +95 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks +2 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +1 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb +15 -0
- data/lib/generators/react_on_rails/templates/js_linters/client/.eslintignore +1 -0
- data/lib/generators/react_on_rails/templates/js_linters/client/.eslintrc +48 -0
- data/lib/generators/react_on_rails/templates/js_linters/client/.jscsrc +18 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +39 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +33 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +8 -0
- data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +48 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +43 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx +19 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +14 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +19 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +35 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +20 -0
- data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +19 -0
- data/lib/generators/react_on_rails/templates/ruby_linters/.rubocop.yml +26 -0
- data/lib/generators/react_on_rails/templates/ruby_linters/.scss-lint.yml +205 -0
- data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/brakeman.rake +17 -0
- data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/ci.rake +33 -0
- data/lib/generators/react_on_rails/templates/ruby_linters/ruby-lint.yml +20 -0
- data/lib/react_on_rails.rb +6 -0
- data/lib/react_on_rails/configuration.rb +60 -0
- data/lib/react_on_rails/engine.rb +7 -0
- data/lib/react_on_rails/prerender_error.rb +31 -0
- data/lib/react_on_rails/server_rendering_pool.rb +110 -0
- data/lib/react_on_rails/version.rb +3 -0
- data/package.json +76 -0
- data/rakelib/docker.rake +33 -0
- data/rakelib/dummy_apps.rake +20 -0
- data/rakelib/example_type.rb +160 -0
- data/rakelib/examples.rake +103 -0
- data/rakelib/examples_config.yml +19 -0
- data/rakelib/lint.rake +37 -0
- data/rakelib/node_package.rake +11 -0
- data/rakelib/run_rspec.rake +65 -0
- data/rakelib/task_helpers.rb +44 -0
- data/react_on_rails.gemspec +31 -0
- data/ruby-lint.yml +24 -0
- metadata +119 -2
data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
// This file loads Bootstrap by importing components explicitly instead of doing `@import 'bootstrap';`
|
2
|
+
// Doing so allows for customization of exactly which components are imported.
|
3
|
+
// The components themselves are made available via bootstrap-sass (https://github.com/twbs/bootstrap-sass#sass)
|
4
|
+
|
5
|
+
// IMPORTANT: Make sure to keep the customizations defined in this file
|
6
|
+
// in-sync with the ones defined in client/bootstrap-sass.config.js.
|
7
|
+
|
8
|
+
// For a reference on customizations,refer to:
|
9
|
+
// https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/_bootstrap.scss
|
10
|
+
|
11
|
+
// If you are looking to merely change bootstrap variables from their default,
|
12
|
+
// you should instead declare them in client/assets/stylesheets/_post-bootstrap.scss
|
13
|
+
|
14
|
+
// Core variables and mixins
|
15
|
+
@import 'bootstrap/variables';
|
16
|
+
@import 'bootstrap/mixins';
|
17
|
+
|
18
|
+
// Reset and dependencies
|
19
|
+
@import 'bootstrap/normalize';
|
20
|
+
@import 'bootstrap/print';
|
21
|
+
@import 'bootstrap/glyphicons';
|
22
|
+
|
23
|
+
// Core CSS
|
24
|
+
@import 'bootstrap/scaffolding';
|
25
|
+
@import 'bootstrap/type';
|
26
|
+
@import 'bootstrap/code';
|
27
|
+
@import 'bootstrap/grid';
|
28
|
+
@import 'bootstrap/tables';
|
29
|
+
@import 'bootstrap/forms';
|
30
|
+
@import 'bootstrap/buttons';
|
31
|
+
|
32
|
+
// Components
|
33
|
+
@import 'bootstrap/component-animations';
|
34
|
+
@import 'bootstrap/dropdowns';
|
35
|
+
@import 'bootstrap/button-groups';
|
36
|
+
@import 'bootstrap/input-groups';
|
37
|
+
@import 'bootstrap/navs';
|
38
|
+
@import 'bootstrap/navbar';
|
39
|
+
@import 'bootstrap/breadcrumbs';
|
40
|
+
@import 'bootstrap/pagination';
|
41
|
+
@import 'bootstrap/pager';
|
42
|
+
@import 'bootstrap/labels';
|
43
|
+
@import 'bootstrap/badges';
|
44
|
+
@import 'bootstrap/jumbotron';
|
45
|
+
@import 'bootstrap/thumbnails';
|
46
|
+
@import 'bootstrap/alerts';
|
47
|
+
@import 'bootstrap/progress-bars';
|
48
|
+
@import 'bootstrap/media';
|
49
|
+
@import 'bootstrap/list-group';
|
50
|
+
@import 'bootstrap/panels';
|
51
|
+
@import 'bootstrap/responsive-embed';
|
52
|
+
@import 'bootstrap/wells';
|
53
|
+
@import 'bootstrap/close';
|
54
|
+
|
55
|
+
// Components w/ JavaScript
|
56
|
+
@import 'bootstrap/modals';
|
57
|
+
@import 'bootstrap/tooltip';
|
58
|
+
@import 'bootstrap/popovers';
|
59
|
+
@import 'bootstrap/carousel';
|
60
|
+
|
61
|
+
// Utility classes
|
62
|
+
@import 'bootstrap/utilities';
|
63
|
+
@import 'bootstrap/responsive-utilities';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// The Rails server imports this file via app/assets/stylesheets/application.css.scss
|
2
|
+
// The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
|
3
|
+
|
4
|
+
// In either case, this file is loaded AFTER bootstrap has been loaded.
|
5
|
+
// This is where you can add your own styles and override bootstrap styles
|
6
|
+
// utilizing bootstrap variables and mixins.
|
7
|
+
|
8
|
+
.this-works {
|
9
|
+
color: orange !important;
|
10
|
+
}
|
data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
// The Rails server imports this file via app/assets/stylesheets/application.css.scss
|
2
|
+
// The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
|
3
|
+
|
4
|
+
// In either case, this file is loaded BEFORE bootstrap has been loaded.
|
5
|
+
// Use it to define variables BEFORE bootstrap loads. See http://getbootstrap.com/customize/
|
6
|
+
|
7
|
+
// This is a file that provides a fallback for `img-url` and fonts
|
8
|
+
@import 'react-on-rails-sass-helper';
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// The Rails server imports this file via app/assets/stylesheets/application.css.scss
|
2
|
+
// The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
|
3
|
+
|
4
|
+
// This file allows the same sass code with Rails and node-sass for the Webpack Dev Server.
|
5
|
+
// It is CRTICAL that this file is loaded first.
|
6
|
+
|
7
|
+
$rails: false !default; // defaults to false (e.g. webpack environment)
|
8
|
+
|
9
|
+
// Sass 3 removes image-url helper
|
10
|
+
// https://github.com/sass/libsass/issues/489
|
11
|
+
$image-url-path: '/assets/images/' !default;
|
12
|
+
|
13
|
+
@function img-url($image) {
|
14
|
+
@if $rails {
|
15
|
+
@return image-url($image);
|
16
|
+
} @else {
|
17
|
+
@return url('#{$image-url-path}#{$image}');
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
// See https://github.com/shakacode/bootstrap-sass-loader for more information
|
2
|
+
|
3
|
+
// IMPORTANT: Make sure to keep the customizations defined in this file
|
4
|
+
// in-sync with the ones defined in app/assets/stylesheets/_bootstrap-custom.scss.
|
5
|
+
|
6
|
+
// For a reference on customizations,refer to:
|
7
|
+
// https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/_bootstrap.scss
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
bootstrapCustomizations: './assets/stylesheets/_pre-bootstrap.scss',
|
11
|
+
mainSass: './assets/stylesheets/_post-bootstrap.scss',
|
12
|
+
|
13
|
+
// Default for the style loading is to put in your js files
|
14
|
+
// styleLoader: 'style-loader!css-loader!sass-loader',
|
15
|
+
|
16
|
+
// See: https://github.com/sass/node-sass#outputstyle
|
17
|
+
// https://github.com/sass/node-sass#imagepath
|
18
|
+
styleLoader: 'style-loader!css-loader!sass-loader?imagePath=/assets/images',
|
19
|
+
|
20
|
+
// ### Scripts
|
21
|
+
// Any scripts here set to false will never make it to the client,
|
22
|
+
// i.e. it's not packaged by webpack.
|
23
|
+
scripts: {
|
24
|
+
transition: true,
|
25
|
+
alert: true,
|
26
|
+
button: true,
|
27
|
+
|
28
|
+
carousel: true,
|
29
|
+
collapse: true,
|
30
|
+
dropdown: true,
|
31
|
+
|
32
|
+
modal: true,
|
33
|
+
tooltip: true,
|
34
|
+
popover: true,
|
35
|
+
scrollspy: true,
|
36
|
+
tab: true,
|
37
|
+
affix: true,
|
38
|
+
},
|
39
|
+
|
40
|
+
// ### Styles
|
41
|
+
// Enable or disable certain less components and thus remove
|
42
|
+
// the css for them from the build.
|
43
|
+
styles: {
|
44
|
+
mixins: true,
|
45
|
+
|
46
|
+
normalize: true,
|
47
|
+
print: true,
|
48
|
+
|
49
|
+
scaffolding: true,
|
50
|
+
type: true,
|
51
|
+
code: true,
|
52
|
+
grid: true,
|
53
|
+
tables: true,
|
54
|
+
forms: true,
|
55
|
+
buttons: true,
|
56
|
+
|
57
|
+
'component-animations': true,
|
58
|
+
glyphicons: true,
|
59
|
+
dropdowns: true,
|
60
|
+
'button-groups': true,
|
61
|
+
'input-groups': true,
|
62
|
+
navs: true,
|
63
|
+
navbar: true,
|
64
|
+
breadcrumbs: true,
|
65
|
+
pagination: true,
|
66
|
+
pager: true,
|
67
|
+
labels: true,
|
68
|
+
badges: true,
|
69
|
+
|
70
|
+
jumbotron: true,
|
71
|
+
thumbnails: true,
|
72
|
+
alerts: true,
|
73
|
+
|
74
|
+
'progress-bars': true,
|
75
|
+
media: true,
|
76
|
+
'list-group': true,
|
77
|
+
panels: true,
|
78
|
+
wells: true,
|
79
|
+
close: true,
|
80
|
+
|
81
|
+
modals: true,
|
82
|
+
tooltip: true,
|
83
|
+
popovers: true,
|
84
|
+
carousel: true,
|
85
|
+
|
86
|
+
utilities: true,
|
87
|
+
'responsive-utilities': true,
|
88
|
+
},
|
89
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "../rails_helper"
|
2
|
+
|
3
|
+
feature "Hello World", js: true do
|
4
|
+
scenario "the hello world example works" do
|
5
|
+
visit "/hello_world"
|
6
|
+
expect(heading).to have_text("Rendering")
|
7
|
+
expect(message).to have_text("Stranger")
|
8
|
+
name_input.set("John Doe")
|
9
|
+
expect(message).to have_text("John Doe")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def name_input
|
16
|
+
page.first("input")
|
17
|
+
end
|
18
|
+
|
19
|
+
def message
|
20
|
+
page.first(:css, "h3")
|
21
|
+
end
|
22
|
+
|
23
|
+
def heading
|
24
|
+
page.first(:css, "h1")
|
25
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# This file is copied to spec/ when you run "rails generate rspec:install"
|
2
|
+
ENV["RAILS_ENV"] ||= "test"
|
3
|
+
require_relative "../config/environment"
|
4
|
+
require_relative "simplecov_helper"
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require_relative "spec_helper"
|
8
|
+
|
9
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
10
|
+
|
11
|
+
require "rspec/rails"
|
12
|
+
require "capybara/rspec"
|
13
|
+
require "capybara/rails"
|
14
|
+
|
15
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
16
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
17
|
+
# run as spec files by default. This means that files in spec/support that end
|
18
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
19
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
20
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
21
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
22
|
+
#
|
23
|
+
# The following line is provided for convenience purposes. It has the downside
|
24
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
25
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
26
|
+
# require only the support files necessary.
|
27
|
+
#
|
28
|
+
# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
29
|
+
|
30
|
+
# Checks for pending migrations before tests are run.
|
31
|
+
# If you are not using ActiveRecord, you can remove this line.
|
32
|
+
# ActiveRecord::Migration.maintain_test_schema!
|
33
|
+
|
34
|
+
RSpec.configure do |config|
|
35
|
+
# Remove this line if you"re not using ActiveRecord or ActiveRecord fixtures
|
36
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
37
|
+
|
38
|
+
# If you"re not using ActiveRecord, or you"d prefer not to run each of your
|
39
|
+
# examples within a transaction, remove the following line or assign false
|
40
|
+
# instead of true.
|
41
|
+
config.use_transactional_fixtures = true
|
42
|
+
|
43
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
44
|
+
# based on their file location, for example enabling you to call `get` and
|
45
|
+
# `post` in specs under `spec/controllers`.
|
46
|
+
#
|
47
|
+
# You can disable this behaviour by removing the line below, and instead
|
48
|
+
# explicitly tag your specs with their type, e.g.:
|
49
|
+
#
|
50
|
+
# RSpec.describe UsersController, :type => :controller do
|
51
|
+
# # ...
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# The different available types are documented in the features, such as in
|
55
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
56
|
+
config.infer_spec_type_from_file_location!
|
57
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Starts SimpleCov for code coverage.
|
2
|
+
|
3
|
+
if ENV["COVERAGE"]
|
4
|
+
require "simplecov"
|
5
|
+
|
6
|
+
# Using a command name prevents results from getting clobbered by other test suites
|
7
|
+
example_name = File.basename(File.expand_path("../../../.", __FILE__))
|
8
|
+
SimpleCov.command_name(example_name)
|
9
|
+
|
10
|
+
SimpleCov.start("rails") do
|
11
|
+
# Consider the entire gem project as the root
|
12
|
+
# (typically this will be the folder named "react_on_rails")
|
13
|
+
gem_root_path = File.expand_path("../../../../.", __FILE__)
|
14
|
+
root gem_root_path
|
15
|
+
|
16
|
+
# Don't report anything that has "spec" in the path
|
17
|
+
add_filter do |src|
|
18
|
+
src.filename =~ %r{\/spec\/}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
# rubocop:disable Style/BlockComments
|
46
|
+
=begin
|
47
|
+
|
48
|
+
# These two settings work together to allow you to limit a spec run
|
49
|
+
# to individual examples or groups you care about by tagging them with
|
50
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
51
|
+
# get run.
|
52
|
+
config.filter_run :focus
|
53
|
+
config.run_all_when_everything_filtered = true
|
54
|
+
|
55
|
+
# Allows RSpec to persist some state between runs in order to support
|
56
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
57
|
+
# you configure your source control system to ignore this file.
|
58
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
59
|
+
|
60
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
61
|
+
# recommended. For more details, see:
|
62
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
63
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
64
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
65
|
+
config.disable_monkey_patching!
|
66
|
+
|
67
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
68
|
+
# file, and it's useful to allow more verbose output when running an
|
69
|
+
# individual spec file.
|
70
|
+
if config.files_to_run.one?
|
71
|
+
# Use the documentation formatter for detailed output,
|
72
|
+
# unless a formatter has already been configured
|
73
|
+
# (e.g. via a command-line flag).
|
74
|
+
config.default_formatter = 'doc'
|
75
|
+
end
|
76
|
+
|
77
|
+
# Print the 10 slowest examples and example groups at the
|
78
|
+
# end of the spec run, to help surface which specs are running
|
79
|
+
# particularly slow.
|
80
|
+
config.profile_examples = 10
|
81
|
+
|
82
|
+
# Run specs in random order to surface order dependencies. If you find an
|
83
|
+
# order dependency and want to debug it, you can fix the order by providing
|
84
|
+
# the seed, which is printed after each run.
|
85
|
+
# --seed 1234
|
86
|
+
config.order = :random
|
87
|
+
|
88
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
89
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
90
|
+
# test failures related to randomization by passing the same `--seed` value
|
91
|
+
# as the one that triggered the failure.
|
92
|
+
Kernel.srand config.seed
|
93
|
+
=end
|
94
|
+
end
|
95
|
+
# rubocop:enable Style/BlockComments
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec puma -C config/puma.rb
|
@@ -0,0 +1,15 @@
|
|
1
|
+
workers Integer(ENV["WEB_CONCURRENCY"] || 2)
|
2
|
+
threads_count = Integer(ENV["MAX_THREADS"] || 5)
|
3
|
+
threads threads_count, threads_count
|
4
|
+
|
5
|
+
preload_app!
|
6
|
+
|
7
|
+
rackup DefaultRackup
|
8
|
+
port ENV["PORT"] || 3000
|
9
|
+
environment ENV["RACK_ENV"] || "development"
|
10
|
+
|
11
|
+
on_worker_boot do
|
12
|
+
# Worker specific setup for Rails 4.1+
|
13
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
14
|
+
ActiveRecord::Base.establish_connection
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
node_modules
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
parser: babel-eslint
|
3
|
+
|
4
|
+
extends: eslint-config-airbnb
|
5
|
+
|
6
|
+
plugins:
|
7
|
+
- react
|
8
|
+
|
9
|
+
globals:
|
10
|
+
__DEBUG_SERVER_ERRORS__: true
|
11
|
+
__SERVER_ERRORS__: true
|
12
|
+
|
13
|
+
env:
|
14
|
+
browser: true
|
15
|
+
node: true
|
16
|
+
mocha: true
|
17
|
+
|
18
|
+
rules:
|
19
|
+
### Variables
|
20
|
+
no-undef: 2
|
21
|
+
no-unused-vars: [2, { vars: all, args: none }]
|
22
|
+
|
23
|
+
### Stylistic issues
|
24
|
+
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
|
25
|
+
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
|
26
|
+
|
27
|
+
### React
|
28
|
+
jsx-quotes: [1, prefer-double]
|
29
|
+
react/display-name: 0
|
30
|
+
react/jsx-boolean-value: [1, always]
|
31
|
+
react/jsx-curly-spacing: [1, never]
|
32
|
+
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
|
33
|
+
react/jsx-no-undef: 2
|
34
|
+
react/jsx-sort-prop-types: 0
|
35
|
+
react/jsx-sort-props: 0
|
36
|
+
react/jsx-uses-react: 2
|
37
|
+
react/jsx-uses-vars: 2
|
38
|
+
react/no-danger: 0
|
39
|
+
react/no-did-mount-set-state: 1
|
40
|
+
react/no-did-update-set-state: 0
|
41
|
+
react/no-multi-comp: 2
|
42
|
+
react/no-unknown-property: 2
|
43
|
+
react/prop-types: 1
|
44
|
+
react/react-in-jsx-scope: 2
|
45
|
+
react/require-extension: [1, { extensions: [.js, .jsx] }]
|
46
|
+
react/self-closing-comp: 2
|
47
|
+
react/sort-comp: 0 # Should be 1. `statics` should be on top.
|
48
|
+
react/wrap-multilines: 2
|