trick_bag 0.67.0 → 0.68.0
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/README.md +2 -2
- data/RELEASE_NOTES.md +5 -0
- data/lib/trick_bag/filesystem/filesystem.rb +43 -0
- data/lib/trick_bag/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59ec06de448c4ccb3f3cd3966fcdc855cb602ac5
|
4
|
+
data.tar.gz: 67da903f678ed62aae6d7e0ba4d84441fe6a837a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8919fe6998b064c515dd6440474327691558c72c0755e93337d1e6c066fce99a6436610fe15651a71e6964ceb94b1daf785f225eaf3c2f38cb7dcb45f4c6906
|
7
|
+
data.tar.gz: a488a53c4369a98e6adf563e07b8f60d758726f7299aed2e6da47b6366caed364e4fbc57d7c059d9db499a09c36b4338aa71e8247852ac04fcc742116e364dcb
|
data/README.md
CHANGED
data/RELEASE_NOTES.md
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
module TrickBag
|
2
|
+
module Filesystem
|
3
|
+
|
4
|
+
module_function
|
5
|
+
|
6
|
+
# @return true if the passed file is being run as a script, else false
|
7
|
+
# @param __file__ - !!! __FILE__ must be passed as the __file__ argument for this to work correctly !!!
|
8
|
+
#
|
9
|
+
# Sometimes we want to see if a given file is being run as a script, as opposed to loaded
|
10
|
+
# by other Ruby code. For example, the script at https://github.com/keithrbennett/macwifi/blob/master/bin/mac-wifi
|
11
|
+
# is normally run as a script (either by running the file directly, or by running the executable's
|
12
|
+
# binstub installed by the gem), but it can also be loaded so that the model can be used by custom code.
|
13
|
+
#
|
14
|
+
# When the file's behavior needs to differ when running as a script and _not_ running as a script,
|
15
|
+
# this method can be called to report which of the two states it is.
|
16
|
+
#
|
17
|
+
# An example of differing behavior is also in the case of `mac-wifi`. When run as a script,
|
18
|
+
# it parses the command line and executes a task, sending text to stdout.
|
19
|
+
def running_as_script?(__file__)
|
20
|
+
|
21
|
+
# Here is some sample state, when running a file as a gem executable:
|
22
|
+
# __FILE__ = /Users/kbennett/.rvm/gems/ruby-2.4.0/gems/mac-wifi-1.0.0/bin/mac-wifi
|
23
|
+
# $0 = /Users/kbennett/.rvm/gems/ruby-2.4.0/bin/mac-wifi
|
24
|
+
# GEM_PATH = /Users/kbennett/.rvm/gems/ruby-2.4.0:/Users/kbennett/.rvm/gems/ruby-2.4.0@global
|
25
|
+
|
26
|
+
# Please enable this code and report its output if you report any issues with this method:
|
27
|
+
# puts "__file__ = #{__file__}"
|
28
|
+
# puts "$0 = #{$0}"
|
29
|
+
# puts "GEM_PATH = #{ENV['GEM_PATH']}"
|
30
|
+
|
31
|
+
return true if __file__ == $0
|
32
|
+
return false if File.basename(__file__) != File.basename($0)
|
33
|
+
|
34
|
+
# If here, then filespecs are different but have the same basename.
|
35
|
+
gem_paths = ENV['GEM_PATH'].split(File::PATH_SEPARATOR)
|
36
|
+
basename = File.basename($0)
|
37
|
+
gem_paths.any? do |path|
|
38
|
+
($0 == File.join(path, 'bin', basename)) \
|
39
|
+
&& (path == File.expand_path(File.join(__file__, '..', '..', '..', '..')))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/trick_bag/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trick_bag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.68.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Bennett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/trick_bag/enumerables/endless_last_enumerable.rb
|
147
147
|
- lib/trick_bag/enumerables/file_line_reader.rb
|
148
148
|
- lib/trick_bag/enumerables/filtered_enumerable.rb
|
149
|
+
- lib/trick_bag/filesystem/filesystem.rb
|
149
150
|
- lib/trick_bag/formatters/binary_to_hex_and_ascii.rb
|
150
151
|
- lib/trick_bag/formatters/erb_renderer.rb
|
151
152
|
- lib/trick_bag/formatters/formatters.rb
|