pear-programmer 0.1.8 → 0.1.10
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/lib/cli/actions.rb +9 -1
- data/lib/cli/version.rb +1 -1
- data/lib/pairprogrammer/api/coder.rb +3 -2
- data/lib/pairprogrammer/command.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41bbb0a6dd818d03cc48a2d3c6af65505b3f03c390cd652a1bb20c13204d0816
|
4
|
+
data.tar.gz: d3de4fcd63755c9e7f1090f8b3a50e4649ed88b83e7714286724c05f3207adbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b4e76138f86463abf1e70ecfc75da7848a1af62232cd732a4559befdf8b5fee1fb272cdcb491c833df9c0d0a4d8ce4aa84c1b7ec19eee9bbe36ef4f6a0b37c0
|
7
|
+
data.tar.gz: 4a38b125981dd747fff0061393f3224a44a15f7c56783569393a21b0315034743ace8e36b6cd378dd958a0d0af3a037fdc65ce9809c044f76beea908639afc39
|
data/lib/cli/actions.rb
CHANGED
@@ -98,6 +98,11 @@ module Cli
|
|
98
98
|
id = options[:id]
|
99
99
|
else
|
100
100
|
coders = PairProgrammer::Api::Coder.list
|
101
|
+
if coders.empty?
|
102
|
+
Cli::Display.error_message("you have not created any requirements yet")
|
103
|
+
return
|
104
|
+
end
|
105
|
+
|
101
106
|
id = Cli::Display.select("Select which requirements you would like to work on", coders.inject({}) { |hash, coder| hash[coder["requirements"]] = coder["id"]; hash })
|
102
107
|
end
|
103
108
|
|
@@ -135,6 +140,9 @@ module Cli
|
|
135
140
|
end
|
136
141
|
|
137
142
|
system_message = response["system_message"]
|
143
|
+
if system_message.nil?
|
144
|
+
next
|
145
|
+
end
|
138
146
|
|
139
147
|
response_required = true
|
140
148
|
# TODO if there is explanation but no command then response is required
|
@@ -190,7 +198,7 @@ module Cli
|
|
190
198
|
Cli::Display.info_message("retrying...")
|
191
199
|
next
|
192
200
|
end
|
193
|
-
PairProgrammer::Api::Coder.append_output(id, output)
|
201
|
+
PairProgrammer::Api::Coder.append_output(id, output, system_message["command"])
|
194
202
|
end
|
195
203
|
end
|
196
204
|
end
|
data/lib/cli/version.rb
CHANGED
@@ -29,10 +29,11 @@ module PairProgrammer
|
|
29
29
|
Client.new.post('/api/v1/coder/run', body)
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.append_output(id, output)
|
32
|
+
def self.append_output(id, output, command_name)
|
33
33
|
body = {
|
34
34
|
id: id,
|
35
|
-
output: output
|
35
|
+
output: output,
|
36
|
+
command: command_name
|
36
37
|
}
|
37
38
|
Client.new.post('/api/v1/coder/append_output', body)
|
38
39
|
end
|
@@ -71,6 +71,7 @@ module PairProgrammer
|
|
71
71
|
File.open(file_path, 'w') do |file|
|
72
72
|
file_content.each { |line| file.puts(line) }
|
73
73
|
end
|
74
|
+
"file updated"
|
74
75
|
when "yarn"
|
75
76
|
run_shell "cd #{PairProgrammer::Configuration.root} && yarn #{arguments["command"]}"
|
76
77
|
when "mv"
|
@@ -90,12 +91,13 @@ module PairProgrammer
|
|
90
91
|
File.open(file_path, "w") do |file|
|
91
92
|
file.puts(arguments["content"])
|
92
93
|
end
|
94
|
+
"file updated"
|
93
95
|
when "create_directory"
|
94
96
|
directory_path = PairProgrammer::Configuration.absolute_path(arguments["directory_path"])
|
95
|
-
FileUtils.mkdir_p(directory_path)
|
97
|
+
FileUtils.mkdir_p(directory_path) || "directory created"
|
96
98
|
when "delete_file"
|
97
99
|
file_path = PairProgrammer::Configuration.absolute_path(arguments["file_path"])
|
98
|
-
File.delete(file_path)
|
100
|
+
File.delete(file_path) || "file_deleted"
|
99
101
|
when "view_changes"
|
100
102
|
# TODO
|
101
103
|
when "delete_lines"
|
@@ -109,13 +111,13 @@ module PairProgrammer
|
|
109
111
|
lines.delete_if.with_index { |line, index| line_numbers.include?(index) }
|
110
112
|
|
111
113
|
# Write the modified contents back to the file
|
112
|
-
File.write(file_path, lines.join)
|
114
|
+
File.write(file_path, lines.join) || "lines deleted"
|
113
115
|
when "rspec"
|
114
116
|
file_path = PairProgrammer::Configuration.absolute_path(arguments["file_path"])
|
115
117
|
run_shell "cd #{PairProgrammer::Configuration.root} && rspec #{file_path}}"
|
116
118
|
when "ask_question"
|
117
119
|
puts arguments["question"]
|
118
|
-
STDIN.gets.chomp
|
120
|
+
STDIN.gets.chomp || ''
|
119
121
|
when "read_file"
|
120
122
|
file_path = PairProgrammer::Configuration.absolute_path(arguments["file_path"])
|
121
123
|
if File.exist?(file_path)
|
@@ -126,7 +128,7 @@ module PairProgrammer
|
|
126
128
|
when "create_file"
|
127
129
|
# TODO return response if file is already created
|
128
130
|
file_path = PairProgrammer::Configuration.absolute_path(arguments["file_path"])
|
129
|
-
FileUtils.touch(file_path)
|
131
|
+
FileUtils.touch(file_path) || "file created"
|
130
132
|
else
|
131
133
|
raise "Invalid command: #{command}"
|
132
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pear-programmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Edelstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open3
|