appium_console 4.1.1 → 4.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98c4036134b5798b5fd7fc921a02645df3d6a9a775a1edfeb3101e1a39022d1f
4
- data.tar.gz: 68fb4e5985837043967f0aebdfa28495c2eb26bf88e39ad3c0e011303243b3b2
3
+ metadata.gz: d35c8ccbcf449176ebd22cb03bf4debd2c1b3538db04d09ed5a8af308bdb53d8
4
+ data.tar.gz: 6315d3dca7927d2137760d71f75bd04b9c47d63ceaf2576000620736bad18ffc
5
5
  SHA512:
6
- metadata.gz: 9e3ff7b3b04d517521bef0f2b5878c0acc4b32b0fde617b615d0ab6340513ed702fa77f00949434691b8032e9e59f81a723ba0c9df803ed9e9b0236e64ba7537
7
- data.tar.gz: cd608ddf9825959ce2a1d5417aa0f5ac56444f7c55ca30e84e6f6727d1a8e612061cd4e369cecef74ad78219f7b436a352b791f5b2e7e910afc3b2d72e667527
6
+ metadata.gz: 1de4c84924901e5303ed218540d22926f98ed9ccd9ad337030f2a89bd462508c89bdeec7d80aa12edf0cf1461de2cfc035cc34cd00058ae900f72e146659be06
7
+ data.tar.gz: 1df9030b98171cf15667ccf98044c7290c914061a046f6023ef849b74f822947fb535bef611f6d381c737f0b6bc305a768ff8c59854c23ab1a027bf7b31fa6bc
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
3
- Metrics/LineLength:
2
+ TargetRubyVersion: 3.1
3
+ Layout/LineLength:
4
4
  Max: 128
5
5
  Metrics/MethodLength:
6
6
  Enabled: false
@@ -12,7 +12,7 @@ Style/GlobalVars:
12
12
  Enabled: false
13
13
  Layout/HeredocIndentation:
14
14
  Enabled: false
15
- Gemspec/DateAssignment: # new in 1.10
15
+ Gemspec/DeprecatedAttributeAssignment:
16
16
  Enabled: true
17
17
  Layout/LineEndStringConcatenationIndentation: # new in 1.18
18
18
  Enabled: true
@@ -100,3 +100,163 @@ Style/StringChars: # new in 1.12
100
100
  Enabled: true
101
101
  Style/SwapValues: # new in 1.1
102
102
  Enabled: true
103
+ Gemspec/AddRuntimeDependency: # new in 1.65
104
+ Enabled: true
105
+ Gemspec/DevelopmentDependencies: # new in 1.44
106
+ Enabled: true
107
+ Gemspec/RequireMFA: # new in 1.23
108
+ Enabled: true
109
+ Layout/LineContinuationLeadingSpace: # new in 1.31
110
+ Enabled: true
111
+ Layout/LineContinuationSpacing: # new in 1.31
112
+ Enabled: true
113
+ Lint/ArrayLiteralInRegexp: # new in 1.71
114
+ Enabled: true
115
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
116
+ Enabled: true
117
+ Lint/ConstantReassignment: # new in 1.70
118
+ Enabled: true
119
+ Lint/DuplicateMagicComment: # new in 1.37
120
+ Enabled: true
121
+ Lint/DuplicateMatchPattern: # new in 1.50
122
+ Enabled: true
123
+ Lint/DuplicateSetElement: # new in 1.67
124
+ Enabled: true
125
+ Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
126
+ Enabled: true
127
+ Lint/ItWithoutArgumentsInBlock: # new in 1.59
128
+ Enabled: true
129
+ Lint/LiteralAssignmentInCondition: # new in 1.58
130
+ Enabled: true
131
+ Lint/MixedCaseRange: # new in 1.53
132
+ Enabled: true
133
+ Lint/NonAtomicFileOperation: # new in 1.31
134
+ Enabled: true
135
+ Lint/NumericOperationWithConstantResult: # new in 1.69
136
+ Enabled: true
137
+ Lint/RedundantRegexpQuantifiers: # new in 1.53
138
+ Enabled: true
139
+ Lint/RefinementImportMethods: # new in 1.27
140
+ Enabled: true
141
+ Lint/RequireRangeParentheses: # new in 1.32
142
+ Enabled: true
143
+ Lint/SharedMutableDefault: # new in 1.70
144
+ Enabled: true
145
+ Lint/UnescapedBracketInRegexp: # new in 1.68
146
+ Enabled: true
147
+ Lint/UselessDefined: # new in 1.69
148
+ Enabled: true
149
+ Lint/UselessNumericOperation: # new in 1.66
150
+ Enabled: true
151
+ Lint/UselessRescue: # new in 1.43
152
+ Enabled: true
153
+ Lint/UselessRuby2Keywords: # new in 1.23
154
+ Enabled: true
155
+ Metrics/CollectionLiteralLength: # new in 1.47
156
+ Enabled: true
157
+ Naming/BlockForwarding: # new in 1.24
158
+ Enabled: true
159
+ Security/CompoundHash: # new in 1.28
160
+ Enabled: true
161
+ Style/AmbiguousEndlessMethodDefinition: # new in 1.68
162
+ Enabled: true
163
+ Style/ArrayIntersect: # new in 1.40
164
+ Enabled: true
165
+ Style/BitwisePredicate: # new in 1.68
166
+ Enabled: true
167
+ Style/CombinableDefined: # new in 1.68
168
+ Enabled: true
169
+ Style/ComparableClamp: # new in 1.44
170
+ Enabled: true
171
+ Style/ConcatArrayLiterals: # new in 1.41
172
+ Enabled: true
173
+ Style/DataInheritance: # new in 1.49
174
+ Enabled: true
175
+ Style/DigChain: # new in 1.69
176
+ Enabled: true
177
+ Style/DirEmpty: # new in 1.48
178
+ Enabled: true
179
+ Style/EmptyHeredoc: # new in 1.32
180
+ Enabled: true
181
+ Style/EnvHome: # new in 1.29
182
+ Enabled: true
183
+ Style/ExactRegexpMatch: # new in 1.51
184
+ Enabled: true
185
+ Style/FetchEnvVar: # new in 1.28
186
+ Enabled: true
187
+ Style/FileEmpty: # new in 1.48
188
+ Enabled: true
189
+ Style/FileNull: # new in 1.69
190
+ Enabled: true
191
+ Style/FileRead: # new in 1.24
192
+ Enabled: true
193
+ Style/FileTouch: # new in 1.69
194
+ Enabled: true
195
+ Style/FileWrite: # new in 1.24
196
+ Enabled: true
197
+ Style/HashSlice: # new in 1.71
198
+ Enabled: true
199
+ Style/ItAssignment: # new in 1.70
200
+ Enabled: true
201
+ Style/KeywordArgumentsMerging: # new in 1.68
202
+ Enabled: true
203
+ Style/MagicCommentFormat: # new in 1.35
204
+ Enabled: true
205
+ Style/MapCompactWithConditionalBlock: # new in 1.30
206
+ Enabled: true
207
+ Style/MapIntoArray: # new in 1.63
208
+ Enabled: true
209
+ Style/MapToHash: # new in 1.24
210
+ Enabled: true
211
+ Style/MapToSet: # new in 1.42
212
+ Enabled: true
213
+ Style/MinMaxComparison: # new in 1.42
214
+ Enabled: true
215
+ Style/NestedFileDirname: # new in 1.26
216
+ Enabled: true
217
+ Style/ObjectThen: # new in 1.28
218
+ Enabled: true
219
+ Style/OpenStructUse: # new in 1.23
220
+ Enabled: true
221
+ Style/OperatorMethodCall: # new in 1.37
222
+ Enabled: true
223
+ Style/RedundantArrayConstructor: # new in 1.52
224
+ Enabled: true
225
+ Style/RedundantConstantBase: # new in 1.40
226
+ Enabled: true
227
+ Style/RedundantCurrentDirectoryInPath: # new in 1.53
228
+ Enabled: true
229
+ Style/RedundantDoubleSplatHashBraces: # new in 1.41
230
+ Enabled: true
231
+ Style/RedundantEach: # new in 1.38
232
+ Enabled: true
233
+ Style/RedundantFilterChain: # new in 1.52
234
+ Enabled: true
235
+ Style/RedundantHeredocDelimiterQuotes: # new in 1.45
236
+ Enabled: true
237
+ Style/RedundantInitialize: # new in 1.27
238
+ Enabled: true
239
+ Style/RedundantInterpolationUnfreeze: # new in 1.66
240
+ Enabled: true
241
+ Style/RedundantLineContinuation: # new in 1.49
242
+ Enabled: true
243
+ Style/RedundantRegexpArgument: # new in 1.53
244
+ Enabled: true
245
+ Style/RedundantRegexpConstructor: # new in 1.52
246
+ Enabled: true
247
+ Style/RedundantStringEscape: # new in 1.37
248
+ Enabled: true
249
+ Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
250
+ Enabled: true
251
+ Style/SafeNavigationChainLength: # new in 1.68
252
+ Enabled: true
253
+ Style/SendWithLiteralMethodName: # new in 1.64
254
+ Enabled: true
255
+ Style/SingleLineDoEndBlock: # new in 1.57
256
+ Enabled: true
257
+ Style/SuperArguments: # new in 1.64
258
+ Enabled: true
259
+ Style/SuperWithArgsParentheses: # new in 1.58
260
+ Enabled: true
261
+ Style/YAMLFileRead: # new in 1.53
262
+ Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ Historical commit-level notes through 4.2.0 are in [release_notes.md](release_notes.md).
4
+ New entries are maintained by Release Please.
5
+
6
+ ## [4.3.0](https://github.com/appium/ruby_console/compare/v4.2.0...v4.3.0) (2026-09-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * correct console setup defaults and safely load files ([#265](https://github.com/appium/ruby_console/issues/265)) ([d127d91](https://github.com/appium/ruby_console/commit/d127d9150d72fec8529d9c68c121a5dc6b50fb4c))
12
+
13
+ ## [4.2.0] - 2025-01-25
14
+
15
+ - See the historical release notes for this release.
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+ gemspec
3
+
4
+ gem 'minitest', '~> 5.0'
5
+ gem 'rake', '~> 13.0'
6
+ gem 'rubocop', '1.91.0'
data/Rakefile CHANGED
@@ -2,6 +2,11 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
  require 'rubocop/rake_task'
4
4
 
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib'
7
+ t.pattern = 'test/**/*_test.rb'
8
+ end
9
+
5
10
  desc('Execute RuboCop static code analysis')
6
11
  RuboCop::RakeTask.new(:rubocop) do |t|
7
12
  t.patterns = %w(lib test)
@@ -1,8 +1,7 @@
1
- # encoding: utf-8
2
- def self.add_to_path path
3
- path = File.expand_path "../#{path}/", __FILE__
1
+ def self.add_to_path(path)
2
+ path = File.expand_path "../#{path}/", __FILE__
4
3
 
5
- $:.unshift path unless $:.include? path
4
+ $:.unshift path unless $:.include? path
6
5
  end
7
6
 
8
7
  add_to_path 'lib'
@@ -10,27 +9,30 @@ add_to_path 'lib'
10
9
  require 'appium_console/version'
11
10
 
12
11
  Gem::Specification.new do |s|
13
- s.required_ruby_version = '>= 3.0'
12
+ s.required_ruby_version = '>= 3.1'
14
13
 
15
14
  s.name = 'appium_console'
16
15
  s.version = Appium::Console::VERSION
17
- s.date = Appium::Console::DATE
18
16
  s.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
19
17
  s.description = s.summary = 'Appium Ruby Console'
20
- s.description += '.' # avoid identical warning
18
+ s.description += '.' # avoid identical warning
21
19
  s.authors = ['code@bootstraponline.com', 'Kazuaki Matsuo']
22
- s.email = %w(code@bootstraponline.com fly.49.89.over@gmail.com)
20
+ s.email = %w[code@bootstraponline.com fly.49.89.over@gmail.com]
23
21
  s.homepage = 'https://github.com/appium/ruby_console' # published as appium_console
24
- s.require_paths = [ 'lib' ]
22
+ s.require_paths = ['lib']
25
23
 
26
24
  # appium_lib version must match ruby console version.
27
- s.add_runtime_dependency 'appium_lib', '>= 14.0.0'
28
- s.add_runtime_dependency 'pry', '~> 0.14.0'
29
- s.add_runtime_dependency 'thor', '>= 0.19', '< 2.0'
30
- s.add_development_dependency 'rake', '~> 13.0'
31
- s.add_development_dependency 'appium_thor', '~> 2.0'
32
- s.add_development_dependency 'rubocop', '1.63.3'
33
-
34
- s.executables = [ 'arc' ]
25
+ s.add_dependency 'appium_lib', '>= 14.0.0'
26
+ s.add_dependency 'pry', '>= 0.14', '< 0.17'
27
+ s.add_dependency 'thor', '>= 0.19', '< 2.0'
28
+
29
+ s.executables = ['arc']
35
30
  s.files = `git ls-files`.split "\n"
31
+ s.metadata['rubygems_mfa_required'] = 'true'
32
+ # Keep release automation out of the published package.
33
+ s.files.reject! do |file|
34
+ file.start_with?('.github/', 'script/', 'test/release/') ||
35
+ %w[RELEASING.md release-please-config.json .release-please-manifest.json].include?(file)
36
+ end
37
+
36
38
  end
@@ -4,7 +4,7 @@
4
4
  module Appium; end unless defined? Appium
5
5
  module Appium
6
6
  module Console
7
- VERSION = '4.1.1' unless defined? ::Appium::Console::VERSION
8
- DATE = '2024-04-26' unless defined? ::Appium::Console::DATE
7
+ VERSION = '4.3.0' unless defined? ::Appium::Console::VERSION
8
+ DATE = '2026-09-20' unless defined? ::Appium::Console::DATE # x-release-please-date
9
9
  end
10
10
  end
@@ -43,7 +43,7 @@ module Appium
43
43
  requires = parsed[:appium_lib][:require]
44
44
 
45
45
  unless requires.empty?
46
- load_files = requires.map { |f| %(require "#{f}";) }.join "\n"
46
+ load_files = requires.map { |f| "require #{f.dump};" }.join "\n"
47
47
  cmd += ['-e', load_files]
48
48
  end
49
49
 
data/lib/cli.rb CHANGED
@@ -18,6 +18,7 @@ module Appium::CLI # rubocop:disable Style/ClassAndModuleChildren
18
18
  <<-TEMPLATE.gsub(/skip\s/, '')
19
19
  [caps]
20
20
  platformName = "#{caps[:platform_name]}"
21
+ automationName = "#{caps[:automation_name]}"
21
22
  #{caps[:platform_version] ? "platformVersion = \"#{caps[:platform_version]}\"" : 'skip'}
22
23
  #{caps[:device_name] ? "deviceName = \"#{caps[:device_name]}\"" : 'skip'}
23
24
  app = "#{caps[:path_to_app]}"
@@ -25,7 +26,7 @@ app = "#{caps[:path_to_app]}"
25
26
  #{caps[:app_activity] ? "appActivity = \"#{caps[:app_activity]}\"" : 'skip'}
26
27
 
27
28
  [appium_lib]
28
- server_url = "http://127.0.0.1:4723/wd/hub"
29
+ server_url = "http://127.0.0.1:4723/"
29
30
  TEMPLATE
30
31
  end
31
32
  end
@@ -33,6 +34,7 @@ server_url = "http://127.0.0.1:4723/wd/hub"
33
34
 
34
35
  class Setup < Thor
35
36
  desc 'ios', 'Generates toml for ios'
37
+ method_option :force, type: :boolean, default: false, desc: 'Overwrite an existing appium.txt'
36
38
  def ios
37
39
  toml = File.join(Dir.pwd, Config.default_appium_txt_path)
38
40
  template = Config.template(
@@ -42,10 +44,11 @@ server_url = "http://127.0.0.1:4723/wd/hub"
42
44
  platform_version: '15.0',
43
45
  path_to_app: '/path/to/app_bundle'
44
46
  )
45
- File.write(toml, template)
47
+ write_config(toml, template)
46
48
  end
47
49
 
48
50
  desc 'android', 'Generates toml for android'
51
+ method_option :force, type: :boolean, default: false, desc: 'Overwrite an existing appium.txt'
49
52
  def android
50
53
  toml = File.join(Dir.pwd, Config.default_appium_txt_path)
51
54
  template = Config.template(
@@ -56,11 +59,23 @@ server_url = "http://127.0.0.1:4723/wd/hub"
56
59
  app_package: 'com.package.example',
57
60
  app_activity: 'com.package.example.ExampleActivity'
58
61
  )
59
- File.write(toml, template)
62
+ write_config(toml, template)
63
+ end
64
+
65
+ private
66
+
67
+ def write_config(path, template)
68
+ File.write(path, template, mode: options[:force] ? 'w' : 'wx')
69
+ rescue Errno::EEXIST
70
+ raise Thor::Error, "#{path} already exists. Use --force to overwrite it."
60
71
  end
61
72
  end
62
73
 
63
74
  class Main < Thor
75
+ def self.exit_on_failure?
76
+ true
77
+ end
78
+
64
79
  desc 'version', 'Prints version of appium_lib and appium_console'
65
80
  def version
66
81
  puts <<-VERSION
data/lib/start.rb CHANGED
@@ -17,7 +17,6 @@ core = Appium::Driver.new opts, false
17
17
  core.start_driver
18
18
  Appium.promote_appium_methods Object, core
19
19
 
20
-
21
20
  # Load minitest
22
21
  begin
23
22
  require 'minitest'
data/readme.md CHANGED
@@ -19,15 +19,26 @@
19
19
  - `arc version` prints the current version of appium console and appium lib.
20
20
  - `arc setup android` creates `appium.txt` for android in the current working dir.
21
21
  - `arc setup ios` creates `appium.txt` for ios in the current working dir.
22
+ - Setup preserves an existing `appium.txt`. Add `--force` to overwrite it.
22
23
  - `arc toml FILE` starts arc with toml FILE path
23
24
 
24
25
  ## Documentation
25
26
 
26
27
  - [ruby_lib](https://github.com/appium/ruby_lib)
27
28
 
29
+ ## Development
30
+
31
+ Run `bundle install`, then `bundle exec rake test` and `bundle exec rake rubocop`.
32
+ Tests run without an Appium server or device.
33
+
28
34
  ## Changelog
29
35
  - 4.0.0
30
36
  - Drop Ruby 2.7 support
31
37
  - 3.0.0
32
38
  - Update ruby_lib version to v12
33
39
 
40
+
41
+ ## Releasing
42
+
43
+ Review and merge the Release Please PR to publish. See [RELEASING.md](RELEASING.md)
44
+ for one-time Trusted Publishing setup and recovery instructions.
data/release_notes.md CHANGED
@@ -1,3 +1,24 @@
1
+ #### v4.2.0 2025-01-25
2
+
3
+ - [2f63a20](https://github.com/appium/ruby_console/commit/2f63a20264d375195d49b975df974522605c54ce) Release 4.2.0
4
+ - [505874e](https://github.com/appium/ruby_console/commit/505874e6e0ab45bb148783bfd22ce0598640e035) feat: bump ruby version to follow ruby_lib
5
+ - [5eea0ec](https://github.com/appium/ruby_console/commit/5eea0ec13ec7f502e91a8fd788a63accca222127) chore: update rubocop requirement from = 1.70.0 to = 1.71.0 (#208)
6
+ - [0eb24cc](https://github.com/appium/ruby_console/commit/0eb24cc37178c0c2975eb298ddd27f100bf161b5) chore: update rubocop requirement from = 1.69.2 to = 1.70.0 (#207)
7
+ - [10ee9b9](https://github.com/appium/ruby_console/commit/10ee9b97623ea6faa2ff673832cc72e6ff58cec8) chore: update rubocop requirement from = 1.69.1 to = 1.69.2 (#206)
8
+ - [849e353](https://github.com/appium/ruby_console/commit/849e353f8940ef14aaf49c0e0e0d5551f1c230ea) chore: update rubocop requirement from = 1.69.0 to = 1.69.1 (#205)
9
+ - [22d0871](https://github.com/appium/ruby_console/commit/22d0871ad4e150c0b07691cfda60febfaf13d399) chore: update rubocop requirement from = 1.68.0 to = 1.69.0 (#204)
10
+ - [69adc4e](https://github.com/appium/ruby_console/commit/69adc4e4146e6c0bbdb480ca71e3056fba613b60) chore: update rubocop requirement from = 1.67.0 to = 1.68.0 (#202)
11
+ - [5ec1e36](https://github.com/appium/ruby_console/commit/5ec1e36a1d809437d3a02f34ecf80c8817aff7dc) chore: update rubocop requirement from = 1.66.1 to = 1.67.0 (#201)
12
+ - [270ed4a](https://github.com/appium/ruby_console/commit/270ed4a749d41fc563a0bbebbe0e2327829cb103) chore: update rubocop requirement from = 1.66.0 to = 1.66.1 (#200)
13
+ - [14136a3](https://github.com/appium/ruby_console/commit/14136a3a64c78a2b3250f8da75df97d56ac20a74) chore: update rubocop requirement from = 1.65.1 to = 1.66.0 (#199)
14
+ - [5371021](https://github.com/appium/ruby_console/commit/53710210fb95b01788a008fe9ceaeb465122c66c) chore: update rubocop requirement from = 1.65.0 to = 1.65.1 (#198)
15
+ - [9204c2d](https://github.com/appium/ruby_console/commit/9204c2d411de2913a0abf7fc9b2aefc154152717) chore: update rubocop requirement from = 1.64.1 to = 1.65.0 (#197)
16
+ - [ba5732e](https://github.com/appium/ruby_console/commit/ba5732ecce98e823a85611eff2ea77d53047e9da) chore: update rubocop requirement from = 1.64.0 to = 1.64.1 (#196)
17
+ - [5f4ea6a](https://github.com/appium/ruby_console/commit/5f4ea6a6436149b6d820af162ccf1ab40acf58f3) chore: update rubocop requirement from = 1.63.5 to = 1.64.0 (#195)
18
+ - [ceed33e](https://github.com/appium/ruby_console/commit/ceed33e41098bc6e488c74e0aef4bee68c5f345a) chore: update rubocop requirement from = 1.63.4 to = 1.63.5 (#194)
19
+ - [ddd5519](https://github.com/appium/ruby_console/commit/ddd5519bc5b4aa0a860fa2e684732ca48fbdd9a1) chore: update rubocop requirement from = 1.63.3 to = 1.63.4 (#193)
20
+
21
+
1
22
  #### v4.1.1 2024-04-26
2
23
 
3
24
  - [cff749c](https://github.com/appium/ruby_console/commit/cff749cef4e63e66f62d7075cb89c7b0fb706d4d) Release 4.1.1
data/test/cli_test.rb ADDED
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'open3'
5
+ require 'tmpdir'
6
+ require 'tomlrb'
7
+
8
+ class CliTest < Minitest::Test
9
+ ROOT = File.expand_path('..', __dir__)
10
+
11
+ def run_arc(*args)
12
+ Open3.capture3(Gem.ruby, '-I', File.join(ROOT, 'lib'), File.join(ROOT, 'bin/arc'), *args)
13
+ end
14
+
15
+ def test_setup_generates_driver_and_server_settings
16
+ { 'ios' => 'XCUITest', 'android' => 'uiautomator2' }.each do |platform, driver|
17
+ Dir.mktmpdir do |dir|
18
+ Dir.chdir(dir) do
19
+ _, stderr, status = run_arc('setup', platform)
20
+ assert status.success?, stderr
21
+ config = Tomlrb.load_file('appium.txt')
22
+ assert_equal driver, config.fetch('caps').fetch('automationName')
23
+ assert_equal platform == 'ios' ? 'iOS' : 'Android', config.fetch('caps').fetch('platformName')
24
+ assert_equal 'http://127.0.0.1:4723/', config.fetch('appium_lib').fetch('server_url')
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ def test_setup_preserves_existing_config_unless_forced
31
+ %w[ios android].each do |platform|
32
+ Dir.mktmpdir do |dir|
33
+ Dir.chdir(dir) do
34
+ File.write('appium.txt', 'custom configuration')
35
+ _, stderr, status = run_arc('setup', platform)
36
+ refute status.success?
37
+ assert_includes stderr, '--force'
38
+ assert_equal 'custom configuration', File.read('appium.txt')
39
+
40
+ _, stderr, status = run_arc('setup', platform, '--force')
41
+ assert status.success?, stderr
42
+ assert Tomlrb.load_file('appium.txt').fetch('caps').key?('automationName')
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ def test_version_command
49
+ stdout, stderr, status = run_arc('version')
50
+ assert status.success?, stderr
51
+ assert_includes stdout, 'appium_console:'
52
+ assert_includes stdout, 'appium_lib:'
53
+ end
54
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'minitest/mock'
5
+ require 'open3'
6
+ require 'tmpdir'
7
+ require 'appium_console'
8
+
9
+ class ConsoleTest < Minitest::Test
10
+ def test_start_requires_files_with_special_characters_literally
11
+ Dir.mktmpdir do |dir|
12
+ file = File.join(dir, 'page"\\#{raise "interpolated"}.rb')
13
+ File.write(file, 'puts "page loaded"')
14
+ parsed = { appium_lib: { require: [file] } }
15
+ Appium::Console.setup('appium.txt')
16
+ launch = lambda do |args|
17
+ assert_equal '-r', args.first
18
+ assert_equal File.expand_path('../lib/start.rb', __dir__), args[1]
19
+ assert_equal '-e', args[2]
20
+ stdout, stderr, status = Open3.capture3(Gem.ruby, '-e', args[3])
21
+ assert status.success?, stderr
22
+ assert_equal "page loaded\n", stdout
23
+ end
24
+ Appium.stub(:load_appium_txt, parsed) do
25
+ Pry::CLI.stub(:parse_options, ->(args) { args }) do
26
+ Pry::CLI.stub(:start, launch) { capture_io { Appium::Console.start } }
27
+ end
28
+ end
29
+ ensure
30
+ Pry.hooks.delete_hook(:after_session, 'Release session hook')
31
+ end
32
+ end
33
+
34
+ def test_reload_loads_changed_file_contents
35
+ Dir.mktmpdir do |dir|
36
+ file = File.join(dir, 'page.rb')
37
+ Appium::Console.setup('appium.txt')
38
+ Appium.stub(:load_appium_txt, { appium_lib: { require: [file] } }) do
39
+ File.write(file, 'puts "first version"')
40
+ assert_output("first version\n") { Pry.reload }
41
+ File.write(file, 'puts "second version"')
42
+ assert_output("second version\n") { Pry.reload }
43
+ end
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  - Kazuaki Matsuo
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-04-26 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: appium_lib
@@ -29,16 +28,22 @@ dependencies:
29
28
  name: pry
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.14'
34
+ - - "<"
33
35
  - !ruby/object:Gem::Version
34
- version: 0.14.0
36
+ version: '0.17'
35
37
  type: :runtime
36
38
  prerelease: false
37
39
  version_requirements: !ruby/object:Gem::Requirement
38
40
  requirements:
39
- - - "~>"
41
+ - - ">="
40
42
  - !ruby/object:Gem::Version
41
- version: 0.14.0
43
+ version: '0.14'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.17'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: thor
44
49
  requirement: !ruby/object:Gem::Requirement
@@ -59,48 +64,6 @@ dependencies:
59
64
  - - "<"
60
65
  - !ruby/object:Gem::Version
61
66
  version: '2.0'
62
- - !ruby/object:Gem::Dependency
63
- name: rake
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '13.0'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '13.0'
76
- - !ruby/object:Gem::Dependency
77
- name: appium_thor
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
90
- - !ruby/object:Gem::Dependency
91
- name: rubocop
92
- requirement: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 1.63.3
97
- type: :development
98
- prerelease: false
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.63.3
104
67
  description: Appium Ruby Console.
105
68
  email:
106
69
  - code@bootstraponline.com
@@ -110,13 +73,12 @@ executables:
110
73
  extensions: []
111
74
  extra_rdoc_files: []
112
75
  files:
113
- - ".github/dependabot.yml"
114
76
  - ".gitignore"
115
77
  - ".rubocop.yml"
78
+ - CHANGELOG.md
116
79
  - Gemfile
117
80
  - LICENSE-2.0.txt
118
81
  - Rakefile
119
- - Thorfile
120
82
  - appium_console.gemspec
121
83
  - bin/arc
122
84
  - img/avd_settings.png
@@ -127,12 +89,14 @@ files:
127
89
  - lib/start.rb
128
90
  - readme.md
129
91
  - release_notes.md
92
+ - test/cli_test.rb
93
+ - test/console_test.rb
130
94
  - test/simple.rb
131
95
  homepage: https://github.com/appium/ruby_console
132
96
  licenses:
133
97
  - http://www.apache.org/licenses/LICENSE-2.0.txt
134
- metadata: {}
135
- post_install_message:
98
+ metadata:
99
+ rubygems_mfa_required: 'true'
136
100
  rdoc_options: []
137
101
  require_paths:
138
102
  - lib
@@ -140,15 +104,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
104
  requirements:
141
105
  - - ">="
142
106
  - !ruby/object:Gem::Version
143
- version: '3.0'
107
+ version: '3.1'
144
108
  required_rubygems_version: !ruby/object:Gem::Requirement
145
109
  requirements:
146
110
  - - ">="
147
111
  - !ruby/object:Gem::Version
148
112
  version: '0'
149
113
  requirements: []
150
- rubygems_version: 3.5.9
151
- signing_key:
114
+ rubygems_version: 4.0.20
152
115
  specification_version: 4
153
116
  summary: Appium Ruby Console
154
117
  test_files: []
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "11:00"
8
- open-pull-requests-limit: 10
data/Thorfile DELETED
@@ -1,20 +0,0 @@
1
- require 'appium_thor'
2
-
3
- Appium::Thor::Config.set do
4
- gem_name 'appium_console'
5
- github_owner 'appium'
6
- github_name 'ruby_console'
7
- version_file 'lib/appium_console/version.rb'
8
- end
9
-
10
- # Must use '::' otherwise Default will point to Thor::Sandbox::Default
11
- # Debug by calling Thor::Base.subclass_files via Pry
12
- #
13
- # https://github.com/erikhuda/thor/issues/484
14
- #
15
- class ::Default < Thor
16
- desc 'spec', 'Run RSpec tests'
17
- def spec
18
- exec 'rspec spec'
19
- end
20
- end