scout-essentials 1.6.11 → 1.6.13
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/VERSION +1 -1
- data/lib/scout/log/color.rb +2 -0
- data/lib/scout/misc/filesystem.rb +32 -1
- data/lib/scout/open/sync.rb +0 -1
- data/lib/scout/path/find.rb +10 -5
- data/lib/scout/resource/util.rb +2 -3
- data/lib/scout/simple_opt/get.rb +3 -1
- data/scout-essentials.gemspec +4 -4
- data/test/scout/path/test_find.rb +9 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b0d08853e8b5dc5179a61969c0778068d5aa613df3ea03b63ec8c0501ebbbce
|
4
|
+
data.tar.gz: 48a325008838d43f3007184fe278cc68f10a3e7d694f09b97146797f4a69b150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7058cfb59b79eb0cc0b0b1524190562e08e0588ae2a00ff8ef5a5442c75799158de0279141da16815b3c1e5e417583137756be3eb63c6fd4d562d8aee4510f
|
7
|
+
data.tar.gz: def4814942f6325cb8ea0d059bc5b935a32989ca6b373aea8b8345747a7b9c500f89df58b524e40e440883f0b2946a3d40a10dd204de2042a08c9d15b76d1f59
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.13
|
data/lib/scout/log/color.rb
CHANGED
@@ -23,7 +23,7 @@ module Misc
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.
|
26
|
+
def self.tarize_cmd(path, dest = nil)
|
27
27
|
Misc.in_dir(path) do
|
28
28
|
if dest
|
29
29
|
CMD.cmd("tar cvfz '#{dest}' '.'")
|
@@ -33,6 +33,37 @@ module Misc
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.tarize(source_dir, archive_path)
|
37
|
+
require 'rubygems/package'
|
38
|
+
require 'zlib'
|
39
|
+
require 'stringio'
|
40
|
+
require 'fileutils'
|
41
|
+
|
42
|
+
tar_io = StringIO.new("")
|
43
|
+
|
44
|
+
Gem::Package::TarWriter.new(tar_io) do |tar|
|
45
|
+
Dir[File.join(source_dir, '**', '*')].each do |file|
|
46
|
+
relative_path = file.sub(/^#{Regexp.escape(source_dir)}\/?/, '')
|
47
|
+
|
48
|
+
if File.directory?(file)
|
49
|
+
tar.mkdir(relative_path, File.stat(file).mode)
|
50
|
+
else
|
51
|
+
tar.add_file(relative_path, File.stat(file).mode) do |tf|
|
52
|
+
File.open(file, 'rb') { |f| tf.write(f.read) }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
tar_io.rewind
|
59
|
+
|
60
|
+
File.open(archive_path, 'wb') do |f|
|
61
|
+
gz = Zlib::GzipWriter.new(f)
|
62
|
+
gz.write(tar_io.string)
|
63
|
+
gz.close
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
36
67
|
def self.untar(file, target = '.')
|
37
68
|
target = target.find if Path === target
|
38
69
|
file = file.find if Path === file
|
data/lib/scout/open/sync.rb
CHANGED
data/lib/scout/path/find.rb
CHANGED
@@ -117,13 +117,17 @@ module Path
|
|
117
117
|
def self.load_path_maps(filename)
|
118
118
|
Path.setup(filename) unless Path === filename
|
119
119
|
if filename.exist?
|
120
|
+
filename = filename.find
|
120
121
|
begin
|
122
|
+
Log.debug "Loading search_paths from #{filename}"
|
121
123
|
YAML.load(filename.read).each do |where, location|
|
122
|
-
|
124
|
+
add_path where.to_sym, location
|
123
125
|
end
|
124
126
|
rescue
|
125
127
|
Log.error "Error loading search_paths from #{filename}: " << $!.message
|
126
128
|
end
|
129
|
+
else
|
130
|
+
Log.debug "Could not find search_paths file #{filename}"
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
@@ -132,11 +136,11 @@ module Path
|
|
132
136
|
end
|
133
137
|
|
134
138
|
def _subpath
|
135
|
-
@subpath ||= _parts.length > 1 ? _parts[1..-1] * "/" :
|
139
|
+
@subpath ||= _parts.length > 1 ? _parts[1..-1] * "/" : nil
|
136
140
|
end
|
137
141
|
|
138
142
|
def _toplevel
|
139
|
-
@toplevel ||= _parts
|
143
|
+
@toplevel ||= _parts[0]
|
140
144
|
end
|
141
145
|
|
142
146
|
SLASH = "/"[0]
|
@@ -184,10 +188,11 @@ module Path
|
|
184
188
|
end
|
185
189
|
|
186
190
|
def self.exists_file_or_alternatives(file)
|
187
|
-
|
191
|
+
file = file.dup if Path === file
|
192
|
+
return file if Open.exist?(file) or Open.directory?(file)
|
188
193
|
%w(gz bgz zip).each do |extension|
|
189
194
|
alt_file = file + '.' + extension
|
190
|
-
return alt_file if
|
195
|
+
return alt_file if Open.exist?(alt_file) or Open.directory?(alt_file)
|
191
196
|
end
|
192
197
|
nil
|
193
198
|
end
|
data/lib/scout/resource/util.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Resource
|
2
2
|
def identify(path)
|
3
|
-
|
3
|
+
path = Path.setup path unless Path === path
|
4
|
+
return path unless path.located?
|
4
5
|
path_maps = path.path_maps if Path === path
|
5
6
|
path_maps ||= self.path_maps || Path.path_maps
|
6
7
|
path = File.expand_path(path) if path.start_with?("/")
|
@@ -30,8 +31,6 @@ module Resource
|
|
30
31
|
m.named_captures.include?(c) ? m[c] : nil
|
31
32
|
}.compact * "/"
|
32
33
|
|
33
|
-
#unlocated.gsub!(/\/+/,'/')
|
34
|
-
|
35
34
|
if self.subdir && ! self.subdir.empty?
|
36
35
|
subdir = self.subdir
|
37
36
|
subdir += "/" unless subdir.end_with?("/")
|
data/lib/scout/simple_opt/get.rb
CHANGED
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.6.
|
5
|
+
# stub: scout-essentials 1.6.13 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-essentials".freeze
|
9
|
-
s.version = "1.6.
|
9
|
+
s.version = "1.6.13".freeze
|
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 = "
|
14
|
+
s.date = "1980-01-02"
|
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 = [
|
@@ -146,7 +146,7 @@ Gem::Specification.new do |s|
|
|
146
146
|
]
|
147
147
|
s.homepage = "http://github.com/mikisvaz/scout-essentials".freeze
|
148
148
|
s.licenses = ["MIT".freeze]
|
149
|
-
s.rubygems_version = "3.6.
|
149
|
+
s.rubygems_version = "3.6.7".freeze
|
150
150
|
s.summary = "Scout essential tools".freeze
|
151
151
|
|
152
152
|
s.specification_version = 4
|
@@ -10,8 +10,8 @@ class TestPathFind < Test::Unit::TestCase
|
|
10
10
|
assert_equal "data/some_file", path._subpath
|
11
11
|
|
12
12
|
path = Path.setup("data", 'scout')
|
13
|
-
assert_equal "", path._toplevel
|
14
|
-
assert_equal
|
13
|
+
assert_equal "data", path._toplevel
|
14
|
+
assert_equal nil, path._subpath
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_find_local
|
@@ -138,5 +138,12 @@ class TestPathFind < Test::Unit::TestCase
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
def test_single
|
143
|
+
file = Path.setup('foo')
|
144
|
+
assert_equal 'foo', file._toplevel
|
145
|
+
assert_equal nil, file._subpath
|
146
|
+
assert_equal '/usr/local/foo/scout/', file.find(:local)
|
147
|
+
end
|
141
148
|
end
|
142
149
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout-essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: shoulda
|
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
|
-
rubygems_version: 3.6.
|
274
|
+
rubygems_version: 3.6.7
|
275
275
|
specification_version: 4
|
276
276
|
summary: Scout essential tools
|
277
277
|
test_files: []
|