Class: Burke::GemTaskManager
- Inherits:
-
Object
- Object
- Burke::GemTaskManager
- Defined in:
- lib/burke.rb
Constant Summary collapse
- TASKS =
{}
Class Method Summary collapse
- .add_task(conf) ⇒ Object
- .has_task?(platform) ⇒ Boolean
- .install_task ⇒ Object
- .task_for_this_platform ⇒ Object
Class Method Details
.add_task(conf) ⇒ Object
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/burke.rb', line 260 def self.add_task conf spec = conf.gemspec name = "gem:#{spec.platform}" pkg_dir = Burke.settings.gems.package_dir if TASKS.empty? desc "Build gems for all targets" end task :gems => name unless ::Rake.application.last_comment desc "Build gem for target '#{spec.platform}'" end task(name) do conf.before.call spec unless conf.before.nil? builder = Gem::Builder.new(spec) builder.build verbose true do mkdir pkg_dir unless File.exists? pkg_dir mv conf.gem_file, File.join(pkg_dir, conf.gem_file) end conf.after.call spec unless conf.after.nil? end TASKS[spec.platform.to_s] = conf end |
.has_task?(platform) ⇒ Boolean
288 289 290 |
# File 'lib/burke.rb', line 288 def self.has_task? platform TASKS.has_key? platform end |
.install_task ⇒ Object
305 306 307 308 309 310 311 312 |
# File 'lib/burke.rb', line 305 def self.install_task t = task_for_this_platform desc "Install gem for this platform" task 'install' => [t.task_name] do Gem::Installer.new(File.join(t.package_dir, t.gem_file)).install end end |
.task_for_this_platform ⇒ Object
292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/burke.rb', line 292 def self.task_for_this_platform platform = Gem::Platform.new(RUBY_PLATFORM).to_s name = nil if GemTaskManager.has_task? platform name = platform elsif GemTaskManager.has_task? 'ruby' name = "ruby" end TASKS[name] end |