transcriptic 0.2.5 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/transcriptic.rb +3 -1
- data/lib/transcriptic/api.rb +2 -2
- data/lib/transcriptic/auth.rb +9 -7
- data/lib/transcriptic/cli.rb +40 -17
- data/lib/transcriptic/client.rb +83 -80
- data/lib/transcriptic/helpers.rb +25 -0
- data/lib/transcriptic/labfile.rb +4 -0
- data/lib/transcriptic/project_generator.rb +17 -4
- data/lib/transcriptic/sbt.rb +17 -1
- data/lib/transcriptic/templates/Labfile.erb +1 -0
- data/lib/transcriptic/templates/app/Main.erb +1 -1
- data/lib/transcriptic/templates/project/Build.erb +7 -27
- data/lib/transcriptic/templates/project/Dependencies.erb +1 -1
- data/lib/transcriptic/templates/project/plugins.sbt +2 -2
- data/lib/transcriptic/version.rb +2 -2
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0ddaaffe1e8a3fe9e353498e519dedb9c9c6f67
|
4
|
+
data.tar.gz: 3a5cf1b0f657319e93563e7ec1188580007522d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2248fd95af2523dd56b823614c9aa0eeb425404c3a1d2ac47e55b46fcc5bdc6ceb37179c9481a811c940e51b518cc59b971538e55d1ba62a74deb11ebe627435
|
7
|
+
data.tar.gz: 30b755de92ac786cabbe7a4b26cc901f57dec3d87f083c952834ec0c07ed814df619a816186b954ed672ffb56ba8b10861afe724591e6aa13213bbd0194b2ef9
|
data/lib/transcriptic.rb
CHANGED
@@ -14,15 +14,17 @@ require 'chozo/core_ext'
|
|
14
14
|
require 'rexml/document'
|
15
15
|
require 'rest-client'
|
16
16
|
require 'uri'
|
17
|
+
require 'faraday'
|
17
18
|
require 'net/http'
|
18
19
|
require 'time'
|
19
20
|
|
20
21
|
require 'vendor/okjson'
|
21
22
|
|
23
|
+
require 'thor/monkies'
|
22
24
|
require 'transcriptic/version'
|
23
25
|
require 'transcriptic/core_ext'
|
24
26
|
require 'transcriptic/errors'
|
25
|
-
require '
|
27
|
+
require 'transcriptic/helpers'
|
26
28
|
|
27
29
|
module Transcriptic
|
28
30
|
class << self
|
data/lib/transcriptic/api.rb
CHANGED
@@ -17,7 +17,7 @@ module Transcriptic
|
|
17
17
|
user_pass = ":#{@api_key}"
|
18
18
|
options = {
|
19
19
|
:headers => {},
|
20
|
-
:host => 'transcriptic.com',
|
20
|
+
:host => 'secure.transcriptic.com',
|
21
21
|
:nonblock => false,
|
22
22
|
:scheme => 'https'
|
23
23
|
}.merge(options)
|
@@ -26,7 +26,7 @@ module Transcriptic
|
|
26
26
|
'Accept-Encoding' => 'gzip',
|
27
27
|
'Accept-Language' => 'en-US, en;q=0.8',
|
28
28
|
'Authorization' => "Token token=\"#{@api_key}\"",
|
29
|
-
'User-Agent' => "transcriptic
|
29
|
+
'User-Agent' => "transcriptic/#{Transcriptic::API::VERSION}",
|
30
30
|
'X-Transcriptic-API-Version' => '1',
|
31
31
|
'X-Ruby-Version' => RUBY_VERSION,
|
32
32
|
'X-Ruby-Platform' => RUBY_PLATFORM
|
data/lib/transcriptic/auth.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
class Transcriptic::Auth
|
2
2
|
class << self
|
3
|
+
include Transcriptic::Helpers
|
4
|
+
include Thor::Shell
|
5
|
+
|
3
6
|
attr_accessor :credentials
|
4
7
|
|
5
8
|
def client
|
@@ -26,11 +29,11 @@ class Transcriptic::Auth
|
|
26
29
|
|
27
30
|
# just a stub; will raise if not authenticated
|
28
31
|
def check
|
29
|
-
client.
|
32
|
+
client.list_runs
|
30
33
|
end
|
31
34
|
|
32
35
|
def default_host
|
33
|
-
"transcriptic.com"
|
36
|
+
"https://secure.transcriptic.com"
|
34
37
|
end
|
35
38
|
|
36
39
|
def host
|
@@ -82,10 +85,8 @@ class Transcriptic::Auth
|
|
82
85
|
def ask_for_credentials
|
83
86
|
puts "Enter your Transcriptic credentials."
|
84
87
|
|
85
|
-
|
86
|
-
user = ask
|
88
|
+
user = ask "Email: "
|
87
89
|
|
88
|
-
print "Password: "
|
89
90
|
password = running_on_windows? ? ask_for_password_on_windows : ask_for_password
|
90
91
|
api_key = Transcriptic::Client.auth(user, password, host)['api_key']
|
91
92
|
[user, api_key]
|
@@ -96,6 +97,7 @@ class Transcriptic::Auth
|
|
96
97
|
char = nil
|
97
98
|
password = ''
|
98
99
|
|
100
|
+
print "Password: "
|
99
101
|
while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
|
100
102
|
break if char == 10 || char == 13 # received carriage return or newline
|
101
103
|
if char == 127 || char == 8 # backspace and delete
|
@@ -111,7 +113,7 @@ class Transcriptic::Auth
|
|
111
113
|
|
112
114
|
def ask_for_password
|
113
115
|
echo_off
|
114
|
-
password = ask
|
116
|
+
password = ask "Password: "
|
115
117
|
puts
|
116
118
|
echo_on
|
117
119
|
return password
|
@@ -125,7 +127,7 @@ class Transcriptic::Auth
|
|
125
127
|
rescue ::RestClient::Unauthorized, ::RestClient::ResourceNotFound => e
|
126
128
|
delete_credentials
|
127
129
|
clear
|
128
|
-
|
130
|
+
say "Authentication failed."
|
129
131
|
retry if retry_login?
|
130
132
|
exit 1
|
131
133
|
rescue Exception => e
|
data/lib/transcriptic/cli.rb
CHANGED
@@ -66,33 +66,32 @@ module Transcriptic
|
|
66
66
|
type: :string,
|
67
67
|
desc: 'Brief one-line description of the project'
|
68
68
|
def new(name)
|
69
|
-
Transcriptic::ProjectGenerator.new([File.join(Dir.pwd, name), name], options).
|
69
|
+
Transcriptic::ProjectGenerator.new([File.join(Dir.pwd, name), name], options).generate
|
70
70
|
end
|
71
71
|
|
72
72
|
desc "logs RUNID", "Get log data from a run"
|
73
73
|
def logs(run_id)
|
74
|
-
|
74
|
+
transcriptic_client.read_logs(run_id)
|
75
75
|
end
|
76
76
|
|
77
77
|
desc "status RUNID", "Show status for a given run ID"
|
78
78
|
def status(run_id)
|
79
|
-
ret =
|
79
|
+
ret = transcriptic_client.run_info(run_id)
|
80
80
|
if ret.nil?
|
81
|
-
error "#{run_id} not found for #{
|
81
|
+
error "#{run_id} not found for #{transcriptic_client.user}"
|
82
82
|
end
|
83
|
-
say
|
83
|
+
say ret["status"]
|
84
84
|
end
|
85
85
|
|
86
86
|
desc "list", "List your in-flight run IDs"
|
87
87
|
def list
|
88
|
-
ret =
|
88
|
+
ret = transcriptic_client.list_runs
|
89
89
|
if ret.empty?
|
90
|
-
say "No runs for #{
|
90
|
+
say "No runs for #{transcriptic_client.user}"
|
91
91
|
return
|
92
92
|
end
|
93
|
-
say("Runs:")
|
94
93
|
ret.each do |run|
|
95
|
-
say "
|
94
|
+
say "#{run["title"]}\t#{run["id"]}\t#{run["partials"].length} partials\t#{run["status"]}"
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
@@ -109,7 +108,7 @@ module Transcriptic
|
|
109
108
|
LONGDESC
|
110
109
|
method_option :limit, type: :numeric, desc: "Maximum number of results to return"
|
111
110
|
def lookup(term)
|
112
|
-
ret =
|
111
|
+
ret = transcriptic_client.search_resources(term)
|
113
112
|
ret["results"].each do |result|
|
114
113
|
output_with_arrow "#{result[:resource_id]}: #{result[:name]}"
|
115
114
|
end
|
@@ -121,6 +120,7 @@ module Transcriptic
|
|
121
120
|
output_with_arrow "Updating dependencies..."
|
122
121
|
labfile = Transcriptic::Labfile.from_file(Transcriptic.find_labfile)
|
123
122
|
Transcriptic::DependenciesGenerator.new([Dir.pwd, labfile.dependencies], options).invoke_all
|
123
|
+
Transcriptic::ProjectGenerator.new([Dir.pwd, labfile.options[:name]], options).update_build_version(labfile)
|
124
124
|
end
|
125
125
|
|
126
126
|
desc "compile", "Compile the project"
|
@@ -130,6 +130,13 @@ module Transcriptic
|
|
130
130
|
Transcriptic::SBT.compile
|
131
131
|
end
|
132
132
|
|
133
|
+
desc "clean", "Wipe out generated (compiled) files"
|
134
|
+
def clean
|
135
|
+
require_labfile!
|
136
|
+
update
|
137
|
+
Transcriptic::SBT.compile
|
138
|
+
end
|
139
|
+
|
133
140
|
desc "analyze OBJECTPATH", "Analyze a protocol. Object path is of the form edu.foo.bar where bar is the name of your Protocol object."
|
134
141
|
method_options :raw => :boolean, :iterations => :numeric, :linearize => :boolean
|
135
142
|
def analyze(object_path, *params)
|
@@ -155,7 +162,10 @@ module Transcriptic
|
|
155
162
|
desc "publish", "Packages up the current project and uploads it to the Autoprotocol Central Repository"
|
156
163
|
def publish
|
157
164
|
labfile = require_labfile!
|
158
|
-
|
165
|
+
update
|
166
|
+
Transcriptic::SBT.clean
|
167
|
+
compiled_jar_path = Transcriptic::SBT.stage
|
168
|
+
if compiled_jar_path
|
159
169
|
dependencies = labfile.dependencies.map {|d| "#{d[:group]}.#{d[:name]}/#{d[:version]}" }.join(", ")
|
160
170
|
output_with_arrow "Preparing to publish..."
|
161
171
|
output_with_arrow "Project name: #{labfile.options[:name]}, Author: #{labfile.options[:author]}, Email: #{labfile.options[:email]}"
|
@@ -167,8 +177,21 @@ module Transcriptic
|
|
167
177
|
if labfile.dependencies.length > 0
|
168
178
|
output_with_arrow "Dependencies: #{dependencies}}"
|
169
179
|
end
|
170
|
-
confirm(format_with_bang("Are you sure you want to publish version #{labfile.options[:version]} of this project? (y/N)"))
|
171
|
-
|
180
|
+
if confirm(format_with_bang("Are you sure you want to publish version #{labfile.options[:version]} of this project? (y/N)"))
|
181
|
+
output_with_arrow "Uploading #{compiled_jar_path} to Transcriptic..."
|
182
|
+
|
183
|
+
signature = transcriptic_client.sign_upload(labfile, File.basename(compiled_jar_path))
|
184
|
+
res = transcriptic_client.create_or_get_protocol(labfile, signature)
|
185
|
+
if res["success"]
|
186
|
+
transcriptic_client.upload_to_s3(compiled_jar_path, signature)
|
187
|
+
output_with_arrow "Revision #{labfile.options[:version]} of #{labfile.options[:name]} published!"
|
188
|
+
else
|
189
|
+
errors = res["errors"].map { |e| e[1].map { |m| "#{e[0]} #{m}" }.join(", ") }.join(", ")
|
190
|
+
display format_with_bang("Errors occurred: #{errors}")
|
191
|
+
end
|
192
|
+
else
|
193
|
+
display "Aborting."
|
194
|
+
end
|
172
195
|
end
|
173
196
|
end
|
174
197
|
|
@@ -188,7 +211,7 @@ module Transcriptic
|
|
188
211
|
project_id = args.shift
|
189
212
|
end
|
190
213
|
run = action("Uploading `#{path}`") {
|
191
|
-
|
214
|
+
transcriptic_client.create_run(fd, project_id)
|
192
215
|
}
|
193
216
|
|
194
217
|
if run["success"]
|
@@ -198,10 +221,10 @@ module Transcriptic
|
|
198
221
|
if Transcriptic.ui.confirm_quote
|
199
222
|
Transcriptic.ui.display
|
200
223
|
Transcriptic.ui.action("Launching") {
|
201
|
-
|
224
|
+
transcriptic_client.launch_run(run["run_id"])
|
202
225
|
}
|
203
226
|
Transcriptic.ui.output_with_arrow "Protocol run launched. ID: #{run["run_id"]}"
|
204
|
-
Transcriptic.ui.output_with_arrow "Monitor at: https://secure.
|
227
|
+
Transcriptic.ui.output_with_arrow "Monitor at: https://secure.transcriptic_client.com/#{run["organization_id"]}/#{run["project_id"]}/runs/#{run["run_id"]}"
|
205
228
|
end
|
206
229
|
else
|
207
230
|
Transcriptic.ui.error_with_failure "Error creating protocol run."
|
@@ -209,7 +232,7 @@ module Transcriptic
|
|
209
232
|
end
|
210
233
|
|
211
234
|
private
|
212
|
-
def
|
235
|
+
def transcriptic_client
|
213
236
|
Transcriptic::Auth.client
|
214
237
|
end
|
215
238
|
|
data/lib/transcriptic/client.rb
CHANGED
@@ -10,6 +10,11 @@
|
|
10
10
|
#
|
11
11
|
class Transcriptic::Client
|
12
12
|
include Transcriptic::UI
|
13
|
+
include Transcriptic::Helpers
|
14
|
+
|
15
|
+
class << self
|
16
|
+
include Transcriptic::Helpers
|
17
|
+
end
|
13
18
|
|
14
19
|
def self.version
|
15
20
|
Transcriptic::VERSION
|
@@ -23,7 +28,10 @@ class Transcriptic::Client
|
|
23
28
|
|
24
29
|
def self.auth(user, password, host = Transcriptic::Auth.default_host)
|
25
30
|
client = new(user, nil, host)
|
26
|
-
json_decode client.post('/users/sign_in', {
|
31
|
+
json_decode client.post('/users/sign_in', {
|
32
|
+
'user[email]' => user,
|
33
|
+
'user[password]' => password
|
34
|
+
}, :accept => 'json').to_s
|
27
35
|
end
|
28
36
|
|
29
37
|
def initialize(user, api_key, host = Transcriptic::Auth.default_host)
|
@@ -49,7 +57,73 @@ class Transcriptic::Client
|
|
49
57
|
end
|
50
58
|
|
51
59
|
def run_info(id)
|
52
|
-
|
60
|
+
begin
|
61
|
+
json_decode get("/api/runs/#{id}.json").to_s
|
62
|
+
rescue RestClient::ResourceNotFound
|
63
|
+
false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def sign_upload(labfile, filename)
|
68
|
+
json_decode get("/api/upload/sign?type=protocol-pkg&group=#{labfile.options[:group]}&name=#{labfile.options[:name]}&filename=#{filename}&version=#{labfile.options[:version]}").to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
def upload_to_s3(path, signature)
|
72
|
+
conn = Faraday.new(:url => "https://#{signature["bucket"]}.s3.amazonaws.com") do |faraday|
|
73
|
+
faraday.request :multipart
|
74
|
+
faraday.request :url_encoded
|
75
|
+
faraday.adapter :net_http
|
76
|
+
end
|
77
|
+
res = conn.post "/", {
|
78
|
+
"key" => signature["key"],
|
79
|
+
"AWSAccessKeyId" => signature["access_key"],
|
80
|
+
"acl" => "private",
|
81
|
+
"success_action_status" => signature["success_action_status"],
|
82
|
+
"policy" => signature["policy"],
|
83
|
+
"signature" => signature["signature"],
|
84
|
+
"file" => Faraday::UploadIO.new(path, 'application/jar')
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_protocol(labfile)
|
89
|
+
begin
|
90
|
+
json_decode get("/api/protocols/#{labfile.options[:name]}").to_s
|
91
|
+
rescue RestClient::ResourceNotFound
|
92
|
+
false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_protocol(labfile)
|
97
|
+
json_decode post("/api/protocols", {
|
98
|
+
"protocol[name]" => labfile.options[:name],
|
99
|
+
"protocol[author_email]" => labfile.options[:email],
|
100
|
+
"protocol[author_name]" => labfile.options[:author],
|
101
|
+
"protocol[description]" => labfile.options[:description]
|
102
|
+
}).to_s
|
103
|
+
end
|
104
|
+
|
105
|
+
def update_protocol(labfile, signature)
|
106
|
+
payload = {
|
107
|
+
"protocol[name]" => labfile.options[:name],
|
108
|
+
"protocol[author_email]" => labfile.options[:email],
|
109
|
+
"protocol[author_name]" => labfile.options[:author],
|
110
|
+
"protocol[description]" => labfile.options[:description],
|
111
|
+
"protocol[package][key]" => signature["key"],
|
112
|
+
"protocol[package][version]" => labfile.options[:version],
|
113
|
+
"protocol[package][dependencies]" => labfile.dependencies.to_json
|
114
|
+
}
|
115
|
+
begin
|
116
|
+
json_decode put("/api/protocols/#{labfile.options[:name]}", payload).to_s
|
117
|
+
rescue RestClient::UnprocessableEntity => ex
|
118
|
+
json_decode ex.response.to_s
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def create_or_get_protocol(labfile, signature)
|
123
|
+
if not get_protocol(labfile)
|
124
|
+
create_protocol(labfile)
|
125
|
+
end
|
126
|
+
update_protocol(labfile, signature)
|
53
127
|
end
|
54
128
|
|
55
129
|
def create_run(fd, project_id)
|
@@ -60,10 +134,6 @@ class Transcriptic::Client
|
|
60
134
|
json_decode post("/api/runs", payload, { 'Content-Type' => 'application/zip; charset=UTF-8' }).to_s
|
61
135
|
end
|
62
136
|
|
63
|
-
def protocol(run_id)
|
64
|
-
Protocol.new(self, run_id)
|
65
|
-
end
|
66
|
-
|
67
137
|
def read_logs(run_id, options=[])
|
68
138
|
query = "&" + options.join("&") unless options.empty?
|
69
139
|
url = get("/api/runs/#{run_id}/logs.json?#{query}").to_s
|
@@ -96,73 +166,6 @@ class Transcriptic::Client
|
|
96
166
|
end
|
97
167
|
end
|
98
168
|
|
99
|
-
class ProtocolException < RuntimeError; end
|
100
|
-
|
101
|
-
class Protocol
|
102
|
-
attr_accessor :attached
|
103
|
-
|
104
|
-
def initialize(client, protocol)
|
105
|
-
@client = client
|
106
|
-
@protocol = protocol
|
107
|
-
end
|
108
|
-
|
109
|
-
# launch the protocol
|
110
|
-
def launch(command, attached = false)
|
111
|
-
@attached = attached
|
112
|
-
@response = @client.post(
|
113
|
-
"/api/runs/#{@app}/confirm",
|
114
|
-
command,
|
115
|
-
:content_type => 'application/json'
|
116
|
-
)
|
117
|
-
@next_chunk = @response.to_s
|
118
|
-
@interval = 0
|
119
|
-
self
|
120
|
-
rescue RestClient::RequestFailed => e
|
121
|
-
raise ProtocolException, e.http_body if e.http_code == 502
|
122
|
-
raise
|
123
|
-
end
|
124
|
-
|
125
|
-
# Does the service have any remaining output?
|
126
|
-
def end_of_stream?
|
127
|
-
@next_chunk.nil?
|
128
|
-
end
|
129
|
-
|
130
|
-
# Read the next chunk of output.
|
131
|
-
def read
|
132
|
-
chunk = @client.get(@next_chunk)
|
133
|
-
if chunk.headers[:location].nil? && chunk.code != 204
|
134
|
-
# no more chunks
|
135
|
-
@next_chunk = nil
|
136
|
-
chunk.to_s
|
137
|
-
elsif chunk.to_s == ''
|
138
|
-
# assume no content and back off
|
139
|
-
@interval = 2
|
140
|
-
''
|
141
|
-
elsif location = chunk.headers[:location]
|
142
|
-
# some data read and next chunk available
|
143
|
-
@next_chunk = location
|
144
|
-
@interval = 0
|
145
|
-
chunk.to_s
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
# Iterate over all output chunks until EOF is reached.
|
150
|
-
def each
|
151
|
-
until end_of_stream?
|
152
|
-
sleep(@interval)
|
153
|
-
output = read
|
154
|
-
yield output unless output.empty?
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
# All output as a string
|
159
|
-
def to_s
|
160
|
-
buf = []
|
161
|
-
each { |part| buf << part }
|
162
|
-
buf.join
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
169
|
def on_warning(&blk)
|
167
170
|
@warning_callback = blk
|
168
171
|
end
|
@@ -201,10 +204,10 @@ class Transcriptic::Client
|
|
201
204
|
response = resource(uri, resource_options, host).send(*args)
|
202
205
|
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError
|
203
206
|
host = URI.parse(realize_full_uri(uri, host)).host
|
204
|
-
error " ! Unable to connect to #{host}"
|
207
|
+
Transcriptic.ui.error " ! Unable to connect to #{host}"
|
205
208
|
rescue RestClient::SSLCertificateNotVerified => ex
|
206
209
|
host = URI.parse(realize_full_uri(uri, host)).host
|
207
|
-
error "WARNING: Unable to verify SSL certificate for #{host}\nTo disable SSL verification, run with TRANSCRIPTIC_SSL_VERIFY=disable"
|
210
|
+
Transcriptic.ui.error "WARNING: Unable to verify SSL certificate for #{host}\nTo disable SSL verification, run with TRANSCRIPTIC_SSL_VERIFY=disable"
|
208
211
|
end
|
209
212
|
|
210
213
|
extract_warning(response)
|
@@ -225,10 +228,10 @@ class Transcriptic::Client
|
|
225
228
|
|
226
229
|
def transcriptic_headers # :nodoc:
|
227
230
|
headers = {
|
228
|
-
'X-
|
229
|
-
'User-Agent'
|
230
|
-
'X-Ruby-Version'
|
231
|
-
'X-Ruby-Platform'
|
231
|
+
'X-API-Version' => '1',
|
232
|
+
'User-Agent' => self.class.gem_version_string,
|
233
|
+
'X-Ruby-Version' => RUBY_VERSION,
|
234
|
+
'X-Ruby-Platform' => RUBY_PLATFORM
|
232
235
|
}
|
233
236
|
headers = headers.merge({'Authorization' => "Token token=\"#{@api_key}\""}) if @api_key
|
234
237
|
headers
|
@@ -265,7 +268,7 @@ class Transcriptic::Client
|
|
265
268
|
def default_resource_options_for_uri(uri)
|
266
269
|
if ENV["TRANSCRIPTIC_SSL_VERIFY"] == "disable"
|
267
270
|
{}
|
268
|
-
elsif realize_full_uri(uri) =~ %r|^https://
|
271
|
+
elsif realize_full_uri(uri) =~ %r|^https://secure.transcriptic.com|
|
269
272
|
# OpenSSL::SSL::VERIFY_PEER
|
270
273
|
{ }
|
271
274
|
#{ :verify_ssl => OpenSSL::SSL::VERIFY_NONE, :ssl_ca_file => local_ca_file }
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Transcriptic
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
def running_on_windows?
|
5
|
+
RUBY_PLATFORM =~ /mswin32|mingw32/
|
6
|
+
end
|
7
|
+
|
8
|
+
def running_on_a_mac?
|
9
|
+
RUBY_PLATFORM =~ /-darwin\d/
|
10
|
+
end
|
11
|
+
|
12
|
+
def json_encode(object)
|
13
|
+
Transcriptic::OkJson.encode(object)
|
14
|
+
rescue Transcriptic::OkJson::Error
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def json_decode(json)
|
19
|
+
Transcriptic::OkJson.decode(json)
|
20
|
+
rescue Transcriptic::OkJson::Error
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/transcriptic/labfile.rb
CHANGED
@@ -4,9 +4,12 @@ module Transcriptic
|
|
4
4
|
class ProjectGenerator < BaseGenerator
|
5
5
|
|
6
6
|
argument :name
|
7
|
-
class_option :
|
7
|
+
class_option :group,
|
8
8
|
type: :string,
|
9
9
|
default: "org.autoprotocol.unclaimed"
|
10
|
+
class_option :version,
|
11
|
+
type: :string,
|
12
|
+
default: "1.0.0"
|
10
13
|
class_option :author,
|
11
14
|
type: :string,
|
12
15
|
default: "John Appleseed"
|
@@ -20,7 +23,8 @@ module Transcriptic
|
|
20
23
|
def generate
|
21
24
|
empty_directory target.join('app')
|
22
25
|
empty_directory target.join('project')
|
23
|
-
|
26
|
+
|
27
|
+
version
|
24
28
|
|
25
29
|
template 'app/Main.erb', target.join('app/Main.scala')
|
26
30
|
template 'project/Build.erb', target.join('project/Build.scala')
|
@@ -33,6 +37,11 @@ module Transcriptic
|
|
33
37
|
Transcriptic::DependenciesGenerator.new([File.join(Dir.pwd, name), []], options).invoke_all
|
34
38
|
end
|
35
39
|
|
40
|
+
def update_build_version(labfile)
|
41
|
+
@version = labfile.options[:version]
|
42
|
+
template 'project/Build.erb', target.join('project/Build.scala'), force: true
|
43
|
+
end
|
44
|
+
|
36
45
|
def autoprotocol_version
|
37
46
|
Transcriptic::AUTOPROTOCOL_VERSION
|
38
47
|
end
|
@@ -41,8 +50,12 @@ module Transcriptic
|
|
41
50
|
options[:description]
|
42
51
|
end
|
43
52
|
|
44
|
-
def
|
45
|
-
options[:
|
53
|
+
def group
|
54
|
+
options[:group]
|
55
|
+
end
|
56
|
+
|
57
|
+
def version
|
58
|
+
@version = options[:version]
|
46
59
|
end
|
47
60
|
|
48
61
|
def author
|
data/lib/transcriptic/sbt.rb
CHANGED
@@ -10,7 +10,18 @@ module Transcriptic
|
|
10
10
|
|
11
11
|
def stage
|
12
12
|
ensure_installed
|
13
|
-
sbt("
|
13
|
+
if sbt("package")
|
14
|
+
jars = Dir.glob("target/scala-2.10/*.jar")
|
15
|
+
if jars.length == 0
|
16
|
+
output_with_arrow "Couldn't find compiled package! Is your code in the right directory?"
|
17
|
+
false
|
18
|
+
elsif jars.length > 1
|
19
|
+
output_with_arrow "Multiple packages found: I'm unsure which one is correct. Try `transcriptic clean` and recompiling."
|
20
|
+
false
|
21
|
+
else
|
22
|
+
jars[0]
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
27
|
def update
|
@@ -18,6 +29,11 @@ module Transcriptic
|
|
18
29
|
sbt("update")
|
19
30
|
end
|
20
31
|
|
32
|
+
def clean
|
33
|
+
ensure_installed
|
34
|
+
sbt("clean")
|
35
|
+
end
|
36
|
+
|
21
37
|
private
|
22
38
|
def ensure_installed
|
23
39
|
stat = `which sbt`
|
@@ -1,42 +1,22 @@
|
|
1
|
+
// THIS FILE IS AUTOMATICALLY GENERATED.
|
2
|
+
// DO NOT EDIT THIS FILE. ALL CHANGES WILL BE LOST.
|
3
|
+
|
1
4
|
import sbt._
|
2
5
|
import Keys._
|
3
6
|
import com.typesafe.sbt.SbtStartScript
|
4
7
|
|
5
8
|
object BuildSettings {
|
6
|
-
val buildVersion = "
|
9
|
+
val buildVersion = "<%= @version %>"
|
7
10
|
val buildScalaVersion = "2.10.0"
|
8
11
|
|
9
12
|
val buildSettings = Defaults.defaultSettings ++ Seq (
|
10
13
|
version := buildVersion,
|
11
|
-
scalaVersion := buildScalaVersion
|
12
|
-
shellPrompt := ShellPrompt.buildShellPrompt
|
14
|
+
scalaVersion := buildScalaVersion
|
13
15
|
)
|
14
16
|
}
|
15
17
|
|
16
|
-
object ShellPrompt {
|
17
|
-
object devnull extends ProcessLogger {
|
18
|
-
def info (s: => String) {}
|
19
|
-
def error (s: => String) { }
|
20
|
-
def buffer[T] (f: => T): T = f
|
21
|
-
}
|
22
|
-
def currBranch = (
|
23
|
-
("git status -sb" lines_! devnull headOption)
|
24
|
-
getOrElse "-" stripPrefix "## "
|
25
|
-
)
|
26
|
-
|
27
|
-
val buildShellPrompt = {
|
28
|
-
(state: State) => {
|
29
|
-
val currProject = Project.extract (state).currentProject.id
|
30
|
-
"%s:%s:%s> ".format (
|
31
|
-
currProject, currBranch, BuildSettings.buildVersion
|
32
|
-
)
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
18
|
object Resolvers {
|
38
|
-
val transcriptic = "Transcriptic" at "
|
39
|
-
val autoprotocol = "Autoprotocol" at "http://transcriptic.s3.amazonaws.com/autoprotocol/"
|
19
|
+
val transcriptic = "Transcriptic" at "http://static.transcriptic.com/repo/"
|
40
20
|
val typesafe = "Typesafe" at "http://repo.typesafe.com/typesafe/releases/"
|
41
21
|
}
|
42
22
|
|
@@ -50,7 +30,7 @@ object AutoprotocolBuild extends Build {
|
|
50
30
|
file("."),
|
51
31
|
settings =
|
52
32
|
buildSettings ++ Seq (libraryDependencies ++= (Seq("org.autoprotocol" %% "autoprotocol-library" % "<%= autoprotocol_version %>") ++
|
53
|
-
dependencies), resolvers ++= Seq(transcriptic,
|
33
|
+
dependencies), resolvers ++= Seq(transcriptic, typesafe)) ++ Defaults.defaultSettings ++
|
54
34
|
SbtStartScript.startScriptForClassesSettings
|
55
35
|
) settings (
|
56
36
|
fork in run := true
|
@@ -1,3 +1,3 @@
|
|
1
|
-
resolvers +=
|
1
|
+
resolvers += "Transcriptic" at "http://static.transcriptic.com/repo/"
|
2
2
|
|
3
|
-
addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.8.0")
|
3
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.8.0-MAC-FIXED")
|
data/lib/transcriptic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transcriptic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Transcriptic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: faraday
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ~>
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: '0.9'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: '0.9'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: hashie
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,28 +170,28 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.5
|
173
|
+
version: '0.5'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ~>
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.5
|
180
|
+
version: '0.5'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: retryable
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 1.3
|
187
|
+
version: '1.3'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 1.3
|
194
|
+
version: '1.3'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: zipruby
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- lib/transcriptic/core_ext/string.rb
|
246
246
|
- lib/transcriptic/dependencies_generator.rb
|
247
247
|
- lib/transcriptic/errors.rb
|
248
|
+
- lib/transcriptic/helpers.rb
|
248
249
|
- lib/transcriptic/labfile.rb
|
249
250
|
- lib/transcriptic/project_generator.rb
|
250
251
|
- lib/transcriptic/sbt.rb
|