unipept 0.6.2 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 567da9af48d82125a8bb3d330d25ee0f51429833
4
- data.tar.gz: d176b5daec3dc2287fe453d3567d9d7ce86032e8
3
+ metadata.gz: 4e2985df7d45eb45a982bb73099e92c001155829
4
+ data.tar.gz: fc79cba4a15df4511af91a85eb9b09f7172b93e9
5
5
  SHA512:
6
- metadata.gz: e2ca1389cfd0bf5b341222aca4ac8c878b1928d2872ed8d6d2ea8440d2e2f7bb39b51fde803888721fcd85a3b03a3ce2848943348e14cb235556e4f692c2eacd
7
- data.tar.gz: 44e9af1dde7132c883fac6f95a0a6d2bf23bb8676f59ece0e51537ed8a101ab141c7056deca40aaee978d6273b557b8389b800cf40178d7d499b0adbc7110d74
6
+ metadata.gz: 9f0269ffa7a80d490ebf3e85a0a090f5ab89d2d8c75e9f4ca2e904a848ba155b8721d6a0d3fc28289ccab9cf931236074e9ab20d6a1a126a0ddd208cc1240222
7
+ data.tar.gz: 5381cafb81ac0c32a0f2475e51b0df439e886187ea296a52fb340507763740e4db63918e049434e926f0e360120e4f2609cfbbe80e57518b05be0d951d605637
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
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] if not sub_result.kind_of? Array
111
+ sub_result = [sub_result] unless sub_result.is_a? Array
111
112
 
112
- sub_result.map! {|r| r.select! {|k,v| filter_list.any? {|f| f.match k } } } if ! filter_list.empty?
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
- if ! sub_result.empty?
121
- if ! printed_header
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 "request timed out, continuing anyway, but results might be incomplete"
133
- save_error("request timed out, continuing anyway, but results might be incomplete")
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 "could not get an http response, continuing anyway, but results might be incomplete"
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.to_s}, continuing anyway, but results might be incomplete"
147
- save_error("Got #{resp.code.to_s}: #{resp.response_body}")
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, ".unipept", "unipept-#{Time.now.strftime("%F-%T")}.log"))
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, "w") do |f|
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}"
@@ -1,3 +1,3 @@
1
1
  module Unipept
2
- VERSION = File.read(File.join(File.dirname(__FILE__), "..", "..", "VERSION"))
2
+ VERSION = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).strip
3
3
  end
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.2 ruby lib
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.2"
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-04-30"
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.2
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-04-30 00:00:00.000000000 Z
13
+ date: 2015-05-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cri