ruby_raider 0.4.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commands/utility_commands.rb +18 -3
- data/lib/utilities/open_ai.rb +37 -0
- data/ruby_raider.gemspec +2 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eb106f129e5b690948b563085637b1bf775ffbd0258972b8fd7551021abe64e
|
4
|
+
data.tar.gz: ad19ffdff7e43f3dc4f8a81f7720022c519070cc685bf9bd489ff130ad484fe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a319a898af7c5d4282d06904bdf298efcb1aeff70715c8ba18bee62b5af289375d8fc398cfd2fe1d236518569f367500532989e55bac102ee6ea45397922d3c9
|
7
|
+
data.tar.gz: c4d26509776661ee9d52d8962f00929a8e50b3e7e14583b65568685b7f9562c3cc7412eb0151659f34c9cf7edccad8225238293c6187ab402919ab8964866204
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'thor'
|
4
4
|
require_relative '../utilities/utilities'
|
5
|
+
require_relative '../utilities/open_ai'
|
5
6
|
|
6
7
|
class UtilityCommands < Thor
|
7
8
|
desc 'path [PATH]', 'Sets the default path for scaffolding'
|
@@ -73,7 +74,7 @@ class UtilityCommands < Thor
|
|
73
74
|
option :delete,
|
74
75
|
type: :boolean, required: false, desc: 'This will delete the selected config file', aliases: '-d'
|
75
76
|
|
76
|
-
desc 'platform [
|
77
|
+
desc 'platform [PLATFORM]', 'Sets the default platform for a cross-platform project'
|
77
78
|
|
78
79
|
def platform(platform)
|
79
80
|
Utilities.new.platform = platform
|
@@ -81,7 +82,7 @@ class UtilityCommands < Thor
|
|
81
82
|
|
82
83
|
map '-pl' => 'platform'
|
83
84
|
|
84
|
-
desc 'download_builds [
|
85
|
+
desc 'download_builds [BUILD_TYPE]', 'It downloads the example builds for appium projects'
|
85
86
|
def download_builds(build_type)
|
86
87
|
if %w[android, ios, both].include?(build_type)
|
87
88
|
raise 'Please select one of the following build types: android, ios, both'
|
@@ -94,8 +95,22 @@ class UtilityCommands < Thor
|
|
94
95
|
|
95
96
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
96
97
|
def version
|
97
|
-
puts 'The Ruby Raider version is 0.
|
98
|
+
puts 'The Ruby Raider version is 0.5.0, Happy testing!'
|
98
99
|
end
|
99
100
|
|
100
101
|
map '-v' => 'version'
|
102
|
+
|
103
|
+
desc 'open_ai [REQUEST]', 'Uses open AI to create a file or generate output'
|
104
|
+
option :path,
|
105
|
+
type: :string, required: false, desc: 'The path where your file will be created', aliases: '-p'
|
106
|
+
option :output,
|
107
|
+
type: :string, required: false, desc: 'This will output the response from open AI on the terminal', aliases: '-o'
|
108
|
+
|
109
|
+
def open_ai(request)
|
110
|
+
if options[:path]
|
111
|
+
OpenAi.create_file(choice = 0, options[:path], request)
|
112
|
+
else
|
113
|
+
OpenAi.output(request)
|
114
|
+
end
|
115
|
+
end
|
101
116
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'openai'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module OpenAi
|
5
|
+
class << self
|
6
|
+
def create_client
|
7
|
+
configure_client
|
8
|
+
OpenAI::Client.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def configure_client
|
12
|
+
OpenAI.configure do |config|
|
13
|
+
config.access_token = ENV.fetch('OPENAI_ACCESS_TOKEN')
|
14
|
+
config.organization_id = ENV.fetch('OPENAI_ORGANIZATION_ID', nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def input(model = "gpt-3.5-turbo", temperature = 0.7, request)
|
19
|
+
create_client.chat(
|
20
|
+
parameters: {
|
21
|
+
model: model,
|
22
|
+
messages: [{ role: "user", content: request }],
|
23
|
+
temperature: temperature
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_file(choice = 0, path, request)
|
28
|
+
response = input(request)
|
29
|
+
File.write(path, response.dig("choices", choice, "message", "content"))
|
30
|
+
end
|
31
|
+
|
32
|
+
def output(choice = 0, request)
|
33
|
+
response = input(request)
|
34
|
+
puts response.dig("choices", choice, "message", "content")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/ruby_raider.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ruby_raider'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.5.0'
|
6
6
|
s.summary = 'A gem to make setup and start of UI automation projects easier'
|
7
7
|
s.description = 'This gem has everything you need to start working with test automation'
|
8
8
|
s.authors = ['Agustin Pequeno']
|
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'thor', '~> 1.2.1'
|
24
24
|
s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
|
25
|
+
s.add_runtime_dependency 'ruby-openai', '~> 3.5'
|
25
26
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.23.1
|
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'
|
125
139
|
description: This gem has everything you need to start working with test automation
|
126
140
|
email: agustin.pe94@gmail.com
|
127
141
|
executables:
|
@@ -217,6 +231,7 @@ files:
|
|
217
231
|
- lib/scaffolding/templates/helper.tt
|
218
232
|
- lib/scaffolding/templates/page_object.tt
|
219
233
|
- lib/scaffolding/templates/spec.tt
|
234
|
+
- lib/utilities/open_ai.rb
|
220
235
|
- lib/utilities/utilities.rb
|
221
236
|
- ruby_raider.gemspec
|
222
237
|
- spec/automation_generator_spec.rb
|
@@ -245,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
260
|
- !ruby/object:Gem::Version
|
246
261
|
version: '0'
|
247
262
|
requirements: []
|
248
|
-
rubygems_version: 3.3.
|
263
|
+
rubygems_version: 3.3.7
|
249
264
|
signing_key:
|
250
265
|
specification_version: 4
|
251
266
|
summary: A gem to make setup and start of UI automation projects easier
|