Class: PhoneGap::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/phonegap/builder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options) ⇒ Builder

Returns a new instance of Builder.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/phonegap/builder.rb', line 23

def initialize(path, options)
  @options    = options
  @path       = Pathname.new(path)
  
  @web_path   = @path.join("public") if @path.join("public").exist?
  @web_path   = @path.join("www") if @path.join("www").exist?

  if !@web_path && @path.exist?
    @web_path = @path.dup
    @path     = @path.parent
  end
  
  @build_path = @path.join("build", platform)
  @build_path.mkpath
end

Instance Attribute Details

#build_pathObject (readonly)

Returns the value of attribute build_path.



21
22
23
# File 'lib/phonegap/builder.rb', line 21

def build_path
  @build_path
end

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/phonegap/builder.rb', line 21

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



21
22
23
# File 'lib/phonegap/builder.rb', line 21

def path
  @path
end

#web_pathObject (readonly)

Returns the value of attribute web_path.



21
22
23
# File 'lib/phonegap/builder.rb', line 21

def web_path
  @web_path
end

Class Method Details

.platformObject



12
13
14
# File 'lib/phonegap/builder.rb', line 12

def platform
  @platform
end

.process(path, options) ⇒ Object



16
17
18
# File 'lib/phonegap/builder.rb', line 16

def process(path, options)
  self.new(path, options).process
end

.register(platform) ⇒ Object



7
8
9
10
# File 'lib/phonegap/builder.rb', line 7

def register(platform)
  @platform = platform
  Builders.register self
end

Instance Method Details

#buildObject



48
49
50
# File 'lib/phonegap/builder.rb', line 48

def build
  raise "Implement"
end

#generateObject



44
45
46
# File 'lib/phonegap/builder.rb', line 44

def generate
  raise "Implement"
end

#processObject



39
40
41
42
# File 'lib/phonegap/builder.rb', line 39

def process
  generate if options[:generate]
  build if options[:build]
end