Skip to content

Commit 67e8ffa

Browse files
author
Robert Mosolgo
committed
Merge pull request #254 from byroot/dont-crash-on-boot-because-of-file-copying
Copyless setup of react source
2 parents 0faa0f6 + 1c92a45 commit 67e8ffa

File tree

13 files changed

+57160
-54
lines changed

13 files changed

+57160
-54
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "vendor/"
3+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Gemfile.lock
44
test/dummy/tmp
55
gemfiles/*.lock
66
*.swp
7+
/vendor/react

Rakefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ end
66

77
Bundler::GemHelper.install_tasks
88

9+
require 'pathname'
10+
namespace :react do
11+
task :update do
12+
FileUtils.rm_f('vendor/react/.bower.json')
13+
system('bower install react')
14+
assets_path = Pathname.new(File.dirname(__FILE__)).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+
vendor_path = Pathname.new(File.dirname(__FILE__)).join('vendor/react')
24+
FileUtils.mkdir_p(destination.dirname.to_s)
25+
FileUtils.cp(vendor_path.join(source), destination.to_s)
26+
end
27+
end
28+
929
require 'appraisal'
1030
require 'rake/testtask'
1131

0 commit comments

Comments
 (0)