ragdoll-cli 0.0.2 → 0.1.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37690a904a95405edf1f83bcc0655d0933028ba81dc9d16862f2e46a197c86e2
|
4
|
+
data.tar.gz: 352ab870d8581d97b4aa0f53906614c5a4c1c07128cd7392693b810bef75a685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c49805896f34f099dc5a87421df3697996cb34700c371f75df37b587eb9984d6f81032b7b3b4457226fbcad2ebfa67cec1fb23f66665dc964bbbf490c6c71d91
|
7
|
+
data.tar.gz: e8183a1904f7a3877319d11a8e96110f9570ba036af175fe92dcd1b4dffe9cfbdd119c555af6d3edc8d49ee364121b2a2da32abd56e5cd49e55a4c1bc447a104
|
data/Rakefile
CHANGED
@@ -16,6 +16,12 @@ Rake::TestTask.new(:test) do |t|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Load annotate tasks
|
19
|
-
Dir.glob("lib/tasks/*.rake").each
|
19
|
+
Dir.glob("lib/tasks/*.rake").each do |r|
|
20
|
+
begin
|
21
|
+
load r
|
22
|
+
rescue LoadError => e
|
23
|
+
puts "Skipping #{r}: #{e.message}" if ENV['DEBUG']
|
24
|
+
end
|
25
|
+
end
|
20
26
|
|
21
27
|
task default: :test
|
@@ -15,7 +15,7 @@ module Ragdoll
|
|
15
15
|
return unless yes?('Confirm deletion?')
|
16
16
|
end
|
17
17
|
|
18
|
-
result = client.delete_document(id
|
18
|
+
result = client.delete_document(id)
|
19
19
|
|
20
20
|
if result[:success]
|
21
21
|
puts "Document ID #{id} deleted successfully."
|
@@ -29,8 +29,9 @@ module Ragdoll
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def yes?(question)
|
32
|
-
|
33
|
-
|
32
|
+
print "#{question} (y/n) "
|
33
|
+
response = $stdin.gets.chomp.downcase
|
34
|
+
response == 'y' || response == 'yes'
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
@@ -19,7 +19,7 @@ module Ragdoll
|
|
19
19
|
search_options[:keywords] = options[:keywords].split(',').map(&:strip) if options[:keywords]
|
20
20
|
search_options[:tags] = options[:tags].split(',').map(&:strip) if options[:tags]
|
21
21
|
|
22
|
-
search_response = client.search(query, **search_options)
|
22
|
+
search_response = client.search(query: query, **search_options)
|
23
23
|
|
24
24
|
# Extract the actual results array from the response
|
25
25
|
results = search_response[:results] || search_response['results'] || []
|
@@ -6,10 +6,8 @@ require 'fileutils'
|
|
6
6
|
module Ragdoll
|
7
7
|
module CLI
|
8
8
|
class ConfigurationLoader
|
9
|
-
DEFAULT_CONFIG_PATH = File.expand_path('~/.ragdoll/config.yml')
|
10
|
-
|
11
9
|
def initialize
|
12
|
-
@config_path =
|
10
|
+
@config_path = nil
|
13
11
|
end
|
14
12
|
|
15
13
|
|
@@ -41,25 +39,27 @@ module Ragdoll
|
|
41
39
|
'log_file' => File.expand_path('~/.ragdoll/ragdoll.log')
|
42
40
|
}
|
43
41
|
|
44
|
-
File.write(
|
42
|
+
File.write(config_path, YAML.dump(default_config))
|
45
43
|
default_config
|
46
44
|
end
|
47
45
|
|
48
46
|
|
49
47
|
def config_exists?
|
50
|
-
File.exist?(
|
48
|
+
File.exist?(config_path)
|
51
49
|
end
|
52
50
|
|
53
|
-
|
51
|
+
def config_path
|
52
|
+
@config_path ||= ENV['RAGDOLL_CONFIG'] || File.expand_path('~/.ragdoll/config.yml')
|
53
|
+
end
|
54
54
|
|
55
55
|
private
|
56
56
|
|
57
57
|
def load_config_file
|
58
58
|
return create_default_config unless config_exists?
|
59
59
|
|
60
|
-
YAML.load_file(
|
60
|
+
YAML.load_file(config_path)
|
61
61
|
rescue StandardError => e
|
62
|
-
puts "Warning: Could not load config file #{
|
62
|
+
puts "Warning: Could not load config file #{config_path}: #{e.message}"
|
63
63
|
puts 'Using default configuration.'
|
64
64
|
create_default_config
|
65
65
|
end
|
@@ -136,7 +136,7 @@ module Ragdoll
|
|
136
136
|
|
137
137
|
|
138
138
|
def ensure_config_directory
|
139
|
-
config_dir = File.dirname(
|
139
|
+
config_dir = File.dirname(config_path)
|
140
140
|
FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
|
141
141
|
end
|
142
142
|
end
|
data/lib/ragdoll/cli/version.rb
CHANGED