Top Level Namespace

Defined Under Namespace

Modules: Dubious

Constant Summary collapse

SERVLET_JAR =
File.join(AppEngine::SDK::SDK_ROOT, *%w{lib shared servlet-api.jar})
CLASSPATH =
[SERVLET_JAR, AppEngine::SDK::API_JAR].join(":")
MODEL_SRC_JAR =
File.dirname(Gem.find_files('dubious.rb').first) + '/../javalib/mirahdatastore.jar'
MIRAH_HOME =
ENV['MIRAH_HOME'] ? ENV['MIRAH_HOME'] : Gem.find_files('mirah').first.sub(/lib\/mirah.rb/,'')

Instance Method Summary collapse

Instance Method Details

#appengine_app(name, src, hash = {}, &block) ⇒ Object



131
132
133
134
135
136
137
138
139
140
# File 'lib/dubious_tasks.rb', line 131

def appengine_app(name,src,hash={}, &block)
  war = hash.keys.first
  deps = hash[war] || []
  
  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

#mirah_compile_options(opts) ⇒ Object

sets mirah compile opts

Parameters:

  • opts (Hash)

Options Hash (opts):

  • :dest_path (String)
  • :source_paths (Array<String>)
  • :compiler_options (Array<String>)

    commandline style options



147
148
149
150
151
# File 'lib/dubious_tasks.rb', line 147

def mirah_compile_options opts
  Mirah.dest_paths << opts[:dest_path]
  Mirah.source_paths.unshift *opts[:source_paths]
  Mirah.compiler_options.push *opts[:compiler_options]
end

#mirahc(*files) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/dubious_tasks.rb', line 154

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| f.sub(/^#{source_dir}\//, '')}
  flags = options.fetch(:options, Mirah.compiler_options)
  args = ['-d', dest, *flags] + files
  chdir(source_dir) do
    cmd = "mirahc #{args.join ' '}"
    puts cmd
    if files.any? {|f|f.include? 'controllers'}
      system cmd
    else
      Mirah.compile(*args)
      Mirah.reset
    end
  end
end