rubyn 0.1.6 → 0.1.7
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/rubyn/tools/git_create_branch.rb +1 -1
- data/lib/rubyn/tools/patch_file.rb +6 -3
- data/lib/rubyn/tools/run_tests.rb +4 -1
- data/lib/rubyn/tools/search_files.rb +4 -3
- data/lib/rubyn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b608a9d2f94acf82de5f6867e77deb5c718d0181014b90bc2438fb2a77be159c
|
|
4
|
+
data.tar.gz: 60fef63b740da2e1d133123b94baf2fe10a42965b676451265e38c27b7f51d44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e681790e738cb8ef39ff1722ae8693b8491aa63e402b21842501480a1b1e14b41b4717b746362b9d3d847725760b264284d6f6c2ce51a152f5db4eabdb178465
|
|
7
|
+
data.tar.gz: ebf58936f9b3699c192934819cd872fa4f58d5d3e8428bc98b2b3c8bc3f683dbea65a5a192958338911287e3115cef7da3378cc8a73d32c904d78443d6054b0e
|
|
@@ -17,7 +17,7 @@ module Rubyn
|
|
|
17
17
|
VALID_BRANCH_PATTERN = %r{\A[a-zA-Z0-9\-_/]+\z}
|
|
18
18
|
|
|
19
19
|
def execute(params)
|
|
20
|
-
branch_name = params[:branch_name]
|
|
20
|
+
branch_name = params[:branch_name] || params[:name]
|
|
21
21
|
return error("branch_name is required") unless branch_name && !branch_name.strip.empty?
|
|
22
22
|
|
|
23
23
|
unless branch_name.match?(VALID_BRANCH_PATTERN)
|
|
@@ -22,18 +22,21 @@ module Rubyn
|
|
|
22
22
|
return error("File not found: #{params[:path]}") unless File.exist?(resolved)
|
|
23
23
|
|
|
24
24
|
content = File.read(resolved)
|
|
25
|
-
find = params[:find]
|
|
25
|
+
find = params[:find] || params[:old_text]
|
|
26
|
+
replace = params[:replace] || params[:new_text]
|
|
26
27
|
|
|
28
|
+
return error("Missing find/old_text parameter") unless find
|
|
29
|
+
return error("Missing replace/new_text parameter") unless replace
|
|
27
30
|
return error("Find string not found in file: #{params[:path]}") unless content.include?(find)
|
|
28
31
|
|
|
29
32
|
all_occurrences = params[:all_occurrences] || false
|
|
30
33
|
|
|
31
34
|
if all_occurrences
|
|
32
35
|
replacements = content.scan(find).length
|
|
33
|
-
new_content = content.gsub(find,
|
|
36
|
+
new_content = content.gsub(find, replace)
|
|
34
37
|
else
|
|
35
38
|
replacements = 1
|
|
36
|
-
new_content = content.sub(find,
|
|
39
|
+
new_content = content.sub(find, replace)
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
File.write(resolved, new_content)
|
|
@@ -18,7 +18,10 @@ module Rubyn
|
|
|
18
18
|
command = detect_test_command
|
|
19
19
|
return error("No test framework detected (no spec/ or test/ directory found)") unless command
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
# Accept both gem params (path) and API params (files array)
|
|
22
|
+
test_path = params[:path]
|
|
23
|
+
test_path ||= Array(params[:files]).join(" ") if params[:files]
|
|
24
|
+
command = "#{command} #{test_path}" if test_path && !test_path.strip.empty?
|
|
22
25
|
command = "#{command} #{params[:options]}" if params[:options] && !params[:options].strip.empty?
|
|
23
26
|
|
|
24
27
|
begin
|
|
@@ -16,16 +16,17 @@ module Rubyn
|
|
|
16
16
|
MAX_FILE_SIZE = 2_000_000
|
|
17
17
|
|
|
18
18
|
def execute(params)
|
|
19
|
-
|
|
19
|
+
query = params[:pattern] || params[:query]
|
|
20
|
+
return error("Missing required parameter: pattern") unless query
|
|
20
21
|
|
|
21
22
|
begin
|
|
22
|
-
regex = Regexp.new(
|
|
23
|
+
regex = Regexp.new(query)
|
|
23
24
|
rescue RegexpError => e
|
|
24
25
|
return error("Invalid regex pattern: #{e.message}")
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
search_path = params[:path] || "."
|
|
28
|
-
file_pattern = params[:file_pattern]
|
|
29
|
+
file_pattern = params[:file_pattern] || params[:include]
|
|
29
30
|
|
|
30
31
|
resolved = resolve_path(search_path)
|
|
31
32
|
return resolved if resolved.is_a?(Hash) && resolved[:error]
|
data/lib/rubyn/version.rb
CHANGED