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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca46feecfdca0f796ad76e9e0e8f3dcf33eb169e41605708cf2042507c968207
4
- data.tar.gz: 93b589d483250fdca27ed5e888887d2135b81f253b7ad30afb97adcb8a3382f2
3
+ metadata.gz: 9b0d08853e8b5dc5179a61969c0778068d5aa613df3ea03b63ec8c0501ebbbce
4
+ data.tar.gz: 48a325008838d43f3007184fe278cc68f10a3e7d694f09b97146797f4a69b150
5
5
  SHA512:
6
- metadata.gz: 95d450e003292a7507116cd39bc74822e12820119cea0ddfeabd8aa5a86979f17d4a8aefdf76db5f526026c7795422b8bf7a91c5ae2833a75feb48cf08c5a17b
7
- data.tar.gz: 2bdaa762c5899135b5d5aadc054017b597244bf000bb5525894da4b9f9e893053221d3049c5df821726cb999cb5c3fc53e486535395b7fb54513b6a9a339d21c
6
+ metadata.gz: db7058cfb59b79eb0cc0b0b1524190562e08e0588ae2a00ff8ef5a5442c75799158de0279141da16815b3c1e5e417583137756be3eb63c6fd4d562d8aee4510f
7
+ data.tar.gz: def4814942f6325cb8ea0d059bc5b935a32989ca6b373aea8b8345747a7b9c500f89df58b524e40e440883f0b2946a3d40a10dd204de2042a08c9d15b76d1f59
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.11
1
+ 1.6.13
@@ -155,6 +155,8 @@ module Log
155
155
  :time => cyan,
156
156
  :task => yellow,
157
157
  :workflow => yellow,
158
+ :present => green,
159
+ :missing => cyan,
158
160
  })
159
161
  HIGHLIGHT = "\033[1m"
160
162
 
@@ -23,7 +23,7 @@ module Misc
23
23
  end
24
24
  end
25
25
 
26
- def self.tarize(path, dest = nil)
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
@@ -36,7 +36,6 @@ module Open
36
36
  Open.mkdir File.dirname(target)
37
37
  end
38
38
 
39
-
40
39
  Log.low "Migrating #{source} #{files.length} files to #{target} - #{Misc.fingerprint(files)}}" if files
41
40
 
42
41
 
@@ -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
- @@path_maps[where.to_sym] = location
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] * "/" : _parts[0] || ""
139
+ @subpath ||= _parts.length > 1 ? _parts[1..-1] * "/" : nil
136
140
  end
137
141
 
138
142
  def _toplevel
139
- @toplevel ||= _parts.length > 1 ? _parts[0] : ""
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
- return file if File.exist?(file) or File.directory?(file)
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 File.exist?(alt_file) or File.directory?(alt_file)
195
+ return alt_file if Open.exist?(alt_file) or Open.directory?(alt_file)
191
196
  end
192
197
  nil
193
198
  end
@@ -1,6 +1,7 @@
1
1
  module Resource
2
2
  def identify(path)
3
- return path unless Path.located?(path)
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?("/")
@@ -39,9 +39,11 @@ module SOPT
39
39
  end
40
40
 
41
41
  IndiferentHash.setup @@current_options
42
+ @@current_options.keys_to_sym!
43
+
42
44
  GOT_OPTIONS.merge! @@current_options
43
45
 
44
- @@current_options.keys_to_sym
46
+ @@current_options
45
47
  end
46
48
 
47
49
  def self.get(opt_str)
@@ -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.11 ruby lib
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.11".freeze
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 = "2025-04-10"
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.5".freeze
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 "data", path._subpath
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.11
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: 2025-04-10 00:00:00.000000000 Z
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.5
274
+ rubygems_version: 3.6.7
275
275
  specification_version: 4
276
276
  summary: Scout essential tools
277
277
  test_files: []