livingstyleguide 2.0.0 → 2.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 +4 -4
- data/lib/livingstyleguide/commands/import_and_use.rb +2 -2
- data/lib/livingstyleguide/document.rb +2 -2
- data/lib/livingstyleguide/integration/rails.rb +2 -2
- data/lib/livingstyleguide/integration/sprockets.rb +48 -3
- data/lib/livingstyleguide/tilt_template.rb +2 -2
- data/lib/livingstyleguide/version.rb +1 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e479b61b3908455eba0e0736876700f7db009e
|
4
|
+
data.tar.gz: 41f5b342d7b41d198b06863925ddd864adab556f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 688c685befee8c0950bc3abb04d13d38208526dd5c7e03ec5d51bed01737983d7b1dc48a1365d241720dadcb942aff55f013c46776a04a267d52b50daaa8b944
|
7
|
+
data.tar.gz: 4dffe131b8f86d86cbe93e5282ad362b056abbecc81f0f5bd4a089798aee562430d0b5d4fd3d7f7be40f31739c2eac0f0fbc5fc06269901016674c26e56025c1
|
@@ -280,7 +280,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
280
280
|
end
|
281
281
|
|
282
282
|
def template_name
|
283
|
-
|
283
|
+
@type == :lsg || @type == :markdown ? :redcarpet : @type
|
284
284
|
end
|
285
285
|
|
286
286
|
def generate_id
|
@@ -310,4 +310,4 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
-
Tilt.register "lsg"
|
313
|
+
Tilt.register LivingStyleGuide::Document, "lsg"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
if defined?(Rails) && defined?(Rails::Railtie)
|
1
|
+
if defined?(Rails) && defined?(Rails::Railtie) && defined?(Sprockets)
|
2
2
|
require "rails"
|
3
3
|
class LivingStyleGuideRailtie < Rails::Railtie
|
4
4
|
initializer "living_style_guide.assets" do |app|
|
5
5
|
Rails.application.config.assets.configure do |env|
|
6
|
-
|
6
|
+
LivingStyleGuideTransformer.register(env)
|
7
7
|
end
|
8
8
|
LivingStyleGuide.default_options[:scss_template] =
|
9
9
|
::Sass::Rails::ScssTemplate
|
@@ -1,10 +1,55 @@
|
|
1
1
|
if defined?(Sprockets)
|
2
2
|
begin
|
3
3
|
require "sprockets"
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
|
5
|
+
class LivingStyleGuideTransformer
|
6
|
+
def initialize(filename)
|
7
|
+
@filename = filename
|
8
|
+
@source = yield
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context, _)
|
12
|
+
self.class.run(@filename, @source, context)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.run(filename, source, context)
|
16
|
+
doc = LivingStyleGuide::Document.new(filename) { source }
|
17
|
+
doc.render(context)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.call(input)
|
21
|
+
filename = input[:filename]
|
22
|
+
source = input[:data]
|
23
|
+
context = input[:environment].context_class.new(input)
|
24
|
+
|
25
|
+
result = run(filename, source, context)
|
26
|
+
context.metadata.merge(data: result)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.register(env)
|
30
|
+
if env.respond_to?(:register_transformer)
|
31
|
+
env.register_mime_type("text/lsg",
|
32
|
+
extensions: [".lsg"],
|
33
|
+
charset: :unicode)
|
34
|
+
env.register_transformer("text/lsg", "text/html",
|
35
|
+
LivingStyleGuideTransformer)
|
36
|
+
end
|
37
|
+
|
38
|
+
if env.respond_to?(:register_engine)
|
39
|
+
args = [".lsg", ::LivingStyleGuide::Document]
|
40
|
+
if Sprockets::VERSION.start_with?("3")
|
41
|
+
args << { mime_type: "text/html", silence_deprecation: true }
|
42
|
+
end
|
43
|
+
env.register_engine(*args)
|
44
|
+
end
|
45
|
+
|
46
|
+
if env.respond_to?(:append_path)
|
47
|
+
env.append_path(::LivingStyleGuide::SASS_PATH)
|
48
|
+
end
|
49
|
+
end
|
7
50
|
end
|
51
|
+
|
52
|
+
LivingStyleGuideTransformer.register(Sprockets)
|
8
53
|
rescue LoadError
|
9
54
|
end
|
10
55
|
end
|
@@ -49,7 +49,7 @@ module LivingStyleGuide
|
|
49
49
|
|
50
50
|
def parse_options(data)
|
51
51
|
data.strip!
|
52
|
-
@options =
|
52
|
+
@options = data[0] == "{" ? JSON.parse(data) : YAML.load(data)
|
53
53
|
@options = {} unless @options
|
54
54
|
@options.keys.each do |key|
|
55
55
|
@options[key.tr("-", "_").to_sym] = @options.delete(key)
|
@@ -78,7 +78,7 @@ module LivingStyleGuide
|
|
78
78
|
|
79
79
|
def find_root_path
|
80
80
|
path = @file.nil? ? Dir.pwd : File.dirname(@file)
|
81
|
-
while path.
|
81
|
+
while !path.empty?
|
82
82
|
if File.exists?(File.join(path, "Gemfile")) ||
|
83
83
|
File.exists?(File.join(path, ".git"))
|
84
84
|
break
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livingstyleguide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico Hagenburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minisyntax
|
@@ -220,9 +220,8 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
-
description:
|
224
|
-
|
225
|
-
Markdown. Se htps:/livingstyleguide.org for details.
|
223
|
+
description: Automatically generate beautiful front-end style guides with Sass and
|
224
|
+
Markdown. See https://livingstyleguide.org for details.
|
226
225
|
email:
|
227
226
|
- nico@hagenburger.net
|
228
227
|
executables:
|
@@ -308,9 +307,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
307
|
version: '0'
|
309
308
|
requirements: []
|
310
309
|
rubyforge_project:
|
311
|
-
rubygems_version: 2.
|
310
|
+
rubygems_version: 2.5.1
|
312
311
|
signing_key:
|
313
312
|
specification_version: 4
|
314
313
|
summary: Generate beautiful front-end style guides
|
315
314
|
test_files: []
|
316
|
-
has_rdoc:
|