scout-essentials 1.2.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/scout/misc/digest.rb +0 -1
- data/lib/scout/named_array.rb +5 -0
- data/lib/scout/path/find.rb +1 -1
- data/lib/scout/persist/serialize.rb +10 -3
- data/lib/scout/persist.rb +7 -1
- data/lib/scout/resource/path.rb +3 -2
- data/scout-essentials.gemspec +3 -3
- 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: 7045a24f9341c66514b014a48e5c6f01ce8eba30a951703e9fdf290842ca7119
|
4
|
+
data.tar.gz: 043c2b5778256fae3b26e6029b16b1c35a52c18e6e0be3377456c1a163f1bc5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03a1c74fd678942a99725952479db7de5d0696c30f406070c89cffa50ca3a8bf967ed46b192e3f006569d08478bf7d3141aad7045a837eebc31fb38272edfa89
|
7
|
+
data.tar.gz: 4f0797aac22d7a5609bcd21f21a1fae1d0db8a5208ccab4431475c1e963f2e42ef7da19226bddb52b6ec8ca09b9270d21eb434629f0541c7a60eab17b2ca4a69
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.1
|
data/lib/scout/misc/digest.rb
CHANGED
data/lib/scout/named_array.rb
CHANGED
@@ -3,6 +3,10 @@ module NamedArray
|
|
3
3
|
extend MetaExtension
|
4
4
|
extension_attr :fields, :key
|
5
5
|
|
6
|
+
def all_fields
|
7
|
+
[key, fields].compact.flatten
|
8
|
+
end
|
9
|
+
|
6
10
|
def self.field_match(field, name)
|
7
11
|
if (String === field) && (String === name)
|
8
12
|
field == name ||
|
@@ -130,6 +134,7 @@ module NamedArray
|
|
130
134
|
|
131
135
|
def self.add_zipped(source, new)
|
132
136
|
source.zip(new).each do |s,n|
|
137
|
+
next if n.nil?
|
133
138
|
s.concat(n)
|
134
139
|
end
|
135
140
|
source
|
data/lib/scout/path/find.rb
CHANGED
@@ -7,7 +7,7 @@ module Path
|
|
7
7
|
caller_dup = caller.dup
|
8
8
|
while file = caller_dup.shift
|
9
9
|
break unless file =~ /(?:scout|rbbt)\/(?:resource\.rb|workflow\.rb)/ or
|
10
|
-
file =~ /(?:scout|rbbt)\/(?:.*\/)?path\.rb/ or
|
10
|
+
file =~ /(?:scout|rbbt)\/(?:.*\/)?(path|open)\.rb/ or
|
11
11
|
file =~ /(?:scout|rbbt)\/(?:.*\/)?path\/(?:find|refactor|util)\.rb/ or
|
12
12
|
file =~ /(?:scout|rbbt)\/persist.rb/ or
|
13
13
|
file =~ /scout\/resource\/produce.rb/ or
|
@@ -49,8 +49,10 @@ module Persist
|
|
49
49
|
type = SERIALIZER if type == :serializer
|
50
50
|
|
51
51
|
case type
|
52
|
-
when nil, :
|
52
|
+
when nil, :text, :stream
|
53
53
|
serialized
|
54
|
+
when :string, :file, :select, :folder
|
55
|
+
serialized.strip
|
54
56
|
when :path
|
55
57
|
Path.setup(serialized.strip)
|
56
58
|
when :integer
|
@@ -142,7 +144,11 @@ module Persist
|
|
142
144
|
when :file
|
143
145
|
value = Open.read(file)
|
144
146
|
value.sub!(/^\./, File.dirname(file)) if value.start_with?("./")
|
145
|
-
value
|
147
|
+
if Path.is_filename?(value)
|
148
|
+
value
|
149
|
+
else
|
150
|
+
file
|
151
|
+
end
|
146
152
|
when :file_array
|
147
153
|
Open.read(file).split("\n").collect do |f|
|
148
154
|
f.sub!(/^\./, File.dirname(file)) if f.start_with?("./")
|
@@ -151,7 +157,8 @@ module Persist
|
|
151
157
|
when Hash
|
152
158
|
type[file]
|
153
159
|
else
|
154
|
-
|
160
|
+
serialized = Open.read(file)
|
161
|
+
deserialize(serialized, type)
|
155
162
|
end
|
156
163
|
end
|
157
164
|
end
|
data/lib/scout/persist.rb
CHANGED
@@ -55,7 +55,13 @@ module Persist
|
|
55
55
|
res = yield
|
56
56
|
|
57
57
|
if res.nil?
|
58
|
-
|
58
|
+
if type.nil?
|
59
|
+
Log.debug "Empty result and no persist type; not loading result file"
|
60
|
+
return nil
|
61
|
+
else
|
62
|
+
Log.debug "Empty result; loading #{type} result from file"
|
63
|
+
return Persist.load(file, type)
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
Open.rm(file)
|
data/lib/scout/resource/path.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Path
|
2
2
|
def produce(force = false)
|
3
|
+
raise @produced if Exception === @produced
|
3
4
|
return self if ! force && (Open.exist?(self) || @produced)
|
4
5
|
begin
|
5
6
|
if Resource === self.pkgdir
|
@@ -8,14 +9,14 @@ module Path
|
|
8
9
|
false
|
9
10
|
end
|
10
11
|
rescue ResourceNotFound
|
11
|
-
false
|
12
|
+
@produced = false
|
12
13
|
rescue
|
13
14
|
message = $!.message
|
14
15
|
message = "No exception message" if message.nil? || message.empty?
|
15
16
|
Log.warn "Error producing #{self}: #{message}"
|
16
17
|
raise $!
|
17
18
|
ensure
|
18
|
-
@produced = true
|
19
|
+
@produced = true if @produced.nil?
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
data/scout-essentials.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-essentials 1.
|
5
|
+
# stub: scout-essentials 1.3.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-essentials".freeze
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.3.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Miguel Vazquez".freeze]
|
14
|
-
s.date = "2023-
|
14
|
+
s.date = "2023-11-07"
|
15
15
|
s.description = "Things a scout can use anywhere".freeze
|
16
16
|
s.email = "mikisvaz@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout-essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|