Skip to content

Change permissions on copied file so subsequent deploys work. #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/react/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ class Railtie < ::Rails::Railtie
(app.config.react.addons ? '-with-addons' : '') +
(app.config.react.variant == :production ? '.min.js' : '.js')
FileUtils.mkdir_p(tmp_path)

# Copy over files and set permissions so subsequent deploys can overwrite files
FileUtils.cp(::React::Source.bundled_path_for(filename),
tmp_path.join('react.js'))
tmp_path.join('react.js'))
FileUtils.chmod("u=rw,g=rw",
tmp_path.join("react.js")) if File.stat(tmp_path.join("react.js")).owned?

FileUtils.cp(::React::Source.bundled_path_for('JSXTransformer.js'),
tmp_path.join('JSXTransformer.js'))
tmp_path.join('JSXTransformer.js'))
FileUtils.chmod("u=rw,g=rw",
tmp_path.join("JSXTransformer.js")) if File.stat(tmp_path.join("JSXTransformer.js")).owned?

app.assets.prepend_path tmp_path

# Allow overriding react files that are not based on environment
Expand Down