File tree 4 files changed +30
-6
lines changed
4 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ Gemfile.lock
4
4
test /dummy /tmp
5
5
gemfiles /* .lock
6
6
* .swp
7
+ /lib /assets /react-source /*
8
+ /lib /assets /javascripts /JSXTransformer.js
Original file line number Diff line number Diff line change 6
6
7
7
Bundler ::GemHelper . install_tasks
8
8
9
+ require 'pathname'
10
+ require 'react/source'
11
+
12
+ namespace :react do
13
+ task :copy_assets do
14
+ assets_path = Pathname . new ( __dir__ ) . join ( 'lib/assets' )
15
+ copy_react_asset ( 'JSXTransformer.js' , assets_path . join ( 'javascripts/JSXTransformer.js' ) )
16
+ copy_react_asset ( 'react.js' , assets_path . join ( 'react-source/development/react.js' ) )
17
+ copy_react_asset ( 'react.min.js' , assets_path . join ( 'react-source/production/react.js' ) )
18
+ copy_react_asset ( 'react-with-addons.js' , assets_path . join ( 'react-source/development-with-addons/react.js' ) )
19
+ copy_react_asset ( 'react-with-addons.min.js' , assets_path . join ( 'react-source/production-with-addons/react.js' ) )
20
+ end
21
+
22
+ def copy_react_asset ( source , destination )
23
+ FileUtils . mkdir_p ( destination . dirname . to_s )
24
+ FileUtils . cp ( ::React ::Source . bundled_path_for ( source ) , destination . to_s )
25
+ end
26
+ end
27
+
28
+ Rake ::Task [ :build ] . enhance ( %w( react:copy_assets ) )
29
+
9
30
require 'appraisal'
10
31
require 'rake/testtask'
11
32
Original file line number Diff line number Diff line change @@ -33,10 +33,11 @@ class Railtie < ::Rails::Railtie
33
33
# contain console logging for invariants and logging to help catch
34
34
# common mistakes. These are all stripped out in the production build.
35
35
36
- directory = ( app . config . react . variant || :production ) . to_s
37
- directory += 'with-addons' if app . config . react . addons
38
- app . assets . prepend_path ::React ::Source . bundled_path_for ( directory )
39
- app . assets . prepend_path ::React ::Source . bundled_path_for ( '' ) # JSXTransformer.js
36
+ directory = app . config . react . variant == :production ? 'production' : 'development'
37
+ directory += '-with-addons' if app . config . react . addons
38
+
39
+ path = Pathname . new ( '../../../assets/react-source/' ) . join ( directory ) . expand_path ( __FILE__ ) . to_s
40
+ app . assets . append_path ( path )
40
41
end
41
42
42
43
Original file line number Diff line number Diff line change @@ -22,14 +22,14 @@ Gem::Specification.new do |s|
22
22
s . add_development_dependency 'poltergeist' , '>= 0.3.3'
23
23
s . add_development_dependency 'test-unit' , '~> 2.5'
24
24
s . add_development_dependency 'turbolinks' , '>= 2.0.0'
25
+ # If you change this, make sure to update VERSIONS.md:
26
+ s . add_development_dependency 'react-source' , '~> 0.13'
25
27
26
28
27
29
s . add_dependency 'coffee-script-source' , '~>1.8'
28
30
s . add_dependency 'connection_pool'
29
31
s . add_dependency 'execjs'
30
32
s . add_dependency 'rails' , '>= 3.1'
31
- # If you change this, make sure to update VERSIONS.md:
32
- s . add_dependency 'react-source' , '~> 0.13'
33
33
s . add_dependency 'tilt'
34
34
35
35
s . files = Dir [
You can’t perform that action at this time.
0 commit comments