appsendr 0.0.6 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +1 -16
- data/appsendr.gemspec +18 -43
- data/bin/appsendr +103 -8
- data/lib/appsendr.rb +6 -26
- data/lib/appsendr/app.rb +60 -0
- data/lib/appsendr/version.rb +3 -0
- data/test/units/app_test.rb +9 -0
- metadata +51 -168
- data/Manifest +0 -25
- data/README.rdoc +0 -49
- data/lib/appsendr/binary_plist.rb +0 -494
- data/lib/appsendr/client.rb +0 -258
- data/lib/appsendr/command.rb +0 -81
- data/lib/appsendr/commands/app.rb +0 -241
- data/lib/appsendr/commands/auth.rb +0 -139
- data/lib/appsendr/commands/base.rb +0 -78
- data/lib/appsendr/commands/build.rb +0 -320
- data/lib/appsendr/commands/collaborators.rb +0 -52
- data/lib/appsendr/commands/common.rb +0 -36
- data/lib/appsendr/commands/deploy.rb +0 -56
- data/lib/appsendr/commands/groups.rb +0 -63
- data/lib/appsendr/commands/help.rb +0 -103
- data/lib/appsendr/commands/portal.rb +0 -375
- data/lib/appsendr/commands/testers.rb +0 -118
- data/lib/appsendr/commands/version.rb +0 -7
- data/lib/appsendr/constants.rb +0 -5
- data/lib/appsendr/helpers.rb +0 -144
- data/lib/appsendr/progressbar.rb +0 -236
- data/portal.rb +0 -197
- data/terms +0 -0
@@ -1,118 +0,0 @@
|
|
1
|
-
module AppSendr::Command
|
2
|
-
class Testers < Base
|
3
|
-
def index #output testers
|
4
|
-
if in_project_dir?
|
5
|
-
unless has_project_droppr?
|
6
|
-
require_project_droppr
|
7
|
-
return
|
8
|
-
end
|
9
|
-
|
10
|
-
testers = appsendr.testers(read_app_id)
|
11
|
-
if testers["message"].size > 0
|
12
|
-
display "=== Your testers"
|
13
|
-
i = 0
|
14
|
-
display testers["message"].map {|app, id|
|
15
|
-
"#{i+=1}. #{app['name']} - #{app['email']}"
|
16
|
-
}.join("\n")
|
17
|
-
else
|
18
|
-
display "You have no testers."
|
19
|
-
end
|
20
|
-
|
21
|
-
# f = testers_file
|
22
|
-
# return unless f
|
23
|
-
# display "=== Testers"
|
24
|
-
# f.each do |line|
|
25
|
-
# tester = line.split(',')
|
26
|
-
# email = tester.first.strip
|
27
|
-
# display "#{email},#{name}"
|
28
|
-
# end
|
29
|
-
# f.close
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def add
|
34
|
-
|
35
|
-
if require_project(2,"add testers","an email and name", true)
|
36
|
-
email = args.shift.strip
|
37
|
-
name = args.join(" ").strip
|
38
|
-
|
39
|
-
begin
|
40
|
-
response = appsendr.add_tester(read_app_id,email,name)
|
41
|
-
message "#{email} added"
|
42
|
-
|
43
|
-
rescue RestClient::RequestFailed => e
|
44
|
-
message "Errors"
|
45
|
-
response = JSON.parse(e.http_body)
|
46
|
-
response['message'].each{|err|
|
47
|
-
display err.join(" ")
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def remove
|
55
|
-
if require_project(1,"remove testers","an email")
|
56
|
-
entered_email = args.shift.strip
|
57
|
-
appsendr.remove_tester(read_app_id,entered_email)
|
58
|
-
message "Removed tester"
|
59
|
-
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def clear
|
64
|
-
if require_project(0,"clear testers",nil)
|
65
|
-
message "Removing all testers"
|
66
|
-
appsendr.add_tester(read_app_id)
|
67
|
-
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def notify
|
72
|
-
if require_project(0,"clear testers",nil)
|
73
|
-
require_project_droppr
|
74
|
-
message "Notifying testers"
|
75
|
-
group = args.join(" ").strip
|
76
|
-
|
77
|
-
appsendr.notify(read_app_id,group)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def devices
|
82
|
-
all = option_exists?('--all', false)
|
83
|
-
|
84
|
-
if require_project(0,nil,nil)
|
85
|
-
message "Devices"
|
86
|
-
app_id = read_app_id unless all
|
87
|
-
@remote_devices = appsendr.devices(app_id,false)
|
88
|
-
devices = @remote_devices['message']['Device UDIDs']
|
89
|
-
devices.each{|device|
|
90
|
-
puts device.to_yaml
|
91
|
-
}
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
protected
|
97
|
-
|
98
|
-
def testers
|
99
|
-
AppSendr::PROJECT_DIR+"/testers"
|
100
|
-
end
|
101
|
-
|
102
|
-
def testers_file
|
103
|
-
return nil unless in_project_dir?
|
104
|
-
return File.open(testers, File::RDWR|File::CREAT, 0600)
|
105
|
-
end
|
106
|
-
|
107
|
-
def testers_file_append
|
108
|
-
return nil unless in_project_dir?
|
109
|
-
return File.open(testers, File::WRONLY|File::APPEND|File::CREAT, 0600)
|
110
|
-
end
|
111
|
-
|
112
|
-
def testers_file_truncate
|
113
|
-
return nil unless in_project_dir?
|
114
|
-
return File.open(path, File::WRONLY|File::TRUNC|File::CREAT, 0600)
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
end
|
data/lib/appsendr/constants.rb
DELETED
data/lib/appsendr/helpers.rb
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
module AppSendr
|
2
|
-
module Helpers
|
3
|
-
def home_directory
|
4
|
-
running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
|
5
|
-
end
|
6
|
-
|
7
|
-
def running_on_windows?
|
8
|
-
RUBY_PLATFORM =~ /mswin32|mingw32/
|
9
|
-
end
|
10
|
-
|
11
|
-
def running_on_a_mac?
|
12
|
-
RUBY_PLATFORM =~ /-darwin\d/
|
13
|
-
end
|
14
|
-
|
15
|
-
def display(msg, newline=true)
|
16
|
-
if newline
|
17
|
-
puts(msg)
|
18
|
-
else
|
19
|
-
print(msg)
|
20
|
-
STDOUT.flush
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def credentials_file
|
25
|
-
"#{home_directory}/#{AppSendr::APPDROPPR_DIR}/credentials"
|
26
|
-
end
|
27
|
-
|
28
|
-
def credentials_setup?
|
29
|
-
File.exist?(credentials_file)
|
30
|
-
end
|
31
|
-
|
32
|
-
def project_appsendr
|
33
|
-
Dir.pwd+"/#{AppSendr::PROJECT_DIR}"
|
34
|
-
end
|
35
|
-
|
36
|
-
def project_appsendr_app
|
37
|
-
project_appsendr+"/app"
|
38
|
-
end
|
39
|
-
|
40
|
-
def read_app_id
|
41
|
-
File.exists?(project_appsendr_app) and File.read(project_appsendr_app).split("\n").first
|
42
|
-
end
|
43
|
-
def read_app
|
44
|
-
File.exists?(project_appsendr_app) and File.read(project_appsendr_app).split("\n")
|
45
|
-
end
|
46
|
-
|
47
|
-
def error(msg)
|
48
|
-
STDERR.puts(msg)
|
49
|
-
exit 1
|
50
|
-
end
|
51
|
-
|
52
|
-
def message(msg)
|
53
|
-
puts("=== #{msg}")
|
54
|
-
end
|
55
|
-
|
56
|
-
### split
|
57
|
-
def is_file_to_large?(file)
|
58
|
-
in_mb = size_of_file(file).to_f
|
59
|
-
if in_mb > 10
|
60
|
-
return true
|
61
|
-
else
|
62
|
-
return false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def size_of_file(file)
|
67
|
-
size = File.size(file)
|
68
|
-
mb = 1024.0 * 1024.0
|
69
|
-
in_mb = size / mb
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
## droppr
|
74
|
-
def has_project_droppr?
|
75
|
-
return false unless File.directory?(project_appsendr)
|
76
|
-
return File.exist?(project_appsendr_app)
|
77
|
-
end
|
78
|
-
|
79
|
-
def require_project_droppr
|
80
|
-
error "Project directory doesn't exist. Have you created an this app on appsendr?" unless has_project_droppr?
|
81
|
-
end
|
82
|
-
|
83
|
-
def require_project_dir(action)
|
84
|
-
error "You must be in a Xcode project directory to #{action}" unless in_project_dir?
|
85
|
-
end
|
86
|
-
|
87
|
-
def in_project_dir?
|
88
|
-
return Dir.entries(Dir.pwd).grep(/.+\.xcodeproj/).first
|
89
|
-
end
|
90
|
-
|
91
|
-
def require_project(num_args,action,wrong_args,greater_than=false)
|
92
|
-
if in_project_dir? and has_project_droppr?
|
93
|
-
if args.count >= num_args
|
94
|
-
if greater_than
|
95
|
-
return true
|
96
|
-
elsif !greater_than and (args.count == num_args)
|
97
|
-
return true
|
98
|
-
else
|
99
|
-
return false
|
100
|
-
end
|
101
|
-
elsif wrong_args
|
102
|
-
error "You must include #{wrong_args}"
|
103
|
-
end
|
104
|
-
else
|
105
|
-
require_project_dir(action)
|
106
|
-
require_project_droppr
|
107
|
-
end
|
108
|
-
|
109
|
-
return false
|
110
|
-
end
|
111
|
-
|
112
|
-
def require_in_project_and_no_droppr(num_args,action,wrong_args,greater_than=false)
|
113
|
-
if in_project_dir? and !has_project_droppr?
|
114
|
-
if args.count >= num_args
|
115
|
-
if greater_than
|
116
|
-
return true
|
117
|
-
elsif !greater_than and (args.count == num_args)
|
118
|
-
return true
|
119
|
-
else
|
120
|
-
return false
|
121
|
-
end
|
122
|
-
elsif wrong_args
|
123
|
-
error "You must include #{wrong_args}"
|
124
|
-
end
|
125
|
-
else
|
126
|
-
require_project_dir(action)
|
127
|
-
error "This app is already linked to appsendr." unless !has_project_droppr?
|
128
|
-
end
|
129
|
-
|
130
|
-
return false
|
131
|
-
end
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
unless String.method_defined?(:shellescape)
|
139
|
-
class String
|
140
|
-
def shellescape
|
141
|
-
empty? ? "''" : gsub(/([^A-Za-z0-9_\-.,:\/@\n])/n, '\\\\\\1').gsub(/\n/, "'\n'")
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
data/lib/appsendr/progressbar.rb
DELETED
@@ -1,236 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Ruby/ProgressBar - a text progress bar library
|
3
|
-
#
|
4
|
-
# Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
|
5
|
-
# All rights reserved.
|
6
|
-
# This is free software with ABSOLUTELY NO WARRANTY.
|
7
|
-
#
|
8
|
-
# You can redistribute it and/or modify it under the terms
|
9
|
-
# of Ruby's license.
|
10
|
-
#
|
11
|
-
|
12
|
-
class ProgressBar
|
13
|
-
VERSION = "0.9"
|
14
|
-
|
15
|
-
def initialize (title, total, out = STDERR)
|
16
|
-
@title = title
|
17
|
-
@total = total
|
18
|
-
@out = out
|
19
|
-
@terminal_width = 80
|
20
|
-
@bar_mark = "="
|
21
|
-
@current = 0
|
22
|
-
@previous = 0
|
23
|
-
@finished_p = false
|
24
|
-
@start_time = Time.now
|
25
|
-
@previous_time = @start_time
|
26
|
-
@title_width = 14
|
27
|
-
@format = "%-#{@title_width}s %3d%% %s %s"
|
28
|
-
@format_arguments = [:title, :percentage, :bar, :stat]
|
29
|
-
clear
|
30
|
-
show
|
31
|
-
end
|
32
|
-
attr_reader :title
|
33
|
-
attr_reader :current
|
34
|
-
attr_reader :total
|
35
|
-
attr_accessor :start_time
|
36
|
-
|
37
|
-
private
|
38
|
-
def fmt_bar
|
39
|
-
bar_width = do_percentage * @terminal_width / 100
|
40
|
-
sprintf("|%s%s|",
|
41
|
-
@bar_mark * bar_width,
|
42
|
-
" " * (@terminal_width - bar_width))
|
43
|
-
end
|
44
|
-
|
45
|
-
def fmt_percentage
|
46
|
-
do_percentage
|
47
|
-
end
|
48
|
-
|
49
|
-
def fmt_stat
|
50
|
-
if @finished_p then elapsed else eta end
|
51
|
-
end
|
52
|
-
|
53
|
-
def fmt_stat_for_file_transfer
|
54
|
-
if @finished_p then
|
55
|
-
sprintf("%s %s %s", bytes, transfer_rate, elapsed)
|
56
|
-
else
|
57
|
-
sprintf("%s %s %s", bytes, transfer_rate, eta)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def fmt_title
|
62
|
-
@title[0,(@title_width - 1)] + ":"
|
63
|
-
end
|
64
|
-
|
65
|
-
def convert_bytes (bytes)
|
66
|
-
if bytes < 1024
|
67
|
-
sprintf("%6dB", bytes)
|
68
|
-
elsif bytes < 1024 * 1000 # 1000kb
|
69
|
-
sprintf("%5.1fKB", bytes.to_f / 1024)
|
70
|
-
elsif bytes < 1024 * 1024 * 1000 # 1000mb
|
71
|
-
sprintf("%5.1fMB", bytes.to_f / 1024 / 1024)
|
72
|
-
else
|
73
|
-
sprintf("%5.1fGB", bytes.to_f / 1024 / 1024 / 1024)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def transfer_rate
|
78
|
-
bytes_per_second = @current.to_f / (Time.now - @start_time)
|
79
|
-
sprintf("%s/s", convert_bytes(bytes_per_second))
|
80
|
-
end
|
81
|
-
|
82
|
-
def bytes
|
83
|
-
convert_bytes(@current)
|
84
|
-
end
|
85
|
-
|
86
|
-
def format_time (t)
|
87
|
-
t = t.to_i
|
88
|
-
sec = t % 60
|
89
|
-
min = (t / 60) % 60
|
90
|
-
hour = t / 3600
|
91
|
-
sprintf("%02d:%02d:%02d", hour, min, sec);
|
92
|
-
end
|
93
|
-
|
94
|
-
# ETA stands for Estimated Time of Arrival.
|
95
|
-
def eta
|
96
|
-
if @current == 0
|
97
|
-
"ETA: --:--:--"
|
98
|
-
else
|
99
|
-
elapsed = Time.now - @start_time
|
100
|
-
eta = elapsed * @total / @current - elapsed;
|
101
|
-
sprintf("ETA: %s", format_time(eta))
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def elapsed
|
106
|
-
elapsed = Time.now - @start_time
|
107
|
-
sprintf("Time: %s", format_time(elapsed))
|
108
|
-
end
|
109
|
-
|
110
|
-
def eol
|
111
|
-
if @finished_p then "\n" else "\r" end
|
112
|
-
end
|
113
|
-
|
114
|
-
def do_percentage
|
115
|
-
if @total.zero?
|
116
|
-
100
|
117
|
-
else
|
118
|
-
@current * 100 / @total
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def get_width
|
123
|
-
# FIXME: I don't know how portable it is.
|
124
|
-
default_width = 80
|
125
|
-
begin
|
126
|
-
tiocgwinsz = 0x5413
|
127
|
-
data = [0, 0, 0, 0].pack("SSSS")
|
128
|
-
if @out.ioctl(tiocgwinsz, data) >= 0 then
|
129
|
-
rows, cols, xpixels, ypixels = data.unpack("SSSS")
|
130
|
-
if cols >= 0 then cols else default_width end
|
131
|
-
else
|
132
|
-
default_width
|
133
|
-
end
|
134
|
-
rescue Exception
|
135
|
-
default_width
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def show
|
140
|
-
arguments = @format_arguments.map {|method|
|
141
|
-
method = sprintf("fmt_%s", method)
|
142
|
-
send(method)
|
143
|
-
}
|
144
|
-
line = sprintf(@format, *arguments)
|
145
|
-
|
146
|
-
width = get_width
|
147
|
-
if line.length == width - 1
|
148
|
-
@out.print(line + eol)
|
149
|
-
@out.flush
|
150
|
-
elsif line.length >= width
|
151
|
-
@terminal_width = [@terminal_width - (line.length - width + 1), 0].max
|
152
|
-
if @terminal_width == 0 then @out.print(line + eol) else show end
|
153
|
-
else # line.length < width - 1
|
154
|
-
@terminal_width += width - line.length + 1
|
155
|
-
show
|
156
|
-
end
|
157
|
-
@previous_time = Time.now
|
158
|
-
end
|
159
|
-
|
160
|
-
def show_if_needed
|
161
|
-
if @total.zero?
|
162
|
-
cur_percentage = 100
|
163
|
-
prev_percentage = 0
|
164
|
-
else
|
165
|
-
cur_percentage = (@current * 100 / @total).to_i
|
166
|
-
prev_percentage = (@previous * 100 / @total).to_i
|
167
|
-
end
|
168
|
-
|
169
|
-
# Use "!=" instead of ">" to support negative changes
|
170
|
-
if cur_percentage != prev_percentage ||
|
171
|
-
Time.now - @previous_time >= 1 || @finished_p
|
172
|
-
show
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
public
|
177
|
-
def clear
|
178
|
-
@out.print "\r"
|
179
|
-
@out.print(" " * (get_width - 1))
|
180
|
-
@out.print "\r"
|
181
|
-
end
|
182
|
-
|
183
|
-
def finish
|
184
|
-
@current = @total
|
185
|
-
@finished_p = true
|
186
|
-
show
|
187
|
-
end
|
188
|
-
|
189
|
-
def finished?
|
190
|
-
@finished_p
|
191
|
-
end
|
192
|
-
|
193
|
-
def file_transfer_mode
|
194
|
-
@format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer]
|
195
|
-
end
|
196
|
-
|
197
|
-
def format= (format)
|
198
|
-
@format = format
|
199
|
-
end
|
200
|
-
|
201
|
-
def format_arguments= (arguments)
|
202
|
-
@format_arguments = arguments
|
203
|
-
end
|
204
|
-
|
205
|
-
def halt
|
206
|
-
@finished_p = true
|
207
|
-
show
|
208
|
-
end
|
209
|
-
|
210
|
-
def inc (step = 1)
|
211
|
-
@current += step
|
212
|
-
@current = @total if @current > @total
|
213
|
-
show_if_needed
|
214
|
-
@previous = @current
|
215
|
-
end
|
216
|
-
|
217
|
-
def set (count)
|
218
|
-
if count < 0 || count > @total
|
219
|
-
raise "invalid count: #{count} (total: #{@total})"
|
220
|
-
end
|
221
|
-
@current = count
|
222
|
-
show_if_needed
|
223
|
-
@previous = @current
|
224
|
-
end
|
225
|
-
|
226
|
-
def inspect
|
227
|
-
"#<ProgressBar:#{@current}/#{@total}>"
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
class ReversedProgressBar < ProgressBar
|
232
|
-
def do_percentage
|
233
|
-
100 - super
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|