Top Level Namespace

Defined Under Namespace

Modules: Cordova

Constant Summary collapse

START =
Time.now

Instance Method Summary collapse

Instance Method Details

#appObject



36
37
38
# File 'lib/cordova/rake.rb', line 36

def app
  config(:app)
end

#config(key) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/cordova/rake.rb', line 21

def config(key)
  return @xml[key] if @xml
  xml = Nokogiri::XML(File.open('config.xml'))
  @xml = {
    app: xml.xpath('//xmlns:name').text,
    desc: xml.xpath('//xmlns:description').text,
    platforms: xml.xpath('//xmlns:platform').map { |os| os['name'] }
  }
  config(key)
end

#envObject



40
41
42
# File 'lib/cordova/rake.rb', line 40

def env
  @env ||= ENV['TARGET'] || 'development'
end

#get_sources(ext, dir = 'app') ⇒ Object

Some helper methods



13
14
15
16
17
18
19
# File 'lib/cordova/rake.rb', line 13

def get_sources(ext, dir = 'app')
  Rake::FileList.new("#{dir}/**/*.#{ext}") do |fl|
    fl.exclude('~*')
    fl.exclude(%r{^scratch/})
    # fl.exclude { |f| `git ls-files #{f}`.empty? } # Only commited
  end
end

#layoutObject



32
33
34
# File 'lib/cordova/rake.rb', line 32

def layout
  @layout ||= Tilt.new('app/html/layout.haml')
end