Skip to content

Commit

Permalink
Merge branch 'master' into travis-config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKVal authored Aug 12, 2016
2 parents 4b644ca + a6373f0 commit 4ff4656
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ node_modules
/node_package/lib

npm-debug.*
spec/dummy/client/npm-debug.log.*
spec/dummy/client/npm-debug.log*

/gen-examples

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]

- React on Rails server rendering now supports contexts outside of browser rendering, such as ActionMailer templates [#486](https://github.com/shakacode/react_on_rails/pull/486) by [eacaps](https://github.com/eacaps).
- React on Rails now correctly parses single-digit version strings from package.json [#491](https://github.com/shakacode/react_on_rails/pull/491) by [samphilipd ](https://github.com/samphilipd ).
- Fixed assets symlinking to correctly use filenames with spaces. Begining in [#510](https://github.com/shakacode/react_on_rails/pull/510), ending in [#513](https://github.com/shakacode/react_on_rails/pull/513) by [dzirtusss](https://github.com/dzirtusss)

## [6.0.5] - 2016-07-11
##### Added
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Then you may run

More Details:

`https://github.com/shakacode/react_on_rails#generator`
`https://github.com/shakacode/react_on_rails/blob/master/docs/basics/generator.md`
2 changes: 1 addition & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def add_hello_world_route
def update_git_ignore
data = <<-DATA.strip_heredoc
# React on Rails
npm-debug.log
npm-debug.log*
node_modules
# Generated js bundles
Expand Down
6 changes: 4 additions & 2 deletions lib/react_on_rails/assets_precompile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ def symlink_file(target, symlink)
# need to cd to directory and then symlink
target_sub_path, _divider, target_filename = target.rpartition("/")
_symlink_sub_path, _divider, symlink_filename = symlink.rpartition("/")
puts "React On Rails: Symlinking #{target} to #{symlink}"
puts "React On Rails: Symlinking \"#{target}\" to \"#{symlink}\""
dest_path = File.join(@assets_path, target_sub_path)
`cd #{dest_path} && ln -s #{target_filename} #{symlink_filename}`
FileUtils.chdir(dest_path) do
File.symlink(target_filename, symlink_filename)
end
end
end

Expand Down
7 changes: 4 additions & 3 deletions spec/dummy/client/webpack.client.base.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Common client-side webpack configuration used by webpack.hot.config and webpack.rails.config.
// Common client-side webpack configuration used by
// webpack.client.rails.hot.config and webpack.client.rails.build.config.

const webpack = require('webpack');
const path = require('path');
Expand All @@ -22,9 +23,9 @@ module.exports = {
'jquery',
],

// This will contain the app entry points defined by webpack.hot.config and webpack.rails.config
// This will contain the app entry points defined by
// webpack.client.rails.hot.config and webpack.client.rails.build.config
app: [
// './app/assets/styles/global-styles.scss',
'./app/startup/clientRegistration',
],
},
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/client/webpack.client.rails.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config.output = {
path: '../app/assets/webpack',
};

// See webpack.common.config for adding modules common to both the webpack dev server and rails
// See webpack.client.base.config for adding modules common to both the webpack dev server and rails

config.module.loaders.push(
{
Expand Down
26 changes: 24 additions & 2 deletions spec/react_on_rails/assets_precompile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ module ReactOnRails
assets_path.join(digest_filename))).to be true
end

it "creates a relative symlink" do
filename = File.basename(Tempfile.new("tempfile", assets_path))
digest_filename = "#{filename}_digest"
AssetsPrecompile.new(assets_path: assets_path)
.symlink_file(filename, digest_filename)

expect(File.readlink(assets_path.join(digest_filename)).to_s).to eq(filename)
expect(File.readlink(assets_path.join(digest_filename)).to_s)
.not_to eq(File.expand_path(assets_path.join(filename)).to_s)
end

it "creates a proper symlink with spaces in path" do
filename = File.basename(Tempfile.new("temp file", assets_path))
digest_filename = "#{filename} digest"
AssetsPrecompile.new(assets_path: assets_path)
.symlink_file(filename, digest_filename)

expect(assets_path.join(digest_filename).lstat.symlink?).to be true
expect(File.identical?(assets_path.join(filename),
assets_path.join(digest_filename))).to be true
end

it "creates a proper symlink when nested" do
Dir.mkdir assets_path.join("images")
filename = "images/" + File.basename(Tempfile.new("tempfile",
Expand Down Expand Up @@ -48,7 +70,7 @@ module ReactOnRails
end

context "correct nondigest filename" do
it "create valid symlink" do
it "creates valid symlink" do
FileUtils.touch assets_path.join(digest_filename)
checker.symlink_non_digested_assets

Expand All @@ -59,7 +81,7 @@ module ReactOnRails
end

context "zipped nondigest filename" do
it "create valid symlink" do
it "creates valid symlink" do
FileUtils.touch assets_path.join("#{digest_filename}.gz")
checker.symlink_non_digested_assets

Expand Down
2 changes: 1 addition & 1 deletion spec/react_on_rails/generators/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
.gitignore was not found.
Please add the following content to your .gitignore file:
# React on Rails
npm-debug.log
npm-debug.log*
node_modules
# Generated js bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
match = <<-MATCH.strip_heredoc
some existing text
# React on Rails
npm-debug.log
npm-debug.log*
node_modules
# Generated js bundles
Expand Down

0 comments on commit 4ff4656

Please sign in to comment.