pear-programmer 0.1.8 → 0.1.9
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 +1 -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: a283d4c891d368dc2e993708b00ea90fbb1f86f5e68765bd9f0d18b7b0567121
|
4
|
+
data.tar.gz: 8095247c090ed086de1eb1759c9c358c62ca9bd3312c06fba7917daf847aa1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e7cca90087e744d99049e53ca930e42a77dfa578042cd0487b620613a0d2a7d439fd11b7e65c8b45914a1718230daae4d3b2f36183369ae97b5d5f9aa04d50f
|
7
|
+
data.tar.gz: 657d5a54741dfc1454a3c5d463f8de7b3da702b826b7b6ff448b158a7686b183f65bb1ab8965ea817d4294b68d964f20f6385f1b5cce38164ada954ad088b234
|
data/lib/cli/actions.rb
CHANGED
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.9
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open3
|