chemlab 0.2.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -0
- data/bin/chemlab +10 -0
- data/bin/chemlab-suite +1 -0
- data/bin/chemlab-test +1 -0
- data/lib/chemlab.rb +27 -17
- data/lib/chemlab/attributable.rb +16 -10
- data/lib/chemlab/cli/fixtures/new_library/.gitignore +63 -0
- data/lib/chemlab/cli/fixtures/new_library/Gemfile +5 -0
- data/lib/chemlab/cli/fixtures/new_library/README.md.erb +1 -0
- data/lib/chemlab/cli/fixtures/new_library/lib/new_library.rb.erb +7 -0
- data/lib/chemlab/cli/fixtures/new_library/lib/page/sample.rb.erb +9 -0
- data/lib/chemlab/cli/fixtures/new_library/new_library.gemspec.erb +23 -0
- data/lib/chemlab/cli/fixtures/new_library/spec/integration/page/sample_spec.rb.erb +17 -0
- data/lib/chemlab/cli/fixtures/new_library/spec/unit/page/sample_spec.rb.erb +19 -0
- data/lib/chemlab/cli/generator.rb +46 -0
- data/lib/chemlab/cli/generator/templates/page.erb +3 -0
- data/lib/chemlab/cli/new_library.rb +62 -0
- data/lib/chemlab/cli/stub.erb +65 -0
- data/lib/chemlab/cli/stubber.rb +74 -0
- data/lib/chemlab/component.rb +78 -8
- data/lib/chemlab/configuration.rb +61 -13
- data/lib/chemlab/element.rb +5 -0
- data/lib/chemlab/page.rb +20 -2
- data/lib/chemlab/runtime/browser.rb +19 -25
- data/lib/chemlab/runtime/env.rb +13 -9
- data/lib/chemlab/runtime/logger.rb +16 -13
- data/lib/chemlab/version.rb +1 -1
- data/lib/tasks/generate.rake +22 -0
- data/lib/tasks/generate_stubs.rake +20 -0
- data/lib/tasks/help.rake +24 -0
- data/lib/tasks/new.rake +19 -0
- data/lib/tasks/version.rake +8 -0
- metadata +68 -58
- data/lib/chemlab/api_fabricator.rb +0 -134
- data/lib/chemlab/resource.rb +0 -169
- data/lib/chemlab/runtime/api_client.rb +0 -18
- data/lib/chemlab/support/api.rb +0 -71
- data/lib/chemlab/support/logging.rb +0 -176
- data/lib/chemlab/support/repeater.rb +0 -65
- data/lib/chemlab/support/waiter.rb +0 -39
data/lib/chemlab/runtime/env.rb
CHANGED
@@ -4,18 +4,22 @@ module Chemlab
|
|
4
4
|
module Runtime
|
5
5
|
# Environment configuration file
|
6
6
|
module Env
|
7
|
-
|
7
|
+
class << self
|
8
|
+
# @return [Boolean] true if debug mode is enabled
|
9
|
+
# @example
|
10
|
+
# ENV['CHEMLAB_DEBUG'] = 'true'
|
11
|
+
# Runtime::Env.debug? #=> true
|
12
|
+
def debug?
|
13
|
+
enabled?(ENV['CHEMLAB_DEBUG'], default: false)
|
14
|
+
end
|
8
15
|
|
9
|
-
|
10
|
-
enabled?(ENV['DEBUG'], default: false)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
16
|
+
private
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
def enabled?(value, default: true)
|
19
|
+
return default if value.nil?
|
17
20
|
|
18
|
-
|
21
|
+
(value =~ /^(false|no|n|0)$/i) != 0
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -1,23 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'logger'
|
4
|
-
require 'forwardable'
|
5
|
-
|
6
3
|
module Chemlab
|
7
4
|
module Runtime
|
5
|
+
# Logger module
|
8
6
|
module Logger
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
# Log something to a stream
|
8
|
+
# @param [Any] obj Any object that responds to #to_s
|
9
|
+
# @param [Symbol] type The type of message logged
|
10
|
+
# @param [Hash] args Any additional arguments
|
11
|
+
# @example
|
12
|
+
# log('something', :info) #=> logs INFO :: something, to $stdout
|
13
|
+
# log('error', :err) #=> logs ERR :: error, to $stderr
|
14
|
+
# log('important', :important, stream: $stderr) #=> logs IMPO :: important, to $stderr
|
15
|
+
# log('to file', :info, stream: File.open('file.txt', 'w')) #=> logs INFO :: to file, to the file.txt file
|
16
|
+
def log(obj, type = :info, **args)
|
17
|
+
raise ArgumentError, "Cannot log #{obj} as it does not respond to to_s!" unless obj.respond_to?(:to_s)
|
12
18
|
|
13
|
-
|
14
|
-
attr_writer :logger
|
19
|
+
args[:stream] = type.match?(/(err(or)?|warn(ing)?)/) ? $stderr : $stdout
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
+
prefix = Time.now.strftime('%Y-%m-%d %H:%M:%S / ')
|
22
|
+
prefix << type[0..3].upcase << "\t:: " # we only want the prefix to be four chars long
|
23
|
+
args[:stream].puts(prefix << obj.to_s)
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/lib/chemlab/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
desc <<-DESCRIPTION
|
4
|
+
Generate something
|
5
|
+
|
6
|
+
Arguments: WHAT NAME [ARGS]
|
7
|
+
Examples:
|
8
|
+
- generate page Login path=/users/sign_in
|
9
|
+
Generates a page library
|
10
|
+
Notes:
|
11
|
+
- [ARGS] will be in form key=value separated by `=`
|
12
|
+
DESCRIPTION
|
13
|
+
task :generate do |_, args|
|
14
|
+
require_relative '../chemlab/cli/generator'
|
15
|
+
|
16
|
+
raise ArgumentError, 'Please specify what to generate and the name' if args.size < 2
|
17
|
+
|
18
|
+
what = args.shift
|
19
|
+
name = args.shift
|
20
|
+
|
21
|
+
Chemlab::CLI::Generator.generate(what, name, args)
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :generate do
|
4
|
+
desc <<-DESCRIPTION
|
5
|
+
Generate page library stubs
|
6
|
+
|
7
|
+
Arguments: PATH
|
8
|
+
Examples:
|
9
|
+
- generate:stubs qa/page/login.rb
|
10
|
+
Generate stubs for a specific page library
|
11
|
+
- generate:stubs qa/page
|
12
|
+
Generates stubs for all page libraries in `qa/page`
|
13
|
+
DESCRIPTION
|
14
|
+
task :stubs do |_, path|
|
15
|
+
puts "Doin some stubbin in #{path}"
|
16
|
+
|
17
|
+
require_relative '../chemlab/cli/stubber'
|
18
|
+
Chemlab::CLI::Stubber.stub_all(path)
|
19
|
+
end
|
20
|
+
end
|
data/lib/tasks/help.rake
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'colorize'
|
4
|
+
|
5
|
+
desc 'Show the help'
|
6
|
+
task '--help' do
|
7
|
+
usage = +%(Usage: #{$PROGRAM_NAME} TASK\n)
|
8
|
+
|
9
|
+
Rake.application.tasks.each do |task|
|
10
|
+
usage += %(#{task.name.bold}: #{task.comment}\n)
|
11
|
+
|
12
|
+
next unless task.full_comment && task.full_comment != task.comment
|
13
|
+
|
14
|
+
# standardize and colorize the description
|
15
|
+
full_comment = task.full_comment.gsub(/(Arguments|Examples|Notes):/, '\1:'.underline)
|
16
|
+
|
17
|
+
# remove the short description and the newlines
|
18
|
+
full_comment = full_comment[task.comment.size + 2..]
|
19
|
+
|
20
|
+
usage += %(#{full_comment}\n\n)
|
21
|
+
end
|
22
|
+
|
23
|
+
$stdout.puts usage
|
24
|
+
end
|
data/lib/tasks/new.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
desc <<-DESCRIPTION
|
4
|
+
Scaffold a new Chemlab Library
|
5
|
+
|
6
|
+
Arguments: PATH
|
7
|
+
Examples:
|
8
|
+
- new my-library
|
9
|
+
Scaffolds a new Chemlab Library in the `my-library` directory.
|
10
|
+
This will fail if the PATH already exists
|
11
|
+
DESCRIPTION
|
12
|
+
task 'new' do |_, args|
|
13
|
+
require_relative '../chemlab/cli/new_library'
|
14
|
+
|
15
|
+
library = args.first
|
16
|
+
|
17
|
+
warn "NOTE: Only creating #{library}" if args.size > 1
|
18
|
+
Chemlab::CLI::NewLibrary.scaffold(library)
|
19
|
+
end
|
metadata
CHANGED
@@ -1,189 +1,183 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chemlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: climate_control
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 1.6.6
|
33
|
+
version: 1.10.9
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 1.6.6
|
40
|
+
version: 1.10.9
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: pry
|
42
|
+
name: pry
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: 0.14.1
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
54
|
+
version: 0.14.1
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
56
|
+
name: rspec
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
59
|
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
61
|
+
version: '3.7'
|
68
62
|
type: :development
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
68
|
+
version: '3.7'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
70
|
+
name: rspec-parameterized
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
75
|
+
version: 0.4.2
|
82
76
|
type: :development
|
83
77
|
prerelease: false
|
84
78
|
version_requirements: !ruby/object:Gem::Requirement
|
85
79
|
requirements:
|
86
80
|
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
82
|
+
version: 0.4.2
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
84
|
+
name: rubocop
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
92
86
|
requirements:
|
93
87
|
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
96
|
-
type: :
|
89
|
+
version: 1.14.0
|
90
|
+
type: :development
|
97
91
|
prerelease: false
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
99
93
|
requirements:
|
100
94
|
- - "~>"
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
version: 1.14.0
|
103
97
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
98
|
+
name: rubocop-rspec
|
105
99
|
requirement: !ruby/object:Gem::Requirement
|
106
100
|
requirements:
|
107
101
|
- - "~>"
|
108
102
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
110
|
-
type: :
|
103
|
+
version: 2.3.0
|
104
|
+
type: :development
|
111
105
|
prerelease: false
|
112
106
|
version_requirements: !ruby/object:Gem::Requirement
|
113
107
|
requirements:
|
114
108
|
- - "~>"
|
115
109
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
110
|
+
version: 2.3.0
|
117
111
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
112
|
+
name: yard
|
119
113
|
requirement: !ruby/object:Gem::Requirement
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
124
|
-
type: :
|
117
|
+
version: 0.9.26
|
118
|
+
type: :development
|
125
119
|
prerelease: false
|
126
120
|
version_requirements: !ruby/object:Gem::Requirement
|
127
121
|
requirements:
|
128
122
|
- - "~>"
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
124
|
+
version: 0.9.26
|
131
125
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
126
|
+
name: activesupport-inflector
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|
134
128
|
requirements:
|
135
129
|
- - "~>"
|
136
130
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
131
|
+
version: 0.1.0
|
138
132
|
type: :runtime
|
139
133
|
prerelease: false
|
140
134
|
version_requirements: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - "~>"
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
138
|
+
version: 0.1.0
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
140
|
+
name: colorize
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
148
142
|
requirements:
|
149
143
|
- - "~>"
|
150
144
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
145
|
+
version: 0.8.1
|
152
146
|
type: :runtime
|
153
147
|
prerelease: false
|
154
148
|
version_requirements: !ruby/object:Gem::Requirement
|
155
149
|
requirements:
|
156
150
|
- - "~>"
|
157
151
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
152
|
+
version: 0.8.1
|
159
153
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
154
|
+
name: i18n
|
161
155
|
requirement: !ruby/object:Gem::Requirement
|
162
156
|
requirements:
|
163
157
|
- - "~>"
|
164
158
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
159
|
+
version: 1.8.10
|
166
160
|
type: :runtime
|
167
161
|
prerelease: false
|
168
162
|
version_requirements: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - "~>"
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
166
|
+
version: 1.8.10
|
173
167
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
168
|
+
name: rake
|
175
169
|
requirement: !ruby/object:Gem::Requirement
|
176
170
|
requirements:
|
177
171
|
- - "~>"
|
178
172
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
173
|
+
version: 13.0.3
|
180
174
|
type: :runtime
|
181
175
|
prerelease: false
|
182
176
|
version_requirements: !ruby/object:Gem::Requirement
|
183
177
|
requirements:
|
184
178
|
- - "~>"
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.
|
180
|
+
version: 13.0.3
|
187
181
|
- !ruby/object:Gem::Dependency
|
188
182
|
name: selenium-webdriver
|
189
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,28 +209,44 @@ dependencies:
|
|
215
209
|
description:
|
216
210
|
email:
|
217
211
|
- quality@gitlab.com
|
218
|
-
executables:
|
212
|
+
executables:
|
213
|
+
- chemlab
|
219
214
|
extensions: []
|
220
215
|
extra_rdoc_files: []
|
221
216
|
files:
|
217
|
+
- Rakefile
|
218
|
+
- bin/chemlab
|
219
|
+
- bin/chemlab-suite
|
220
|
+
- bin/chemlab-test
|
222
221
|
- lib/chemlab.rb
|
223
|
-
- lib/chemlab/api_fabricator.rb
|
224
222
|
- lib/chemlab/attributable.rb
|
223
|
+
- lib/chemlab/cli/fixtures/new_library/.gitignore
|
224
|
+
- lib/chemlab/cli/fixtures/new_library/Gemfile
|
225
|
+
- lib/chemlab/cli/fixtures/new_library/README.md.erb
|
226
|
+
- lib/chemlab/cli/fixtures/new_library/lib/new_library.rb.erb
|
227
|
+
- lib/chemlab/cli/fixtures/new_library/lib/page/sample.rb.erb
|
228
|
+
- lib/chemlab/cli/fixtures/new_library/new_library.gemspec.erb
|
229
|
+
- lib/chemlab/cli/fixtures/new_library/spec/integration/page/sample_spec.rb.erb
|
230
|
+
- lib/chemlab/cli/fixtures/new_library/spec/unit/page/sample_spec.rb.erb
|
231
|
+
- lib/chemlab/cli/generator.rb
|
232
|
+
- lib/chemlab/cli/generator/templates/page.erb
|
233
|
+
- lib/chemlab/cli/new_library.rb
|
234
|
+
- lib/chemlab/cli/stub.erb
|
235
|
+
- lib/chemlab/cli/stubber.rb
|
225
236
|
- lib/chemlab/component.rb
|
226
237
|
- lib/chemlab/configuration.rb
|
227
238
|
- lib/chemlab/element.rb
|
228
239
|
- lib/chemlab/page.rb
|
229
|
-
- lib/chemlab/resource.rb
|
230
|
-
- lib/chemlab/runtime/api_client.rb
|
231
240
|
- lib/chemlab/runtime/browser.rb
|
232
241
|
- lib/chemlab/runtime/env.rb
|
233
242
|
- lib/chemlab/runtime/logger.rb
|
234
|
-
- lib/chemlab/support/api.rb
|
235
|
-
- lib/chemlab/support/logging.rb
|
236
|
-
- lib/chemlab/support/repeater.rb
|
237
|
-
- lib/chemlab/support/waiter.rb
|
238
243
|
- lib/chemlab/version.rb
|
239
|
-
|
244
|
+
- lib/tasks/generate.rake
|
245
|
+
- lib/tasks/generate_stubs.rake
|
246
|
+
- lib/tasks/help.rake
|
247
|
+
- lib/tasks/new.rake
|
248
|
+
- lib/tasks/version.rake
|
249
|
+
homepage: https://about.gitlab.com/
|
240
250
|
licenses:
|
241
251
|
- MIT
|
242
252
|
metadata: {}
|
@@ -248,14 +258,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
258
|
requirements:
|
249
259
|
- - ">="
|
250
260
|
- !ruby/object:Gem::Version
|
251
|
-
version:
|
261
|
+
version: 2.7.2
|
252
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
263
|
requirements:
|
254
264
|
- - ">="
|
255
265
|
- !ruby/object:Gem::Version
|
256
266
|
version: '0'
|
257
267
|
requirements: []
|
258
|
-
rubygems_version: 3.
|
268
|
+
rubygems_version: 3.1.4
|
259
269
|
signing_key:
|
260
270
|
specification_version: 4
|
261
271
|
summary: Automation framework built by GitLab, for the world.
|