Class: PluginExampleApp

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ PluginExampleApp

Returns a new instance of PluginExampleApp.



2
3
4
# File 'lib/PluginExampleApp.rb', line 2

def initialize options
  @name, @path, @bundle_id, @verbose = options[:name], options[:path], options[:bundle_id], options[:verbose]
end

Instance Method Details

#build_example_appObject



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/PluginExampleApp.rb', line 49

def build_example_app
  if @verbose
    puts "Running Build command"
  end

  build_successful = system("cordova build")

  if @verbose && build_successful
    puts "Built successfully"
  end
end

#create_example_app_for_testingObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/PluginExampleApp.rb', line 6

def create_example_app_for_testing
  if @verbose
    puts "Creating Example Cordova App for Plugin"
  end

  Dir.chdir(@path)

  if @verbose
    puts "Running Create Command"
  end

  create_successful = system("cordova create #{@name}_example #{@bundle_id}.#{@name} #{@name}")

  if @verbose && create_successful
    puts "Create Command Successful"
  end

  Dir.chdir("#{@name}_example")

  if @verbose
    puts "Adding platforms"
  end

  system("cordova platform add ios")
  system("cordova platform add android")

  if @verbose
    puts "Platforms added"
  end
end

#install_pluginObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/PluginExampleApp.rb', line 37

def install_plugin
  if @verbose
    puts "Adding our plugin"
  end

  plugin_successful = system("cordova plugin add #{@path}/#{@name}")

  if @verbose && plugin_successful
    puts "Plugin installed successfully"
  end
end