tes-request 0.10 → 0.11
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/.travis.yml +5 -9
- data/lib/tes/request/expression.rb +1 -1
- data/lib/tes/request/rspec/ci_slicer.rb +52 -25
- data/lib/tes/request/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ef4285a8107b16ad50d37d0d4ed27e4deb96be99ff6a20ed24e742ea3533183
|
4
|
+
data.tar.gz: b4e0fdc1dcafed9548b9027a53228ef31db168bb554c3aacdfadbef3e68b664a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d00ae75a43d6effbf933b9ff4229f1184bac0706dc4c13d459d25da1b9b332524f9c98da609e8a8cca32738aa279da36abcb09d5ae577644394761f083913e4
|
7
|
+
data.tar.gz: 2301ac3ba6c6cda67b7dd23ea539e0743fcfa45da5edcf73cc5c45598b35ecdaa160775b561a55167fad875ba8faf7245c2c70732f49cac2f58208b0dfdbab49
|
data/.travis.yml
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
- 2.3.4
|
9
|
-
- 2.4.0
|
10
|
-
- 2.4.1
|
11
|
-
- 2.5.0
|
4
|
+
- 2.2.10
|
5
|
+
- 2.3.7
|
6
|
+
- 2.4.4
|
7
|
+
- 2.5.1
|
12
8
|
before_install: gem install bundler
|
13
9
|
install: bundle
|
14
10
|
script:
|
@@ -18,4 +14,4 @@ deploy:
|
|
18
14
|
api-key: $RUBYGEMS_API_KEY
|
19
15
|
on:
|
20
16
|
tags: true
|
21
|
-
rvm: 2.
|
17
|
+
rvm: 2.5.1
|
@@ -5,7 +5,7 @@ module Tes
|
|
5
5
|
class Expression
|
6
6
|
include Comparable
|
7
7
|
|
8
|
-
REG_EXP_CHAIN = /^(!)?([0-9A-Za-z_.]+)(\?|==|>=|<=|<|>|=|!=)?([
|
8
|
+
REG_EXP_CHAIN = /^(!)?([0-9A-Za-z_.]+)(\?|==|>=|<=|<|>|=|!=)?([.\-\w]+)?/
|
9
9
|
|
10
10
|
# @param [String] exp_str 表达式字符串
|
11
11
|
def initialize(exp_str)
|
@@ -8,7 +8,7 @@ module Tes::Request::RSpec
|
|
8
8
|
class CiSlicer
|
9
9
|
SUPPORT_FILE_TYPES = [:yaml, :yml, :json, :properties]
|
10
10
|
|
11
|
-
def initialize(file_type, project_dir, res_replace_map_json_file=nil, pool_url=nil)
|
11
|
+
def initialize(file_type, project_dir, res_replace_map_json_file = nil, pool_url = nil)
|
12
12
|
unless SUPPORT_FILE_TYPES.include?(file_type.to_sym)
|
13
13
|
raise(ArgumentError, "Not supported file type:#{file_type}!")
|
14
14
|
end
|
@@ -36,16 +36,38 @@ module Tes::Request::RSpec
|
|
36
36
|
@cfg_target_dir
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def rspec_tag_param_str(tags)
|
40
40
|
case tags
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
when Array
|
42
|
+
tags.map {|t| "--tag #{t}"}.join(' ')
|
43
|
+
when String
|
44
|
+
"--tag #{tags}"
|
45
|
+
when nil
|
46
|
+
nil
|
47
|
+
else
|
48
|
+
raise("不支持的类型:#{tags.class}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def pytest_mark_param_str(tags)
|
53
|
+
case tags
|
54
|
+
when Array
|
55
|
+
if tags.empty?
|
46
56
|
nil
|
57
|
+
elsif tags.size > 1
|
58
|
+
total_tag_str = tags.map {|t| t =~ /\S+\s+\S+/ ? "(#{t})" : t}.join(' or ')
|
59
|
+
"-m '#{total_tag_str}'"
|
47
60
|
else
|
48
|
-
|
61
|
+
tag = tags.first
|
62
|
+
(tag =~ /\S+\s+\S+/) ? "-m '#{tag}'" : "-m #{tag}"
|
63
|
+
end
|
64
|
+
|
65
|
+
when String
|
66
|
+
(tags =~ /\S+\s+\S+/) ? "-m '#{tags}'" : "-m #{tags}"
|
67
|
+
when nil
|
68
|
+
nil
|
69
|
+
else
|
70
|
+
raise("不支持的类型:#{tags.class}")
|
49
71
|
end
|
50
72
|
end
|
51
73
|
|
@@ -58,34 +80,39 @@ module Tes::Request::RSpec
|
|
58
80
|
FileUtils.rm_rf(target_dir)
|
59
81
|
FileUtils.mkdir(target_dir)
|
60
82
|
case file_type
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
83
|
+
when :json
|
84
|
+
save_file = File.join(target_dir, 'ci_tasks.json')
|
85
|
+
File.open(save_file, 'w') {|f| f.write job_configs_for_ci.to_json}
|
86
|
+
puts "Generated #{jobs.size} jobs, Stored in:#{save_file} ."
|
87
|
+
when :yml, :yaml
|
88
|
+
save_file = File.join(target_dir, 'ci_tasks.yml')
|
89
|
+
File.open(save_file, 'w') {|f| f.write job_configs_for_ci.to_yaml}
|
90
|
+
puts "Generated #{jobs.size} jobs, Stored in:#{save_file} ."
|
91
|
+
when :properties
|
92
|
+
job_configs_for_ci.each_with_index do |params, i|
|
93
|
+
file = File.join(target_dir, "#{i}.properties")
|
94
|
+
JavaProperties.write(params, file)
|
95
|
+
end
|
96
|
+
puts "Generated #{jobs.size} jobs, Stored in:#{target_dir}/*.properties ."
|
75
97
|
end
|
76
98
|
end
|
77
99
|
|
78
|
-
def get_job_rspec_run_args_str(job, split=' ')
|
79
|
-
|
100
|
+
def get_job_rspec_run_args_str(job, split = ' ')
|
101
|
+
if job[:specs].any? {|s| s.match(/_spec.rb\b/)}
|
102
|
+
tags_str = rspec_tag_param_str(job[:tag])
|
103
|
+
elsif job[:specs].any? {|s| s.match(/_test.py\b/) or s.match(/test_\w+.py\b/)}
|
104
|
+
tags_str = pytest_mark_param_str(job[:tag])
|
105
|
+
end
|
80
106
|
paths_str = job[:specs].join(split)
|
81
107
|
tags_str ? (tags_str + split + paths_str) : paths_str
|
82
108
|
end
|
83
109
|
|
84
|
-
def get_job_env_profile_str(job, split=';')
|
110
|
+
def get_job_env_profile_str(job, split = ';')
|
85
111
|
job[:profile].to_s(split)
|
86
112
|
end
|
87
113
|
|
88
114
|
private
|
115
|
+
|
89
116
|
def gen_job_ci_params(job)
|
90
117
|
{'RSPEC_PARAM' => get_job_rspec_run_args_str(job), 'REQUEST_ASKS' => get_job_env_profile_str(job)}
|
91
118
|
end
|
data/lib/tes/request/version.rb
CHANGED
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.
|
4
|
+
version: '0.11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wuhuizuo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: java-properties
|