context_spook 0.0.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46a28bdfcceb8928f53b232ce6d2e69d64632ff171eb6493edfa8c4471ffff43
4
- data.tar.gz: 0ea5102521b157be1198bf9e440e28530f023565a4d2ae3c5988ddd685f00912
3
+ metadata.gz: 8061fffaf039f19b3b37a0df7ce5ce62624c04c303fd525a6b2a96b74bbf0fd4
4
+ data.tar.gz: 72b878f810bd5695aa0a09144fb3eb66475d7e12d73ba1cd1b17694e54a89c00
5
5
  SHA512:
6
- metadata.gz: 8d351e068d6a174857d3dd9d5d413e71a4cb6d84fe271595076bd72870e2e10e539e90475556f1d0381048e092360061ee81d8585ce60935431d8c049af0d24a
7
- data.tar.gz: f3a2f224075862ed04c87bd5ca695a410510b42a4974fd061edeb99025712de4fff2691f7401da1e6e1f977041f9fb9b5a6ad25b641e441746fff367206c6f09
6
+ metadata.gz: f5f21ce7d81d9488732ebbe27e2b17096fa6c92afcd2e9dadf0427cad36a33eb48e4e114a7bd687a0fb60a37351297b8cbbcc035e4a6644c530a3007ee2aedc3
7
+ data.tar.gz: 38bc4a4e00193b70fce74115e8ba8d230dbb06d3c6179cebb1c889b83fb10310fe3d9699f8bbc26ef4d16fbd9c646c080274ea738e56d94fe08381250c7c1a96
data/README.md CHANGED
@@ -68,7 +68,7 @@ context do
68
68
 
69
69
  meta ruby: RUBY_DESCRIPTION
70
70
 
71
- meta code_coverage: JSON.load_file('coverage/coverage_context.json') rescue nil
71
+ meta code_coverage: json('coverage/coverage_context.json')
72
72
  end
73
73
  ```
74
74
 
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 0.0.1 ruby lib
2
+ # stub: context_spook 0.1.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "context_spook".freeze
6
- s.version = "0.0.1".freeze
6
+ s.version = "0.1.0".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]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["context_spook".freeze]
15
15
  s.extra_rdoc_files = ["README.md".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze]
16
- s.files = ["Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/context_spook".freeze, "context_spook.gemspec".freeze, "contexts/project.rb".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze, "spec/context_spook/generator_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
+ s.files = ["Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/context_spook".freeze, "context_spook.gemspec".freeze, "contexts/project.rb".freeze, "hello_world.json".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze, "spec/context_spook/generator_spec.rb".freeze, "spec/spec_helper.rb".freeze]
17
17
  s.homepage = "https://github.com/flori/context_spook".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "ContextSpook - context_spook collects project context for AI".freeze, "--main".freeze, "README.md".freeze]
data/contexts/project.rb CHANGED
@@ -35,5 +35,9 @@ context do
35
35
 
36
36
  meta ruby: RUBY_DESCRIPTION
37
37
 
38
- meta code_coverage: JSON.load_file('coverage/coverage_context.json') rescue nil
38
+ meta hello_world: json('hello_world.json')
39
+
40
+ meta nixda_json: json('nixda_json.json')
41
+
42
+ meta code_coverage: json('coverage/coverage_context.json')
39
43
  end
data/hello_world.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "hello": "world"
3
+ }
@@ -117,6 +117,29 @@ module ContextSpook
117
117
  nil
118
118
  end
119
119
 
120
+ # The json method reads and parses a JSON file, returning the parsed data
121
+ # structure.
122
+ #
123
+ # This method attempts to load a JSON file from the specified path and
124
+ # returns the resulting Ruby data structure. It provides verbose output
125
+ # about the file size when successfully reading the file. In case of file
126
+ # not found errors, it outputs a colored warning message to standard
127
+ # error and returns nil.
128
+ #
129
+ # @param filename [ String ] the path to the JSON file to be read and parsed
130
+ #
131
+ # @return [ Object, nil ] the parsed JSON data structure or nil if the file cannot be read
132
+ def json(filename)
133
+ file_size = Tins::Unit.format(
134
+ File.size(filename), format: '%.2f %U', unit: ?b, prefix: 1024
135
+ )
136
+ STDERR.puts "Read #{filename.inspect} as JSON (%s) for context." % file_size
137
+ JSON.load_file(filename)
138
+ rescue Errno::ENOENT => e
139
+ STDERR.puts color(208) { "Reading #{filename.inspect} as JSON caused #{e.class}: #{e}" }
140
+ nil
141
+ end
142
+
120
143
  # The files method sets up a DSL accessor for providing files.
121
144
  #
122
145
  # @param default [ Hash ] the default files hash
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
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.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -141,6 +141,7 @@ files:
141
141
  - bin/context_spook
142
142
  - context_spook.gemspec
143
143
  - contexts/project.rb
144
+ - hello_world.json
144
145
  - lib/context_spook.rb
145
146
  - lib/context_spook/generator.rb
146
147
  - lib/context_spook/version.rb