bobkit 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1b548b8fb9cbbf19f4da08999cf046d5e8fdf962a3997e5eacf3207e506cf26
4
- data.tar.gz: 15595d9a3400982f23c04e0a1891d2dfb8c5a7b3b517b37cffe690ef32226f94
3
+ metadata.gz: e011b932bedd2252cb78432cc9b7261281e55f4654b3056d98b8bc634f0c5e1e
4
+ data.tar.gz: 7ccf9a3be1256939569414bd4df3135130f5ba5c9572497d8e00e4bbcb708adc
5
5
  SHA512:
6
- metadata.gz: 30c05ba027aeb7c88c081fce8fd3ed9b6c5e6328bf373bbeab2c485d79960c5662b1404be378db9b0a341414a1e7c8949e7bd43f012a59d869a8b04634070008
7
- data.tar.gz: e20d03d6e426e3dc126d0b9c85b3808bbff89d00f3a717ba4dab62cb02a970490755324a7a8c53184bb33f2057ffdb521fdca241be77a1d6d55d4f26e5c728f9
6
+ metadata.gz: cdcaa1015c09a7c981683df6a4697bb847775a63957ecb7cb6b00444d7a34642695871c8a9b437fea85db779eff030d4d12ff33f85ce4b772477e891a687cd02
7
+ data.tar.gz: 688fdb9b513568ab6c66e801e2de3dd6eeef2107071fa8533a3b00a5414f733d41562e9393cbed096cefea1c96b958f08e6774ce80f9a611834740792fcc2440
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Bobkit - Site Generation Toolkit
2
- ==================================================
1
+ # Bobkit - Site Generation Toolkit
3
2
 
4
3
  [![Gem Version](https://badge.fury.io/rb/bobkit.svg)](https://badge.fury.io/rb/bobkit)
5
4
  [![Build Status](https://github.com/DannyBen/bobkit/workflows/Test/badge.svg)](https://github.com/DannyBen/bobkit/actions?query=workflow%3ATest)
@@ -29,8 +28,7 @@ The design intentions were to:
29
28
 
30
29
 
31
30
 
32
- Install
33
- --------------------------------------------------
31
+ ## Install
34
32
 
35
33
  `gem install bobkit`
36
34
 
@@ -40,8 +38,7 @@ Or with Bundler:
40
38
 
41
39
 
42
40
 
43
- Usage
44
- --------------------------------------------------
41
+ ## Usage
45
42
 
46
43
  The basic usage pattern is this:
47
44
 
@@ -92,8 +89,7 @@ bob.render ...
92
89
  bob.compile_css ...
93
90
  ```
94
91
 
95
- Reference
96
- --------------------------------------------------
92
+ ## Reference
97
93
 
98
94
  ### Setting folder locations and options
99
95
 
@@ -265,9 +261,11 @@ use it.
265
261
  ```ruby
266
262
  include Bobkit::Watcher
267
263
 
268
- watch do |filename, event|
269
- puts "#{event}: #{filename}"
270
- generate
264
+ watch do |changes|
265
+ changes do |filename, event|
266
+ puts "#{event}: #{filename}"
267
+ generate
268
+ end
271
269
  end
272
270
 
273
271
  def generate
@@ -280,11 +278,5 @@ The watch command is just like
280
278
  with the exception that the array of paths to watch is optional. If none
281
279
  provided, we will watch all the input folders.
282
280
 
283
- Todo
284
- --------------------------------------------------
285
-
286
- - [ ] YAML loader (data_folder?)
287
- - [ ] CSV Loader (data_folder?)
288
-
289
281
 
290
282
  [1]: https://github.com/DannyBen/bobkit/tree/master/examples
data/lib/bobkit/assets.rb CHANGED
@@ -1,14 +1,15 @@
1
- module Bobkit
2
- module Assets
3
- include FileHelpers
4
-
5
- def copy_asset(source, target=nil)
6
- if target
7
- target = "#{output_folder}/#{target}"
8
- else
9
- target = "#{assets_output_folder}/#{source}"
10
- end
11
- copy_entry "#{assets_folder}/#{source}", target
12
- end
13
- end
14
- end
1
+ module Bobkit
2
+ module Assets
3
+ include FileHelpers
4
+
5
+ def copy_asset(source, target = nil)
6
+ target = if target
7
+ "#{output_folder}/#{target}"
8
+ else
9
+ "#{assets_output_folder}/#{source}"
10
+ end
11
+
12
+ copy_entry "#{assets_folder}/#{source}", target
13
+ end
14
+ end
15
+ end
data/lib/bobkit/bob.rb CHANGED
@@ -2,4 +2,4 @@ module Bobkit
2
2
  class Bob
3
3
  include Tasks
4
4
  end
5
- end
5
+ end
@@ -1,13 +1,13 @@
1
- module Bobkit
2
- module CoffeeBridge
3
- include FileHelpers
4
-
5
- def compile_js(file, options={})
6
- @file = "#{coffee_folder}/#{file}.coffee"
7
- content = CoffeeScript.compile File.read @file
8
- output = options[:output]
9
- create_file "#{js_output_folder}/#{output}.js", content if output
10
- content
11
- end
12
- end
13
- end
1
+ module Bobkit
2
+ module CoffeeBridge
3
+ include FileHelpers
4
+
5
+ def compile_js(file, options = {})
6
+ @file = "#{coffee_folder}/#{file}.coffee"
7
+ content = CoffeeScript.compile File.read @file
8
+ output = options[:output]
9
+ create_file "#{js_output_folder}/#{output}.js", content if output
10
+ content
11
+ end
12
+ end
13
+ end
@@ -1,24 +1,23 @@
1
- module Bobkit
2
- module FileHelpers
3
- def create_folder(path)
4
- FileUtils.mkdir_p(path) unless File.directory?(path)
5
- end
6
-
7
- def create_folder_for(path)
8
- create_folder File.dirname(path)
9
- end
10
-
11
- def create_file(path, content)
12
- create_folder_for path
13
- File.write path, content
14
- end
15
-
16
- def copy_file(source, target)
17
- create_folder_for target
18
- FileUtils.copy_entry source, target
19
- end
20
- alias_method :copy_folder, :copy_file
21
- alias_method :copy_entry, :copy_file
22
-
23
- end
24
- end
1
+ module Bobkit
2
+ module FileHelpers
3
+ def create_folder(path)
4
+ FileUtils.mkdir_p(path) unless File.directory?(path)
5
+ end
6
+
7
+ def create_folder_for(path)
8
+ create_folder File.dirname(path)
9
+ end
10
+
11
+ def create_file(path, content)
12
+ create_folder_for path
13
+ File.write path, content
14
+ end
15
+
16
+ def copy_file(source, target)
17
+ create_folder_for target
18
+ FileUtils.copy_entry source, target
19
+ end
20
+ alias copy_folder copy_file
21
+ alias copy_entry copy_file
22
+ end
23
+ end
@@ -1,25 +1,24 @@
1
- module Bobkit
2
- module I18nBridge
3
- include I18nMixin
4
-
5
- def locale(language=nil)
6
- I18nHandler.instance.locale language if language
7
- I18n.locale
8
- end
9
-
10
- class I18nHandler
11
- include Singleton
12
- include LocationOptions
13
-
14
- def initialize
15
- I18n.load_path = Dir["#{locales_folder}/**/*.yml"]
16
- I18n.backend.load_translations
17
- end
18
-
19
- def locale(language)
20
- I18n.locale = language
21
- end
22
- end
23
-
24
- end
25
- end
1
+ module Bobkit
2
+ module I18nBridge
3
+ include I18nMixin
4
+
5
+ def locale(language = nil)
6
+ I18nHandler.instance.locale language if language
7
+ I18n.locale
8
+ end
9
+
10
+ class I18nHandler
11
+ include Singleton
12
+ include LocationOptions
13
+
14
+ def initialize
15
+ I18n.load_path = Dir["#{locales_folder}/**/*.yml"]
16
+ I18n.backend.load_translations
17
+ end
18
+
19
+ def locale(language)
20
+ I18n.locale = language
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,11 +1,11 @@
1
- module Bobkit
2
- module I18nMixin
3
- def t(*args)
4
- I18n.t *args
5
- end
6
-
7
- def l(*args)
8
- I18n.l *args
9
- end
10
- end
11
- end
1
+ module Bobkit
2
+ module I18nMixin
3
+ def t(*args)
4
+ I18n.t(*args)
5
+ end
6
+
7
+ def l(*args)
8
+ I18n.l(*args)
9
+ end
10
+ end
11
+ end
@@ -1,54 +1,53 @@
1
- module Bobkit
2
- module LocationOptions
3
- include OptionsBase
4
-
5
- def root_folder(path=nil)
6
- setopt :root_folder, path, '.'
7
- end
8
-
9
- def templates_folder(path=nil)
10
- setopt :templates_folder, path, "#{root_folder}/templates"
11
- end
12
-
13
- def markdown_folder(path=nil)
14
- setopt :markdown_folder, path, "#{root_folder}/markdown"
15
- end
16
-
17
- def styles_folder(path=nil)
18
- setopt :styles_folder, path, "#{root_folder}/styles"
19
- end
20
-
21
- def coffee_folder(path=nil)
22
- setopt :coffee_folder, path, "#{root_folder}/coffee"
23
- end
24
-
25
- def output_folder(path=nil)
26
- setopt :output_folder, path, "#{root_folder}/output"
27
- end
28
-
29
- def assets_folder(path=nil)
30
- setopt :assets_folder, path, "#{root_folder}/assets"
31
- end
32
-
33
- def locales_folder(path=nil)
34
- setopt :locales_folder, path, "#{root_folder}/locales"
35
- end
36
-
37
- def layouts_folder(path=nil)
38
- setopt :layouts_folder, path, "#{templates_folder}/layouts"
39
- end
40
-
41
- def css_output_folder(path=nil)
42
- setopt :css_output_folder, path, "#{output_folder}/css"
43
- end
44
-
45
- def js_output_folder(path=nil)
46
- setopt :js_output_folder, path, "#{output_folder}/js"
47
- end
48
-
49
-
50
- def assets_output_folder(path=nil)
51
- setopt :assets_output_folder, path, "#{output_folder}/assets"
52
- end
53
- end
54
- end
1
+ module Bobkit
2
+ module LocationOptions
3
+ include OptionsBase
4
+
5
+ def root_folder(path = nil)
6
+ setopt :root_folder, path, '.'
7
+ end
8
+
9
+ def templates_folder(path = nil)
10
+ setopt :templates_folder, path, "#{root_folder}/templates"
11
+ end
12
+
13
+ def markdown_folder(path = nil)
14
+ setopt :markdown_folder, path, "#{root_folder}/markdown"
15
+ end
16
+
17
+ def styles_folder(path = nil)
18
+ setopt :styles_folder, path, "#{root_folder}/styles"
19
+ end
20
+
21
+ def coffee_folder(path = nil)
22
+ setopt :coffee_folder, path, "#{root_folder}/coffee"
23
+ end
24
+
25
+ def output_folder(path = nil)
26
+ setopt :output_folder, path, "#{root_folder}/output"
27
+ end
28
+
29
+ def assets_folder(path = nil)
30
+ setopt :assets_folder, path, "#{root_folder}/assets"
31
+ end
32
+
33
+ def locales_folder(path = nil)
34
+ setopt :locales_folder, path, "#{root_folder}/locales"
35
+ end
36
+
37
+ def layouts_folder(path = nil)
38
+ setopt :layouts_folder, path, "#{templates_folder}/layouts"
39
+ end
40
+
41
+ def css_output_folder(path = nil)
42
+ setopt :css_output_folder, path, "#{output_folder}/css"
43
+ end
44
+
45
+ def js_output_folder(path = nil)
46
+ setopt :js_output_folder, path, "#{output_folder}/js"
47
+ end
48
+
49
+ def assets_output_folder(path = nil)
50
+ setopt :assets_output_folder, path, "#{output_folder}/assets"
51
+ end
52
+ end
53
+ end
@@ -1,32 +1,31 @@
1
- module Bobkit
2
- module MarkdownBridge
3
- def markdown(file, *args)
4
- MarkdownHandler.instance.compile file, *args
5
- end
6
-
7
- class MarkdownHandler
8
- include Singleton
9
- include SlimBridge
10
- include LocationOptions
11
-
12
- def compile(file, options={})
13
- markdown = RDiscount.new file_content file
14
- content = markdown.to_html
15
- options[:content] = content
16
- content = render options if options[:layout]
17
- content
18
- end
19
-
20
- private
21
-
22
- def file_content(basename)
23
- File.read markdown_file basename
24
- end
25
-
26
- def markdown_file(basename)
27
- "#{markdown_folder}/#{basename}.md"
28
- end
29
- end
30
-
31
- end
32
- end
1
+ module Bobkit
2
+ module MarkdownBridge
3
+ def markdown(file, *args)
4
+ MarkdownHandler.instance.compile file, *args
5
+ end
6
+
7
+ class MarkdownHandler
8
+ include Singleton
9
+ include SlimBridge
10
+ include LocationOptions
11
+
12
+ def compile(file, options = {})
13
+ markdown = RDiscount.new file_content file
14
+ content = markdown.to_html
15
+ options[:content] = content
16
+ content = render options if options[:layout]
17
+ content
18
+ end
19
+
20
+ private
21
+
22
+ def file_content(basename)
23
+ File.read markdown_file basename
24
+ end
25
+
26
+ def markdown_file(basename)
27
+ "#{markdown_folder}/#{basename}.md"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,31 +1,31 @@
1
- module Bobkit
2
- module OptionsBase
3
- def use_defaults
4
- OptionsHandler.instance.options = {}
5
- end
6
-
7
- def setopt(*args)
8
- OptionsHandler.instance.setopt *args
9
- end
10
-
11
- def options
12
- OptionsHandler.instance.options
13
- end
14
-
15
- class OptionsHandler
16
- include Singleton
17
-
18
- attr_accessor :options
19
-
20
- def initialize
21
- @options = {}
22
- end
23
-
24
- def setopt(key, value=nil, default=nil)
25
- options[key] = value if value
26
- options[key] ||= default
27
- options[key]
28
- end
29
- end
30
- end
31
- end
1
+ module Bobkit
2
+ module OptionsBase
3
+ def use_defaults
4
+ OptionsHandler.instance.options = {}
5
+ end
6
+
7
+ def setopt(*args)
8
+ OptionsHandler.instance.setopt(*args)
9
+ end
10
+
11
+ def options
12
+ OptionsHandler.instance.options
13
+ end
14
+
15
+ class OptionsHandler
16
+ include Singleton
17
+
18
+ attr_accessor :options
19
+
20
+ def initialize
21
+ @options = {}
22
+ end
23
+
24
+ def setopt(key, value = nil, default = nil)
25
+ options[key] = value if value
26
+ options[key] ||= default
27
+ options[key]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,20 +1,20 @@
1
- module Bobkit
2
- module SassBridge
3
- include FileHelpers
4
-
5
- def compile_css(file, output: nil, source_map: true)
6
- file = "#{styles_folder}/#{file}.scss"
7
- sass = Sasstool::Renderer.new file
8
-
9
- if output
10
- create_file "#{css_output_folder}/#{output}.css", sass.render
11
-
12
- if source_map
13
- create_file "#{css_output_folder}/#{output}.css.map", sass.source_map
14
- end
15
- end
16
-
17
- sass.render
18
- end
19
- end
20
- end
1
+ module Bobkit
2
+ module SassBridge
3
+ include FileHelpers
4
+
5
+ def compile_css(file, output: nil, source_map: true)
6
+ file = "#{styles_folder}/#{file}.scss"
7
+ sass = Sasstool::Renderer.new file
8
+
9
+ if output
10
+ create_file "#{css_output_folder}/#{output}.css", sass.render
11
+
12
+ if source_map
13
+ create_file "#{css_output_folder}/#{output}.css.map", sass.source_map
14
+ end
15
+ end
16
+
17
+ sass.render
18
+ end
19
+ end
20
+ end
data/lib/bobkit/scope.rb CHANGED
@@ -1,32 +1,31 @@
1
- module Bobkit
2
- class Scope
3
- include SlimBridge
4
- include I18nMixin
5
-
6
- def initialize(scope=nil)
7
- @scope = scope || {}
8
- end
9
-
10
- def method_missing(method_name, *arguments, &block)
11
- if @scope.respond_to?(:key?) and @scope.key?(method_name)
12
- @scope[method_name]
13
- elsif @scope.respond_to? method_name
14
- @scope.send method_name, *arguments
15
- else
16
- super
17
- end
18
- end
19
-
20
- def respond_to?(method_name, include_private = false)
21
- if @scope.respond_to?(:key?) and @scope.key?(method_name)
22
- true
23
- elsif @scope.respond_to? method_name
24
- true
25
- else
26
- super
27
- end
28
- end
29
- alias_method :have?, :respond_to?
30
-
31
- end
32
- end
1
+ module Bobkit
2
+ class Scope
3
+ include SlimBridge
4
+ include I18nMixin
5
+
6
+ attr_reader :scope
7
+
8
+ def initialize(scope = nil)
9
+ @scope = scope || {}
10
+ end
11
+
12
+ def method_missing(method_name, *arguments, &)
13
+ if scope.respond_to?(:key?) && scope.has_key?(method_name)
14
+ scope[method_name]
15
+ elsif scope.respond_to? method_name
16
+ scope.send method_name, *arguments
17
+ else
18
+ super
19
+ end
20
+ end
21
+
22
+ def respond_to_missing?(method_name, include_private = false)
23
+ if (scope.respond_to?(:key?) && scope.has_key?(method_name)) || scope.respond_to?(method_name)
24
+ true
25
+ else
26
+ super
27
+ end
28
+ end
29
+ alias have? respond_to?
30
+ end
31
+ end
@@ -1,9 +1,9 @@
1
- module Bobkit
2
- module ScopeOptions
3
- include OptionsBase
4
-
5
- def scope(scope=nil)
6
- scope ? setopt(:scope, Scope.new(scope)) : options[:scope]
7
- end
8
- end
9
- end
1
+ module Bobkit
2
+ module ScopeOptions
3
+ include OptionsBase
4
+
5
+ def scope(scope = nil)
6
+ scope ? setopt(:scope, Scope.new(scope)) : options[:scope]
7
+ end
8
+ end
9
+ end
@@ -1,57 +1,57 @@
1
- module Bobkit
2
- module SlimBridge
3
- def render(*args)
4
- SlimHandler.instance.render *args
5
- end
6
-
7
- class SlimHandler
8
- include Singleton
9
- include FileHelpers
10
- include SlimOptions
11
- include LocationOptions
12
- include ScopeOptions
13
- include I18nBridge
14
-
15
- def render(options={}, extra_options={})
16
- if options.is_a? String
17
- options = { partial: options }.merge(extra_options)
18
- elsif options.respond_to? :to_partial
19
- scope options
20
- options = { partial: options.to_partial }.merge(extra_options)
21
- end
22
-
23
- partial = options.delete :partial
24
- layout = options.delete :layout
25
- output = options.delete :output
26
- content = options.delete :content
27
-
28
- context = options.empty? ? scope : options
29
- if context.is_a? Hash or !context
30
- context = Scope.new context
31
- end
32
-
33
- content ||= Slim::Template.new(partial_filename(partial), slim_options).render(context)
34
- content = Slim::Template.new(layout_filename(layout), slim_options).render(context) { content } if layout
35
- create_file "#{output_folder}/#{output}.html", content if output
36
- content
37
- end
38
-
39
- private
40
-
41
- def partial_filename(partial)
42
- localized_template templates_folder, partial
43
- end
44
-
45
- def layout_filename(layout)
46
- localized_template layouts_folder, layout
47
- end
48
-
49
- def localized_template(folder, basename)
50
- preferred = "#{folder}/#{basename}.#{locale}.slim"
51
- return preferred if File.exist? preferred
52
- "#{folder}/#{basename}.slim"
53
- end
54
- end
55
-
56
- end
57
- end
1
+ module Bobkit
2
+ module SlimBridge
3
+ def render(*args)
4
+ SlimHandler.instance.render(*args)
5
+ end
6
+
7
+ class SlimHandler
8
+ include Singleton
9
+ include FileHelpers
10
+ include SlimOptions
11
+ include LocationOptions
12
+ include ScopeOptions
13
+ include I18nBridge
14
+
15
+ def render(options = {}, extra_options = {})
16
+ if options.is_a? String
17
+ options = { partial: options }.merge(extra_options)
18
+ elsif options.respond_to? :to_partial
19
+ scope options
20
+ options = { partial: options.to_partial }.merge(extra_options)
21
+ end
22
+
23
+ partial = options.delete :partial
24
+ layout = options.delete :layout
25
+ output = options.delete :output
26
+ content = options.delete :content
27
+
28
+ context = options.empty? ? scope : options
29
+ if context.is_a?(Hash) || !context
30
+ context = Scope.new context
31
+ end
32
+
33
+ content ||= Slim::Template.new(partial_filename(partial), slim_options).render(context)
34
+ content = Slim::Template.new(layout_filename(layout), slim_options).render(context) { content } if layout
35
+ create_file "#{output_folder}/#{output}.html", content if output
36
+ content
37
+ end
38
+
39
+ private
40
+
41
+ def partial_filename(partial)
42
+ localized_template templates_folder, partial
43
+ end
44
+
45
+ def layout_filename(layout)
46
+ localized_template layouts_folder, layout
47
+ end
48
+
49
+ def localized_template(folder, basename)
50
+ preferred = "#{folder}/#{basename}.#{locale}.slim"
51
+ return preferred if File.exist? preferred
52
+
53
+ "#{folder}/#{basename}.slim"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,11 +1,11 @@
1
- module Bobkit
2
- module SlimOptions
3
- def slim_options(options=nil)
4
- setopt :slim_options, options, slim_defaults
5
- end
6
-
7
- def slim_defaults
8
- { pretty: true, disable_escape: true }
9
- end
10
- end
11
- end
1
+ module Bobkit
2
+ module SlimOptions
3
+ def slim_options(options = nil)
4
+ setopt :slim_options, options, slim_defaults
5
+ end
6
+
7
+ def slim_defaults
8
+ { pretty: true, disable_escape: true }
9
+ end
10
+ end
11
+ end
data/lib/bobkit/tasks.rb CHANGED
@@ -1,14 +1,14 @@
1
- module Bobkit
2
- module Tasks
3
- include OptionsBase
4
- include LocationOptions
5
- include SassBridge
6
- include SlimBridge
7
- include CoffeeBridge
8
- include I18nBridge
9
- include MarkdownBridge
10
- include SlimOptions
11
- include ScopeOptions
12
- include Assets
13
- end
14
- end
1
+ module Bobkit
2
+ module Tasks
3
+ include OptionsBase
4
+ include LocationOptions
5
+ include SassBridge
6
+ include SlimBridge
7
+ include CoffeeBridge
8
+ include I18nBridge
9
+ include MarkdownBridge
10
+ include SlimOptions
11
+ include ScopeOptions
12
+ include Assets
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Bobkit
2
- VERSION = "0.2.1"
3
- end
2
+ VERSION = '0.2.3'
3
+ end
@@ -1,41 +1,40 @@
1
- module Bobkit
2
- module Watcher
3
- def watch(*args, &block)
4
- # :nocov:
5
- FileWatcherHandler.instance.watch *args, &block
6
- # :nocov:
7
- end
8
-
9
- def filewatcher
10
- FileWatcherHandler.instance.filewatcher
11
- end
12
-
13
- class FileWatcherHandler
14
- include Singleton
15
- include LocationOptions
16
-
17
- def watch(paths=nil, &block)
18
- # :nocov:
19
- @paths = paths
20
- filewatcher.watch &block
21
- # :nocov:
22
- end
23
-
24
- def filewatcher
25
- Filewatcher.new(paths)
26
- end
27
-
28
- protected
29
-
30
- def paths
31
- @paths ||= all_input_paths
32
- end
33
-
34
- def all_input_paths
35
- [ templates_folder, layouts_folder, styles_folder,
36
- coffee_folder, assets_folder, locales_folder ]
37
- end
38
-
39
- end
40
- end
41
- end
1
+ module Bobkit
2
+ module Watcher
3
+ def watch(...)
4
+ # :nocov:
5
+ FileWatcherHandler.instance.watch(...)
6
+ # :nocov:
7
+ end
8
+
9
+ def filewatcher
10
+ FileWatcherHandler.instance.filewatcher
11
+ end
12
+
13
+ class FileWatcherHandler
14
+ include Singleton
15
+ include LocationOptions
16
+
17
+ def watch(paths = nil, &)
18
+ # :nocov:
19
+ @paths = paths
20
+ filewatcher.watch(&)
21
+ # :nocov:
22
+ end
23
+
24
+ def filewatcher
25
+ Filewatcher.new(paths)
26
+ end
27
+
28
+ protected
29
+
30
+ def paths
31
+ @paths ||= all_input_paths
32
+ end
33
+
34
+ def all_input_paths
35
+ [templates_folder, layouts_folder, styles_folder,
36
+ coffee_folder, assets_folder, locales_folder]
37
+ end
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,87 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bobkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: slim
14
+ name: coffee-script
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '2.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sasstool
28
+ name: filewatcher
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: coffee-script
42
+ name: i18n
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.4'
47
+ version: '1.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.4'
54
+ version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
- name: i18n
56
+ name: mini_racer
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.7'
61
+ version: '0.6'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.7'
68
+ version: '0.6'
69
69
  - !ruby/object:Gem::Dependency
70
- name: filewatcher
70
+ name: rdiscount
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '2.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '2.2'
83
83
  - !ruby/object:Gem::Dependency
84
- name: mini_racer
84
+ name: sasstool
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
@@ -95,19 +95,25 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.2'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rdiscount
98
+ name: slim
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '2.2'
103
+ version: '4.0'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '6.0'
104
107
  type: :runtime
105
108
  prerelease: false
106
109
  version_requirements: !ruby/object:Gem::Requirement
107
110
  requirements:
108
- - - "~>"
111
+ - - ">="
109
112
  - !ruby/object:Gem::Version
110
- version: '2.2'
113
+ version: '4.0'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '6.0'
111
117
  description: Site Generation Toolkit with Slim, SCSS, CoffeeScript and Markdown
112
118
  email: db@dannyben.com
113
119
  executables: []
@@ -136,8 +142,9 @@ files:
136
142
  homepage: https://github.com/DannyBen/bobkit
137
143
  licenses:
138
144
  - MIT
139
- metadata: {}
140
- post_install_message:
145
+ metadata:
146
+ rubygems_mfa_required: 'true'
147
+ post_install_message:
141
148
  rdoc_options: []
142
149
  require_paths:
143
150
  - lib
@@ -145,15 +152,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
152
  requirements:
146
153
  - - ">="
147
154
  - !ruby/object:Gem::Version
148
- version: 2.4.0
155
+ version: '3.1'
149
156
  required_rubygems_version: !ruby/object:Gem::Requirement
150
157
  requirements:
151
158
  - - ">="
152
159
  - !ruby/object:Gem::Version
153
160
  version: '0'
154
161
  requirements: []
155
- rubygems_version: 3.2.3
156
- signing_key:
162
+ rubygems_version: 3.5.6
163
+ signing_key:
157
164
  specification_version: 4
158
165
  summary: Site Generation Toolkit
159
166
  test_files: []