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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea37f8f7f6d8653e96ccf73795be9702b4f10401c0a5ff13ae78d1ae89adabdd
4
- data.tar.gz: 14a65612ee0e4598bd5797d9d542fee108f143452520752b4047281724bb92fb
3
+ metadata.gz: 46a28bdfcceb8928f53b232ce6d2e69d64632ff171eb6493edfa8c4471ffff43
4
+ data.tar.gz: 0ea5102521b157be1198bf9e440e28530f023565a4d2ae3c5988ddd685f00912
5
5
  SHA512:
6
- metadata.gz: 8d4ca846a041fd61065d31e533cce3c56b06aaaa9eb438b9f462df8e58397d61588b1b8f734f36a9dec182444839763c8248fa375ed1df393c71fc679d613781
7
- data.tar.gz: f9b13a0d717542832c44db2fefe328188780c9f465424631594da657478db15747df7f7a4ccd7335bad90c5d6611a77c87cbcae2264188e478997ba77eede026
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
- STDERR.puts "Now outputting #{context_json.size} bytes of JSON context."
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
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 0.0.0 ruby lib
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.0".freeze
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
@@ -25,6 +25,8 @@ context do
25
25
 
26
26
  command 'false', tags: 'failure'
27
27
 
28
+ command 'echo hello world'
29
+
28
30
  file 'nixda', tags: 'failure'
29
31
 
30
32
  file 'Rakefile', tags: [ 'gem_hadar' ]
@@ -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
- warn "Reading #{filename.inspect} caused #{e.class}: #{e}"
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
- warn "Executing #{shell_command.inspect} resulted in exit code #{exit_code}."
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
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: context_spook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank