hyper-react 0.99.6 → 1.0.0.lap21
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 +5 -5
- data/.codeclimate.yml +27 -0
- data/.gitignore +30 -37
- data/.rubocop.yml +1159 -0
- data/.travis.yml +32 -0
- data/Appraisals +31 -0
- data/CHANGELOG.md +143 -0
- data/DOCS.md +1515 -0
- data/Gemfile +2 -5
- data/LICENSE +19 -0
- data/README.md +5 -33
- data/Rakefile +25 -6
- data/UPGRADING.md +24 -0
- data/component-name-lookup.md +145 -0
- data/dciy.toml +3 -0
- data/dciy_prepare.sh +8 -0
- data/dciy_run.sh +10 -0
- data/hyper-react.gemspec +24 -18
- data/lib/generators/reactive_ruby/test_app/templates/assets/javascripts/components.rb +3 -0
- data/lib/generators/reactive_ruby/test_app/templates/assets/javascripts/server_rendering.js +5 -0
- data/lib/generators/reactive_ruby/test_app/templates/assets/javascripts/test_application.rb +2 -0
- data/lib/generators/reactive_ruby/test_app/templates/boot.rb.erb +6 -0
- data/lib/generators/reactive_ruby/test_app/templates/script/rails +5 -0
- data/lib/generators/reactive_ruby/test_app/templates/test_application.rb.erb +13 -0
- data/lib/generators/reactive_ruby/test_app/templates/views/components/hello_world.rb +11 -0
- data/lib/generators/reactive_ruby/test_app/templates/views/components/todo.rb +14 -0
- data/lib/generators/reactive_ruby/test_app/templates/views/layouts/test_layout.html.erb +0 -0
- data/lib/generators/reactive_ruby/test_app/test_app_generator.rb +117 -0
- data/lib/hyper-react.rb +66 -4
- data/lib/rails-helpers/top_level_rails_component.rb +75 -0
- data/lib/react/api.rb +203 -0
- data/lib/react/callbacks.rb +41 -0
- data/lib/react/children.rb +30 -0
- data/lib/react/component.rb +177 -0
- data/lib/react/component/api.rb +69 -0
- data/lib/react/component/base.rb +13 -0
- data/lib/react/component/class_methods.rb +181 -0
- data/lib/react/component/dsl_instance_methods.rb +23 -0
- data/lib/react/component/params.rb +6 -0
- data/lib/react/component/props_wrapper.rb +78 -0
- data/lib/react/component/should_component_update.rb +99 -0
- data/lib/react/component/tags.rb +108 -0
- data/lib/react/config.rb +5 -0
- data/lib/react/config/client.rb.erb +19 -0
- data/lib/react/config/server.rb +23 -0
- data/lib/react/element.rb +150 -0
- data/lib/react/event.rb +76 -0
- data/lib/react/ext/hash.rb +9 -0
- data/lib/react/ext/opal-jquery/element.rb +26 -0
- data/lib/react/ext/string.rb +8 -0
- data/lib/react/hash.rb +13 -0
- data/lib/react/native_library.rb +87 -0
- data/lib/react/object.rb +15 -0
- data/lib/react/react-source-browser.rb +3 -0
- data/lib/react/react-source-server.rb +3 -0
- data/lib/react/react-source.rb +16 -0
- data/lib/react/ref_callback.rb +31 -0
- data/lib/react/rendering_context.rb +146 -0
- data/lib/react/server.rb +19 -0
- data/lib/react/state_wrapper.rb +23 -0
- data/lib/react/test.rb +16 -0
- data/lib/react/test/dsl.rb +17 -0
- data/lib/react/test/matchers/render_html_matcher.rb +56 -0
- data/lib/react/test/rspec.rb +15 -0
- data/lib/react/test/session.rb +37 -0
- data/lib/react/test/utils.rb +71 -0
- data/lib/react/top_level.rb +110 -0
- data/lib/react/top_level_render.rb +28 -0
- data/lib/react/validator.rb +136 -0
- data/lib/reactive-ruby/component_loader.rb +43 -0
- data/lib/reactive-ruby/isomorphic_helpers.rb +235 -0
- data/lib/reactive-ruby/rails.rb +8 -0
- data/lib/reactive-ruby/rails/component_mount.rb +48 -0
- data/lib/reactive-ruby/rails/controller_helper.rb +14 -0
- data/lib/reactive-ruby/rails/railtie.rb +20 -0
- data/lib/reactive-ruby/serializers.rb +15 -0
- data/lib/reactive-ruby/server_rendering/contextual_renderer.rb +41 -0
- data/lib/reactive-ruby/server_rendering/hyper_asset_container.rb +46 -0
- data/lib/reactive-ruby/version.rb +3 -0
- data/lib/reactrb/auto-import.rb +27 -0
- data/logo1.png +0 -0
- data/logo2.png +0 -0
- data/logo3.png +0 -0
- data/path_release_steps.md +9 -0
- data/spec/controller_helper_spec.rb +35 -0
- data/spec/index.html.erb +11 -0
- data/spec/react/callbacks_spec.rb +142 -0
- data/spec/react/children_spec.rb +132 -0
- data/spec/react/component/base_spec.rb +36 -0
- data/spec/react/component_spec.rb +1073 -0
- data/spec/react/dsl_spec.rb +323 -0
- data/spec/react/element_spec.rb +132 -0
- data/spec/react/event_spec.rb +39 -0
- data/spec/react/native_library_spec.rb +387 -0
- data/spec/react/observable_spec.rb +31 -0
- data/spec/react/opal_jquery_extensions_spec.rb +68 -0
- data/spec/react/param_declaration_spec.rb +253 -0
- data/spec/react/react_spec.rb +278 -0
- data/spec/react/refs_callback_spec.rb +65 -0
- data/spec/react/server_spec.rb +25 -0
- data/spec/react/state_spec.rb +52 -0
- data/spec/react/test/dsl_spec.rb +43 -0
- data/spec/react/test/matchers/render_html_matcher_spec.rb +83 -0
- data/spec/react/test/rspec_spec.rb +62 -0
- data/spec/react/test/session_spec.rb +88 -0
- data/spec/react/test/utils_spec.rb +28 -0
- data/spec/react/top_level_component_spec.rb +103 -0
- data/spec/react/tutorial/tutorial_spec.rb +42 -0
- data/spec/react/validator_spec.rb +134 -0
- data/spec/reactive-ruby/component_loader_spec.rb +74 -0
- data/spec/reactive-ruby/isomorphic_helpers_spec.rb +157 -0
- data/spec/reactive-ruby/rails/asset_pipeline_spec.rb +17 -0
- data/spec/reactive-ruby/rails/component_mount_spec.rb +64 -0
- data/spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb +39 -0
- data/spec/spec_helper.rb +55 -0
- data/spec/test_app/README.md +24 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/config/manifest.js +3 -0
- data/spec/test_app/app/assets/images/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/application.rb +7 -0
- data/spec/test_app/app/assets/javascripts/cable.js +13 -0
- data/spec/test_app/app/assets/javascripts/channels/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/server_rendering.js +5 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/test_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/test_app/app/controllers/application_controller.rb +3 -0
- data/spec/test_app/app/controllers/concerns/.keep +0 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/jobs/application_job.rb +2 -0
- data/spec/test_app/app/mailers/application_mailer.rb +4 -0
- data/spec/test_app/app/models/application_record.rb +3 -0
- data/spec/test_app/app/models/concerns/.keep +0 -0
- data/spec/test_app/app/views/components.rb +11 -0
- data/spec/test_app/app/views/components/hello_world.rb +11 -0
- data/spec/test_app/app/views/components/todo.rb +14 -0
- data/spec/test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/test_app/app/views/layouts/explicit_layout.html.erb +0 -0
- data/spec/test_app/app/views/layouts/mailer.html.erb +13 -0
- data/spec/test_app/app/views/layouts/mailer.text.erb +1 -0
- data/spec/test_app/app/views/layouts/test_layout.html.erb +0 -0
- data/spec/test_app/bin/bundle +3 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/bin/setup +38 -0
- data/spec/test_app/bin/update +29 -0
- data/spec/test_app/bin/yarn +11 -0
- data/spec/test_app/config.ru +5 -0
- data/spec/test_app/config/application.rb +45 -0
- data/spec/test_app/config/boot.rb +6 -0
- data/spec/test_app/config/cable.yml +10 -0
- data/spec/test_app/config/database.yml +25 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +54 -0
- data/spec/test_app/config/environments/production.rb +91 -0
- data/spec/test_app/config/environments/test.rb +42 -0
- data/spec/test_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/test_app/config/initializers/assets.rb +14 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/mime_types.rb +4 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/test_app/config/locales/en.yml +33 -0
- data/spec/test_app/config/puma.rb +56 -0
- data/spec/test_app/config/routes.rb +3 -0
- data/spec/test_app/config/secrets.yml +32 -0
- data/spec/test_app/config/spring.rb +6 -0
- data/spec/test_app/db/development.sqlite3 +0 -0
- data/spec/test_app/db/schema.rb +15 -0
- data/spec/test_app/db/seeds.rb +7 -0
- data/spec/test_app/db/test.sqlite3 +0 -0
- data/spec/test_app/lib/assets/.keep +0 -0
- data/spec/test_app/log/.keep +0 -0
- data/spec/test_app/package.json +5 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/vendor/es5-shim.min.js +7 -0
- data/spec/vendor/jquery-2.2.4.min.js +4 -0
- metadata +401 -61
- data/CODE_OF_CONDUCT.md +0 -49
- data/lib/react/version.rb +0 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# this spec makes trouble, becasue if the assets wont get deleted, the app will use
|
|
4
|
+
# the precompiled assets suring testing, whcih interferes with dynamically created code
|
|
5
|
+
describe 'test_app generator' do
|
|
6
|
+
xit "does not interfere with asset precompilation" do
|
|
7
|
+
cmd = "cd spec/test_app; BUNDLE_GEMFILE=#{ENV['REAL_BUNDLE_GEMFILE']} bundle exec rails assets:precompile"
|
|
8
|
+
expect(system(cmd)).to be_truthy
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'assets:clobber' do
|
|
13
|
+
xit "remove precompiled assets so tests use recent assets" do
|
|
14
|
+
cmd = "cd spec/test_app; BUNDLE_GEMFILE=#{ENV['REAL_BUNDLE_GEMFILE']} bundle exec rails assets:clobber"
|
|
15
|
+
expect(system(cmd)).to be_truthy
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe ReactiveRuby::Rails::ComponentMount do
|
|
4
|
+
let(:helper) { described_class.new }
|
|
5
|
+
|
|
6
|
+
before do
|
|
7
|
+
helper.setup(ActionView::TestCase::TestController.new)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '#react_component' do
|
|
11
|
+
it 'renders a div' do
|
|
12
|
+
html = helper.react_component('Components::HelloWorld')
|
|
13
|
+
expect(html).to match(/<div.*><\/div>/)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'accepts a pre-render option' do
|
|
17
|
+
html = helper.react_component('Components::HelloWorld', {}, prerender: true)
|
|
18
|
+
expect(html).to match(/<div.*><span.*>Hello, World!<\/span><\/div>/)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'sets data-react-class to React.TopLevelRailsComponent' do
|
|
22
|
+
html = helper.react_component('Components::HelloWorld')
|
|
23
|
+
top_level_class = 'React.TopLevelRailsComponent'
|
|
24
|
+
expect(attr_value(html, 'data-react-class')).to eq(top_level_class)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'sets component_name in data-react-props hash' do
|
|
28
|
+
html = helper.react_component('Components::HelloWorld')
|
|
29
|
+
props = react_props_for(html)
|
|
30
|
+
|
|
31
|
+
expect(props['component_name']).to eq('Components::HelloWorld')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'sets render_params in data-react-props hash' do
|
|
35
|
+
html = helper.react_component('Components::HelloWorld', {'foo' => 'bar'})
|
|
36
|
+
props = react_props_for(html)
|
|
37
|
+
|
|
38
|
+
expect(props['render_params']).to include({ 'foo' => 'bar' })
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'sets controller in data-react-props hash' do
|
|
42
|
+
html = helper.react_component('Components::HelloWorld')
|
|
43
|
+
props = react_props_for(html)
|
|
44
|
+
|
|
45
|
+
expect(props['controller']).to eq('ActionView::TestCase::Test')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'passes additional options through as html attributes' do
|
|
49
|
+
html = helper.react_component('Components::HelloWorld', {},
|
|
50
|
+
{ 'foo-bar' => 'biz-baz' })
|
|
51
|
+
|
|
52
|
+
expect(attr_value(html, 'foo-bar')).to eq('biz-baz')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def attr_value(html, attr)
|
|
57
|
+
matches = html.match(/#{attr}=["']((?:.(?!["']\s+(?:\S+)=|[>"']))+.)["']?/)
|
|
58
|
+
matches.captures.first
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def react_props_for(html)
|
|
62
|
+
JSON.parse(CGI.unescapeHTML("#{attr_value(html, 'data-react-props')}"))
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe ReactiveRuby::ServerRendering::ContextualRenderer do
|
|
4
|
+
let(:renderer) { described_class.new({}) }
|
|
5
|
+
let(:init) { Proc.new {} }
|
|
6
|
+
let(:options) { { context_initializer: init } }
|
|
7
|
+
|
|
8
|
+
describe '#render' do
|
|
9
|
+
it 'pre-renders HTML' do
|
|
10
|
+
result = renderer.render('Components.Todo',
|
|
11
|
+
{ todo: 'finish reactive-ruby' },
|
|
12
|
+
options)
|
|
13
|
+
expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
|
|
14
|
+
# react 16 does not generate checksum
|
|
15
|
+
# expect(result).to match(/data-react-checksum/)
|
|
16
|
+
expect(result).to match(/data-reactroot/)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'accepts props as a string' do
|
|
20
|
+
result = renderer.render('Components.Todo',
|
|
21
|
+
{ todo: 'finish reactive-ruby' }.to_json,
|
|
22
|
+
options)
|
|
23
|
+
expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
|
|
24
|
+
# react 16 does not generate checksum
|
|
25
|
+
# expect(result).to match(/data-react-checksum/)
|
|
26
|
+
expect(result).to match(/data-reactroot/)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'pre-renders static content' do
|
|
30
|
+
result = renderer.render('Components.Todo',
|
|
31
|
+
{ todo: 'finish reactive-ruby' },
|
|
32
|
+
:static)
|
|
33
|
+
expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
|
|
34
|
+
# react 16 does not generate checksum
|
|
35
|
+
# expect(result).to_not match(/data-react-checksum/)
|
|
36
|
+
expect(result).to_not match(/data-reactroot/)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
2
|
+
|
|
3
|
+
require 'opal'
|
|
4
|
+
require 'opal-rspec'
|
|
5
|
+
require 'opal-jquery'
|
|
6
|
+
|
|
7
|
+
begin
|
|
8
|
+
require File.expand_path('../test_app/config/environment', __FILE__)
|
|
9
|
+
rescue LoadError
|
|
10
|
+
puts 'Could not load test application. Please ensure you have run `bundle exec rake test_app`'
|
|
11
|
+
end
|
|
12
|
+
require 'rspec/rails'
|
|
13
|
+
require 'hyper-spec'
|
|
14
|
+
require 'pry'
|
|
15
|
+
require 'opal-browser'
|
|
16
|
+
require 'timecop'
|
|
17
|
+
|
|
18
|
+
RSpec.configure do |config|
|
|
19
|
+
config.color = true
|
|
20
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
|
21
|
+
config.fixture_path = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures")
|
|
22
|
+
config.infer_spec_type_from_file_location!
|
|
23
|
+
config.mock_with :rspec
|
|
24
|
+
config.raise_errors_for_deprecations!
|
|
25
|
+
|
|
26
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
27
|
+
# examples within a transaction, comment the following line or assign false
|
|
28
|
+
# instead of true.
|
|
29
|
+
config.use_transactional_fixtures = true
|
|
30
|
+
|
|
31
|
+
config.before :each do
|
|
32
|
+
Rails.cache.clear
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
config.filter_run_including focus: true
|
|
36
|
+
config.filter_run_excluding opal: true
|
|
37
|
+
config.run_all_when_everything_filtered = true
|
|
38
|
+
|
|
39
|
+
# Fail tests on JavaScript errors in Chrome Headless
|
|
40
|
+
class JavaScriptError < StandardError; end
|
|
41
|
+
|
|
42
|
+
config.after(:each, js: true) do |spec|
|
|
43
|
+
logs = page.driver.browser.manage.logs.get(:browser)
|
|
44
|
+
errors = logs.select { |e| e.level == "SEVERE" && e.message.present? }
|
|
45
|
+
.map { |m| m.message.gsub(/\\n/, "\n") }.to_a
|
|
46
|
+
if client_options[:deprecation_warnings] == :on
|
|
47
|
+
warnings = logs.select { |e| e.level == "WARNING" && e.message.present? }
|
|
48
|
+
.map { |m| m.message.gsub(/\\n/, "\n") }.to_a
|
|
49
|
+
puts "\033[0;33;1m\nJavascript client console warnings:\n\n" + warnings.join("\n\n") + "\033[0;30;21m" if warnings.present?
|
|
50
|
+
end
|
|
51
|
+
unless client_options[:raise_on_js_errors] == :off
|
|
52
|
+
raise JavaScriptError, errors.join("\n\n") if errors.present?
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
|
3
|
+
//
|
|
4
|
+
//= require action_cable
|
|
5
|
+
//= require_self
|
|
6
|
+
//= require_tree ./channels
|
|
7
|
+
|
|
8
|
+
(function() {
|
|
9
|
+
this.App || (this.App = {});
|
|
10
|
+
|
|
11
|
+
App.cable = ActionCable.createConsumer();
|
|
12
|
+
|
|
13
|
+
}).call(this);
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
|
6
|
+
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>TestApp</title>
|
|
5
|
+
<%= csrf_meta_tags %>
|
|
6
|
+
|
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<%= yield %>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'pathname'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
include FileUtils
|
|
5
|
+
|
|
6
|
+
# path to your application root.
|
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
|
8
|
+
|
|
9
|
+
def system!(*args)
|
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
chdir APP_ROOT do
|
|
14
|
+
# This script is a starting point to setup your application.
|
|
15
|
+
# Add necessary setup steps to this file.
|
|
16
|
+
|
|
17
|
+
puts '== Installing dependencies =='
|
|
18
|
+
system! 'gem install bundler --conservative'
|
|
19
|
+
system('bundle check') || system!('bundle install')
|
|
20
|
+
|
|
21
|
+
# Install JavaScript dependencies if using Yarn
|
|
22
|
+
# system('bin/yarn')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# puts "\n== Copying sample files =="
|
|
26
|
+
# unless File.exist?('config/database.yml')
|
|
27
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
|
28
|
+
# end
|
|
29
|
+
|
|
30
|
+
puts "\n== Preparing database =="
|
|
31
|
+
system! 'bin/rails db:setup'
|
|
32
|
+
|
|
33
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
34
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
35
|
+
|
|
36
|
+
puts "\n== Restarting application server =="
|
|
37
|
+
system! 'bin/rails restart'
|
|
38
|
+
end
|