context_spook 0.0.0 → 0.0.1
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/bin/context_spook +4 -1
- data/context_spook.gemspec +2 -2
- data/contexts/project.rb +2 -0
- data/lib/context_spook/generator.rb +10 -13
- data/lib/context_spook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46a28bdfcceb8928f53b232ce6d2e69d64632ff171eb6493edfa8c4471ffff43
|
4
|
+
data.tar.gz: 0ea5102521b157be1198bf9e440e28530f023565a4d2ae3c5988ddd685f00912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d351e068d6a174857d3dd9d5d413e71a4cb6d84fe271595076bd72870e2e10e539e90475556f1d0381048e092360061ee81d8585ce60935431d8c049af0d24a
|
7
|
+
data.tar.gz: f3a2f224075862ed04c87bd5ca695a410510b42a4974fd061edeb99025712de4fff2691f7401da1e6e1f977041f9fb9b5a6ad25b641e441746fff367206c6f09
|
data/bin/context_spook
CHANGED
@@ -4,5 +4,8 @@ require 'context_spook'
|
|
4
4
|
|
5
5
|
filename = ARGV.shift or fail 'require context definition file as first argument'
|
6
6
|
context_json = ContextSpook.generate_context(filename).to_json
|
7
|
-
|
7
|
+
context_json_size = Tins::Unit.format(
|
8
|
+
context_json.size, format: '%.2f %U', unit: ?b, prefix: 1024
|
9
|
+
)
|
10
|
+
STDERR.puts "Now outputting #{context_json_size} of JSON context in total."
|
8
11
|
puts context_json
|
data/context_spook.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: context_spook 0.0.
|
2
|
+
# stub: context_spook 0.0.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "context_spook".freeze
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.1".freeze
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
data/contexts/project.rb
CHANGED
@@ -143,9 +143,13 @@ module ContextSpook
|
|
143
143
|
lines: content.lines.size,
|
144
144
|
tags: (Array(tags) if tags),
|
145
145
|
}.compact
|
146
|
+
file_size = Tins::Unit.format(
|
147
|
+
content.size, format: '%.2f %U', unit: ?b, prefix: 1024
|
148
|
+
)
|
149
|
+
STDERR.puts "Read #{filename.inspect} (%s) for context." % file_size
|
146
150
|
nil
|
147
151
|
rescue Errno::ENOENT => e
|
148
|
-
|
152
|
+
STDERR.puts color(208) { "Reading #{filename.inspect} caused #{e.class}: #{e}" }
|
149
153
|
end
|
150
154
|
|
151
155
|
# The commands method sets up a DSL accessor for provided command outputs.
|
@@ -168,7 +172,7 @@ module ContextSpook
|
|
168
172
|
output = `#{shell_command}`
|
169
173
|
exit_code = $?&.exitstatus.to_i
|
170
174
|
if exit_code != 0
|
171
|
-
|
175
|
+
STDERR.puts color(208) { "Executing #{shell_command.inspect} resulted in exit code #{exit_code}." }
|
172
176
|
end
|
173
177
|
commands[shell_command] = {
|
174
178
|
namespace: scope_top,
|
@@ -177,6 +181,10 @@ module ContextSpook
|
|
177
181
|
working_directory: Dir.pwd,
|
178
182
|
tags: (Array(tags) if tags),
|
179
183
|
}.compact
|
184
|
+
output_size = Tins::Unit.format(
|
185
|
+
output.size, format: '%.2f %U', unit: ?b, prefix: 1024
|
186
|
+
)
|
187
|
+
STDERR.puts "Executed #{shell_command.inspect} with output (%s) for context." % output_size
|
180
188
|
nil
|
181
189
|
end
|
182
190
|
|
@@ -199,17 +207,6 @@ module ContextSpook
|
|
199
207
|
variables:
|
200
208
|
}
|
201
209
|
end
|
202
|
-
|
203
|
-
private
|
204
|
-
|
205
|
-
# The warn method enhances warning messages by applying colored
|
206
|
-
# formatting before passing them to the superclass implementation.
|
207
|
-
#
|
208
|
-
# @param msgs [ Array ] an array of message objects to be formatted and warned
|
209
|
-
def warn(*msgs)
|
210
|
-
msgs.map! { |m| color(208) { m } }
|
211
|
-
super(*msgs, uplevel: 1)
|
212
|
-
end
|
213
210
|
end
|
214
211
|
|
215
212
|
private
|