Class: Embarista::Updater::UpdateJqueryTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Embarista::Updater::UpdateJqueryTask
- Defined in:
- lib/embarista/tasks/updater.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :update_jquery) {|_self| ... } ⇒ UpdateJqueryTask
constructor
A new instance of UpdateJqueryTask.
Constructor Details
#initialize(name = :update_jquery) {|_self| ... } ⇒ UpdateJqueryTask
Returns a new instance of UpdateJqueryTask.
175 176 177 178 179 |
# File 'lib/embarista/tasks/updater.rb', line 175 def initialize(name = :update_jquery) @name = name yield self if block_given? define end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
173 174 175 |
# File 'lib/embarista/tasks/updater.rb', line 173 def name @name end |
Instance Method Details
#define ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/embarista/tasks/updater.rb', line 181 def define update_jquery_task = task name do |t, args| version = ENV['VERSION'] raise "please supply VERSION env var to specify jQuery version" if version.nil? cd('./app/vendor') do # remove old jquerys rm Dir['jquery-*.js'] sh "curl -O http://code.jquery.com/jquery-#{version}.js" sh "curl -O http://code.jquery.com/jquery-#{version}.min.js" end Embarista::Updater.update_asset_file(%r{JQUERY_VERSION = '[^']+'}, "JQUERY_VERSION = '#{version}'") puts "Updated to jQuery #{version}" end update_jquery_task.add_description "Update jQuery to VERSION from code.jquery.com" end |