tes-request 0.7 → 0.8

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: 89839601d142aa5d07bd69406f75c8153be12eed
4
- data.tar.gz: fa0941f0453aa1042ab1b942456c669105c6a763
3
+ metadata.gz: 7dd957de5812e55a337c9b095dffa7ad80a64a98
4
+ data.tar.gz: 8ac21c83d116729acb7999adc568a4abbcd09a84
5
5
  SHA512:
6
- metadata.gz: 741905dc2c94dca2dbefad1d6e2c4cfe829253854aaa9159d4bc573f050bc82f87106aac86458e9fea989c8eb084b395668bed377bee3422aac151fd9844574f
7
- data.tar.gz: d0d67cf2a7e9623765d2368a9dfbd34581a0e68820b67ed7fb5f9e8c94c9610aeb1f1b53cabf24526a02cf5f2185ddfdab0c9503ec90d7f548a3364e4889ed95
6
+ metadata.gz: 737463005aaaf4908a45fdbce18a78e0720013264e4f8a5d6bb59ddf9fc0598ff9daa4a53cef5a9d79c2a3b1a52e3900656446d34f477d18776f8b5569019196
7
+ data.tar.gz: 7ff8fe4b8e42967fd1eec73dd4b1e677c5f68179abc6ec555cfd976edc75002a9741ed885fbf6a598b1d73bfd287e1f072389040f94ed8c20c636470679b6145
data/CODE_OF_CONDUCT.md CHANGED
@@ -35,7 +35,7 @@ This code of conduct applies both within project spaces and in public spaces
35
35
  when an individual is representing the project or its community.
36
36
 
37
37
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at 51085@sangfor.com. All
38
+ reported by contacting a project maintainer at wuhuizuo@126.com. All
39
39
  complaints will be reviewed and investigated and will result in a response that
40
40
  is deemed necessary and appropriate to the circumstances. Maintainers are
41
41
  obligated to maintain confidentiality with regard to the reporter of an
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tes::Request
2
2
 
3
- [![Build Status](https://travis-ci.org/sangfor-vtt/tes-request.svg)](https://travis-ci.org/sangfor-vtt/tes-request)
3
+ [![Build Status](https://travis-ci.org/NightProgrammers/tes-request.svg)](https://travis-ci.org/NightProgrammers/tes-request)
4
4
  [![Gem Version](https://badge.fury.io/rb/tes-request.svg)](https://rubygems.org/gems/tes-request)
5
5
 
6
6
  TES(Test Env Service) request profile struct, manager lib and request tools
@@ -86,7 +86,7 @@ $ tes-client
86
86
 
87
87
  ## Contributing
88
88
 
89
- Bug reports and pull requests are welcome on GitHub at https://github.com/sangfor-vtt/tes-request.
89
+ Bug reports and pull requests are welcome on GitHub at https://github.com/NightProgrammers/tes-request.
90
90
  This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
91
91
 
92
92
  ## License
@@ -24,7 +24,7 @@ module Tes
24
24
  # @param [Array<String>] asks
25
25
  # @return [Hash]
26
26
  def request_env(user, asks)
27
- res = @driver.post('/env', body: {user: user, ask: asks.join("\n")}.to_json)
27
+ res = @driver.post('env', body: {user: user, ask: asks.join("\n")}.to_json)
28
28
  ret = parse_res res
29
29
 
30
30
  if ret.is_a?(Hash) and
@@ -32,7 +32,7 @@ module Tes
32
32
  ret[:data].is_a?(Hash) and
33
33
  ret[:data][:res].is_a?(Hash)
34
34
  res_hash = ret[:data][:res]
35
- res_hash.keys.each { |k| res_hash[k.to_s] = res_hash.delete(k) }
35
+ res_hash.keys.each {|k| res_hash[k.to_s] = res_hash.delete(k)}
36
36
  ret[:data][:res] = res_hash
37
37
  end
38
38
 
@@ -42,19 +42,19 @@ module Tes
42
42
  # @param [String] id resource id
43
43
  # @param [String] user lock/using username
44
44
  # @param [1,0] lock need lock? `false` == shared using
45
- def request_res(id, user, lock=1)
46
- res = @driver.post("/res/#{id}/lock", body: {user: user, lock: lock})
45
+ def request_res(id, user, lock = 1)
46
+ res = @driver.post("res/#{id}/lock", body: {user: user, lock: lock})
47
47
  parse_res res
48
48
  end
49
49
 
50
50
  def release_res(id, user)
51
- res = @driver.post("/res/#{id}/release", body: {user: user})
51
+ res = @driver.post("res/#{id}/release", body: {user: user})
52
52
  parse_res res
53
53
  end
54
54
 
55
55
  def release_all_res(user)
56
- res_list = parse_res @driver.get('/res')
57
- res_list[:data].select { |_k, c| c[:users] && c[:users].include?(user) }.each do |id, _c|
56
+ res_list = parse_res @driver.get('res')
57
+ res_list[:data].select {|_k, c| c[:users] && c[:users].include?(user)}.each do |id, _c|
58
58
  release_res(id, user)
59
59
  end
60
60
  end
@@ -66,7 +66,7 @@ module Tes
66
66
  raise(fail_msg)
67
67
  else
68
68
  res_body = res.body
69
- if res.http_header['Content-Type'].any? { |h| h =~ /application\/json/i }
69
+ if res.http_header['Content-Type'].any? {|h| h =~ /application\/json/i}
70
70
  res_body = JSON.parse(res_body, :symbolize_names => true) rescue res_body
71
71
  end
72
72
  res_body
@@ -75,7 +75,7 @@ module Tes
75
75
  end
76
76
 
77
77
  class ClientBin
78
- def self.exit_usage(program, exit_code=2)
78
+ def self.exit_usage(program, exit_code = 2)
79
79
  puts <<EOF
80
80
  Usage:
81
81
  % #{program} {TesWebUrl} {User} request_res {ResourceId} [1|0] # Request Specified Resource
@@ -88,7 +88,7 @@ EOF
88
88
 
89
89
  def initialize(tes_url, user)
90
90
  driver = HTTPClient.new(base_url: tes_url)
91
- driver.ssl_config.verify_mode= OpenSSL::SSL::VERIFY_NONE
91
+ driver.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
92
92
  @client = Client.new(driver)
93
93
  @user = user
94
94
  end
@@ -117,7 +117,7 @@ EOF
117
117
  end
118
118
  end
119
119
 
120
- def request_res(res_id, lock=0)
120
+ def request_res(res_id, lock = 0)
121
121
  ret = @client.request_res(res_id, @user, lock)
122
122
 
123
123
  msg_suffix = "Request resource:(id: #{res_id}, user: #{@user}, lock: #{lock})."
@@ -135,11 +135,11 @@ EOF
135
135
  ret[:success]
136
136
  end
137
137
 
138
- def release_pool(saved_env_file=nil)
138
+ def release_pool(saved_env_file = nil)
139
139
  if saved_env_file and File.exists?(saved_env_file)
140
140
  env_pool_info = YAML.load_file(saved_env_file)
141
141
  locks = env_pool_info[:lockes]
142
- locks.each { |lock| @client.release_res(lock, @user) } if locks
142
+ locks.each {|lock| @client.release_res(lock, @user)} if locks
143
143
  puts "[Info] Release env done(user: #{@user}, file: #{saved_env_file})."
144
144
  else
145
145
  @client.release_all_res(@user)
@@ -150,7 +150,7 @@ EOF
150
150
  end
151
151
 
152
152
  # request env pool
153
- def request_pool(profile_file, save_file, timeout_secs=0)
153
+ def request_pool(profile_file, save_file, timeout_secs = 0)
154
154
  File.exists?(profile_file) || raise(ArgumentError, "[ ER ] File not found:#{profile_file}")
155
155
 
156
156
  asks = File.readlines(profile_file).map!(&:strip).compact
@@ -1,5 +1,5 @@
1
1
  module Tes
2
2
  module Request
3
- VERSION = '0.7'
3
+ VERSION = '0.8'
4
4
  end
5
5
  end
data/tes-request.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Request libs and bins for TES(Test Env Service)}
13
13
  spec.description = %q{Provide Tes-Client, Tes-Provider to use public Logic and data struct}
14
- spec.homepage = 'https://github.com/wuhuizuo/tes-request'
14
+ spec.homepage = 'https://github.com/NightProgrammers/tes-request'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tes-request
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - wuhuizuo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2017-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: java-properties
@@ -111,7 +111,7 @@ files:
111
111
  - lib/tes/request/rspec/profile_parser.rb
112
112
  - lib/tes/request/version.rb
113
113
  - tes-request.gemspec
114
- homepage: https://github.com/wuhuizuo/tes-request
114
+ homepage: https://github.com/NightProgrammers/tes-request
115
115
  licenses:
116
116
  - MIT
117
117
  metadata:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.6.13
135
+ rubygems_version: 2.6.14
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Request libs and bins for TES(Test Env Service)