Top Level Namespace

Defined Under Namespace

Modules: Mirah

Instance Method Summary collapse

Instance Method Details

#appengine_app(*args, &block) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/mirah/appengine_tasks.rb', line 148

def appengine_app(*args, &block)
  deps = []
  if args[-1].kind_of?(Hash)
    hash = args.pop
    arg = hash.keys[0]
    deps = hash[arg]
    args << arg
  end
  name, src, war = args
  task = AppEngine::Rake::AppEngineTask.define_task(name => deps, &block)
  src = File.expand_path(src || 'src')
  war = File.expand_path(war || 'war')
  task.init(src, war)
  task
end

#mirahc(*files) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/mirah_task.rb', line 94

def mirahc(*files)
  if files[-1].kind_of?(Hash)
    options = files.pop
  else
    options = {}
  end
  source_dir = options.fetch(:dir, Mirah.source_path)
  dest = File.expand_path(options.fetch(:dest, Mirah.dest_path))
  files = files.map {|f| File.expand_path(f).sub(/^#{source_dir}\//, '')}
  flags = options.fetch(:options, Mirah.compiler_options)
  args = ['-d', dest, *flags] + files
  chdir(source_dir) do
    puts "mirahc #{args.join ' '}"
    Mirah.compile(*args) || exit(1)
    Mirah.reset
  end
end