transcriptic 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/transcriptic/api.rb +19 -10
- data/lib/transcriptic/client.rb +3 -32
- data/lib/transcriptic/command/data.rb +22 -1
- data/lib/transcriptic/command/help.rb +1 -1
- data/lib/transcriptic/command/run.rb +56 -2
- data/lib/transcriptic/helpers.rb +65 -0
- data/lib/transcriptic/version.rb +1 -1
- metadata +14 -20
- data/lib/transcriptic/api/sequences.rb +0 -33
- data/lib/transcriptic/command/analyze.rb +0 -12
- data/lib/transcriptic/command/history.rb +0 -8
- data/lib/transcriptic/command/keys.rb +0 -115
- data/lib/transcriptic/command/sequences.rb +0 -45
- data/lib/transcriptic/command/status.rb +0 -20
data/lib/transcriptic/api.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
require "base64"
|
2
|
+
require "excon"
|
3
|
+
require "securerandom"
|
4
|
+
require "uri"
|
5
|
+
require "zlib"
|
6
|
+
|
1
7
|
require "transcriptic/api/errors"
|
2
8
|
require "transcriptic/api/version"
|
3
9
|
|
4
|
-
require "transcriptic/api/sequences"
|
5
|
-
|
6
10
|
srand
|
7
11
|
|
8
12
|
module Transcriptic
|
@@ -14,17 +18,18 @@ module Transcriptic
|
|
14
18
|
options = {
|
15
19
|
:headers => {},
|
16
20
|
:host => 'transcriptic.com',
|
21
|
+
:nonblock => false,
|
17
22
|
:scheme => 'https'
|
18
23
|
}.merge(options)
|
19
24
|
options[:headers] = {
|
20
|
-
'Accept'
|
21
|
-
'Accept-Encoding'
|
22
|
-
'Accept-Language'
|
23
|
-
'Authorization'
|
24
|
-
'User-Agent'
|
25
|
-
'X-Transcriptic-API-Version' => '
|
26
|
-
'X-Ruby-Version'
|
27
|
-
'X-Ruby-Platform'
|
25
|
+
'Accept' => 'application/json',
|
26
|
+
'Accept-Encoding' => 'gzip',
|
27
|
+
'Accept-Language' => 'en-US, en;q=0.8',
|
28
|
+
'Authorization' => "Token token=\"#{@api_key}\"",
|
29
|
+
'User-Agent' => "transcriptic-cli/#{Transcriptic::API::VERSION}",
|
30
|
+
'X-Transcriptic-API-Version' => '1',
|
31
|
+
'X-Ruby-Version' => RUBY_VERSION,
|
32
|
+
'X-Ruby-Platform' => RUBY_PLATFORM
|
28
33
|
}.merge(options[:headers])
|
29
34
|
@connection = Excon.new("#{options[:scheme]}://#{options[:host]}", options)
|
30
35
|
end
|
@@ -69,5 +74,9 @@ module Transcriptic
|
|
69
74
|
response
|
70
75
|
end
|
71
76
|
|
77
|
+
def escape(string)
|
78
|
+
CGI.escape(string).gsub('.', '%2E')
|
79
|
+
end
|
80
|
+
|
72
81
|
end
|
73
82
|
end
|
data/lib/transcriptic/client.rb
CHANGED
@@ -41,25 +41,6 @@ class Transcriptic::Client
|
|
41
41
|
@host = host
|
42
42
|
end
|
43
43
|
|
44
|
-
def get_keys
|
45
|
-
json_decode get("/api/keys").to_s
|
46
|
-
end
|
47
|
-
|
48
|
-
# Add an ssh public key to the current user.
|
49
|
-
def add_key(key)
|
50
|
-
json_decode post("/api/keys", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s
|
51
|
-
end
|
52
|
-
|
53
|
-
# Remove an existing ssh public key from the current user.
|
54
|
-
def remove_key(key)
|
55
|
-
json_decode delete("/api/keys/#{escape(key)}").to_s
|
56
|
-
end
|
57
|
-
|
58
|
-
# Clear all keys on the current user.
|
59
|
-
def remove_all_keys
|
60
|
-
json_decode delete("/api/keys").to_s
|
61
|
-
end
|
62
|
-
|
63
44
|
# Get a list of stacks available to the app, with the current one marked.
|
64
45
|
def list_stacks(app_name, options={})
|
65
46
|
include_deprecated = options.delete(:include_deprecated) || false
|
@@ -86,16 +67,6 @@ class Transcriptic::Client
|
|
86
67
|
json_decode resource("/organizations").get(:accept => 'application/json').to_s
|
87
68
|
end
|
88
69
|
|
89
|
-
# Add an ssh public key to the current user.
|
90
|
-
def add_sequence(organization, sequence)
|
91
|
-
post("/#{organization}/sequences", sequence, { 'Content-Type' => 'text/ssh-authkey' }).to_s
|
92
|
-
end
|
93
|
-
|
94
|
-
# Remove an existing ssh public key from the current user.
|
95
|
-
def remove_sequence(organization, sequence)
|
96
|
-
delete("/#{organization}/sequences/#{escape(key)}").to_s
|
97
|
-
end
|
98
|
-
|
99
70
|
class Protocol
|
100
71
|
attr_accessor :attached, :upid
|
101
72
|
|
@@ -163,7 +134,7 @@ class Transcriptic::Client
|
|
163
134
|
end
|
164
135
|
|
165
136
|
def status(run_id)
|
166
|
-
json_decode
|
137
|
+
json_decode get("/api/runs/#{run_id}").to_s
|
167
138
|
end
|
168
139
|
|
169
140
|
def create_run(fd)
|
@@ -177,7 +148,7 @@ class Transcriptic::Client
|
|
177
148
|
|
178
149
|
def read_logs(run_id, options=[])
|
179
150
|
query = "&" + options.join("&") unless options.empty?
|
180
|
-
url = get("/runs/#{run_id}/logs?#{query}").to_s
|
151
|
+
url = get("/api/runs/#{run_id}/logs?#{query}").to_s
|
181
152
|
uri = URI.parse(url);
|
182
153
|
http = Net::HTTP.new(uri.host, uri.port)
|
183
154
|
|
@@ -305,7 +276,7 @@ class Transcriptic::Client
|
|
305
276
|
def default_resource_options_for_uri(uri)
|
306
277
|
if ENV["TRANSCRIPTIC_SSL_VERIFY"] == "disable"
|
307
278
|
{}
|
308
|
-
elsif realize_full_uri(uri) =~ %r|^https://transcriptic.com|
|
279
|
+
elsif realize_full_uri(uri) =~ %r|^https://www.transcriptic.com|
|
309
280
|
# OpenSSL::SSL::VERIFY_PEER
|
310
281
|
{ }
|
311
282
|
#{ :verify_ssl => OpenSSL::SSL::VERIFY_NONE, :ssl_ca_file => local_ca_file }
|
@@ -3,6 +3,27 @@ module Transcriptic::Command
|
|
3
3
|
# manage experimental data sets
|
4
4
|
#
|
5
5
|
class Data < Base
|
6
|
-
|
6
|
+
|
7
|
+
# data RUNID
|
8
|
+
#
|
9
|
+
# list available datasets for RUNID
|
10
|
+
#
|
11
|
+
def index
|
12
|
+
end
|
13
|
+
|
14
|
+
# transcriptic data:download DATASETID
|
15
|
+
#
|
16
|
+
# download the dataset identified by DATASETID
|
17
|
+
#
|
18
|
+
def download
|
19
|
+
end
|
20
|
+
|
21
|
+
# transcriptic data:delete DATASETID
|
22
|
+
#
|
23
|
+
# delete the dataset identified by DATASETID
|
24
|
+
#
|
25
|
+
def delete
|
26
|
+
end
|
27
|
+
|
7
28
|
end
|
8
29
|
end
|
@@ -7,24 +7,78 @@ module Transcriptic::Command
|
|
7
7
|
#
|
8
8
|
class Run < Base
|
9
9
|
|
10
|
-
#
|
10
|
+
# run [FILENAME|DIRECTORY]
|
11
11
|
#
|
12
12
|
# upload FILENAME or DIRECTORY and launch it
|
13
13
|
#
|
14
14
|
def index
|
15
15
|
path = args.shift
|
16
16
|
fd = create_protocol_fd_for_path(path)
|
17
|
+
if 1 == fd
|
18
|
+
error "Couldn't create run!"
|
19
|
+
end
|
17
20
|
display "Uploading `#{path}` to Transcriptic..."
|
18
21
|
run_id = transcriptic.create_run(fd)["run_id"]
|
19
22
|
display "Run launched (#{run_id})"
|
20
23
|
end
|
21
24
|
|
25
|
+
# transcriptic run:analyze [FILENAME|DIRECTORY]
|
26
|
+
#
|
27
|
+
# upload FILENAME or DIRECTORY and analyze it
|
28
|
+
#
|
29
|
+
def analyze
|
30
|
+
path = args.shift
|
31
|
+
end
|
32
|
+
|
33
|
+
# transcriptic run:status [RUNID]
|
34
|
+
#
|
35
|
+
# show details of RUNID
|
36
|
+
#
|
37
|
+
def status
|
38
|
+
run_id = args.shift
|
39
|
+
if run_id.nil?
|
40
|
+
error("Usage: transcriptic status RUNID\nMust specify RUNID to get run status.")
|
41
|
+
end
|
42
|
+
ret = transcriptic.status(run_id)
|
43
|
+
if ret.nil?
|
44
|
+
error("#{run_id} not found for #{transcriptic.user}")
|
45
|
+
return
|
46
|
+
end
|
47
|
+
display(ret.inspect)
|
48
|
+
end
|
49
|
+
|
50
|
+
# transcriptic run:list
|
51
|
+
#
|
52
|
+
# list active runs
|
53
|
+
#
|
54
|
+
def list
|
55
|
+
ret = transcriptic.list
|
56
|
+
if ret.empty?
|
57
|
+
error("No runs for #{transcriptic.user}")
|
58
|
+
return
|
59
|
+
end
|
60
|
+
display("Runs:")
|
61
|
+
ret.each do |run|
|
62
|
+
display " #{run.name}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# transcriptic run:logs RUNID
|
67
|
+
#
|
68
|
+
# get log data for RUNID
|
69
|
+
#
|
70
|
+
def logs
|
71
|
+
run_id = args.shift
|
72
|
+
transcriptic.read_logs(run_id)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
22
76
|
def create_protocol_fd_for_path(path)
|
23
77
|
begin
|
24
78
|
stat = File.stat(path)
|
25
79
|
rescue
|
26
80
|
display "No such path: #{path}"
|
27
|
-
return
|
81
|
+
return 1
|
28
82
|
end
|
29
83
|
upfile = Tempfile.new('protocol')
|
30
84
|
if stat.directory?
|
data/lib/transcriptic/helpers.rb
CHANGED
@@ -32,6 +32,16 @@ module Transcriptic
|
|
32
32
|
display
|
33
33
|
end
|
34
34
|
|
35
|
+
def format_with_bang(message)
|
36
|
+
return '' if message.to_s.strip == ""
|
37
|
+
" ! " + message.split("\n").join("\n ! ")
|
38
|
+
end
|
39
|
+
|
40
|
+
def output_with_bang(message="", new_line=true)
|
41
|
+
return if message.to_s.strip == ""
|
42
|
+
display(format_with_bang(message), new_line)
|
43
|
+
end
|
44
|
+
|
35
45
|
def error(msg)
|
36
46
|
STDERR.puts(msg)
|
37
47
|
exit 1
|
@@ -275,6 +285,61 @@ module Transcriptic
|
|
275
285
|
end
|
276
286
|
end
|
277
287
|
end
|
288
|
+
|
289
|
+
def string_distance(first, last)
|
290
|
+
distances = [] # 0x0s
|
291
|
+
0.upto(first.length) do |index|
|
292
|
+
distances << [index] + [0] * last.length
|
293
|
+
end
|
294
|
+
distances[0] = 0.upto(last.length).to_a
|
295
|
+
1.upto(last.length) do |last_index|
|
296
|
+
1.upto(first.length) do |first_index|
|
297
|
+
first_char = first[first_index - 1, 1]
|
298
|
+
last_char = last[last_index - 1, 1]
|
299
|
+
if first_char == last_char
|
300
|
+
distances[first_index][last_index] = distances[first_index - 1][last_index - 1] # noop
|
301
|
+
else
|
302
|
+
distances[first_index][last_index] = [
|
303
|
+
distances[first_index - 1][last_index], # deletion
|
304
|
+
distances[first_index][last_index - 1], # insertion
|
305
|
+
distances[first_index - 1][last_index - 1] # substitution
|
306
|
+
].min + 1 # cost
|
307
|
+
if first_index > 1 && last_index > 1
|
308
|
+
first_previous_char = first[first_index - 2, 1]
|
309
|
+
last_previous_char = last[last_index - 2, 1]
|
310
|
+
if first_char == last_previous_char && first_previous_char == last_char
|
311
|
+
distances[first_index][last_index] = [
|
312
|
+
distances[first_index][last_index],
|
313
|
+
distances[first_index - 2][last_index - 2] + 1 # transposition
|
314
|
+
].min
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
distances[first.length][last.length]
|
321
|
+
end
|
322
|
+
|
323
|
+
def suggestion(actual, possibilities)
|
324
|
+
distances = Hash.new {|hash,key| hash[key] = []}
|
325
|
+
|
326
|
+
possibilities.each do |suggestion|
|
327
|
+
distances[string_distance(actual, suggestion)] << suggestion
|
328
|
+
end
|
329
|
+
|
330
|
+
minimum_distance = distances.keys.min
|
331
|
+
if minimum_distance < 4
|
332
|
+
suggestions = distances[minimum_distance].sort
|
333
|
+
if suggestions.length == 1
|
334
|
+
"Perhaps you meant `#{suggestions.first}`."
|
335
|
+
else
|
336
|
+
"Perhaps you meant #{suggestions[0...-1].map {|suggestion| "`#{suggestion}`"}.join(', ')} or `#{suggestions.last}`."
|
337
|
+
end
|
338
|
+
else
|
339
|
+
nil
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
278
343
|
end
|
279
344
|
end
|
280
345
|
|
data/lib/transcriptic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transcriptic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thrift
|
16
|
-
requirement: &
|
16
|
+
requirement: &70351850156680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.8'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70351850156680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: netrc
|
27
|
-
requirement: &
|
27
|
+
requirement: &70351850156180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.7.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70351850156180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rest-client
|
38
|
-
requirement: &
|
38
|
+
requirement: &70351850155720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70351850155720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: launchy
|
49
|
-
requirement: &
|
49
|
+
requirement: &70351850155260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.3.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70351850155260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: zipruby
|
60
|
-
requirement: &
|
60
|
+
requirement: &70351850154880 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70351850154880
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: multipart-post
|
71
|
-
requirement: &
|
71
|
+
requirement: &70351850154420 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70351850154420
|
80
80
|
description: Client library and command-line tool to work with Transcriptic Platform.
|
81
81
|
email: support@transcriptic.com
|
82
82
|
executables:
|
@@ -87,23 +87,17 @@ files:
|
|
87
87
|
- lib/transcriptic.rb
|
88
88
|
- lib/transcriptic/api.rb
|
89
89
|
- lib/transcriptic/api/errors.rb
|
90
|
-
- lib/transcriptic/api/sequences.rb
|
91
90
|
- lib/transcriptic/api/version.rb
|
92
91
|
- lib/transcriptic/auth.rb
|
93
92
|
- lib/transcriptic/cli.rb
|
94
93
|
- lib/transcriptic/client.rb
|
95
94
|
- lib/transcriptic/command.rb
|
96
|
-
- lib/transcriptic/command/analyze.rb
|
97
95
|
- lib/transcriptic/command/base.rb
|
98
96
|
- lib/transcriptic/command/console.rb
|
99
97
|
- lib/transcriptic/command/data.rb
|
100
98
|
- lib/transcriptic/command/help.rb
|
101
|
-
- lib/transcriptic/command/history.rb
|
102
|
-
- lib/transcriptic/command/keys.rb
|
103
99
|
- lib/transcriptic/command/login.rb
|
104
100
|
- lib/transcriptic/command/run.rb
|
105
|
-
- lib/transcriptic/command/sequences.rb
|
106
|
-
- lib/transcriptic/command/status.rb
|
107
101
|
- lib/transcriptic/helpers.rb
|
108
102
|
- lib/transcriptic/version.rb
|
109
103
|
- lib/vendor/transcriptic/okjson.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Transcriptic
|
2
|
-
class API
|
3
|
-
|
4
|
-
# DELETE /:organization/sequences/:sequence
|
5
|
-
def delete_sequence(organization, sequence)
|
6
|
-
request(
|
7
|
-
:expects => 200,
|
8
|
-
:method => :delete,
|
9
|
-
:path => "/#{organization}/sequences/#{sequence}"
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /:organization/sequences
|
14
|
-
def get_sequences(organization)
|
15
|
-
request(
|
16
|
-
:expects => 200,
|
17
|
-
:method => :get,
|
18
|
-
:path => "/#{organization}/sequences"
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
# POST /:organization/sequences
|
23
|
-
def post_domain(organization, sequence)
|
24
|
-
request(
|
25
|
-
:expects => 201,
|
26
|
-
:method => :post,
|
27
|
-
:path => "/#{organization}/sequences",
|
28
|
-
:query => {'sequence' => sequence}
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
require "transcriptic/command/base"
|
2
|
-
|
3
|
-
module Transcriptic::Command
|
4
|
-
|
5
|
-
# manage authentication keys
|
6
|
-
#
|
7
|
-
class Keys < Base
|
8
|
-
|
9
|
-
# keys
|
10
|
-
#
|
11
|
-
# display keys for the current user
|
12
|
-
#
|
13
|
-
# -l, --long # display extended information for each key
|
14
|
-
#
|
15
|
-
#Examples:
|
16
|
-
#
|
17
|
-
# $ transcriptic keys
|
18
|
-
# === email@example.com Keys
|
19
|
-
# ssh-rsa ABCDEFGHIJK...OPQRSTUV== email@example.com
|
20
|
-
#
|
21
|
-
# $ transcriptic keys --long
|
22
|
-
# === email@example.com Keys
|
23
|
-
# ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAp9AJD5QABmOcrkHm6SINuQkDefaR0MUrfgZ1Pxir3a4fM1fwa00dsUwbUaRuR7FEFD8n1E9WwDf8SwQTHtyZsJg09G9myNqUzkYXCmydN7oGr5IdVhRyv5ixcdiE0hj7dRnOJg2poSQ3Qi+Ka8SVJzF7nIw1YhuicHPSbNIFKi5s0D5a+nZb/E6MNGvhxoFCQX2IcNxaJMqhzy1ESwlixz45aT72mXYq0LIxTTpoTqma1HuKdRY8HxoREiivjmMQulYP+CxXFcMyV9kxTKIUZ/FXqlC6G5vSm3J4YScSatPOj9ID5HowpdlIx8F6y4p1/28r2tTl4CY40FFyoke4MQ== email@example.com
|
24
|
-
#
|
25
|
-
def index
|
26
|
-
validate_arguments!
|
27
|
-
keys = transcriptic.get_keys
|
28
|
-
if keys.length > 0
|
29
|
-
display("#{Transcriptic::Auth.user} Keys")
|
30
|
-
keys = if options[:long]
|
31
|
-
keys.map {|key| key["contents"].strip}
|
32
|
-
else
|
33
|
-
keys.map {|key| format_key_for_display(key["contents"])}
|
34
|
-
end
|
35
|
-
styled_array(keys)
|
36
|
-
else
|
37
|
-
display("You have no keys.")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# keys:add [KEY]
|
42
|
-
#
|
43
|
-
# add a key for the current user
|
44
|
-
#
|
45
|
-
# if no KEY is specified, will try to find ~/.ssh/id_[rd]sa.pub
|
46
|
-
#
|
47
|
-
#Examples:
|
48
|
-
#
|
49
|
-
# $ transcriptic keys:add
|
50
|
-
# Could not find an existing public key.
|
51
|
-
# Would you like to generate one? [Yn] y
|
52
|
-
# Generating new SSH public key.
|
53
|
-
# Uploading SSH public key /.ssh/id_rsa.pub... done
|
54
|
-
#
|
55
|
-
# $ transcriptic keys:add /my/key.pub
|
56
|
-
# Uploading SSH public key /my/key.pub... done
|
57
|
-
#
|
58
|
-
def add
|
59
|
-
keyfile = shift_argument
|
60
|
-
validate_arguments!
|
61
|
-
|
62
|
-
if keyfile
|
63
|
-
Transcriptic::Auth.associate_key(keyfile)
|
64
|
-
else
|
65
|
-
# make sure we have credentials
|
66
|
-
Transcriptic::Auth.get_credentials
|
67
|
-
Transcriptic::Auth.associate_or_generate_ssh_key
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# keys:remove KEY
|
72
|
-
#
|
73
|
-
# remove a key from the current user
|
74
|
-
#
|
75
|
-
#Examples:
|
76
|
-
#
|
77
|
-
# $ transcriptic keys:remove email@example.com
|
78
|
-
# Removing email@example.com SSH key... done
|
79
|
-
#
|
80
|
-
def remove
|
81
|
-
key = shift_argument
|
82
|
-
if key.nil? || key.empty?
|
83
|
-
error("Usage: transcriptic keys:remove KEY\nMust specify KEY to remove.")
|
84
|
-
end
|
85
|
-
validate_arguments!
|
86
|
-
|
87
|
-
action("Removing #{key} SSH key") do
|
88
|
-
api.delete_key(key)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# keys:clear
|
93
|
-
#
|
94
|
-
# remove all authentication keys from the current user
|
95
|
-
#
|
96
|
-
#Examples:
|
97
|
-
#
|
98
|
-
# $ transcriptic keys:cleare
|
99
|
-
# Removing all SSH keys... done
|
100
|
-
#
|
101
|
-
def clear
|
102
|
-
validate_arguments!
|
103
|
-
|
104
|
-
action("Removing all SSH keys") do
|
105
|
-
api.delete_keys
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
protected
|
110
|
-
def format_key_for_display(key)
|
111
|
-
type, hex, local = key.strip.split(/\s/)
|
112
|
-
[type, hex[0,10] + '...' + hex[-10,10], local].join(' ')
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Transcriptic::Command
|
2
|
-
|
3
|
-
# manage sequence data
|
4
|
-
#
|
5
|
-
class Sequences < Base
|
6
|
-
|
7
|
-
# sequences
|
8
|
-
#
|
9
|
-
# list all sequence entries
|
10
|
-
#
|
11
|
-
#Examples:
|
12
|
-
#
|
13
|
-
# $ transcriptic sequences
|
14
|
-
# ...
|
15
|
-
#
|
16
|
-
def index
|
17
|
-
validate_arguments!
|
18
|
-
end
|
19
|
-
|
20
|
-
# sequences:add FILENAME.EXT
|
21
|
-
#
|
22
|
-
# upload new sequence data file. EXT must be .gb or .fasta
|
23
|
-
#
|
24
|
-
#Examples:
|
25
|
-
#
|
26
|
-
# $ transcriptic sequences:add myvector.fasta
|
27
|
-
# ...
|
28
|
-
#
|
29
|
-
def add
|
30
|
-
end
|
31
|
-
|
32
|
-
# sequences:delete NAME
|
33
|
-
#
|
34
|
-
# delete sequence by name NAME
|
35
|
-
#
|
36
|
-
#Examples:
|
37
|
-
#
|
38
|
-
# $ transcriptic sequences:delete myvector20110204
|
39
|
-
# ...
|
40
|
-
#
|
41
|
-
def remove
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Transcriptic::Command
|
2
|
-
|
3
|
-
# view the status of your runs
|
4
|
-
#
|
5
|
-
class Status < Base
|
6
|
-
|
7
|
-
# transcriptic status [RUNID]
|
8
|
-
#
|
9
|
-
# list active runs, or if RUNID supplied, show details of that run
|
10
|
-
#
|
11
|
-
def index
|
12
|
-
run_id = args.shift
|
13
|
-
if run_id.nil?
|
14
|
-
error("Usage: transcriptic status RUNID\nMust specify RUNID to get run status.")
|
15
|
-
end
|
16
|
-
puts run_id
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|