context_spook 0.9.0 → 1.0.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: 2381094248bee26e84f5875ea122e5fa5bf7e8e13562e64cfa25037b87fe1677
4
- data.tar.gz: 458618858393466ca2642d18066c9625de44df2ed1fb77c2caf19c89381bbbe5
3
+ metadata.gz: b9aa9571096d88672f5cb85b1cd7d48e4f8e45a434f5548004a89c9e16b30c36
4
+ data.tar.gz: e3cce61ba33f70bddad3160a48acae891bc4ab2762ba76be1ae24f6e8e0c243d
5
5
  SHA512:
6
- metadata.gz: d209a319a0cac52683c6becbac918a6baea4646fb5dea5f80baaa66ce9de8025a8a7f9bd84682dc420ec7bed32d6470660f06627f3ddec8d1209631add084028
7
- data.tar.gz: ad824ec6714bad73f64a1e9b58226f64e7c69d7e0432fa8fdc478d846688afbe6ddb896ee2fcfded25e1f0abcfe82811ff154dc48b1642029ab08d04f72d31eb
6
+ metadata.gz: d9470933b2d3d52c76b1690cbd4c4aa373531e8e403416102dd438c0ae5dbaee6b5b460e16a47de2222747a820f692e91a3da728ad83e5c15b023a15cfb9a427
7
+ data.tar.gz: a061de63206bef03d2b70a4cebf497c6b55cf856fb3f6dddc36c77013e84a5853476115a2ddfa70f357b048ae3ddecc58452b6b3e198d8c9befb4caf3ee6263a
data/README.md CHANGED
@@ -153,23 +153,20 @@ The CLI tool also supports file redirection:
153
153
  ./bin/context_spook .contexts/project.rb -o context.json
154
154
  ```
155
155
 
156
- You can also use directory globbing to automatically collect files without
156
+ You can also use include patterns to automatically collect files without
157
157
  manually specifying each one:
158
158
 
159
159
  ```bash
160
160
  # Collect all Ruby files from lib/ and spec/ directories
161
- ./bin/context_spook -d lib -d spec -s rb
161
+ ./bin/context_spook -i 'lib/**/*.rb' -i 'spec/**/*.rb'
162
162
 
163
163
  # Collect Markdown and YAML files from current directory
164
- ./bin/context_spook -s md -s yaml
164
+ ./bin/context_spook -i '*.md' -i '*.yaml' -i '*.yml'
165
165
 
166
- # Generate context with explicit suffix hints
167
- # -d lib:rb collects only .rb files from lib/
168
- # -d bin:all collects all files from bin/ (no suffix filtering)
169
- ./bin/context_spook -d lib:rb -d bin:all
170
-
171
- # Same result using default -s suffix all
172
- ./bin/context_spook -d lib:rb -d bin
166
+ # Collect files with complex patterns
167
+ ./bin/context_spook -i 'lib/**/{*.rb,*.rake}' # Brace expansion
168
+ ./bin/context_spook -i 'lib/**/*_spec.rb' # Pattern matching
169
+ ./bin/context_spook -i 'lib/**/*.rb' -i 'spec/**/*_spec.rb' # Mixed patterns
173
170
  ```
174
171
 
175
172
  This is how you can show the usage message:
data/bin/context_spook CHANGED
@@ -24,52 +24,42 @@ def usage
24
24
  -o FILE Write output to FILE instead of stdout
25
25
  ~v Disable verbose output, enabled by default
26
26
  -h Show this help message
27
- -d DIR[:SFX] Directory to search for files (can be used multiple times),
28
- if SFX is given will only consider files with this suffix,
29
- otherwise the -s argument value is used.
30
- -s SUFFIX File suffix to include, defaults to all
27
+ -i PATTERN Include files matching PATTERN (can be used multiple times)
28
+ Supports glob patterns like **, *, ?, [abc], {a,b,c}
31
29
 
32
30
  Examples:
33
31
  # Generate context and output to stdout
34
32
  #{File.basename($0)} .contexts/project.rb
35
33
 
36
- # Generate context from directory globs
37
- #{File.basename($0)} -d lib -d spec -s rb
34
+ # Generate context with include patterns
35
+ #{File.basename($0)} -i 'lib/**/*.rb'
36
+ #{File.basename($0)} -i 'lib/**/*.rb' -i 'spec/**/*.rb'
37
+ #{File.basename($0)} -i 'lib/**/*.rb' -i 'lib/**/*.js'
38
+
39
+ # Complex glob patterns
40
+ #{File.basename($0)} -i 'lib/**/{*.rb,*.rake}' # Brace expansion
41
+ #{File.basename($0)} -i 'lib/**/*_spec.rb' # Pattern matching
42
+ #{File.basename($0)} -i 'lib/**/*.rb' -i 'spec/**/*_spec.rb' # Mixed patterns
38
43
 
39
44
  # Generate context without verbose output
40
45
  #{File.basename($0)} .contexts/project.rb ~v
41
46
 
42
47
  # Generate context and save to file
43
48
  #{File.basename($0)} .contexts/project.rb -o context.json
44
-
45
- # Generate context from directory globs and save to file
46
- #{File.basename($0)} -d lib -d spec -s rb -o context.json
47
-
48
- # Generate context with explicit suffix hints
49
- # -d lib:rb collects only .rb files from lib/
50
- # -d bin:all collects all files from bin/ (no suffix filtering)
51
- #{File.basename($0)} -d lib:rb -d bin:all
52
-
53
- # Same result using default -s suffix all
54
- #{File.basename($0)} -d lib:rb -d bin
55
49
  EOT
56
50
  exit 0
57
51
  end
58
52
 
59
- opts = go 'd:s:o:pvh', defaults: { ?v => true, ?s => 'all' }
53
+ opts = go 'o:i:pvh', defaults: { ?v => true }
60
54
  opts[?h] and usage
61
55
  context = nil
62
56
  output = nil
63
- if opts[?d]
64
- suffix_arg = opts[?s]
57
+
58
+ if opts[?i]
65
59
  context = ContextSpook.generate_context(verbose: opts[?v]) do
66
60
  context do
67
- dirs_sfx = opts[?d].to_a.map { |d| d =~ /:/ ? d : "#{d}:#{suffix_arg}" }
68
- dirs_sfx.each do |ds|
69
- dir, suffix = ds.split(?:, 2)
70
- dir = Pathname.new(dir).expand_path
71
- dir_glob = dir + (suffix == 'all' ? '**/*' : "**/*.#{suffix}")
72
- Dir[dir_glob].each do |filename|
61
+ opts[?i].to_a.each do |glob|
62
+ Dir.glob(glob).each do |filename|
73
63
  Pathname.new(filename).file? or next
74
64
  file filename
75
65
  end
@@ -80,6 +70,7 @@ else
80
70
  filename = ARGV.shift or fail 'require context definition file as an argument'
81
71
  context = ContextSpook.generate_context(filename, verbose: opts[?v])
82
72
  end
73
+
83
74
  if output_filename = opts[?o]
84
75
  if File.exist?(output_filename)
85
76
  fail "Filename #{output_filename.inspect} already exists!"
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 0.9.0 ruby lib
2
+ # stub: context_spook 1.0.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "context_spook".freeze
6
- s.version = "0.9.0".freeze
6
+ s.version = "1.0.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]
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.specification_version = 4
26
26
 
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.9".freeze])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.10".freeze])
28
28
  s.add_development_dependency(%q<all_images>.freeze, ["~> 0.6".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
30
30
  s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '0.9.0'
3
+ VERSION = '1.0.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.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.9'
18
+ version: '2.10'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '2.9'
25
+ version: '2.10'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: all_images
28
28
  requirement: !ruby/object:Gem::Requirement