brianleroux-phonegap 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "lib/platforms"]
2
+ path = lib/platforms
3
+ url = git://github.com/sintaxi/phonegap.git
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  PhoneGap Developer
2
2
  ===
3
- Command line utilities for PhoneGap:
3
+ Command line utilities for PhoneGap.
4
4
 
5
+ - source installation
5
6
  - app generation
7
+ - app debugging
6
8
  - app packaging
7
9
  - system reporting
8
10
 
@@ -11,15 +13,34 @@ Usage
11
13
  phonegap --generate path/to/MyFreshApp
12
14
  phonegap --build path/to/MyFreshApp
13
15
  phonegap --report path/to/MyFreshApp
14
-
16
+ phonegap --install
17
+
15
18
  Options
16
19
  ---
17
20
  -h, --help ......... Displays help message.
21
+ -i, --install ...... Installs the PhoneGap source into ~/.phonegap
18
22
  -v, --version ..... Display the version and then exit.
19
23
  -g, --generate ..... Generates a PhoneGap application skeleton.
20
24
  -b, --build ........ Compiles your PhoneGapp application for supported platforms.
21
25
  -r, --report ....... Generates a report for supported SDK's.
22
26
 
27
+ Thank you to the various PhoneGap hackers whom make this script possible
28
+ ---
29
+
30
+ - Rob Ellis
31
+ - Brock Whitten
32
+ - Dave Johnson
33
+ - Joe Bowser
34
+ - Shazron Abdullah
35
+ - Fil Maj
36
+
37
+ This project makes use of other awesome tools such as...
38
+
39
+ iPhone Simulator
40
+ ---
41
+ http://github.com/jhaynie/iphonesim/tree/master
42
+
43
+ - Jeff Haynie <jhaynie@appcelerator.com>
44
+ - Landon Fuller <landonf@plausiblelabs.com>
23
45
 
24
- Copyright (c) 2009 Brian LeRoux. Licensed under the MIT License:
25
- http://www.opensource.org/licenses/mit-license.php
46
+ Copyright (c) 2009 Brian LeRoux. Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.rubyforge_project = "phonegap"
13
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
14
  gem.add_dependency('rubyzip')
15
+ gem.executables = ["phonegap","iphonesim"]
15
16
  end
16
17
 
17
18
  Jeweler::RubyforgeTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.1
data/bin/iphonesim ADDED
Binary file
data/bin/phonegap CHANGED
@@ -22,6 +22,11 @@ class PhoneGapConsole
22
22
  exit
23
23
  end
24
24
 
25
+ opts.on("-i", '--install', "Installs PhoneGap source #{ p.version } into ~/.phonegap") do
26
+ puts p.install_phonegap_sauce
27
+ exit
28
+ end
29
+
25
30
  opts.on("-b", "--build PATH", "Compiles your PhoneGapp application for supported platforms.") do |path|
26
31
  puts p.build(path)
27
32
  exit
@@ -1,22 +1,32 @@
1
1
  module Iphone
2
- # TODO need to verify version is 3.0
2
+ # TODO need to verify version
3
3
  def iphone_supported?
4
4
  return File.exists?("/usr/bin/xcodebuild")
5
5
  end
6
6
 
7
+ # options for the build
8
+ def config
9
+ {'Release'=>'iphoneos3.0','Debug'=>'iphonesimulator3.0'}
10
+ end
11
+
12
+ def is
13
+ File.join(platform_path,'iphone/www')
14
+ end
15
+
7
16
  # builds the iphone using xcode, FIXME should use open toolchain
8
- def build_iphone(path_to_build)
9
- if iphone_supported? && has_phonegap_sauce?
10
- FileUtils.mkdir_p(path_to_build)
17
+ def build_iphone(path_to_build, debug=true)
18
+ if iphone_supported?
19
+ puts "Building for iPhone..."
11
20
  www_local = File.join(path_to_build,'www')
12
- www_build = File.join(install_path,'iphone')
13
- puts '\building for iphone...\n'
14
- puts "copying #{www_local} to #{www_build}...#{`cp -r #{www_local} #{www_build}`}\n"
15
- # Debug, Release
16
- conf = {'Release'=>'iphoneos3.0','Debug'=>'iphonesimulator3.0'}
17
- puts `cd #{www_build}; /usr/bin/xcodebuild -alltargets -configuration Debug -sdk #{conf['Debug']}`
21
+ www_build = File.join(platform_path,'iphone/www')
22
+ FileUtils.mkdir_p(path_to_build)
23
+ puts "Copying #{www_local} to #{www_build}..."
24
+ File.copy(www_local, www_build)
25
+ puts `cd #{www_build}; /usr/bin/xcodebuild -alltargets -configuration Debug -sdk #{debug ? config['Debug'] : config['Release']}`
26
+ `iphonesim launch #{ www_build } 3.0` if debug
18
27
  else
19
- puts 'skipping iphone build: iphone sdk not installed or phonegap source not in ~/.phonegap'
28
+ puts 'Skipping iPhone build: iphone sdk not installed.'
20
29
  end
21
30
  end
31
+ #
22
32
  end
data/lib/phonegap.rb CHANGED
@@ -9,40 +9,15 @@ class PhoneGap
9
9
  include Blackberry
10
10
 
11
11
  # outputs the current version of PhoneGap
12
- # FIXME needs to pull from sauce repo found at install path
13
12
  def version
14
- '0.7.4'
13
+ '0.7.4' # FIXME needs to know which version is being submoduled in
15
14
  end
16
15
 
17
- # grab install path of the phonegap sauce
18
- def install_path
19
- File.expand_path('~/.phonegap')
16
+ # path to the actual PhoneGap platforms source
17
+ def platform_path
18
+ File.join(File.dirname(__FILE__),'platforms/')
20
19
  end
21
20
 
22
- # check for the phonegap sauce
23
- def has_phonegap_sauce?
24
- File.exists?(install_path)
25
- end
26
-
27
- # downloads the latest version and puts it in install_path/version
28
- def install_phonegap_sauce
29
- url = URI.parse("http://github.com/sintaxi/phonegap/zipball/#{ version }/")
30
- found = false
31
- until found
32
- host, port = url.host, url.port if url.host && url.port
33
- req = Net::HTTP::Get.new(url.path)
34
- res = Net::HTTP.start(host, port) {|http| http.request(req) }
35
- res.header['location'] ? url = URI.parse(res.header['location']) :
36
- found = true
37
- end
38
- FileUtils.mkdir_p(install_path)
39
- zip_path = File.join(install_path, 'phonegap.zip')
40
- final_path = File.join(install_path, version.gsub('.','-'))
41
- open(zip_path, 'w+') {|f| f.write(res.body) }
42
- unzip(zip_path, install_path)
43
- File.mv File.expand_path("~/.phonegap/sintaxi-phonegap-2cd1b85903695b55626d95da117477200be8b57a"), File.expand_path("~/.phonegap/#{version.gsub('.','-')}")
44
- end
45
-
46
21
  # creates an app skeleton
47
22
  def generate(path)
48
23
  generate_path = File.join(Dir.pwd,path)
@@ -102,15 +77,5 @@ class PhoneGap
102
77
  def trim(str)
103
78
  str.gsub(' ','')
104
79
  end
105
-
106
- def unzip(file, destination)
107
- Zip::ZipFile.open(file) do |zip_file|
108
- zip_file.each do |f|
109
- f_path = File.join(destination, f.name)
110
- FileUtils.mkdir_p(File.dirname(f_path))
111
- zip_file.extract(f, f_path) unless File.exist?(f_path)
112
- end
113
- end
114
- end
115
80
  #
116
81
  end
data/phonegap.gemspec CHANGED
@@ -5,14 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{phonegap}
8
- s.version = "0.3.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian LeRoux"]
12
- s.date = %q{2009-08-07}
13
- s.default_executable = %q{phonegap}
12
+ s.date = %q{2009-08-10}
14
13
  s.email = %q{brian@westcoastlogic.com}
15
- s.executables = ["phonegap"]
14
+ s.executables = ["phonegap", "iphonesim"]
16
15
  s.extra_rdoc_files = [
17
16
  "LICENSE",
18
17
  "README.md"
@@ -20,10 +19,12 @@ Gem::Specification.new do |s|
20
19
  s.files = [
21
20
  ".document",
22
21
  ".gitignore",
22
+ ".gitmodules",
23
23
  "LICENSE",
24
24
  "README.md",
25
25
  "Rakefile",
26
26
  "VERSION",
27
+ "bin/iphonesim",
27
28
  "bin/phonegap",
28
29
  "lib/devices/android.rb",
29
30
  "lib/devices/blackberry.rb",
@@ -9,11 +9,9 @@ class PhonegapDevTest < Test::Unit::TestCase
9
9
  should "be an expected version" do
10
10
  assert_equal @p.version, '0.7.4'
11
11
  end
12
-
13
- should "install phonegap sauce" do
14
- @p.install_phonegap_sauce
15
- assert_equal true, File.exists?(File.expand_path('~/.phonegap'))
16
- end
12
+
13
+ should "generate a phonegap project"
14
+ should "build a phonegap project for the iphone"
17
15
  end
18
16
  #
19
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brianleroux-phonegap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian LeRoux
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-07 00:00:00 -07:00
13
- default_executable: phonegap
12
+ date: 2009-08-10 00:00:00 -07:00
13
+ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyzip
@@ -26,6 +26,7 @@ description:
26
26
  email: brian@westcoastlogic.com
27
27
  executables:
28
28
  - phonegap
29
+ - iphonesim
29
30
  extensions: []
30
31
 
31
32
  extra_rdoc_files:
@@ -34,10 +35,12 @@ extra_rdoc_files:
34
35
  files:
35
36
  - .document
36
37
  - .gitignore
38
+ - .gitmodules
37
39
  - LICENSE
38
40
  - README.md
39
41
  - Rakefile
40
42
  - VERSION
43
+ - bin/iphonesim
41
44
  - bin/phonegap
42
45
  - lib/devices/android.rb
43
46
  - lib/devices/blackberry.rb