Rakefile in infopark_fiona7-1.2.0.2.3 vs Rakefile in infopark_fiona7-1.5.2.0.0
- old
+ new
@@ -13,9 +13,42 @@
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
+namespace "package" do
+ desc "Package javascript"
+ task "js" do
+ puts "Transpiling javascript files"
+ require 'babel/transpiler'
+ Dir["app/**/*"].each do |fname|
+ if /\.es6\.js$/ =~ fname
+ nfname = ::File.join(::File.dirname(fname), ::File.basename(fname, '.es6.js') + '.js')
+ puts "#{fname} -> #{nfname}"
+ ::File.open(nfname, 'w') do |f|
+ f.write Babel::Transpiler.transform(File.read(fname))["code"]
+ end
+ end
+ end
+ end
+end
+namespace "clean" do
+ desc "Clean packaged javascript"
+ task "js" do
+ puts "Cleaning transpiled javascript files"
+ Dir["app/**/*"].each do |fname|
+ if /\.es6\.js$/ =~ fname
+ nfname = ::File.join(::File.dirname(fname), ::File.basename(fname, '.es6.js') + '.js')
+ puts "#{nfname}"
+ ::FileUtils.rm(nfname) if ::File.exists?(nfname)
+ end
+ end
+ end
+end
+
+task "build" => ["clean:js", "package:js"] do
+ # dummy, needed for dependencies, the rest is added later by bundler
+end
Bundler::GemHelper.install_tasks