bobkit 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 +7 -0
- data/README.md +13 -0
- data/lib/bobkit.rb +9 -0
- data/lib/bobkit/actions.rb +62 -0
- data/lib/bobkit/file_helpers.rb +13 -0
- data/lib/bobkit/sass_extra.rb +13 -0
- data/lib/bobkit/scope.rb +29 -0
- data/lib/bobkit/slim_extra.rb +20 -0
- data/lib/bobkit/version.rb +3 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9039d57140e0dab71277e153eb1903e9a9eb3f2b
|
4
|
+
data.tar.gz: 2b43616ca5a43085b55191fa701063983d7becfe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7e2b9b3f6823f05544a6dee29a64f5728c2bbfea54c432375679de276ce4c10abcf298b61b00c77eb5b0f251718f9eff6d65ba4ca513c32efe93280d9d82a8e
|
7
|
+
data.tar.gz: afd8794e232ecfa91b5a7d0b1e478c6654f673c4c7ffc7609b6a4bb5af26a03756369cb31f39f6968e1f6d71f52fd0e3b029b300a453b70a98114a3116862e56
|
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Bobkit - Site Generation Toolkit
|
2
|
+
==================================================
|
3
|
+
|
4
|
+
|
5
|
+
Todo
|
6
|
+
--------------------------------------------------
|
7
|
+
|
8
|
+
[ ] Clean repo
|
9
|
+
[ ] Publish gem
|
10
|
+
[ ] Full test coverage
|
11
|
+
[ ] copy_asset (file and folder)
|
12
|
+
[ ] CoffeeScript
|
13
|
+
[ ] Documentation
|
data/lib/bobkit.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module Bobkit
|
2
|
+
module Actions
|
3
|
+
include SassExtra
|
4
|
+
include SlimExtra
|
5
|
+
|
6
|
+
def templates_folder(path=nil)
|
7
|
+
setopt :templates_folder, path, 'templates'
|
8
|
+
end
|
9
|
+
|
10
|
+
def layouts_folder(path=nil)
|
11
|
+
setopt :layouts_folder, path, "#{templates_folder}/layouts"
|
12
|
+
end
|
13
|
+
|
14
|
+
def styles_folder(path=nil)
|
15
|
+
setopt :styles_folder, path, 'styles'
|
16
|
+
end
|
17
|
+
|
18
|
+
def output_folder(path=nil)
|
19
|
+
setopt :output_folder, path, 'output'
|
20
|
+
end
|
21
|
+
|
22
|
+
def css_output_folder(path=nil)
|
23
|
+
setopt :css_output_folder, path, "#{output_folder}/css"
|
24
|
+
end
|
25
|
+
|
26
|
+
def slim_options(options=nil)
|
27
|
+
setopt :slim_options, options, slim_defaults
|
28
|
+
end
|
29
|
+
|
30
|
+
def scss_options(options=nil)
|
31
|
+
setopt :scss_options, options, scss_defaults
|
32
|
+
end
|
33
|
+
|
34
|
+
def scope(scope=nil)
|
35
|
+
scope ? setopt(:scope, Scope.new(scope)) : options[:scope]
|
36
|
+
end
|
37
|
+
|
38
|
+
def use_defaults
|
39
|
+
@@options = {}
|
40
|
+
end
|
41
|
+
|
42
|
+
protected
|
43
|
+
|
44
|
+
def slim_defaults
|
45
|
+
{ pretty: true, disable_escape: true }
|
46
|
+
end
|
47
|
+
|
48
|
+
def scss_defaults
|
49
|
+
{ cache: true, syntax: :scss, style: :nested }
|
50
|
+
end
|
51
|
+
|
52
|
+
def setopt(key, value=nil, default=nil)
|
53
|
+
options[key] = value if value
|
54
|
+
options[key] ||= default
|
55
|
+
options[key]
|
56
|
+
end
|
57
|
+
|
58
|
+
def options
|
59
|
+
@@options ||= {}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Bobkit
|
2
|
+
module FileHelpers
|
3
|
+
def create_file(path, content)
|
4
|
+
create_folder_for path
|
5
|
+
File.write path, content
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_folder_for(path)
|
9
|
+
dir = File.dirname path
|
10
|
+
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Bobkit
|
2
|
+
module SassExtra
|
3
|
+
include FileHelpers
|
4
|
+
|
5
|
+
def compile_css(file, options={})
|
6
|
+
@file = "#{styles_folder}/#{file}.scss"
|
7
|
+
content = Sass::Engine.new(File.read(@file), scss_options).render
|
8
|
+
output = options[:output]
|
9
|
+
create_file "#{css_output_folder}/#{output}.css", content if output
|
10
|
+
content
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/bobkit/scope.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bobkit
|
2
|
+
class Scope
|
3
|
+
include SlimExtra
|
4
|
+
|
5
|
+
def initialize(scope)
|
6
|
+
@scope = scope
|
7
|
+
end
|
8
|
+
|
9
|
+
def method_missing(method_name, *arguments, &block)
|
10
|
+
if @scope.respond_to?(:key?) and @scope.key?(method_name)
|
11
|
+
@scope[method_name]
|
12
|
+
elsif @scope.respond_to? method_name
|
13
|
+
@scope.send method_name
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def respond_to?(method_name, include_private = false)
|
20
|
+
if @scope.respond_to?(:key?) and @scope.key?(method_name)
|
21
|
+
true
|
22
|
+
elsif @scope.respond_to? method_name
|
23
|
+
true
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bobkit
|
2
|
+
module SlimExtra
|
3
|
+
include FileHelpers
|
4
|
+
|
5
|
+
def render(options={}, extra_options={})
|
6
|
+
options = { partial: options }.merge(extra_options) if options.is_a? String
|
7
|
+
partial = options.delete :partial
|
8
|
+
layout = options.delete :layout
|
9
|
+
output = options.delete :output
|
10
|
+
|
11
|
+
context = options.empty? ? scope : options
|
12
|
+
context = Scope.new context if context.is_a? Hash
|
13
|
+
|
14
|
+
content = Slim::Template.new("#{templates_folder}/#{partial}.slim", slim_options).render(context)
|
15
|
+
content = Slim::Template.new("#{layouts_folder}/#{layout}.slim", slim_options).render(context) { content } if layout
|
16
|
+
create_file "#{output_folder}/#{output}.html", content if output
|
17
|
+
content
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bobkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danny Ben Shitrit
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slim
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sass
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: runfile
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: runfile-tasks
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.4'
|
69
|
+
description: Site Generation Toolkit with Slim, SCSS and CoffeeScript
|
70
|
+
email: db@dannyben.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- README.md
|
76
|
+
- lib/bobkit.rb
|
77
|
+
- lib/bobkit/actions.rb
|
78
|
+
- lib/bobkit/file_helpers.rb
|
79
|
+
- lib/bobkit/sass_extra.rb
|
80
|
+
- lib/bobkit/scope.rb
|
81
|
+
- lib/bobkit/slim_extra.rb
|
82
|
+
- lib/bobkit/version.rb
|
83
|
+
homepage: https://github.com/DannyBen/bobkit
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.0.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.4.6
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Site Generation Toolkit
|
107
|
+
test_files: []
|