ruby_raider 0.4.9 → 0.5.1

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: 72809bc4815e52fc26dcd2986702462c2f80c58eea9d5d3ae4093b46b60497d3
4
- data.tar.gz: 367da2b34c2cebb02ceef20c4bea7cd4928ed18be55f02bccfe6d6b41b73ba0e
3
+ metadata.gz: 4901f96986636e0019995eda938ddb94a8598cf5a97f8f56bc7de451f0a8eb18
4
+ data.tar.gz: 8527ee87a6d3883e3729ef8ade090373c126bff67edf8cacc95e8f31430bc850
5
5
  SHA512:
6
- metadata.gz: a654e20f8320af80c083e7e4274ba18b4717a6ba070d858d0334ffae46785031b8e5098061fd54ca9d66562211dfedc797b17e34c81381bac7d4a388ad6e450f
7
- data.tar.gz: 8209f8add377cae9e94ce8e2db3825cf1d6eb40f07432b49a5c1e098963e99d3cbd7086cf9a1e8109b41ea498772d875826d12486d0b83271fdc28668608c1d3
6
+ metadata.gz: 420e8107aa26c7d8aba592f1da87628e5d17962838e07559951dd6112dd36d61e6aa07569a3295994940ab0d2bdfc38eb413a5aed3dba643fd9a55eb67ac24b2
7
+ data.tar.gz: 4c422144ce099f82abce7fb5cc363bf0f901c5f3a17d2d3a6bdc3e049442ca0082d52498c4761417410e0cbfc72d6b8edcefb5d98f07e5159b4d396e84d1081f
@@ -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 [platform]', 'Sets the default platform for a cross-platform project'
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 [build_type]', 'It downloads the example builds for appium projects'
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.4.7, Happy testing!'
98
+ puts 'The Ruby Raider version is 0.5.1, 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
+
107
+ def open_ai(request)
108
+ if options[:path]
109
+ OpenAi.create_file(choice = 0, options[:path], request)
110
+ else
111
+ OpenAi.output(request)
112
+ end
113
+ end
114
+
115
+ map '-oa' => 'open_ai'
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.4.9'
5
+ s.version = '0.5.1'
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']
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency 'rubocop-performance', '~> 1.15.0'
21
21
  s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
22
22
 
23
+ s.add_runtime_dependency 'ruby-openai', '~> 3.5'
23
24
  s.add_runtime_dependency 'thor', '~> 1.2.1'
24
25
  s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
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.9
4
+ version: 0.5.1
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-01-20 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.9.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby-openai
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.5'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.5'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: thor
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -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.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