react_on_rails 1.2.2 → 2.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +5 -126
- data/.babelrc +0 -3
- data/.coveralls.yml +0 -1
- data/.dockerignore +0 -2
- data/.eslintignore +0 -5
- data/.eslintrc +0 -48
- data/.gitignore +0 -26
- data/.jscsrc +0 -26
- data/.rspec +0 -2
- data/.rubocop.yml +0 -70
- data/.scss-lint.yml +0 -205
- data/.travis.yml +0 -41
- data/CHANGELOG.md +0 -42
- data/Dockerfile_tests +0 -12
- data/Gemfile +0 -38
- data/README.md +0 -363
- data/Rakefile +0 -5
- data/app/assets/javascripts/react_on_rails.js +0 -241
- data/app/helpers/react_on_rails_helper.rb +0 -224
- data/docker-compose.yml +0 -11
- data/docs/LICENSE +0 -21
- data/docs/additional_reading/heroku_deployment.md +0 -23
- data/docs/additional_reading/manual_installation.md +0 -142
- data/docs/additional_reading/node_dependencies_and_npm.md +0 -29
- data/docs/additional_reading/optional_configuration.md +0 -34
- data/docs/additional_reading/react-and-redux.md +0 -36
- data/docs/additional_reading/react_router.md +0 -45
- data/docs/additional_reading/server_rendering_tips.md +0 -16
- data/docs/additional_reading/tips.md +0 -10
- data/docs/additional_reading/webpack.md +0 -46
- data/docs/code_of_conduct.md +0 -13
- data/docs/coding-style/linters.md +0 -64
- data/docs/coding-style/style.md +0 -42
- data/docs/contributing.md +0 -62
- data/docs/generator_testing.md +0 -20
- data/docs/install_and_releasing.md +0 -24
- data/docs/sample_generated_js/README.md +0 -4
- data/docs/sample_generated_js/client-generated.js +0 -12
- data/docs/sample_generated_js/server-generated.js +0 -25
- data/lib/generators/USAGE +0 -99
- data/lib/generators/react_on_rails/base_generator.rb +0 -198
- data/lib/generators/react_on_rails/bootstrap_generator.rb +0 -91
- data/lib/generators/react_on_rails/dev_tests_generator.rb +0 -30
- data/lib/generators/react_on_rails/generator_errors.rb +0 -15
- data/lib/generators/react_on_rails/generator_helper.rb +0 -58
- data/lib/generators/react_on_rails/heroku_deployment_generator.rb +0 -30
- data/lib/generators/react_on_rails/install_generator.rb +0 -111
- data/lib/generators/react_on_rails/js_linters_generator.rb +0 -19
- data/lib/generators/react_on_rails/react_no_redux_generator.rb +0 -41
- data/lib/generators/react_on_rails/react_with_redux_generator.rb +0 -52
- data/lib/generators/react_on_rails/ruby_linters_generator.rb +0 -33
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +0 -4
- data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +0 -16
- data/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb +0 -5
- data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +0 -5
- data/lib/generators/react_on_rails/templates/base/base/client/.babelrc +0 -3
- data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +0 -3
- data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/globals.jsx.tt +0 -5
- data/lib/generators/react_on_rails/templates/base/base/client/index.jade +0 -15
- data/lib/generators/react_on_rails/templates/base/base/client/npm-shrinkwrap.json +0 -2907
- data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +0 -98
- data/lib/generators/react_on_rails/templates/base/base/client/server.js +0 -64
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js.tt +0 -67
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js.tt +0 -67
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +0 -41
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +0 -28
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt +0 -26
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/linters.rake.tt +0 -88
- data/lib/generators/react_on_rails/templates/base/base/package.json +0 -31
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverGlobals.jsx +0 -3
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +0 -40
- data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +0 -63
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +0 -10
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +0 -8
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +0 -19
- data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +0 -89
- data/lib/generators/react_on_rails/templates/dev_tests/.rspec +0 -2
- data/lib/generators/react_on_rails/templates/dev_tests/spec/features/hello_world_spec.rb +0 -25
- data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +0 -57
- data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +0 -21
- data/lib/generators/react_on_rails/templates/dev_tests/spec/spec_helper.rb +0 -95
- data/lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks +0 -2
- data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +0 -1
- data/lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb +0 -15
- data/lib/generators/react_on_rails/templates/js_linters/client/.eslintignore +0 -1
- data/lib/generators/react_on_rails/templates/js_linters/client/.eslintrc +0 -48
- data/lib/generators/react_on_rails/templates/js_linters/client/.jscsrc +0 -18
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +0 -39
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +0 -33
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +0 -12
- data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -11
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx +0 -8
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +0 -48
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx +0 -8
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +0 -43
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx +0 -21
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +0 -14
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +0 -21
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +0 -35
- data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +0 -20
- data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -21
- data/lib/generators/react_on_rails/templates/ruby_linters/.rubocop.yml +0 -26
- data/lib/generators/react_on_rails/templates/ruby_linters/.scss-lint.yml +0 -205
- data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/brakeman.rake +0 -17
- data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/ci.rake +0 -33
- data/lib/generators/react_on_rails/templates/ruby_linters/ruby-lint.yml +0 -20
- data/lib/react_on_rails.rb +0 -6
- data/lib/react_on_rails/configuration.rb +0 -53
- data/lib/react_on_rails/engine.rb +0 -7
- data/lib/react_on_rails/prerender_error.rb +0 -31
- data/lib/react_on_rails/server_rendering_pool.rb +0 -111
- data/lib/react_on_rails/version.rb +0 -3
- data/rakelib/docker.rake +0 -33
- data/rakelib/dummy_apps.rake +0 -29
- data/rakelib/example_type.rb +0 -160
- data/rakelib/examples.rake +0 -103
- data/rakelib/examples_config.yml +0 -19
- data/rakelib/lint.rake +0 -37
- data/rakelib/run_rspec.rake +0 -65
- data/rakelib/task_helpers.rb +0 -44
- data/react_on_rails.gemspec +0 -31
- data/ruby-lint.yml +0 -24
data/rakelib/docker.rake
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
namespace :docker do
|
2
|
-
desc "Run Rubocop linter from docker"
|
3
|
-
task :rubocop do
|
4
|
-
sh "docker-compose run lint rake lint:rubocop"
|
5
|
-
end
|
6
|
-
|
7
|
-
desc "Run ruby-lint linter from docker"
|
8
|
-
task :ruby do
|
9
|
-
sh "docker-compose run lint rake lint:ruby"
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "Run scss-lint linter from docker"
|
13
|
-
task :scss do
|
14
|
-
sh "docker-compose run lint rake lint:scss"
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run eslint linter from docker"
|
18
|
-
task :eslint do
|
19
|
-
sh "docker-compose run lint rake lint:eslint"
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Run jscs linter from docker"
|
23
|
-
task :jscs do
|
24
|
-
sh "docker-compose run lint rake lint:jscs"
|
25
|
-
end
|
26
|
-
desc "Run all linting from docker"
|
27
|
-
task :lint do
|
28
|
-
sh "docker-compose run lint rake lint"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Runs all linters from docker. Run `rake -D docker` to see all available lint options"
|
33
|
-
task docker: ["docker:lint"]
|
data/rakelib/dummy_apps.rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require_relative "task_helpers"
|
2
|
-
include ReactOnRails::TaskHelpers
|
3
|
-
|
4
|
-
namespace :dummy_apps do
|
5
|
-
task :dummy_app do
|
6
|
-
dummy_app_dir = File.join(gem_root, "spec/dummy")
|
7
|
-
bundle_install_in(dummy_app_dir)
|
8
|
-
dummy_app_client_dir = File.join(dummy_app_dir, "client")
|
9
|
-
sh_in_dir(dummy_app_client_dir, ["npm install",
|
10
|
-
"$(npm bin)/webpack --config webpack.server.js",
|
11
|
-
"$(npm bin)/webpack --config webpack.client.js"])
|
12
|
-
end
|
13
|
-
|
14
|
-
task :dummy_react_013_app do
|
15
|
-
dummy_app_dir = File.join(gem_root, "spec/dummy-react-013")
|
16
|
-
bundle_install_in(dummy_app_dir)
|
17
|
-
dummy_app_client_dir = File.join(dummy_app_dir, "client")
|
18
|
-
sh_in_dir(dummy_app_client_dir, ["npm install",
|
19
|
-
"$(npm bin)/webpack --config webpack.server.js",
|
20
|
-
"$(npm bin)/webpack --config webpack.client.js"])
|
21
|
-
end
|
22
|
-
|
23
|
-
task dummy_apps: [:dummy_app, :dummy_react_013_app] do
|
24
|
-
puts "Prepared all Dummy Apps"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Prepares all dummy apps by installing dependencies"
|
29
|
-
task dummy_apps: ["dummy_apps:dummy_apps"]
|
data/rakelib/example_type.rb
DELETED
@@ -1,160 +0,0 @@
|
|
1
|
-
require "rake"
|
2
|
-
require "pathname"
|
3
|
-
|
4
|
-
require_relative "task_helpers"
|
5
|
-
|
6
|
-
# Defines the ExampleType class, where each object represents a unique type of example
|
7
|
-
# app that we can generate.
|
8
|
-
module ReactOnRails
|
9
|
-
module TaskHelpers
|
10
|
-
class ExampleType
|
11
|
-
def self.all
|
12
|
-
@example_types ||= []
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.namespace_name
|
16
|
-
"examples"
|
17
|
-
end
|
18
|
-
|
19
|
-
attr_reader :name, :generator_options
|
20
|
-
|
21
|
-
def initialize(name:, generator_options:)
|
22
|
-
@name = name
|
23
|
-
@generator_options = generator_options
|
24
|
-
self.class.all << self
|
25
|
-
end
|
26
|
-
|
27
|
-
def name_pretty
|
28
|
-
"#{@name} example app"
|
29
|
-
end
|
30
|
-
|
31
|
-
def server_rendering?
|
32
|
-
generator_options.include?("--server-rendering")
|
33
|
-
end
|
34
|
-
|
35
|
-
def dir
|
36
|
-
File.join(examples_dir, name)
|
37
|
-
end
|
38
|
-
|
39
|
-
def dir_exist?
|
40
|
-
Dir.exist?(dir)
|
41
|
-
end
|
42
|
-
|
43
|
-
def client_dir
|
44
|
-
File.join(dir, "client")
|
45
|
-
end
|
46
|
-
|
47
|
-
def source_package_json
|
48
|
-
File.join(gem_root, "lib/generators/react_on_rails/templates/base/base/client/package.json.tt")
|
49
|
-
end
|
50
|
-
|
51
|
-
def node_modules_dir
|
52
|
-
File.join(client_dir, "node_modules")
|
53
|
-
end
|
54
|
-
|
55
|
-
def webpack_bundles_dir
|
56
|
-
File.join(dir, "app", "assets", "javascripts", "generated")
|
57
|
-
end
|
58
|
-
|
59
|
-
def webpack_bundles
|
60
|
-
bundles = []
|
61
|
-
bundles << File.join(webpack_bundles_dir, "app-bundle.js")
|
62
|
-
bundles << File.join(webpack_bundles_dir, "server-bundle.js") if server_rendering?
|
63
|
-
bundles << File.join(webpack_bundles_dir, "vendor-bundle.js")
|
64
|
-
end
|
65
|
-
|
66
|
-
def gemfile
|
67
|
-
File.join(dir, "Gemfile")
|
68
|
-
end
|
69
|
-
|
70
|
-
def gemfile_lock
|
71
|
-
"#{gemfile}.lock"
|
72
|
-
end
|
73
|
-
|
74
|
-
def package_json
|
75
|
-
File.join(client_dir, "package.json")
|
76
|
-
end
|
77
|
-
|
78
|
-
# Gems we need to add to the Gemfile before bundle installing
|
79
|
-
def required_gems
|
80
|
-
relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))
|
81
|
-
["gem 'react_on_rails', path: '#{relative_gem_root}'"]
|
82
|
-
end
|
83
|
-
|
84
|
-
# Options we pass when running `rails new` from the command-line
|
85
|
-
def rails_options
|
86
|
-
"--skip-bundle --skip-spring --skip-git --skip-test-unit --skip-active-record"
|
87
|
-
end
|
88
|
-
|
89
|
-
# Methods for retrieving the name of a task specific to the example type
|
90
|
-
%w(gen prepare clean clobber npm_install build_webpack_bundles).each do |task_type|
|
91
|
-
method = "#{task_type}_task_name" # ex: `clean_task_name`
|
92
|
-
task_name = "#{task_type}_#{name}" # ex: `clean_basic`
|
93
|
-
|
94
|
-
define_method(method) { "#{self.class.namespace_name}:#{task_name}" }
|
95
|
-
define_method("#{method}_short") { task_name }
|
96
|
-
end
|
97
|
-
|
98
|
-
def rspec_task_name_short
|
99
|
-
"example_#{name}"
|
100
|
-
end
|
101
|
-
|
102
|
-
def rspec_task_name
|
103
|
-
"run_rspec:#{rspec_task_name_short}"
|
104
|
-
end
|
105
|
-
|
106
|
-
def source_files
|
107
|
-
FileList.new(all_files_in_dir(generators_source_dir))
|
108
|
-
end
|
109
|
-
|
110
|
-
# Note: we need to explicitly declare a file we know is supposed to be there
|
111
|
-
# to indicate that the example is in need of being rebuilt in the case of its absence.
|
112
|
-
def generated_files
|
113
|
-
FileList.new(all_files_in_dir(dir)) do |fl|
|
114
|
-
fl.include(gemfile) # explicitly declared file (dependency of Gemfile.lock)
|
115
|
-
fl.include(package_json) # explicitly declared file (dependency of NPM Install)
|
116
|
-
fl.exclude(%r{client(/node_modules(.+)?)?$}) # leave node_modules folder
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def generated_client_files
|
121
|
-
generated_files.exclude { |f| !f.start_with?(client_dir) }
|
122
|
-
end
|
123
|
-
|
124
|
-
# generated files plus explicitly included files resulting from running
|
125
|
-
# bundle install, npm install, and generating the webpack bundles
|
126
|
-
def prepared_files
|
127
|
-
generated_files
|
128
|
-
.include(webpack_bundles)
|
129
|
-
.include(node_modules_dir)
|
130
|
-
.include(gemfile_lock)
|
131
|
-
end
|
132
|
-
|
133
|
-
def clean_files
|
134
|
-
generated_files
|
135
|
-
end
|
136
|
-
|
137
|
-
# Assumes we are inside client folder
|
138
|
-
def build_webpack_bundles_shell_commands
|
139
|
-
webpack_command = File.join("$(npm bin)", "webpack")
|
140
|
-
shell_commands = []
|
141
|
-
shell_commands << "#{webpack_command} --config webpack.server.rails.config.js" if server_rendering?
|
142
|
-
shell_commands << "#{webpack_command} --config webpack.client.rails.config.js"
|
143
|
-
end
|
144
|
-
|
145
|
-
# Assumes we are inside a rails app's folder and necessary gems have been installed
|
146
|
-
def generator_shell_commands
|
147
|
-
shell_commands = []
|
148
|
-
shell_commands << "rails generate react_on_rails:install #{generator_options}"
|
149
|
-
shell_commands << "rails generate react_on_rails:dev_tests #{generator_options}"
|
150
|
-
end
|
151
|
-
|
152
|
-
private
|
153
|
-
|
154
|
-
# Defines globs that scoop up all files (including dotfiles) in given directory
|
155
|
-
def all_files_in_dir(p_dir)
|
156
|
-
[File.join(p_dir, "**", "*"), File.join(p_dir, "**", ".*")]
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
data/rakelib/examples.rake
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# Defines tasks related to generating example apps using the gem's generator.
|
2
|
-
# Allows us to create and test apps generated using a wide range of options.
|
3
|
-
#
|
4
|
-
# Also see example_type.rb
|
5
|
-
|
6
|
-
require "yaml"
|
7
|
-
require_relative "example_type"
|
8
|
-
require_relative "task_helpers"
|
9
|
-
include ReactOnRails::TaskHelpers
|
10
|
-
|
11
|
-
namespace :examples do
|
12
|
-
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
|
13
|
-
examples_config_file = File.expand_path("../examples_config.yml", __FILE__)
|
14
|
-
examples_config = symbolize_keys(YAML.load(File.read(examples_config_file)))
|
15
|
-
examples_config[:example_type_data].each { |example_type_data| ExampleType.new(symbolize_keys(example_type_data)) }
|
16
|
-
|
17
|
-
# Define tasks for each example type
|
18
|
-
ExampleType.all.each do |example_type|
|
19
|
-
# GENERATED FILES
|
20
|
-
example_type.generated_files.each do |f|
|
21
|
-
file f => example_type.source_files do
|
22
|
-
Rake::Task[example_type.gen_task_name].invoke
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# GEMFILE.LOCK
|
27
|
-
file example_type.gemfile_lock => example_type.gemfile do
|
28
|
-
bundle_install_in(example_type.dir)
|
29
|
-
end
|
30
|
-
|
31
|
-
# WEBPACK BUNDLES
|
32
|
-
example_type.webpack_bundles.each do |f|
|
33
|
-
file f => example_type.generated_client_files do
|
34
|
-
Rake::Task[example_type.build_webpack_bundles_task_name].invoke
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# BUILD WEBPACK BUNDLES
|
39
|
-
task example_type.build_webpack_bundles_task_name_short => example_type.npm_install_task_name do
|
40
|
-
sh_in_dir(example_type.client_dir, example_type.build_webpack_bundles_shell_commands)
|
41
|
-
end
|
42
|
-
|
43
|
-
# NPM INSTALL
|
44
|
-
task example_type.npm_install_task_name_short => example_type.package_json do
|
45
|
-
unless uptodate?(example_type.node_modules_dir, [example_type.source_package_json])
|
46
|
-
sh_in_dir(example_type.client_dir, "npm install")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# CLEAN
|
51
|
-
desc "Cleans #{example_type.name_pretty}"
|
52
|
-
task example_type.clean_task_name_short do
|
53
|
-
example_type.clean_files.each { |f| rm_rf(f) }
|
54
|
-
end
|
55
|
-
|
56
|
-
# CLOBBER
|
57
|
-
desc "Clobbers (deletes) #{example_type.name_pretty}"
|
58
|
-
task example_type.clobber_task_name_short do
|
59
|
-
rm_rf(example_type.dir)
|
60
|
-
end
|
61
|
-
|
62
|
-
# GENERATE
|
63
|
-
desc "Generates #{example_type.name_pretty}"
|
64
|
-
task example_type.gen_task_name_short => example_type.clean_task_name do
|
65
|
-
mkdir_p(example_type.dir)
|
66
|
-
sh_in_dir(examples_dir, "rails new #{example_type.name} #{example_type.rails_options}")
|
67
|
-
append_to_gemfile(example_type.gemfile, example_type.required_gems)
|
68
|
-
bundle_install_in(example_type.dir)
|
69
|
-
sh_in_dir(example_type.dir, example_type.generator_shell_commands)
|
70
|
-
end
|
71
|
-
|
72
|
-
# PREPARE
|
73
|
-
desc "Prepares #{example_type.name_pretty} (generates example, `npm install`s, and generates webpack bundles)"
|
74
|
-
multitask example_type.prepare_task_name_short => example_type.prepared_files
|
75
|
-
end
|
76
|
-
|
77
|
-
desc "Cleans all example apps"
|
78
|
-
multitask clean: ExampleType.all.map(&:clean_task_name)
|
79
|
-
|
80
|
-
desc "Clobbers (deletes) all example apps"
|
81
|
-
task :clobber do
|
82
|
-
rm_rf(examples_dir)
|
83
|
-
end
|
84
|
-
|
85
|
-
desc "Generates all example apps"
|
86
|
-
multitask gen_all: ExampleType.all.map(&:gen_task_name)
|
87
|
-
|
88
|
-
desc "Prepares all example apps"
|
89
|
-
multitask prepare_all: ExampleType.all.map(&:prepare_task_name)
|
90
|
-
end
|
91
|
-
|
92
|
-
desc "Prepares all example apps. Run `rake -D examples` to see all available options"
|
93
|
-
multitask examples: ["examples:prepare_all"]
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
# Appends each string in an array as a new line of text in the given Gemfile.
|
98
|
-
# Automatically adds line returns.
|
99
|
-
def append_to_gemfile(gemfile, lines)
|
100
|
-
old_text = File.read(gemfile)
|
101
|
-
new_text = lines.reduce(old_text) { |a, e| a << "#{e}\n" }
|
102
|
-
File.open(gemfile, "w") { |f| f.puts(new_text) }
|
103
|
-
end
|
data/rakelib/examples_config.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
example_type_data:
|
2
|
-
-
|
3
|
-
name: basic
|
4
|
-
generator_options: ""
|
5
|
-
-
|
6
|
-
name: basic-server-rendering
|
7
|
-
generator_options: --server-rendering
|
8
|
-
-
|
9
|
-
name: redux
|
10
|
-
generator_options: --redux --server-rendering
|
11
|
-
-
|
12
|
-
name: redux-server-rendering
|
13
|
-
generator_options: --redux --server-rendering
|
14
|
-
-
|
15
|
-
name: heroku-deployment
|
16
|
-
generator_options: --heroku-deployment
|
17
|
-
-
|
18
|
-
name: skip-bootstrap
|
19
|
-
generator_options: --skip-bootstrap
|
data/rakelib/lint.rake
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative "task_helpers"
|
2
|
-
include ReactOnRails::TaskHelpers
|
3
|
-
|
4
|
-
namespace :lint do
|
5
|
-
desc "Run Rubocop as shell"
|
6
|
-
task :rubocop do
|
7
|
-
sh_in_dir(gem_root, "rubocop .")
|
8
|
-
end
|
9
|
-
|
10
|
-
desc "Run ruby-lint as shell"
|
11
|
-
task :ruby do
|
12
|
-
sh_in_dir(gem_root, "ruby-lint app spec lib")
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "Run scss-lint as shell"
|
16
|
-
task :scss do
|
17
|
-
sh_in_dir(gem_root, "scss-lint spec/dummy/app/assets/stylesheets/")
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Run eslint as shell"
|
21
|
-
task :eslint do
|
22
|
-
sh_in_dir(gem_root, "eslint . --ext .jsx and .js")
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Run jscs from shell"
|
26
|
-
task :jscs do
|
27
|
-
sh_in_dir(gem_root, "jscs -e -v .")
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "Run all eslint, jscs, rubocop linters. Skip ruby-lint and scss"
|
31
|
-
task lint: [:eslint, :jscs, :rubocop] do
|
32
|
-
puts "Completed all linting"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Runs all linters. Run `rake -D lint` to see all available lint options"
|
37
|
-
task lint: ["lint:lint"]
|
data/rakelib/run_rspec.rake
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require "coveralls/rake/task"
|
2
|
-
require "pathname"
|
3
|
-
|
4
|
-
require_relative "task_helpers"
|
5
|
-
require_relative "example_type"
|
6
|
-
|
7
|
-
include ReactOnRails::TaskHelpers
|
8
|
-
|
9
|
-
namespace :run_rspec do
|
10
|
-
desc "Run RSpec for top level only"
|
11
|
-
task :gem do
|
12
|
-
run_tests_in("", rspec_args: "spec/react_on_rails")
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "Run RSpec for spec/dummy only"
|
16
|
-
task dummy: ["dummy_apps:dummy_app"] do
|
17
|
-
run_tests_in("spec/dummy", env_vars: "DRIVER=selenium_firefox")
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Run RSpec for spec/dummy_react_013 only"
|
21
|
-
task dummy_react_013: ["dummy_apps:dummy_react_013_app"] do
|
22
|
-
run_tests_in("spec/dummy-react-013", env_vars: "DRIVER=selenium_firefox")
|
23
|
-
end
|
24
|
-
|
25
|
-
# Dynamically define Rake tasks for each example app found in the examples directory
|
26
|
-
ExampleType.all.each do |example_type|
|
27
|
-
desc "Runs RSpec for #{example_type.name_pretty} only"
|
28
|
-
task example_type.rspec_task_name_short => example_type.prepare_task_name do
|
29
|
-
run_tests_in("#{File.basename(examples_dir)}/#{example_type.name}") # have to use relative path
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Runs Rspec for example apps only"
|
34
|
-
task examples: "examples:prepare_all" do
|
35
|
-
ExampleType.all.each { |example_type| Rake::Task[example_type.rspec_task_name].invoke }
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "(HACK) Run RSpec on spec/empty_spec in order to have SimpleCov generate a coverage report from cache"
|
39
|
-
task :empty do
|
40
|
-
sh %(COVERAGE=true rspec spec/empty_spec.rb)
|
41
|
-
end
|
42
|
-
|
43
|
-
Coveralls::RakeTask.new
|
44
|
-
|
45
|
-
task run_rspec: [:gem, :dummy, :dummy_react_013, :examples, :empty, "coveralls:push"] do
|
46
|
-
puts "Completed all RSpec tests"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
desc "Runs all tests. Run `rake -D run_rspec` to see all available test options"
|
51
|
-
task run_rspec: ["run_rspec:run_rspec"]
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
# Runs rspec in the given directory (if string is passed, assumed to be relative
|
56
|
-
# to root of the gem.
|
57
|
-
# TEST_ENV_COMMAND_NAME is used to make SimpleCov.command_name unique in order to
|
58
|
-
# prevent a name collision. Defaults to the given directory's name.
|
59
|
-
def run_tests_in(dir, options = {})
|
60
|
-
dir = Pathname.new(File.join(gem_root, dir)) if dir.is_a?(String)
|
61
|
-
command_name = options.fetch(:command_name, dir.basename)
|
62
|
-
rspec_args = options.fetch(:rspec_args, "")
|
63
|
-
env_vars = %(#{options.fetch(env_vars, '')} COVERAGE=true TEST_ENV_COMMAND_NAME="#{command_name}")
|
64
|
-
sh_in_dir(dir, "#{env_vars} bundle exec rspec #{rspec_args}")
|
65
|
-
end
|