lesspainful 0.0.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/lesspainful +68 -4
- data/lib/version.rb +1 -1
- metadata +3 -3
data/bin/lesspainful
CHANGED
@@ -32,11 +32,14 @@ def is_android?
|
|
32
32
|
app.end_with? ".apk"
|
33
33
|
end
|
34
34
|
|
35
|
+
def calabash_android_version
|
36
|
+
`bundle exec calabash-android version`.strip
|
37
|
+
end
|
38
|
+
|
35
39
|
def test_server_path
|
36
40
|
require 'digest/md5'
|
37
41
|
digest = Digest::MD5.hexdigest(File.read(app))
|
38
|
-
|
39
|
-
"#{workspace}test_servers/#{digest}_#{version}.apk"
|
42
|
+
"#{workspace}test_servers/#{digest}_#{calabash_android_version}.apk"
|
40
43
|
end
|
41
44
|
|
42
45
|
def all_files
|
@@ -45,7 +48,6 @@ def all_files
|
|
45
48
|
if is_android?
|
46
49
|
files << test_server_path
|
47
50
|
end
|
48
|
-
files << "Gemfile"
|
49
51
|
files.find_all { |file_or_dir| File.file? file_or_dir }
|
50
52
|
end
|
51
53
|
|
@@ -71,8 +73,63 @@ def self.log_header(message)
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
76
|
+
def self.usage
|
77
|
+
"Usage: lesspainful <app> <api_key>"
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.verify_arguments
|
81
|
+
log_and_abort(usage) unless app
|
82
|
+
log_and_abort(usage) unless api_key
|
83
|
+
abort_unless(File.exist?(app)) do
|
84
|
+
puts "No such file: #{app}"
|
85
|
+
end
|
86
|
+
abort_unless(/\.(apk|ipa)$/ =~ app) do
|
87
|
+
puts usage
|
88
|
+
puts "<app> should be either an ipa or apk file"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def abort(&block)
|
93
|
+
yield block
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def abort_unless(condition, &block)
|
98
|
+
unless condition
|
99
|
+
yield block
|
100
|
+
exit 1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def log_and_abort(message)
|
105
|
+
abort do
|
106
|
+
puts message
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
def self.verify_files
|
112
|
+
if is_android?
|
113
|
+
abort_unless(File.exist?(test_server_path)) do
|
114
|
+
puts "No test server found. Please run:"
|
115
|
+
puts " calabash-android build #{app}"
|
116
|
+
end
|
117
|
+
|
118
|
+
calabash_gem = Dir.glob("vendor/cache/calabash-android-*").first
|
119
|
+
abort_unless(calabash_gem) do
|
120
|
+
puts "calabash-android was not packaged correct."
|
121
|
+
puts "Please tell contact@lesspainf.com about this bug"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
74
129
|
start_at = Time.now
|
75
130
|
|
131
|
+
verify_arguments
|
132
|
+
|
76
133
|
log_header("Checking for Gemfile")
|
77
134
|
unless File.exist?("Gemfile")
|
78
135
|
log("Gemfile missing.")
|
@@ -87,12 +144,19 @@ unless File.exist?("Gemfile")
|
|
87
144
|
end
|
88
145
|
|
89
146
|
log_header("Packaging")
|
90
|
-
|
147
|
+
log_and_abort "Bundler failed. Please check command: bundle package" unless system("bundle package")
|
148
|
+
|
91
149
|
|
92
150
|
log_header("Collecting files")
|
93
151
|
hashes = all_files.collect { |f| digest(f) }
|
94
152
|
hashes << digest(app)
|
95
153
|
|
154
|
+
log_header("Verifying files")
|
155
|
+
|
156
|
+
verify_files
|
157
|
+
|
158
|
+
|
159
|
+
|
96
160
|
|
97
161
|
log_header("Negotiating upload")
|
98
162
|
response = http_post("check_hash", {"hashes" => hashes})
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lesspainful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.8.
|
99
|
+
rubygems_version: 1.8.24
|
100
100
|
signing_key:
|
101
101
|
specification_version: 3
|
102
102
|
summary: Client for uploading calabash test to www.lesspainful.com
|