brianleroux-phonegap 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/phonegap.rb +32 -2
- data/phonegap.gemspec +8 -2
- data/test/phonegap-dev_test.rb +15 -3
- metadata +15 -5
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/phonegap.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
%w(devices/android devices/iphone devices/blackberry).each { |x| require x }
|
1
|
+
%w(devices/android devices/iphone devices/blackberry net/http uri zip/zip).each { |x| require x }
|
2
2
|
#
|
3
3
|
# Provides utilities for generating a PhoneGap application and unifies the build process for each of the supported mobile platforms.
|
4
4
|
#
|
@@ -11,7 +11,7 @@ class PhoneGap
|
|
11
11
|
# outputs the current version of PhoneGap
|
12
12
|
# FIXME needs to pull from sauce repo found at install path
|
13
13
|
def version
|
14
|
-
'0.7.
|
14
|
+
'0.7.4'
|
15
15
|
end
|
16
16
|
|
17
17
|
# grab install path of the phonegap sauce
|
@@ -24,6 +24,25 @@ class PhoneGap
|
|
24
24
|
File.exists?(install_path)
|
25
25
|
end
|
26
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
|
+
|
27
46
|
# creates an app skeleton
|
28
47
|
def generate(path)
|
29
48
|
generate_path = File.join(Dir.pwd,path)
|
@@ -83,4 +102,15 @@ class PhoneGap
|
|
83
102
|
def trim(str)
|
84
103
|
str.gsub(' ','')
|
85
104
|
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
|
+
#
|
86
116
|
end
|
data/phonegap.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{phonegap}
|
5
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Brian LeRoux"]
|
9
|
-
s.date = %q{2009-07
|
12
|
+
s.date = %q{2009-08-07}
|
10
13
|
s.default_executable = %q{phonegap}
|
11
14
|
s.email = %q{brian@westcoastlogic.com}
|
12
15
|
s.executables = ["phonegap"]
|
@@ -53,8 +56,11 @@ Gem::Specification.new do |s|
|
|
53
56
|
s.specification_version = 3
|
54
57
|
|
55
58
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_runtime_dependency(%q<rubyzip>, [">= 0"])
|
56
60
|
else
|
61
|
+
s.add_dependency(%q<rubyzip>, [">= 0"])
|
57
62
|
end
|
58
63
|
else
|
64
|
+
s.add_dependency(%q<rubyzip>, [">= 0"])
|
59
65
|
end
|
60
66
|
end
|
data/test/phonegap-dev_test.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PhonegapDevTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
context "A PhoneGap instance" do
|
5
|
+
setup do
|
6
|
+
@p = PhoneGap.new
|
7
|
+
end
|
8
|
+
|
9
|
+
should "be an expected version" do
|
10
|
+
assert_equal @p.version, '0.7.4'
|
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
|
17
|
+
end
|
18
|
+
#
|
7
19
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian LeRoux
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07
|
12
|
+
date: 2009-08-07 00:00:00 -07:00
|
13
13
|
default_executable: phonegap
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rubyzip
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description:
|
17
26
|
email: brian@westcoastlogic.com
|
18
27
|
executables:
|
@@ -46,6 +55,7 @@ files:
|
|
46
55
|
- test/test_helper.rb
|
47
56
|
has_rdoc: false
|
48
57
|
homepage: http://github.com/brianleroux/phonegap-dev
|
58
|
+
licenses:
|
49
59
|
post_install_message:
|
50
60
|
rdoc_options:
|
51
61
|
- --charset=UTF-8
|
@@ -66,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
76
|
requirements: []
|
67
77
|
|
68
78
|
rubyforge_project: phonegap
|
69
|
-
rubygems_version: 1.
|
79
|
+
rubygems_version: 1.3.5
|
70
80
|
signing_key:
|
71
81
|
specification_version: 3
|
72
82
|
summary: Command line utilities for PhoneGap.
|