Class: Cloudwalk::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Cloudwalk::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/cloudwalk/rake_task.rb
Instance Attribute Summary collapse
-
#libs ⇒ Object
Returns the value of attribute libs.
-
#main_out ⇒ Object
Returns the value of attribute main_out.
-
#out_path ⇒ Object
Returns the value of attribute out_path.
-
#root_path ⇒ Object
Returns the value of attribute root_path.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
- #platform_call(command) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cloudwalk/rake_task.rb', line 20 def initialize yield self if block_given? @libs ||= FileList['lib/*.xml'] @root_path ||= "./" @out_path ||= File.join(root_path, "out", "shared") @outs ||= @libs.pathmap("%{lib,#{@out_path}}p") define end |
Instance Attribute Details
#libs ⇒ Object
Returns the value of attribute libs.
18 19 20 |
# File 'lib/cloudwalk/rake_task.rb', line 18 def libs @libs end |
#main_out ⇒ Object
Returns the value of attribute main_out.
18 19 20 |
# File 'lib/cloudwalk/rake_task.rb', line 18 def main_out @main_out end |
#out_path ⇒ Object
Returns the value of attribute out_path.
18 19 20 |
# File 'lib/cloudwalk/rake_task.rb', line 18 def out_path @out_path end |
#root_path ⇒ Object
Returns the value of attribute root_path.
18 19 20 |
# File 'lib/cloudwalk/rake_task.rb', line 18 def root_path @root_path end |
Instance Method Details
#define ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cloudwalk/rake_task.rb', line 39 def define namespace :cloudwalk do desc "Compile posxml" task :build do FileUtils.rm_rf self.out_path FileUtils.mkdir_p self.out_path self.libs.zip(self.outs).each do |file, out| posxml = CwFileJson.xml2posxml(out) puts "cloudwalk compile -xml -o #{posxml} #{file}" platform_call "cloudwalk compile -xml -o #{posxml} #{file}" end end desc "Deploy all compiled applications based in Cwfile.json" task :deploy => :build do if Cloudwalk::CwFileJson.setup Cloudwalk::CwFileJson.deploy(self.outs) end end desc "Update CwFile.json.lock" task :update do Cloudwalk::CwFileJson.delete_lock! Cloudwalk::CwFileJson.setup(true) Cloudwalk::CwFileJson.persist_lock! end task :default => :build end end |
#platform_call(command) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/cloudwalk/rake_task.rb', line 31 def platform_call(command) if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) sh("bash -c \"#{command}\"") else sh command end end |