Class: Embarista::Updater::UpdateQunitTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/embarista/tasks/updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :update_qunit) {|_self| ... } ⇒ UpdateQunitTask

Returns a new instance of UpdateQunitTask.

Yields:

  • (_self)

Yield Parameters:



149
150
151
152
153
# File 'lib/embarista/tasks/updater.rb', line 149

def initialize(name = :update_qunit)
  @name = name
  yield self if block_given?
  define
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



147
148
149
# File 'lib/embarista/tasks/updater.rb', line 147

def name
  @name
end

Instance Method Details

#defineObject



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/embarista/tasks/updater.rb', line 155

def define
  update_qunit_task = task name do |t, args|
    version = ENV['VERSION']
    raise "please supply VERSION env var to specify QUnit version (specify \"git\" for nightly)" if version.nil?
    cd('./test/vendor') do
      # remove old qunit
      rm Dir['qunit-*.js']
      rm Dir['qunit-*.css']
      sh "curl -O http://code.jquery.com/qunit/qunit-#{version}.js"
      sh "curl -O http://code.jquery.com/qunit/qunit-#{version}.css"
    end
    puts "Updated to QUnit #{version}"
  end
  update_qunit_task.add_description "Update QUnit to VERSION from code.jquery.com"
end