livingstyleguide 0.6.0.alpha.0 → 0.6.0.alpha.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ce8037b3c84517db3602995b10c72e30b3c3ca6
4
- data.tar.gz: b7acd8ff3d54088613ed7274af01da497835256b
3
+ metadata.gz: 9d11d94de9e3e3effd2978cf825fa788d8b1c580
4
+ data.tar.gz: 1c229b285f7e026f7eec53f85c039d561740ee85
5
5
  SHA512:
6
- metadata.gz: 18e3233b83e7645a1170de1bd28e824b2d96a0028b3ca2afc4fe32ead5527d8ccca0be533eafaa07e7362a174f091d0fbacecc54f11c874d2dae6ced6bf2cf07
7
- data.tar.gz: 6831b4ff910cd4076116c03145fd305244aecc5375199f2b1556ebac641c3f5db95c2365762d2a6ae8816f33afbf382709c5d103a8e1b59d95dd2952cf6a257a
6
+ metadata.gz: 995f18281ce94a1eb31f3b711025cc104d3fa4faf8fb23e01443ca57f4069bbea6a63d755315413705e06a5d204dfcec8934791c126f3fe661db8577016fa473
7
+ data.tar.gz: 95cd6a320e6055b2ef931c2d56f388fbb0f173b596fc57a59df264b3c0271f28b542c4b9bddbf66a6bd8bd6b71f29792c19254cbfaf52769aa055fe20df0dfda
data/CHANGELOG.md CHANGED
@@ -22,3 +22,13 @@
22
22
 
23
23
  * More stable CSS
24
24
 
25
+ ## 0.6.0.alpha.0
26
+
27
+ * Implemented command line interface
28
+
29
+ ## 0.6.0.alpha.1
30
+
31
+ * Added Rails support
32
+ * Removed globbing
33
+ * Set .html.lsg as default file extension
34
+
@@ -24,11 +24,6 @@ module LivingStyleGuide
24
24
 
25
25
  end
26
26
 
27
- Compass.configuration.add_import_path LivingStyleGuide::VariablesImporter.new
28
-
29
- base_directory = File.join(File.dirname(__FILE__), '..')
30
- Compass::Frameworks.register 'livingstyleguide', :path => base_directory
31
-
32
27
  class Sass::Engine
33
28
  include LivingStyleGuide::Renderer
34
29
  end
@@ -39,3 +34,5 @@ class String
39
34
  end
40
35
  end
41
36
 
37
+ require 'livingstyleguide/integration'
38
+
@@ -1,18 +1,27 @@
1
- require 'sass-globbing'
1
+ class LivingStyleGuide::Importer < Sass::Importers::Filesystem
2
+
3
+ def initialize(root)
4
+ super(root)
5
+ end
2
6
 
3
- class LivingStyleGuide::Importer < Sass::Globbing::Importer
4
7
  def find_relative(name, base, options, absolute = false)
5
- if name =~ /^(.+)\.s[ac]ss$|^(\*|[a-z0-9_\/-])+$/
6
- path = File.expand_path(File.dirname(base))
7
- file = "#{path}/#{name.sub(/\..+$/, '')}.md"
8
- file.sub!(/(.*)\//, '\\1/_') unless file =~ /\/_/
8
+ find_markdown(File.join(File.dirname(base), name))
9
+ super(name, base, options)
10
+ end
9
11
 
10
- if File.exist? file
11
- LivingStyleGuide.add_markdown File.read(file)
12
- end
12
+ def find(name, options)
13
+ find_markdown(name)
14
+ super(name, options)
15
+ end
13
16
 
14
- super(name, base, options, absolute)
17
+ def find_markdown(sass_filename)
18
+ glob = "#{sass_filename.sub(/\.s[ac]ss$/, '')}.md"
19
+ glob.sub!(/(.*)\//, '\\1/{_,}') unless glob =~ /\/_/
20
+ glob = '{_,}' + glob unless glob =~ /\//
21
+ Dir.glob(glob) do |markdown_filename|
22
+ LivingStyleGuide.add_markdown File.read(markdown_filename)
15
23
  end
16
24
  end
25
+
17
26
  end
18
27
 
@@ -0,0 +1,3 @@
1
+ require 'livingstyleguide/integration/compass'
2
+ require 'livingstyleguide/integration/rails'
3
+
@@ -0,0 +1,5 @@
1
+ Compass.configuration.add_import_path LivingStyleGuide::VariablesImporter.new
2
+
3
+ base_directory = File.join(File.dirname(__FILE__), '..', '..', '..')
4
+ Compass::Frameworks.register 'livingstyleguide', path: base_directory
5
+
@@ -0,0 +1,11 @@
1
+ if defined?(Rails) and defined?(Rails::Railtie)
2
+
3
+ require 'rails'
4
+ class LivingStyleGuideRailtie < Rails::Railtie
5
+ initializer 'living_style_guide.assets' do
6
+ Rails.application.assets.register_engine('.lsg', ::Tilt::LivingStyleGuideTemplate)
7
+ end
8
+ end
9
+
10
+ end
11
+
@@ -5,7 +5,7 @@ module LivingStyleGuide::Renderer
5
5
  def render_living_style_guide
6
6
  @css = self.render
7
7
  template = File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'layouts', 'default.html.erb'))
8
- markdown = LivingStyleGuide.markdown
8
+ markdown = LivingStyleGuide.markdown || ""
9
9
  @html = LivingStyleGuide::RedcarpetTemplate.new{ markdown }.render
10
10
  LivingStyleGuide.reset
11
11
  ERB.new(template).result(binding)
@@ -11,25 +11,28 @@ module ::Tilt
11
11
 
12
12
  def evaluate(scope, locals, &block)
13
13
  engine = ::Sass::Engine.new(data, sass_options)
14
- @output ||= engine.render_living_style_guide
14
+ engine.render_living_style_guide
15
15
  end
16
16
 
17
17
  private
18
18
  def sass_options
19
19
  options = Compass.configuration.to_sass_plugin_options
20
20
  options[:template_location].each do |path, short|
21
- options[:load_paths] << path
21
+ options[:load_paths] << ::LivingStyleGuide::Importer.new(path)
22
22
  end
23
- options[:filename] = eval_file
24
- options[:line] = line
25
- options[:syntax] = @file =~ /\.sass/ ? :sass : :scss
26
- options[:importer] = LivingStyleGuide::Importer.instance
23
+ options[:filename] = eval_file
24
+ options[:line] = line
25
+ options[:syntax] = detect_syntax
26
+ options[:importer] = LivingStyleGuide::Importer.new('.')
27
27
  options
28
28
  end
29
- end
30
29
 
31
- %w(sass.lsg scss.lsg).each do |ext|
32
- register ext, LivingStyleGuideTemplate
30
+ private
31
+ def detect_syntax
32
+ data =~ %r(^//\s*@syntax\s*:\s*sass\s*$) ? :sass : :scss
33
+ end
33
34
  end
35
+
36
+ register 'lsg', LivingStyleGuideTemplate
34
37
  end
35
38
 
@@ -1,3 +1,3 @@
1
1
  module LivingStyleGuide
2
- VERSION = "0.6.0.alpha.0"
2
+ VERSION = "0.6.0.alpha.1"
3
3
  end
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'minisyntax'
21
21
  gem.add_dependency 'compass'
22
22
  gem.add_dependency 'sass'
23
- gem.add_dependency 'sass-globbing'
24
23
  gem.add_dependency 'redcarpet'
25
24
  gem.add_dependency 'tilt'
26
25
  gem.add_dependency 'activesupport'
@@ -1 +1,2 @@
1
- @import "modules/**";
1
+ @import "modules/buttons";
2
+
@@ -0,0 +1,4 @@
1
+ @import "compass";
2
+ @import "style";
3
+ @import "livingstyleguide";
4
+
@@ -4,7 +4,7 @@ require 'tilt'
4
4
  class MarkdownTest < Test::Unit::TestCase
5
5
 
6
6
  def test_standalone_project
7
- html = Tilt.new('test/fixtures/standalone/styleguide.html.scss.lsg').render
7
+ html = Tilt.new('test/fixtures/standalone/styleguide.html.lsg').render
8
8
  assert_match %r(background: red), html
9
9
  assert_match %r(<button class="button">), html
10
10
  end
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: 0.6.0.alpha.0
4
+ version: 0.6.0.alpha.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: 2013-11-21 00:00:00.000000000 Z
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minisyntax
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: sass-globbing
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: redcarpet
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +156,9 @@ files:
170
156
  - lib/livingstyleguide.rb
171
157
  - lib/livingstyleguide/command_line_interface.rb
172
158
  - lib/livingstyleguide/importer.rb
159
+ - lib/livingstyleguide/integration.rb
160
+ - lib/livingstyleguide/integration/compass.rb
161
+ - lib/livingstyleguide/integration/rails.rb
173
162
  - lib/livingstyleguide/markdown_extensions.rb
174
163
  - lib/livingstyleguide/renderer.rb
175
164
  - lib/livingstyleguide/sass_extensions.rb
@@ -201,7 +190,7 @@ files:
201
190
  - test/fixtures/standalone/modules/_buttons.md
202
191
  - test/fixtures/standalone/modules/_buttons.scss
203
192
  - test/fixtures/standalone/style.scss
204
- - test/fixtures/standalone/styleguide.html.scss.lsg
193
+ - test/fixtures/standalone/styleguide.html.lsg
205
194
  - test/fixtures/stylesheets/variables/_more-other-colors.sass
206
195
  - test/fixtures/stylesheets/variables/colors.scss
207
196
  - test/fixtures/stylesheets/variables/other-colors.sass
@@ -229,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
218
  version: 1.3.1
230
219
  requirements: []
231
220
  rubyforge_project:
232
- rubygems_version: 2.0.6
221
+ rubygems_version: 2.1.11
233
222
  signing_key:
234
223
  specification_version: 4
235
224
  summary: Living Style Guide
@@ -250,7 +239,7 @@ test_files:
250
239
  - test/fixtures/standalone/modules/_buttons.md
251
240
  - test/fixtures/standalone/modules/_buttons.scss
252
241
  - test/fixtures/standalone/style.scss
253
- - test/fixtures/standalone/styleguide.html.scss.lsg
242
+ - test/fixtures/standalone/styleguide.html.lsg
254
243
  - test/fixtures/stylesheets/variables/_more-other-colors.sass
255
244
  - test/fixtures/stylesheets/variables/colors.scss
256
245
  - test/fixtures/stylesheets/variables/other-colors.sass
@@ -1,2 +0,0 @@
1
- @import "style";
2
-