ruby_raider 0.9.5 → 0.9.7
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/README.md +8 -11
- data/lib/commands/loaded_commands.rb +9 -0
- data/lib/commands/plugin_commands.rb +34 -0
- data/lib/generators/menu_generator.rb +5 -1
- data/lib/generators/templates/common/read_me.tt +8 -11
- data/lib/plugin/plugin.rb +99 -0
- data/lib/plugin/plugin_exposer.rb +77 -0
- data/lib/ruby_raider.rb +23 -4
- data/lib/version +1 -1
- data/plugins.yml +2 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d8b8446c9a14c729920a9ffe1c1452a2cfee0be1f13358ce3444716c0d95f3
|
4
|
+
data.tar.gz: 97e9143f2c0206044a1d59dccf4348fa6f65be3ad474db1dab8986295363cd8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 369c1dac85b41e583ad2f436bab89a3e355085f57ec2c0e243639fcc7fda39fc6a6d4845bc768eeaabaf103708d8b5832ecc3e7530df3af13e12ffd63f60e4fe
|
7
|
+
data.tar.gz: 2b21dade88f2ccfe1a9e4c18f608544fdf3d88c15377f35bad42ad341a1ae5c8437737b322ec89f0efbfb4c52b5d89ffb029c937e6ec20856d7692198451f97e
|
data/README.md
CHANGED
@@ -10,12 +10,9 @@
|
|
10
10
|
<br />
|
11
11
|
<div align="center">
|
12
12
|
<a href="https://github.com/RubyRaider/ruby_raider">
|
13
|
-
<img src="https://
|
13
|
+
<img src="https://ruby-raider.com/wp-content/uploads/2022/05/logo-160x160.png?w=890" alt="Logo" style="width:600px;">
|
14
14
|
</a>
|
15
|
-
<h1 align="center">Ruby Raider</h1>
|
16
15
|
<p align="center">
|
17
|
-
This is a gem to make setup and start of UI automation projects easier.
|
18
|
-
<br />
|
19
16
|
<a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
|
20
17
|
<br />
|
21
18
|
<br />
|
@@ -85,13 +82,13 @@ Select the ones you will like to work with.
|
|
85
82
|
If you already know which frameworks you want to use, you can do:
|
86
83
|
|
87
84
|
```ruby
|
88
|
-
raider new [name_of_project]
|
85
|
+
raider new [name_of_project] p framework : [framework] automation : [automation_type]
|
89
86
|
```
|
90
87
|
|
91
88
|
An example of the command above would be:
|
92
89
|
|
93
90
|
```ruby
|
94
|
-
raider new test_project
|
91
|
+
raider new test_project p framework : rspec automation: selenium
|
95
92
|
```
|
96
93
|
|
97
94
|
Where [frameworks] is a comma separated list of the frameworks you want to use.
|
@@ -102,7 +99,7 @@ Where [frameworks] is a comma separated list of the frameworks you want to use.
|
|
102
99
|
|
103
100
|
```ruby
|
104
101
|
Commands :
|
105
|
-
|
102
|
+
raider generate # Provides access to all the scaffolding commands
|
106
103
|
raider help [COMMAND] # Describe available commands or one specific command
|
107
104
|
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
108
105
|
raider utility # Provides access to all the utility commands
|
@@ -126,15 +123,15 @@ Ruby Raider also supports scaffolding:
|
|
126
123
|
* To create a new steps definition you do: ```raider g steps [STEPS_NAME]```
|
127
124
|
* To create both a page/spec or a page/feature/steps you do: ```raider g scaffold [SCAFFOLD_NAME]```
|
128
125
|
|
129
|
-
It's possible to add the option --path or
|
126
|
+
It's possible to add the option --path or p if you want to specify where to create your features, pages, helpers and
|
130
127
|
specs.
|
131
128
|
|
132
129
|
If you want to set the default path for the creation of your features, helpers and specs:
|
133
130
|
|
134
131
|
```ruby
|
135
|
-
raider u path [PATH_NAME] - -feature or
|
136
|
-
raider u path [PATH_NAME] - -spec or
|
137
|
-
raider u path [PATH_NAME] - -helper or
|
132
|
+
raider u path [PATH_NAME] - -feature or f
|
133
|
+
raider u path [PATH_NAME] - -spec or s
|
134
|
+
raider u path [PATH_NAME] - -helper or h
|
138
135
|
```
|
139
136
|
|
140
137
|
If you don't specify an option, path will assume you want to change the default path for pages.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require_relative '../plugin/plugin'
|
5
|
+
|
6
|
+
module RubyRaider
|
7
|
+
# :reek:FeatureEnvy { enabled: false }
|
8
|
+
# :reek:UtilityFunction { enabled: false }
|
9
|
+
class PluginCommands < Thor
|
10
|
+
desc 'add [NAME]', 'Adds a plugin to your project'
|
11
|
+
|
12
|
+
def add(plugin_name)
|
13
|
+
Plugin.add_plugin(plugin_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'delete [NAME]', 'Deletes a plugin from your project'
|
17
|
+
|
18
|
+
def delete(plugin_name)
|
19
|
+
Plugin.delete_plugin(plugin_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'local', 'Lists all the plugin in your project'
|
23
|
+
|
24
|
+
def local
|
25
|
+
pp Plugin.installed_plugins
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'list', 'Lists all the available plugin'
|
29
|
+
|
30
|
+
def list
|
31
|
+
pp Plugin.available_plugins
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -84,11 +84,15 @@ class MenuGenerator
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def select_automation_framework(menu)
|
87
|
+
automation_options(menu)
|
88
|
+
menu.choice :Quit, -> { exit }
|
89
|
+
end
|
90
|
+
|
91
|
+
def automation_options(menu)
|
87
92
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
88
93
|
menu.choice :Appium, -> { choose_test_framework('appium') }
|
89
94
|
menu.choice :Watir, -> { choose_test_framework('watir') }
|
90
95
|
menu.choice :Applitools, -> { choose_test_framework('applitools') }
|
91
96
|
menu.choice :Axe, -> { choose_test_framework('axe') }
|
92
|
-
menu.choice :Quit, -> { exit }
|
93
97
|
end
|
94
98
|
end
|
@@ -4,12 +4,9 @@
|
|
4
4
|
<br />
|
5
5
|
<div align="center">
|
6
6
|
<a href="https://github.com/RubyRaider/ruby_raider">
|
7
|
-
<img src="https://
|
7
|
+
<img src="https://ruby-raider.com/wp-content/uploads/2022/05/logo-160x160.png?w=890" alt="Logo" style="width:600px;">
|
8
8
|
</a>
|
9
|
-
<h1 align="center">Ruby Raider</h1>
|
10
9
|
<p align="center">
|
11
|
-
This is a gem to make setup and start of UI automation projects easier.
|
12
|
-
<br />
|
13
10
|
<a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
|
14
11
|
<br />
|
15
12
|
<br />
|
@@ -79,13 +76,13 @@ Select the ones you will like to work with.
|
|
79
76
|
If you already know which frameworks you want to use, you can do:
|
80
77
|
|
81
78
|
```ruby
|
82
|
-
raider new [name_of_project]
|
79
|
+
raider new [name_of_project] p framework : [framework] automation : [automation_type]
|
83
80
|
```
|
84
81
|
|
85
82
|
An example of the command above would be:
|
86
83
|
|
87
84
|
```ruby
|
88
|
-
raider new test_project
|
85
|
+
raider new test_project p framework : rspec automation: selenium
|
89
86
|
```
|
90
87
|
|
91
88
|
Where [frameworks] is a comma separated list of the frameworks you want to use.
|
@@ -120,15 +117,15 @@ Ruby Raider also supports scaffolding:
|
|
120
117
|
* To create a new steps definition you do: ```raider g steps [STEPS_NAME]```
|
121
118
|
* To create both a page/spec or a page/feature/steps you do: ```raider g scaffold [SCAFFOLD_NAME]```
|
122
119
|
|
123
|
-
It's possible to add the option --path or
|
120
|
+
It's possible to add the option --path or p if you want to specify where to create your features, pages, helpers and
|
124
121
|
specs.
|
125
122
|
|
126
123
|
If you want to set the default path for the creation of your features, helpers and specs:
|
127
124
|
|
128
125
|
```ruby
|
129
|
-
raider u path [PATH_NAME] - -feature or
|
130
|
-
raider u path [PATH_NAME] - -spec or
|
131
|
-
raider u path [PATH_NAME] - -helper or
|
126
|
+
raider u path [PATH_NAME] - -feature or f
|
127
|
+
raider u path [PATH_NAME] - -spec or s
|
128
|
+
raider u path [PATH_NAME] - -helper or h
|
132
129
|
```
|
133
130
|
|
134
131
|
If you don't specify an option, path will assume you want to change the default path for pages.
|
@@ -139,4 +136,4 @@ To initialise Appium server run this command:
|
|
139
136
|
|
140
137
|
```ruby
|
141
138
|
raider u start_appium
|
142
|
-
```
|
139
|
+
```
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require_relative 'plugin_exposer'
|
5
|
+
|
6
|
+
module RubyRaider
|
7
|
+
module Plugin
|
8
|
+
class << self
|
9
|
+
def add_plugin(plugin_name)
|
10
|
+
return pp 'The plugin was not found' unless available?(plugin_name)
|
11
|
+
return pp 'The plugin is already installed' if installed?(plugin_name)
|
12
|
+
|
13
|
+
pp "Adding #{plugin_name}..."
|
14
|
+
add_plugin_to_gemfile(plugin_name)
|
15
|
+
system('bundle install')
|
16
|
+
PluginExposer.expose_commands(plugin_name)
|
17
|
+
pp "The plugin #{plugin_name} is added"
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete_plugin(plugin_name)
|
21
|
+
return 'The plugin is not installed' unless installed_plugins.include?(plugin_name)
|
22
|
+
|
23
|
+
pp "Deleting #{plugin_name}..."
|
24
|
+
remove_plugin_from_gemfile(plugin_name)
|
25
|
+
PluginExposer.remove_command(plugin_name)
|
26
|
+
system('bundle install')
|
27
|
+
pp "The plugin #{plugin_name} is deleted"
|
28
|
+
end
|
29
|
+
|
30
|
+
def installed_plugins
|
31
|
+
parsed_gemfile = File.readlines('Gemfile').map { |line| line.sub('gem ', '').strip.delete("'") }
|
32
|
+
parsed_gemfile.select { |line| available_plugins.include?(line) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def available_plugins
|
36
|
+
plugins['plugins']
|
37
|
+
end
|
38
|
+
|
39
|
+
def installed?(plugin_name)
|
40
|
+
installed_plugins.include?(plugin_name)
|
41
|
+
end
|
42
|
+
|
43
|
+
def available?(plugin_name)
|
44
|
+
available_plugins.include?(plugin_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def camelize(str)
|
48
|
+
str.split('_').collect(&:capitalize).join
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def add_plugin_to_gemfile(plugin_name)
|
54
|
+
File.open('Gemfile', 'a') do |file|
|
55
|
+
file.puts "\n# Ruby Raider Plugins\n" unless comment_present?
|
56
|
+
file.puts "gem '#{plugin_name}'" unless plugin_present?(plugin_name)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def remove_plugin_from_gemfile(plugin_name)
|
61
|
+
output_lines = remove_plugins_and_comments(plugin_name)
|
62
|
+
update_gemfile(output_lines)
|
63
|
+
end
|
64
|
+
|
65
|
+
def last_plugin?
|
66
|
+
installed_plugins.count == 1
|
67
|
+
end
|
68
|
+
|
69
|
+
def plugins
|
70
|
+
@plugins ||= YAML.load_file(File.expand_path('plugins.yml'))
|
71
|
+
end
|
72
|
+
|
73
|
+
def read_gemfile
|
74
|
+
File.readlines('Gemfile')
|
75
|
+
end
|
76
|
+
|
77
|
+
def comment_present?
|
78
|
+
read_gemfile.grep(/Ruby Raider Plugins/).any?
|
79
|
+
end
|
80
|
+
|
81
|
+
def plugin_present?(plugin_name)
|
82
|
+
read_gemfile.grep(/#{plugin_name}/).any?
|
83
|
+
end
|
84
|
+
|
85
|
+
def remove_plugins_and_comments(plugin_name)
|
86
|
+
read_gemfile.reject do |line|
|
87
|
+
line.include?(plugin_name) || line.include?('Ruby Raider Plugins') && last_plugin?
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# :reek:NestedIterators { enabled: false }
|
92
|
+
def update_gemfile(output_lines)
|
93
|
+
File.open('Gemfile', 'w') do |file|
|
94
|
+
output_lines.each { |line| file.puts line }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../plugin/plugin'
|
4
|
+
|
5
|
+
module RubyRaider
|
6
|
+
module PluginExposer
|
7
|
+
class << self
|
8
|
+
FILE_PATH = File.expand_path('../commands/loaded_commands.rb', __dir__)
|
9
|
+
# :reek:NestedIterators { enabled: false }
|
10
|
+
def expose_commands(plugin_name)
|
11
|
+
return pp 'The plugin is already installed' if plugin_present?(plugin_name)
|
12
|
+
|
13
|
+
commands = read_loaded_commands
|
14
|
+
|
15
|
+
File.open(FILE_PATH, 'w') do |file|
|
16
|
+
commands.each do |line|
|
17
|
+
file.puts line
|
18
|
+
file.puts require_plugin(plugin_name, line)
|
19
|
+
file.puts select_command_formatting(plugin_name, line)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_command(plugin_name)
|
25
|
+
return pp 'The plugin is not installed' unless plugin_present?(plugin_name)
|
26
|
+
|
27
|
+
delete_plugin_command(plugin_name)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def any_commands?
|
33
|
+
read_loaded_commands.any? { |line| line.include?('subcommand') }
|
34
|
+
end
|
35
|
+
|
36
|
+
def read_loaded_commands
|
37
|
+
File.readlines(FILE_PATH)
|
38
|
+
end
|
39
|
+
|
40
|
+
def formatted_command_without_space(plugin_name)
|
41
|
+
"desc '#{plugin_name}', 'Provides access to all the commands for #{plugin_name}'\n" \
|
42
|
+
"subcommand '#{plugin_name}', #{Plugin.camelize(plugin_name)}::PluginCommands"
|
43
|
+
end
|
44
|
+
|
45
|
+
def formatted_command_with_space(plugin_name)
|
46
|
+
"\n#{formatted_command_without_space(plugin_name)}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def plugin_present?(plugin_name)
|
50
|
+
read_loaded_commands.grep(/#{plugin_name}/).any?
|
51
|
+
end
|
52
|
+
|
53
|
+
def select_command_formatting(plugin_name, line)
|
54
|
+
if line.strip == 'class LoadedCommands < Thor' && !any_commands?
|
55
|
+
formatted_command_without_space(plugin_name)
|
56
|
+
elsif any_commands?
|
57
|
+
formatted_command_with_space(plugin_name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def require_plugin(plugin_name, line)
|
62
|
+
"require '#{plugin_name}'" if line.include?("require 'thor'") && !plugin_present?(plugin_name)
|
63
|
+
end
|
64
|
+
|
65
|
+
# :reek:NestedIterators { enabled: false }
|
66
|
+
def delete_plugin_command(plugin_name)
|
67
|
+
output_lines = read_loaded_commands.reject do |line|
|
68
|
+
line.include?(plugin_name) if plugin_present?(plugin_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
File.open(FILE_PATH, 'w') do |file|
|
72
|
+
output_lines.each { |line| file.puts line }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../lib/plugin/plugin'
|
4
|
+
require_relative '../lib/commands/plugin_commands'
|
5
|
+
require_relative '../lib/commands/loaded_commands'
|
3
6
|
require_relative '../lib/commands/scaffolding_commands'
|
4
7
|
require_relative '../lib/commands/utility_commands'
|
5
8
|
|
@@ -7,9 +10,19 @@ require_relative '../lib/commands/utility_commands'
|
|
7
10
|
# :reek:UtilityFunction { enabled: false }
|
8
11
|
module RubyRaider
|
9
12
|
class Raider < Thor
|
13
|
+
no_tasks do
|
14
|
+
def self.plugin_commands?
|
15
|
+
File.readlines(File.expand_path('commands/loaded_commands.rb', __dir__)).any? do |line|
|
16
|
+
line.include?('subcommand')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_version = File.read(File.expand_path('version', __dir__)).strip
|
21
|
+
end
|
22
|
+
|
10
23
|
desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
|
11
24
|
option :parameters,
|
12
|
-
type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: '
|
25
|
+
type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: 'p'
|
13
26
|
|
14
27
|
def new(project_name)
|
15
28
|
params = options[:parameters]
|
@@ -22,7 +35,7 @@ module RubyRaider
|
|
22
35
|
MenuGenerator.new(project_name).generate_choice_menu
|
23
36
|
end
|
24
37
|
|
25
|
-
map '
|
38
|
+
map 'n' => 'new'
|
26
39
|
|
27
40
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
28
41
|
|
@@ -40,8 +53,14 @@ module RubyRaider
|
|
40
53
|
subcommand 'utility', UtilityCommands
|
41
54
|
map 'u' => 'utility'
|
42
55
|
|
43
|
-
|
44
|
-
|
56
|
+
desc 'plugin_manager', 'Provides access to all the commands to manager your plugins'
|
57
|
+
subcommand 'plugin_manager', PluginCommands
|
58
|
+
map 'pm' => 'plugin_manager'
|
59
|
+
|
60
|
+
if plugin_commands?
|
61
|
+
desc 'plugins', 'loaded plugin commands'
|
62
|
+
subcommand 'plugins', LoadedCommands
|
63
|
+
map 'ps' => 'plugins'
|
45
64
|
end
|
46
65
|
end
|
47
66
|
end
|
data/lib/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.7
|
data/plugins.yml
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_raider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -149,6 +149,8 @@ files:
|
|
149
149
|
- README.md
|
150
150
|
- Rakefile
|
151
151
|
- bin/raider
|
152
|
+
- lib/commands/loaded_commands.rb
|
153
|
+
- lib/commands/plugin_commands.rb
|
152
154
|
- lib/commands/scaffolding_commands.rb
|
153
155
|
- lib/commands/utility_commands.rb
|
154
156
|
- lib/generators/actions/actions_generator.rb
|
@@ -221,6 +223,8 @@ files:
|
|
221
223
|
- lib/generators/templates/helpers/spec_helper.tt
|
222
224
|
- lib/generators/templates/helpers/visual_helper.tt
|
223
225
|
- lib/generators/templates/helpers/visual_spec_helper.tt
|
226
|
+
- lib/plugin/plugin.rb
|
227
|
+
- lib/plugin/plugin_exposer.rb
|
224
228
|
- lib/ruby_raider.rb
|
225
229
|
- lib/scaffolding/scaffolding.rb
|
226
230
|
- lib/scaffolding/templates/feature.tt
|
@@ -231,6 +235,7 @@ files:
|
|
231
235
|
- lib/utilities/logger.rb
|
232
236
|
- lib/utilities/utilities.rb
|
233
237
|
- lib/version
|
238
|
+
- plugins.yml
|
234
239
|
- ruby_raider.gemspec
|
235
240
|
- spec/integration/commands/scaffolding_commands_spec.rb
|
236
241
|
- spec/integration/commands/utility_commands_spec.rb
|