ruby_raider 0.8.7 → 0.8.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
  SHA256:
3
- metadata.gz: c8de2c66fd076efbcd366c5a4aa6aee74d2aa0fb511ec3f1887e669d44aae0d6
4
- data.tar.gz: 2f28902ccb937b3c590eebb404f69fb42cb303bcc187ff1020ea931951734556
3
+ metadata.gz: a3fe29e41e6594c06a03da48fdd3481af4706a6cf4e5c344bb3f78db1e48cec8
4
+ data.tar.gz: 3b53ca1421e02300c0edb463cd4ca7c373992afdb41caa70318fc9df213fec90
5
5
  SHA512:
6
- metadata.gz: a4e7fdf2921ed2f7e16ff1593b1879098c7c87584a194f5a0d132f30ac3f3a032d1377fd208f1ee3d876531902cb945909161db6bb10074b675efc3adc5ae7e5
7
- data.tar.gz: 6cacf73aa4cec432e6ab9591f04f9616661c7922f17ca0a8c83f79278191f0320851bc436df56c93afc330969f5e9ce51c147ecacb36946951685cc207264739
6
+ metadata.gz: 2b684e1ebcca1611a9593f3b77039bfd66e21656e6746f6e31a5240f9fdb032527e29f63d5aab3caf770c472c4c8810f50c587a61375568d6db4d93258454c49
7
+ data.tar.gz: da691e9de5d1128eb1aa0d99fbbde682afb70d0be3bf3d29a75b88bbc2af7c771b19a1aa29295fa4c1f5bd8d56082f7659284aff7484c6f284d6891ae21ff9c9
@@ -20,6 +20,4 @@ jobs:
20
20
  run: bundle install
21
21
 
22
22
  - name: Build and run integration tests
23
- env:
24
- OPENAI_ACCESS_TOKEN: ${{ secrets.OPENAI_ACCESS_TOKEN }}
25
23
  run: rake integration
@@ -0,0 +1,37 @@
1
+ name: Push Gem
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ push:
11
+ if: github.repository == 'RubyRaider/ruby_raider'
12
+ runs-on: ubuntu-latest
13
+
14
+ environment:
15
+ name: rubygems.org
16
+ url: https://rubygems.org/gems/ruby_raider
17
+
18
+ permissions:
19
+ contents: write
20
+ id-token: write
21
+
22
+ steps:
23
+ # Set up
24
+ - name: Harden Runner
25
+ uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
26
+ with:
27
+ egress-policy: audit
28
+
29
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
32
+ with:
33
+ bundler-cache: true
34
+ ruby-version: ruby
35
+
36
+ # Release
37
+ - uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
@@ -26,6 +26,4 @@ jobs:
26
26
  run: bundle install
27
27
 
28
28
  - name: Build and run system tests
29
- env:
30
- OPENAI_ACCESS_TOKEN: ${{ secrets.OPENAI_ACCESS_TOKEN }}
31
29
  run: rake system
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  ruby_raider-*.gem
2
2
  .idea/
3
3
  ruby_raider.iml
4
- Gemfile.lock
5
- .env
4
+ Gemfile.lock
data/.reek.yml CHANGED
@@ -7,6 +7,3 @@ detectors:
7
7
  exclude:
8
8
  - initialize
9
9
  max_statements: 10
10
-
11
- exclude_paths:
12
- - 'lib/commands/open_ai_commands.rb'
data/.rubocop.yml CHANGED
@@ -1,10 +1,6 @@
1
1
  require:
2
2
  - rubocop-rspec
3
3
 
4
- AllCops:
5
- Exclude:
6
- - 'lib/commands/open_ai_commands.rb'
7
-
8
4
  # Layout
9
5
  Layout/CaseIndentation:
10
6
  Enabled: false
data/README.md CHANGED
@@ -91,7 +91,6 @@ Commands:
91
91
  raider generate # Provides access to all the scaffolding commands
92
92
  raider help [COMMAND] # Describe available commands or one specific command
93
93
  raider new [PROJECT_NAME] # Creates a new framework based on settings picked
94
- raider open_ai # Provides access to all the open ai commands
95
94
  raider utility # Provides access to all the utility commands
96
95
  raider version # It shows the version of Ruby Raider you are currently using
97
96
  ```
@@ -100,7 +99,6 @@ All the basic commands have their corresponding shortcut:
100
99
 
101
100
  * g for generate
102
101
  * n for new
103
- * o for open_ai
104
102
  * u for utility
105
103
  * v for version
106
104
 
@@ -133,27 +131,6 @@ To initialise Appium server run this command:
133
131
  raider u start_appium
134
132
  ```
135
133
 
136
- ### Open AI Commands
137
-
138
- ```ruby
139
- # Will print the result of the request on the terminal
140
- raider o make [REQUEST]
141
- # Will create a file with the result of your request as content
142
- raider o make [REQUEST] - -path or -p [PATH]
143
- # Will input the content of the chosen file into open ai and will edit it based on the result
144
- raider o make [PATH_NAME] - -edit or -e [FILE_PATH]
145
- # Creates a cucumber file and uses it to input into open ai and create a steps file
146
- # The prompt is required
147
- raider o cucumber [NAME] - -prompt or -p [PROMPT]
148
- # Creates a cucumber step definitions file based on an scenario file
149
- raider open_ai steps [NAME]
150
- Options :
151
- -p, [--path = PATH] # The path where your steps will be created
152
- -pr, [--prompt = PROMPT] # This will create the selected steps based on your prompt using open ai
153
- -i, [--input = INPUT] # It uses a file as input to create the steps
154
-
155
- ```
156
-
157
134
  ### Sponsors
158
135
 
159
136
  This project is tested with BrowserStack.
@@ -1,29 +1,25 @@
1
1
  # Ruby Raider
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/ruby_raider.svg)](https://badge.fury.io/rb/ruby_raider)
4
- [![Rubocop](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml/badge.svg)](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml)
5
- [![Gitter](https://badges.gitter.im/RubyRaider/community.svg)](https://gitter.im/RubyRaider/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6
-
7
3
  <!-- PROJECT LOGO -->
8
4
  <br />
9
5
  <div align="center">
10
- <a href="https://github.com/RubyRaider/ruby_raider">
11
- <img src="https://rubyraiderdotcom.files.wordpress.com/2022/05/logo_transparent_background-1.png" alt="Logo">
12
- </a>
13
- <h1 align="center">Ruby Raider</h1>
14
- <p align="center">
15
- This is a gem to make setup and start of UI automation projects easier.
16
- <br />
17
- <a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
18
- <br />
19
- <br />
20
- <a href="https://rubygems.org/gems/ruby_raider">Rubygems</a>
21
- ·
22
- <a href="https://github.com/RubyRaider/ruby_raider/issues">Report Bug</a>
23
- ·
24
- <a href="https://github.com/RubyRaider/ruby_raider/issues">Request Feature</a>
25
- </p>
26
- <p align="center"> For more information and updates on releases, see <a href="https://ruby-raider.com">https://ruby-raider.com</a></p>
6
+ <a href="https://github.com/RubyRaider/ruby_raider">
7
+ <img src="https://rubyraiderdotcom.files.wordpress.com/2022/05/logo_transparent_background-1.png" alt="Logo">
8
+ </a>
9
+ <h1 align="center">Ruby Raider</h1>
10
+ <p align="center">
11
+ This is a gem to make setup and start of UI automation projects easier.
12
+ <br />
13
+ <a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
14
+ <br />
15
+ <br />
16
+ <a href="https://rubygems.org/gems/ruby_raider">Rubygems</a>
17
+ ·
18
+ <a href="https://github.com/RubyRaider/ruby_raider/issues">Report Bug</a>
19
+ ·
20
+ <a href="https://github.com/RubyRaider/ruby_raider/issues">Request Feature</a>
21
+ </p>
22
+ <p align="center"> For more information and updates on releases, see <a href="https://ruby-raider.com">https://ruby-raider.com</a></p>
27
23
  </div>
28
24
 
29
25
  ## What is Ruby Raider?
@@ -86,19 +82,17 @@ Select the ones you will like to work with.
86
82
 
87
83
  ```ruby
88
84
  Commands:
89
- raider generate # Provides access to all the scaffolding commands
90
- raider help [COMMAND] # Describe available commands or one specific command
91
- raider new [PROJECT_NAME] # Creates a new framework based on settings picked
92
- raider open_ai # Provides access to all the open ai commands
93
- raider utility # Provides access to all the utility commands
94
- raider version # It shows the version of Ruby Raider you are currently using
85
+ raider generate # Provides access to all the scaffolding commands
86
+ raider help [COMMAND] # Describe available commands or one specific command
87
+ raider new [PROJECT_NAME] # Creates a new framework based on settings picked
88
+ raider utility # Provides access to all the utility commands
89
+ raider version # It shows the version of Ruby Raider you are currently using
95
90
  ```
96
91
 
97
92
  All the basic commands have their corresponding shortcut:
98
93
 
99
94
  * g for generate
100
95
  * n for new
101
- * o for open_ai
102
96
  * u for utility
103
97
  * v for version
104
98
 
@@ -130,24 +124,3 @@ To initialise Appium server run this command:
130
124
  ```ruby
131
125
  raider u start_appium
132
126
  ```
133
-
134
- ### Open AI Commands
135
-
136
- ```ruby
137
- # Will print the result of the request on the terminal
138
- raider o make [REQUEST]
139
- # Will create a file with the result of your request as content
140
- raider o make [REQUEST] - -path or -p [PATH]
141
- # Will input the content of the chosen file into open ai and will edit it based on the result
142
- raider o make [PATH_NAME] - -edit or -e [FILE_PATH]
143
- # Creates a cucumber file and uses it to input into open ai and create a steps file
144
- # The prompt is required
145
- raider o cucumber [NAME] - -prompt or -p [PROMPT]
146
- # Creates a cucumber step definitions file based on an scenario file
147
- raider open_ai steps [NAME]
148
- Options :
149
- -p, [--path = PATH] # The path where your steps will be created
150
- -pr, [--prompt = PROMPT] # This will create the selected steps based on your prompt using open ai
151
- -i, [--input = INPUT] # It uses a file as input to create the steps
152
-
153
- ```
data/lib/ruby_raider.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../lib/commands/open_ai_commands'
4
3
  require_relative '../lib/commands/scaffolding_commands'
5
4
  require_relative '../lib/commands/utility_commands'
6
5
 
@@ -28,10 +27,6 @@ module RubyRaider
28
27
  subcommand 'generate', ScaffoldingCommands
29
28
  map 'g' => 'generate'
30
29
 
31
- desc 'open_ai', 'Provides access to all the open ai commands'
32
- subcommand 'open_ai', OpenAiCommands
33
- map 'o' => 'open_ai'
34
-
35
30
  desc 'utility', 'Provides access to all the utility commands'
36
31
  subcommand 'utility', UtilityCommands
37
32
  map 'u' => 'utility'
data/lib/version CHANGED
@@ -1 +1 @@
1
- 0.8.7
1
+ 0.8.8
data/ruby_raider.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
23
23
 
24
24
  s.add_runtime_dependency 'faraday', '~> 1.10.0'
25
- s.add_runtime_dependency 'ruby-openai', '~> 3.5'
26
25
  s.add_runtime_dependency 'thor', '~> 1.2.1'
27
26
  s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
28
27
  end
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.8.7
4
+ version: 0.8.8
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-05-28 00:00:00.000000000 Z
11
+ date: 2024-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -122,20 +122,6 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.10.0
125
- - !ruby/object:Gem::Dependency
126
- name: ruby-openai
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.5'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.5'
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: thor
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +162,7 @@ files:
176
162
  - ".github/ISSUE_TEMPLATE/feature_request.md"
177
163
  - ".github/auto_assign-issues.yml"
178
164
  - ".github/workflows/integration.yml"
165
+ - ".github/workflows/push_gem.yml"
179
166
  - ".github/workflows/reek.yml"
180
167
  - ".github/workflows/rubocop.yml"
181
168
  - ".github/workflows/system.yml"
@@ -189,7 +176,6 @@ files:
189
176
  - README.md
190
177
  - Rakefile
191
178
  - bin/raider
192
- - lib/commands/open_ai_commands.rb
193
179
  - lib/commands/scaffolding_commands.rb
194
180
  - lib/commands/utility_commands.rb
195
181
  - lib/generators/actions/actions_generator.rb
@@ -262,7 +248,6 @@ files:
262
248
  - lib/generators/templates/helpers/spec_helper.tt
263
249
  - lib/generators/templates/helpers/visual_helper.tt
264
250
  - lib/generators/templates/helpers/visual_spec_helper.tt
265
- - lib/open_ai/open_ai.rb
266
251
  - lib/ruby_raider.rb
267
252
  - lib/scaffolding/scaffolding.rb
268
253
  - lib/scaffolding/templates/feature.tt
@@ -274,7 +259,6 @@ files:
274
259
  - lib/utilities/utilities.rb
275
260
  - lib/version
276
261
  - ruby_raider.gemspec
277
- - spec/integration/commands/open_ai_commands_spec.rb
278
262
  - spec/integration/commands/scaffolding_commands_spec.rb
279
263
  - spec/integration/commands/utility_commands_spec.rb
280
264
  - spec/integration/generators/actions_generator_spec.rb
@@ -305,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
289
  - !ruby/object:Gem::Version
306
290
  version: '0'
307
291
  requirements: []
308
- rubygems_version: 3.5.5
292
+ rubygems_version: 3.5.3
309
293
  signing_key:
310
294
  specification_version: 4
311
295
  summary: A gem to make setup and start of UI automation projects easier
@@ -1,61 +0,0 @@
1
- require 'thor'
2
- require_relative '../open_ai/open_ai'
3
-
4
- class OpenAiCommands < Thor
5
- desc 'make [REQUEST]', 'Uses open AI to create a file or generate output'
6
- option :path,
7
- type: :string, required: false, desc: 'The path where your file will be created', aliases: '-p'
8
- option :edit,
9
- type: :string, required: false, desc: 'Path to the file you want to edit', aliases: '-e'
10
-
11
- def make(request, path = nil)
12
- path ||= options[:path]
13
- edit_path = options[:edit]
14
- if edit_path
15
- pp 'Editing File...'
16
- OpenAi.edit_file(path: edit_path, request: request)
17
- pp "File #{edit_path} edited"
18
- elsif path
19
- pp 'Generating File...'
20
- OpenAi.create_file(path: path, request: request)
21
- pp "File created in #{path}"
22
- else
23
- puts OpenAi.output(request: request)
24
- end
25
- end
26
-
27
- desc 'cucumber [NAME]', 'Creates feature and step files only using open ai'
28
- option :prompt,
29
- type: :string,
30
- required: true, desc: 'The prompt for open ai', aliases: '-p'
31
-
32
- def cucumber(name)
33
- feature_path = "features/#{name}.feature"
34
- make(options[:prompt], feature_path)
35
- prompt_step = "create cucumber steps for the following scenarios in ruby #{File.read(feature_path)}"
36
- make(prompt_step, "features/step_definitions/#{name}_steps.rb")
37
- end
38
-
39
- desc 'steps [NAME]', 'Creates a new step definitions file'
40
- option :path,
41
- type: :string,
42
- required: false, desc: 'The path where your steps will be created', aliases: '-p'
43
- option :prompt,
44
- type: :string, required: false,
45
- desc: 'This will create the selected steps based on your prompt using open ai', aliases: '-pr'
46
- option :input,
47
- type: :string,
48
- required: false, desc: 'It uses a file as input to create the steps', aliases: '-i'
49
-
50
- def steps(name)
51
- path = 'features/step_definitions'
52
- input = options[:input]
53
- if input
54
- prompt = options[:prompt] || 'create cucumber steps for the following scenarios in ruby'
55
- content = "#{prompt} #{File.read(input)}"
56
- make(content, "#{path}/#{name}_steps.rb")
57
- else
58
- make(options[:open_ai], "#{path}/#{name}_steps.rb")
59
- end
60
- end
61
- end
@@ -1,67 +0,0 @@
1
- require 'openai'
2
- require 'fileutils'
3
-
4
- module OpenAi
5
- class << self
6
- def client
7
- @client ||= create_client
8
- end
9
-
10
- def create_client
11
- configure_client
12
- OpenAI::Client.new
13
- end
14
-
15
- def configure_client
16
- OpenAI.configure do |config|
17
- config.access_token = ENV.fetch('OPENAI_ACCESS_TOKEN')
18
- config.organization_id = ENV.fetch('OPENAI_ORGANIZATION_ID', nil)
19
- end
20
- end
21
-
22
- def input(request, model = 'gpt-3.5-turbo', temperature = 0.7)
23
- client.chat(
24
- parameters: {
25
- model: model,
26
- messages: [{ role: 'user', content: request }],
27
- temperature: temperature
28
- })
29
- end
30
-
31
- def create_file(options)
32
- path, request, choice = options.values_at(:path, :request, :choice)
33
- File.write(path, output(request: request, choice: choice))
34
- end
35
-
36
- def output(options)
37
- request, choice = options.values_at(:request, :choice)
38
- choice ||= 0
39
- extract_text(input(request), 'choices', choice, 'message', 'content')
40
- end
41
-
42
- def edit_file(options)
43
- path, request, choice = options.values_at(:path, :request, :choice)
44
- content = File.read(path)
45
- response = edit(content: content, request: request)
46
- File.write(path, extract_text(response, 'choices', choice, 'text'))
47
- end
48
-
49
- def edit(options)
50
- content, request, model = options.values_at(:content, :request, :model)
51
- model ||= 'text-davinci-edit-001'
52
- client.edits(
53
- parameters: {
54
- model: model,
55
- input: content,
56
- instruction: request
57
- }
58
- )
59
- end
60
-
61
- private
62
-
63
- def extract_text(response, *keys)
64
- response.dig(*keys)
65
- end
66
- end
67
- end
@@ -1,37 +0,0 @@
1
- # require 'dotenv'
2
- # require 'fileutils'
3
- # require 'pathname'
4
- # require 'yaml'
5
- # require_relative '../../../lib/generators/common_generator'
6
- # require_relative '../../../lib/integration.commands/open_ai_commands'
7
- # require_relative '../../../lib/scaffolding/scaffolding'
8
- # require_relative '../../spec_helper'
9
- #
10
- # describe OpenAiCommands do
11
- # let(:open_ai) { described_class }
12
- # let(:name) { 'test' }
13
- #
14
- # orig_dir = Dir.pwd
15
- # Dotenv.load
16
- #
17
- # after do
18
- # Dir.chdir orig_dir
19
- # end
20
- #
21
- # context 'without any project' do
22
- # after do
23
- # FileUtils.rm_rf('joke.txt')
24
- # end
25
- #
26
- # # TODO: Enable test once the paid account is setup
27
- # # it 'creates a file using open ai' do
28
- # # open_ai.new.invoke(:make, nil, ['tell me a joke', '--path', 'joke.txt'])
29
- # # expect(File).to be_size('joke.txt')
30
- # # end
31
- #
32
- # # it 'edits an existing file using open ai' do
33
- # # FileUtils.touch('joke.txt')
34
- # # open_ai.new.invoke(:make, nil, ['tell me a better joke', '--edit', 'joke.txt'])
35
- # # end
36
- # end
37
- # end