rwr-view_helpers 0.0.1
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 +7 -0
- data/.babelrc +3 -0
- data/.eslintrc +8 -0
- data/.gitignore +216 -0
- data/.travis.yml +48 -0
- data/CONTRIBUTING.md +17 -0
- data/Gemfile +14 -0
- data/LICENSE +22 -0
- data/README.md +69 -0
- data/Rakefile +7 -0
- data/docs/rwr-view_helpers.md +34 -0
- data/js/.eslintrc +12 -0
- data/js/src/index.js +2 -0
- data/js/src/version.js +1 -0
- data/js/test/index.spec.js +26 -0
- data/lib/assets/javascripts/rwr_view_helpers.js.erb +5 -0
- data/lib/react_webpack_rails/rwr_view_helpers/image_paths.rb +33 -0
- data/lib/react_webpack_rails/rwr_view_helpers/rails/engine.rb +8 -0
- data/lib/react_webpack_rails/rwr_view_helpers/version.rb +5 -0
- data/lib/rwr-view_helpers.rb +3 -0
- data/package.json +43 -0
- data/rwr-view_helpers/.gitignore +9 -0
- data/rwr-view_helpers/Gemfile +4 -0
- data/rwr-view_helpers/README.md +36 -0
- data/rwr-view_helpers/Rakefile +2 -0
- data/rwr-view_helpers/bin/console +14 -0
- data/rwr-view_helpers/bin/setup +8 -0
- data/rwr-view_helpers/lib/rwr/view_helpers/version.rb +5 -0
- data/rwr-view_helpers/lib/rwr/view_helpers.rb +7 -0
- data/rwr-view_helpers/rwr-view_helpers.gemspec +31 -0
- data/rwr-view_helpers.gemspec +28 -0
- data/spec/rails4_dummy_app/.babelrc +3 -0
- data/spec/rails4_dummy_app/.gitignore +216 -0
- data/spec/rails4_dummy_app/.nvmrc +1 -0
- data/spec/rails4_dummy_app/Gemfile +28 -0
- data/spec/rails4_dummy_app/Rakefile +6 -0
- data/spec/rails4_dummy_app/app/assets/images/.keep +0 -0
- data/spec/rails4_dummy_app/app/assets/images/spongebob.png +0 -0
- data/spec/rails4_dummy_app/app/assets/images/spongebob@2x.png +0 -0
- data/spec/rails4_dummy_app/app/assets/images/spongebob@3x.png +0 -0
- data/spec/rails4_dummy_app/app/assets/javascripts/application.js +20 -0
- data/spec/rails4_dummy_app/app/assets/stylesheets/application.css +15 -0
- data/spec/rails4_dummy_app/app/controllers/application_controller.rb +5 -0
- data/spec/rails4_dummy_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails4_dummy_app/app/controllers/pages_controller.rb +4 -0
- data/spec/rails4_dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails4_dummy_app/app/mailers/.keep +0 -0
- data/spec/rails4_dummy_app/app/models/.keep +0 -0
- data/spec/rails4_dummy_app/app/models/concerns/.keep +0 -0
- data/spec/rails4_dummy_app/app/react/components/Spongebob.js +9 -0
- data/spec/rails4_dummy_app/app/react/components/Spongebob.spec.js +28 -0
- data/spec/rails4_dummy_app/app/react/index.js +5 -0
- data/spec/rails4_dummy_app/app/react/test/helpers/browser.js +20 -0
- data/spec/rails4_dummy_app/app/views/layouts/_react_hot_assets.html.erb +3 -0
- data/spec/rails4_dummy_app/app/views/layouts/application.html.erb +16 -0
- data/spec/rails4_dummy_app/app/views/pages/home.html.erb +7 -0
- data/spec/rails4_dummy_app/bin/bundle +3 -0
- data/spec/rails4_dummy_app/bin/rails +8 -0
- data/spec/rails4_dummy_app/bin/rake +8 -0
- data/spec/rails4_dummy_app/bin/setup +29 -0
- data/spec/rails4_dummy_app/bin/spring +15 -0
- data/spec/rails4_dummy_app/config/application.rb +26 -0
- data/spec/rails4_dummy_app/config/boot.rb +3 -0
- data/spec/rails4_dummy_app/config/database.yml +25 -0
- data/spec/rails4_dummy_app/config/environment.rb +5 -0
- data/spec/rails4_dummy_app/config/environments/development.rb +41 -0
- data/spec/rails4_dummy_app/config/environments/production.rb +79 -0
- data/spec/rails4_dummy_app/config/environments/test.rb +42 -0
- data/spec/rails4_dummy_app/config/initializers/assets.rb +11 -0
- data/spec/rails4_dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails4_dummy_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/rails4_dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails4_dummy_app/config/initializers/inflections.rb +16 -0
- data/spec/rails4_dummy_app/config/initializers/mime_types.rb +4 -0
- data/spec/rails4_dummy_app/config/initializers/session_store.rb +3 -0
- data/spec/rails4_dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails4_dummy_app/config/locales/en.yml +23 -0
- data/spec/rails4_dummy_app/config/routes.rb +58 -0
- data/spec/rails4_dummy_app/config.ru +4 -0
- data/spec/rails4_dummy_app/db/schema.rb +16 -0
- data/spec/rails4_dummy_app/db/seeds.rb +7 -0
- data/spec/rails4_dummy_app/forever/development.json +8 -0
- data/spec/rails4_dummy_app/forever/production.json +6 -0
- data/spec/rails4_dummy_app/karma.conf.js +32 -0
- data/spec/rails4_dummy_app/lib/assets/.keep +0 -0
- data/spec/rails4_dummy_app/lib/tasks/.keep +0 -0
- data/spec/rails4_dummy_app/package.json +55 -0
- data/spec/rails4_dummy_app/public/404.html +67 -0
- data/spec/rails4_dummy_app/public/422.html +67 -0
- data/spec/rails4_dummy_app/public/500.html +66 -0
- data/spec/rails4_dummy_app/public/favicon.ico +0 -0
- data/spec/rails4_dummy_app/public/robots.txt +5 -0
- data/spec/rails4_dummy_app/spec/rails_helper.rb +57 -0
- data/spec/rails4_dummy_app/spec/spec_helper.rb +92 -0
- data/spec/rails4_dummy_app/webpack/dev.config.js +7 -0
- data/spec/rails4_dummy_app/webpack/hot-dev.config.js +13 -0
- data/spec/rails4_dummy_app/webpack/production.config.js +3 -0
- data/spec/rails4_dummy_app/webpack/tests.config.js +2 -0
- data/spec/rails4_dummy_app/webpack.config.js +39 -0
- metadata +212 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rwr/view_helpers/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rwr-view_helpers"
|
8
|
+
spec.version = Rwr::ViewHelpers::VERSION
|
9
|
+
spec.authors = ["TODO: Write your name"]
|
10
|
+
spec.email = ["oskar.cieslik@netguru.pl"]
|
11
|
+
|
12
|
+
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
|
13
|
+
spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require "react_webpack_rails/rwr_view_helpers/version"
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = "rwr-view_helpers"
|
11
|
+
s.version = ReactWebpackRails::RWRViewHelpers::VERSION
|
12
|
+
s.authors = ["Oskar Cieslik"]
|
13
|
+
s.email = ["react@netguru.co"]
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.homepage = "https://github.com/netguru/rwr-view_helpers"
|
16
|
+
s.summary = ""
|
17
|
+
s.description = ""
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = Dir["test/**/*"]
|
21
|
+
|
22
|
+
s.add_dependency 'react_webpack_rails', '>= 0.1.0'
|
23
|
+
s.add_dependency 'rails'
|
24
|
+
s.add_dependency 'sprockets', '>= 3.0'
|
25
|
+
|
26
|
+
s.add_development_dependency 'bundler', '~> 1.10'
|
27
|
+
s.add_development_dependency "yard"
|
28
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
#####=== Emacs ===#####
|
2
|
+
# -*- mode: gitignore; -*-
|
3
|
+
*~
|
4
|
+
\#*\#
|
5
|
+
/.emacs.desktop
|
6
|
+
/.emacs.desktop.lock
|
7
|
+
*.elc
|
8
|
+
auto-save-list
|
9
|
+
tramp
|
10
|
+
.\#*
|
11
|
+
|
12
|
+
# Org-mode
|
13
|
+
.org-id-locations
|
14
|
+
*_archive
|
15
|
+
|
16
|
+
# flymake-mode
|
17
|
+
*_flymake.*
|
18
|
+
|
19
|
+
# eshell files
|
20
|
+
/eshell/history
|
21
|
+
/eshell/lastdir
|
22
|
+
|
23
|
+
# elpa packages
|
24
|
+
/elpa/
|
25
|
+
|
26
|
+
# reftex files
|
27
|
+
*.rel
|
28
|
+
|
29
|
+
# AUCTeX auto folder
|
30
|
+
/auto/
|
31
|
+
|
32
|
+
# cask packages
|
33
|
+
.cask/
|
34
|
+
|
35
|
+
#####=== Linux ===#####
|
36
|
+
*~
|
37
|
+
|
38
|
+
# KDE directory preferences
|
39
|
+
.directory
|
40
|
+
|
41
|
+
# Linux trash folder which might appear on any partition or disk
|
42
|
+
.Trash-*
|
43
|
+
|
44
|
+
#####=== Node ===#####
|
45
|
+
|
46
|
+
# Logs
|
47
|
+
logs
|
48
|
+
*.log
|
49
|
+
|
50
|
+
# Runtime data
|
51
|
+
pids
|
52
|
+
*.pid
|
53
|
+
*.seed
|
54
|
+
|
55
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
56
|
+
lib-cov
|
57
|
+
|
58
|
+
# Coverage directory used by tools like istanbul
|
59
|
+
coverage
|
60
|
+
|
61
|
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
62
|
+
.grunt
|
63
|
+
|
64
|
+
# node-waf configuration
|
65
|
+
.lock-wscript
|
66
|
+
|
67
|
+
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
68
|
+
build/Release
|
69
|
+
|
70
|
+
# Dependency directory
|
71
|
+
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
72
|
+
node_modules
|
73
|
+
|
74
|
+
#####=== OSX ===#####
|
75
|
+
.DS_Store
|
76
|
+
.AppleDouble
|
77
|
+
.LSOverride
|
78
|
+
|
79
|
+
# Icon must end with two
|
80
|
+
Icon
|
81
|
+
|
82
|
+
|
83
|
+
# Thumbnails
|
84
|
+
._*
|
85
|
+
|
86
|
+
# Files that might appear in the root of a volume
|
87
|
+
.DocumentRevisions-V100
|
88
|
+
.fseventsd
|
89
|
+
.Spotlight-V100
|
90
|
+
.TemporaryItems
|
91
|
+
.Trashes
|
92
|
+
.VolumeIcon.icns
|
93
|
+
|
94
|
+
# Directories potentially created on remote AFP share
|
95
|
+
.AppleDB
|
96
|
+
.AppleDesktop
|
97
|
+
Network Trash Folder
|
98
|
+
Temporary Items
|
99
|
+
.apdisk
|
100
|
+
|
101
|
+
#####=== Rails ===#####
|
102
|
+
|
103
|
+
*.rbc
|
104
|
+
capybara-*.html
|
105
|
+
.rspec
|
106
|
+
/log
|
107
|
+
/tmp
|
108
|
+
/db/*.sqlite3
|
109
|
+
/db/*.sqlite3-journal
|
110
|
+
/public/system
|
111
|
+
/coverage/
|
112
|
+
/spec/tmp
|
113
|
+
**.orig
|
114
|
+
rerun.txt
|
115
|
+
pickle-email-*.html
|
116
|
+
|
117
|
+
# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
|
118
|
+
config/initializers/secret_token.rb
|
119
|
+
config/secrets.yml
|
120
|
+
|
121
|
+
## Environment normalisation:
|
122
|
+
/.bundle
|
123
|
+
/vendor/bundle
|
124
|
+
|
125
|
+
# these should all be checked in to normalise the environment:
|
126
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
127
|
+
|
128
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
129
|
+
.rvmrc
|
130
|
+
|
131
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
132
|
+
/vendor/assets/bower_components
|
133
|
+
*.bowerrc
|
134
|
+
bower.json
|
135
|
+
|
136
|
+
# Ignore pow environment settings
|
137
|
+
.powenv
|
138
|
+
|
139
|
+
#####=== Ruby ===#####
|
140
|
+
|
141
|
+
*.gem
|
142
|
+
*.rbc
|
143
|
+
/.config
|
144
|
+
/coverage/
|
145
|
+
/InstalledFiles
|
146
|
+
/pkg/
|
147
|
+
/spec/reports/
|
148
|
+
/test/tmp/
|
149
|
+
/test/version_tmp/
|
150
|
+
/tmp/
|
151
|
+
|
152
|
+
## Specific to RubyMotion:
|
153
|
+
.dat*
|
154
|
+
.repl_history
|
155
|
+
build/
|
156
|
+
|
157
|
+
## Documentation cache and generated files:
|
158
|
+
/.yardoc/
|
159
|
+
/_yardoc/
|
160
|
+
/doc/
|
161
|
+
/rdoc/
|
162
|
+
|
163
|
+
## Environment normalisation:
|
164
|
+
/.bundle/
|
165
|
+
/vendor/bundle
|
166
|
+
/lib/bundler/man/
|
167
|
+
|
168
|
+
# for a library or gem, you might want to ignore these files since the code is
|
169
|
+
# intended to run in multiple environments; otherwise, check them in:
|
170
|
+
# Gemfile.lock
|
171
|
+
# .ruby-version
|
172
|
+
# .ruby-gemset
|
173
|
+
|
174
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
175
|
+
.rvmrc
|
176
|
+
|
177
|
+
#####=== SublimeText ===#####
|
178
|
+
# cache files for sublime text
|
179
|
+
*.tmlanguage.cache
|
180
|
+
*.tmPreferences.cache
|
181
|
+
*.stTheme.cache
|
182
|
+
|
183
|
+
# workspace files are user-specific
|
184
|
+
*.sublime-workspace
|
185
|
+
|
186
|
+
# project files should be checked into the repository, unless a significant
|
187
|
+
# proportion of contributors will probably not be using SublimeText
|
188
|
+
# *.sublime-project
|
189
|
+
|
190
|
+
# sftp configuration file
|
191
|
+
sftp-config.json
|
192
|
+
|
193
|
+
#####=== Vim ===#####
|
194
|
+
[._]*.s[a-w][a-z]
|
195
|
+
[._]s[a-w][a-z]
|
196
|
+
*.un~
|
197
|
+
Session.vim
|
198
|
+
.netrwhist
|
199
|
+
*~
|
200
|
+
|
201
|
+
# ----- OWN IGNORES ----- #
|
202
|
+
|
203
|
+
/.bundle/
|
204
|
+
/.yardoc
|
205
|
+
/Gemfile.lock
|
206
|
+
/_yardoc/
|
207
|
+
/coverage/
|
208
|
+
/doc/
|
209
|
+
/pkg/
|
210
|
+
/spec/reports/
|
211
|
+
/tmp/
|
212
|
+
/js/lib/
|
213
|
+
|
214
|
+
node_modules
|
215
|
+
app/assets/javascripts/react_bundle.js
|
216
|
+
rwr-alt-*.gem
|
@@ -0,0 +1 @@
|
|
1
|
+
5.7
|
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '4.2.4'
|
4
|
+
gem 'sqlite3'
|
5
|
+
gem 'react_webpack_rails'
|
6
|
+
gem 'rwr-view_helpers', path: '../..'
|
7
|
+
|
8
|
+
gem 'active_model_serializers'
|
9
|
+
gem 'sass-rails', '~> 5.0'
|
10
|
+
gem 'uglifier', '>= 1.3.0'
|
11
|
+
gem 'coffee-rails', '~> 4.1.0'
|
12
|
+
gem 'jquery-rails'
|
13
|
+
gem 'turbolinks'
|
14
|
+
gem 'jbuilder', '~> 2.0'
|
15
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
16
|
+
|
17
|
+
group :development, :test do
|
18
|
+
gem 'byebug'
|
19
|
+
gem 'rspec-rails'
|
20
|
+
gem 'capybara'
|
21
|
+
gem 'selenium-webdriver'
|
22
|
+
gem 'chromedriver-helper'
|
23
|
+
gem 'pry'
|
24
|
+
end
|
25
|
+
|
26
|
+
group :development do
|
27
|
+
gem 'web-console', '~> 2.0'
|
28
|
+
end
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require react_integration
|
17
|
+
//= require react_bundle
|
18
|
+
//= require rwr_view_helpers
|
19
|
+
|
20
|
+
//= require_tree .
|
@@ -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, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's 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 styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { imagePath } from 'rwr-view-helpers';
|
3
|
+
|
4
|
+
const Spongebob = ({ alt, size }) => {
|
5
|
+
const sizePostfix = size > 1 ? `@${size}x` : '';
|
6
|
+
return <img alt={alt} src={imagePath(`spongebob${sizePostfix}.png`)} />
|
7
|
+
};
|
8
|
+
|
9
|
+
export default Spongebob;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { mount, render, shallow } from 'enzyme';
|
3
|
+
import { expect } from 'chai';
|
4
|
+
import Spongebob from './Spongebob';
|
5
|
+
|
6
|
+
global.__RWR_VIEW_HELPERS__ = {
|
7
|
+
imagePaths: {
|
8
|
+
'spongebob.png': 'spongebob-HASH.png',
|
9
|
+
},
|
10
|
+
},
|
11
|
+
|
12
|
+
describe('<Spongebob />', () => {
|
13
|
+
it('should render image tag', () => {
|
14
|
+
const wrapper = shallow(<Spongebob />);
|
15
|
+
expect(wrapper.find('img')).to.have.length(1);
|
16
|
+
});
|
17
|
+
|
18
|
+
it('allows to set props', () => {
|
19
|
+
const wrapper = mount(<Spongebob alt="A" size="B" />);
|
20
|
+
expect(wrapper.props().alt).to.equal('A');
|
21
|
+
expect(wrapper.props().size).to.equal('B');
|
22
|
+
});
|
23
|
+
|
24
|
+
it('sets proper src attribute', () => {
|
25
|
+
const wrapper = render(<Spongebob />);
|
26
|
+
expect(wrapper.find('img').attr('src')).to.equal('spongebob-HASH.png');
|
27
|
+
});
|
28
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require('babel-register')();
|
2
|
+
|
3
|
+
var jsdom = require('jsdom').jsdom;
|
4
|
+
|
5
|
+
var exposedProperties = ['window', 'navigator', 'document'];
|
6
|
+
|
7
|
+
global.document = jsdom('');
|
8
|
+
global.window = document.defaultView;
|
9
|
+
Object.keys(document.defaultView).forEach((property) => {
|
10
|
+
if (typeof global[property] === 'undefined') {
|
11
|
+
exposedProperties.push(property);
|
12
|
+
global[property] = document.defaultView[property];
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
global.navigator = {
|
17
|
+
userAgent: 'node.js'
|
18
|
+
};
|
19
|
+
|
20
|
+
documentRef = document;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rails4DummyApp</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<%= render 'layouts/react_hot_assets' %>
|
12
|
+
|
13
|
+
<%= yield %>
|
14
|
+
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require "rubygems"
|
8
|
+
require "bundler"
|
9
|
+
|
10
|
+
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
|
11
|
+
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
+
gem "spring", match[1]
|
13
|
+
require "spring/binstub"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module Rails4DummyApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
16
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
17
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
18
|
+
|
19
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
20
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
21
|
+
# config.i18n.default_locale = :de
|
22
|
+
|
23
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
24
|
+
config.active_record.raise_in_transactional_callbacks = true
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|