Sha256: 8703183f11fc637778db58cf63df2171ee1153460cecb78934f7fff5776426fa

Contents?: true

Size: 1.72 KB

Versions: 5

Compression:

Stored size: 1.72 KB

Contents

namespace :skydrive do
  namespace :ember do
    desc 'Build the ember application using the RAILS_ENV variable'
    task :build do
      require 'ember/source'

      puts 'building ember for production'
      FileUtils.cp Ember::Source.bundled_path_for('ember.min.js'), 'app/assets/javascripts/skydrive/vendor/ember.js'
      puts 'building ember'
      puts `ember build --out-file app/assets/javascripts/skydrive/ember_app.js`

      #if(Rails.env.production?)
      #  puts 'building ember for production'
      #  FileUtils.cp Ember::Source.bundled_path_for('ember.min.js'), 'public/javascripts/vendor/ember.js'
      #  puts 'building ember'
      #  puts `ember build`
      #  puts 'minifying application.js'
      #  rewrite_file('public/javascripts/application.js') {|f| Uglifier.compile(f)}
      #else
      #  puts 'building ember for development'
      #  FileUtils.cp Ember::Source.bundled_path_for('ember.js'), 'public/javascripts/vendor/ember.js'
      #  puts 'building ember'
      #  puts `ember build -d`
      #end
    end

    #This doesn't work at present because ember requires an older version of handlebars
    #The version required by the ember-source gem conflicts.
    #task :handlebars do
    #  require 'handlebars/source'
    #
    #  if(Rails.env.production?)
    #    puts 'building handlebars for production'
    #    FileUtils.cp Handlebars::Source.runtime_bundled_path, 'public/javascripts/vendor/handlebars.js'
    #  else
    #    puts 'building handlebars for development'
    #    FileUtils.cp Handlebars::Source.bundled_path, 'public/javascripts/vendor/handlebars.js'
    #  end
    #end

    def rewrite_file(file, &block)
      source = File.read(file)
      File.write(file, block.call(source))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lti_skydrive-0.1.1 lib/tasks/ember.rake
lti_skydrive-0.1.0 lib/tasks/ember.rake
lti_skydrive-0.0.5 lib/tasks/ember.rake
lti_skydrive-0.0.4 lib/tasks/ember.rake
lti_skydrive-0.0.3 lib/tasks/ember.rake