unipept 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/unipept/commands/api_runner.rb +15 -15
- data/lib/unipept/version.rb +1 -1
- data/unipept.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e2985df7d45eb45a982bb73099e92c001155829
|
4
|
+
data.tar.gz: fc79cba4a15df4511af91a85eb9b09f7172b93e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f0269ffa7a80d490ebf3e85a0a090f5ab89d2d8c75e9f4ca2e904a848ba155b8721d6a0d3fc28289ccab9cf931236074e9ab20d6a1a126a0ddd208cc1240222
|
7
|
+
data.tar.gz: 5381cafb81ac0c32a0f2475e51b0df439e886187ea296a52fb340507763740e4db63918e049434e926f0e360120e4f2609cfbbe80e57518b05be0d951d605637
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.4
|
@@ -6,9 +6,10 @@ module Unipept::Commands
|
|
6
6
|
def initialize(args, opts, cmd)
|
7
7
|
super
|
8
8
|
@configuration = Unipept::Configuration.new
|
9
|
-
|
10
9
|
set_configuration
|
11
10
|
|
11
|
+
@user_agent = "Unipept CLI - unipept " + Unipept::VERSION
|
12
|
+
|
12
13
|
@url = "#{@host}/api/v1/#{cmd.name}.json"
|
13
14
|
@message_url = "#{@host}/api/v1/messages.json"
|
14
15
|
end
|
@@ -100,16 +101,16 @@ module Unipept::Commands
|
|
100
101
|
@url,
|
101
102
|
method: :post,
|
102
103
|
body: url_options(sub_division),
|
103
|
-
accept_encoding: "gzip"
|
104
|
+
accept_encoding: "gzip",
|
105
|
+
headers: {"User-Agent" => @user_agent}
|
104
106
|
)
|
105
107
|
request.on_complete do |resp|
|
106
|
-
|
107
108
|
if resp.success?
|
108
109
|
# if JSON parsing goes wrong
|
109
110
|
sub_result = JSON[resp.response_body] rescue []
|
110
|
-
sub_result = [sub_result]
|
111
|
+
sub_result = [sub_result] unless sub_result.is_a? Array
|
111
112
|
|
112
|
-
sub_result.map! {|r| r.select! {|k,
|
113
|
+
sub_result.map! { |r| r.select! { |k, _v| filter_list.any? { |f| f.match k } } } unless filter_list.empty?
|
113
114
|
|
114
115
|
if options[:xml]
|
115
116
|
result << sub_result
|
@@ -117,8 +118,8 @@ module Unipept::Commands
|
|
117
118
|
|
118
119
|
# wait till it's our turn to write
|
119
120
|
batch_order.wait(i) do
|
120
|
-
|
121
|
-
|
121
|
+
unless sub_result.empty?
|
122
|
+
unless printed_header
|
122
123
|
write_to_output formatter.header(sub_result, fasta_input)
|
123
124
|
printed_header = true
|
124
125
|
end
|
@@ -129,26 +130,25 @@ module Unipept::Commands
|
|
129
130
|
elsif resp.timed_out?
|
130
131
|
|
131
132
|
batch_order.wait(i) do
|
132
|
-
$stderr.puts
|
133
|
-
save_error(
|
133
|
+
$stderr.puts 'request timed out, continuing anyway, but results might be incomplete'
|
134
|
+
save_error('request timed out, continuing anyway, but results might be incomplete')
|
134
135
|
end
|
135
136
|
|
136
137
|
elsif resp.code == 0
|
137
138
|
|
138
139
|
batch_order.wait(i) do
|
139
|
-
$stderr.puts
|
140
|
+
$stderr.puts 'could not get an http response, continuing anyway, but results might be incomplete'
|
140
141
|
save_error(resp.return_message)
|
141
142
|
end
|
142
143
|
|
143
144
|
else
|
144
145
|
|
145
146
|
batch_order.wait(i) do
|
146
|
-
$stderr.puts "received a non-successful http response #{resp.code
|
147
|
-
save_error("Got #{resp.code
|
147
|
+
$stderr.puts "received a non-successful http response #{resp.code}, continuing anyway, but results might be incomplete"
|
148
|
+
save_error("Got #{resp.code}: #{resp.response_body}\nRequest headers: #{resp.request.options}\nRequest body:\n#{resp.request.encoded_body}\n\n")
|
148
149
|
end
|
149
150
|
|
150
151
|
end
|
151
|
-
|
152
152
|
end
|
153
153
|
|
154
154
|
hydra.queue request
|
@@ -171,9 +171,9 @@ module Unipept::Commands
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def save_error(message)
|
174
|
-
path = File.expand_path(File.join(Dir.home,
|
174
|
+
path = File.expand_path(File.join(Dir.home, '.unipept', "unipept-#{Time.now.strftime('%F-%T')}.log"))
|
175
175
|
FileUtils.mkdir_p File.dirname(path)
|
176
|
-
File.open(path,
|
176
|
+
File.open(path, 'w') do |f|
|
177
177
|
f.write message
|
178
178
|
end
|
179
179
|
$stderr.puts "API request failed! log can be found in #{path}"
|
data/lib/unipept/version.rb
CHANGED
data/unipept.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: unipept 0.6.
|
5
|
+
# stub: unipept 0.6.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "unipept"
|
9
|
-
s.version = "0.6.
|
9
|
+
s.version = "0.6.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Toon Willems", "Bart Mesuere", "Tom Naessens"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-05-17"
|
15
15
|
s.description = "Command line interface to Unipept web services."
|
16
16
|
s.email = "unipept@ugent.be"
|
17
17
|
s.executables = ["unipept", "prot2pept", "peptfilter", "uniprot"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unipept
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toon Willems
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cri
|