wst 0.10.1 → 0.11.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
  SHA1:
3
- metadata.gz: 40f2036b93f4e55ed673560b7619858c55e106f0
4
- data.tar.gz: 0b8bcfa1c3811eab52488cf1196766eb78a624e2
3
+ metadata.gz: 723c892f789eacb670ebb1a44dfda254c9bfc918
4
+ data.tar.gz: c46c1e6e3739c985f9a4113ed334e1a8c6a3bd33
5
5
  SHA512:
6
- metadata.gz: 7f77b6c780e4eba3f7fa91d7b6672c01bae3428a1a145d20f251ea72abb80f0ed48e6f81df7aefeb303ff0098e564fd09d19ace5eb29e5aa3a848486c60ddc15
7
- data.tar.gz: 0c914d3f7c57952b2625dafe3c79e3e26195ee7d8eafa45037b61d8817ada3c21dccf419b6330d7f05d52b55b740eda508fc8e9596a267f5eb4286bf4ed57d8c
6
+ metadata.gz: abbcc6b49120ba2cd7c15ae3516876a27b6a0f0fdfd9994e060f568734a03abada64c490aaaf6f099b33c9e8339f9c9feae8cfb6c006494b948ab1d595307018
7
+ data.tar.gz: 3ca844e17483d1f3eeb4c1d602283dea52563339d7f4c508bd68258d97df87cc74e11a00b0164c13d41fabef25420656a686839f662a966a2136a76fa141f4c6
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'yaml'
3
- require 'configuration'
3
+ require 'wst/configuration'
4
4
  require 'digest/md5'
5
5
 
6
6
  module Wst
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'configuration'
3
- require 'logging'
2
+ require 'wst/configuration'
3
+ require 'wst/logging'
4
4
  require 'sass'
5
5
 
6
6
  module Wst
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'content'
2
+ require 'wst/content'
3
3
 
4
4
  module Wst
5
5
  class HamlContent < Content
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require 'haml'
3
- require 'haml_content'
4
- require 'configuration'
3
+ require 'wst/haml_content'
4
+ require 'wst/configuration'
5
5
  require 'time'
6
6
  require 'html_truncator'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
- require 'renderer'
2
+ require 'wst/renderer'
3
3
  require 'haml'
4
- require 'configuration'
4
+ require 'wst/configuration'
5
5
 
6
6
  module Wst
7
7
  class HamlRenderer < Renderer
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'configuration'
3
- require 'logging'
2
+ require 'wst/configuration'
3
+ require 'wst/logging'
4
4
 
5
5
  module Wst
6
6
  class JsRenderer
@@ -56,4 +56,4 @@ module Wst
56
56
  end
57
57
  end
58
58
  end
59
- end
59
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'logger'
2
+ require 'wst/logger'
3
3
 
4
4
  module Wst
5
5
  module Logging
data/lib/wst/main.rb ADDED
@@ -0,0 +1,110 @@
1
+ # encoding: utf-8
2
+ require 'haml_helpers_wlt_extensions'
3
+ require 'wst/post'
4
+ require 'wst/page'
5
+ require 'wst/renderer_factory'
6
+ require 'wst/css_renderer'
7
+ require 'wst/js_renderer'
8
+ require 'wst/configuration'
9
+ require 'wst/logging'
10
+ require 'wst/colored'
11
+ require 'uglifier'
12
+
13
+ module Wst
14
+ class Wst
15
+ include Logging
16
+ include Configuration
17
+
18
+ def initialize
19
+ @css_renderer = CssRenderer.new
20
+ @js_renderer = JsRenderer.new
21
+ end
22
+
23
+ # @param [Boolean] all Generate all content or only published content
24
+ def generate(all = false)
25
+ init
26
+ css
27
+ js
28
+ content all
29
+ pub
30
+ end
31
+
32
+ # Compile all css files
33
+ def css
34
+ @css_renderer.generate_all
35
+ end
36
+
37
+ # Compile a single css file
38
+ # @param [String] css_name Css name to compile
39
+ def compile_css(css_name)
40
+ @css_renderer.compile css_name
41
+ end
42
+
43
+ # Compile all js files
44
+ def js
45
+ @js_renderer.generate_all
46
+ end
47
+
48
+ # Compile a single js file
49
+ # @param [String] js_name Js name to compile
50
+ def compile_js(js_name)
51
+ @js_renderer.compile js_name
52
+ end
53
+
54
+ private
55
+
56
+ def init
57
+ logger.info 'Clean'.blue
58
+ FileUtils.mkdir_p File.join config['path'], '_site'
59
+ FileUtils.rm_rf Dir.glob File.join config['path'], '_site/*'
60
+ end
61
+
62
+ #def kss
63
+ # return unless config.has_key? 'assets'
64
+ # return unless config['assets'].has_key? 'css'
65
+ # css_conf = config['assets']['css']
66
+ # return unless css_conf.kind_of? Array
67
+
68
+ # logger.info 'KSS'.blue
69
+ # css_conf.each do |css_name|
70
+ # logger.info " #{css_name}"
71
+ # compile_css_expanded css_name
72
+ # end
73
+ #end
74
+
75
+ # @param [Boolean] all Generate all content or only published content
76
+ def content(all)
77
+ logger.info 'Content'.blue
78
+ contents(all).each do |doc|
79
+ logger.info " #{doc.content_url}"
80
+ renderer = RendererFactory.for doc
81
+ renderer.write_to_site
82
+ end
83
+ end
84
+
85
+ def pub
86
+ logger.info 'Pub'.blue
87
+
88
+ out_dir = File.join(config['path'], '_site')
89
+ in_dir = File.join(config['path'], '_pub', '.')
90
+
91
+ FileUtils.cp_r in_dir , out_dir
92
+ hidden = Dir.glob("#{in_dir}*").select do |file|
93
+ File.basename(file) != '.' && File.basename(file) != '..'
94
+ end
95
+ FileUtils.cp_r hidden , out_dir
96
+ end
97
+
98
+ # @param [Boolean] all Get all content or only published content
99
+ # @return [Array<Content>] Contents
100
+ def contents(all)
101
+ return all_content if all
102
+ all_content.select { |c| c.published }
103
+ end
104
+
105
+ # @return [Array<Content>] All post and page content
106
+ def all_content
107
+ [Post.all, Page.all].flatten
108
+ end
109
+ end
110
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'content'
3
- require 'configuration'
2
+ require 'wst/content'
3
+ require 'wst/configuration'
4
4
 
5
5
  module Wst
6
6
  class MdContent < Content
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
- require 'renderer'
3
- require 'renderer_factory'
2
+ require 'wst/renderer'
3
+ require 'wst/renderer_factory'
4
4
  require 'redcarpet'
5
- require 'html_with_pygments'
5
+ require 'wst/html_with_pygments'
6
6
 
7
7
  module Wst
8
8
  class MdRenderer < Renderer
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'md_content'
3
- require 'haml_content'
2
+ require 'wst/md_content'
3
+ require 'wst/haml_content'
4
4
  require 'cgi'
5
5
 
6
6
  module Wst
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'md_content'
2
+ require 'wst/md_content'
3
3
 
4
4
  module Wst
5
5
  class Post < MdContent
data/lib/wst/reader.rb ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'wst/configuration'
4
+ require 'wst/page'
5
+ require 'wst/post'
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require 'configuration'
3
- require 'haml_content'
2
+ require 'wst/configuration'
3
+ require 'wst/haml_content'
4
4
  require 'fileutils'
5
5
 
6
6
  module Wst
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- require 'post'
3
- require 'page'
4
- require 'haml_content'
5
- require 'md_renderer'
6
- require 'haml_renderer'
2
+ require 'wst/post'
3
+ require 'wst/page'
4
+ require 'wst/haml_content'
5
+ require 'wst/md_renderer'
6
+ require 'wst/haml_renderer'
7
7
 
8
8
  module Wst
9
9
  module RendererFactory
data/lib/wst.rb CHANGED
@@ -1,110 +1,2 @@
1
1
  # encoding: utf-8
2
- require 'haml_helpers_wlt_extensions'
3
- require 'post'
4
- require 'page'
5
- require 'renderer_factory'
6
- require 'css_renderer'
7
- require 'js_renderer'
8
- require 'configuration'
9
- require 'logging'
10
- require 'colored'
11
- require 'uglifier'
12
-
13
- module Wst
14
- class Wst
15
- include Logging
16
- include Configuration
17
-
18
- def initialize
19
- @css_renderer = CssRenderer.new
20
- @js_renderer = JsRenderer.new
21
- end
22
-
23
- # @param [Boolean] all Generate all content or only published content
24
- def generate(all = false)
25
- init
26
- css
27
- js
28
- content all
29
- pub
30
- end
31
-
32
- # Compile all css files
33
- def css
34
- @css_renderer.generate_all
35
- end
36
-
37
- # Compile a single css file
38
- # @param [String] css_name Css name to compile
39
- def compile_css(css_name)
40
- @css_renderer.compile css_name
41
- end
42
-
43
- # Compile all js files
44
- def js
45
- @js_renderer.generate_all
46
- end
47
-
48
- # Compile a single js file
49
- # @param [String] js_name Js name to compile
50
- def compile_js(js_name)
51
- @js_renderer.compile js_name
52
- end
53
-
54
- private
55
-
56
- def init
57
- logger.info 'Clean'.blue
58
- FileUtils.mkdir_p File.join config['path'], '_site'
59
- FileUtils.rm_rf Dir.glob File.join config['path'], '_site/*'
60
- end
61
-
62
- #def kss
63
- # return unless config.has_key? 'assets'
64
- # return unless config['assets'].has_key? 'css'
65
- # css_conf = config['assets']['css']
66
- # return unless css_conf.kind_of? Array
67
-
68
- # logger.info 'KSS'.blue
69
- # css_conf.each do |css_name|
70
- # logger.info " #{css_name}"
71
- # compile_css_expanded css_name
72
- # end
73
- #end
74
-
75
- # @param [Boolean] all Generate all content or only published content
76
- def content(all)
77
- logger.info 'Content'.blue
78
- contents(all).each do |doc|
79
- logger.info " #{doc.content_url}"
80
- renderer = RendererFactory.for doc
81
- renderer.write_to_site
82
- end
83
- end
84
-
85
- def pub
86
- logger.info 'Pub'.blue
87
-
88
- out_dir = File.join(config['path'], '_site')
89
- in_dir = File.join(config['path'], '_pub', '.')
90
-
91
- FileUtils.cp_r in_dir , out_dir
92
- hidden = Dir.glob("#{in_dir}*").select do |file|
93
- File.basename(file) != '.' && File.basename(file) != '..'
94
- end
95
- FileUtils.cp_r hidden , out_dir
96
- end
97
-
98
- # @param [Boolean] all Get all content or only published content
99
- # @return [Array<Content>] Contents
100
- def contents(all)
101
- return all_content if all
102
- all_content.select { |c| c.published }
103
- end
104
-
105
- # @return [Array<Content>] All post and page content
106
- def all_content
107
- [Post.all, Page.all].flatten
108
- end
109
- end
110
- end
2
+ require 'wst/main'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Brissaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -133,23 +133,25 @@ files:
133
133
  - bin/wst
134
134
  - bin/wst-serve
135
135
  - lib/.editorconfig
136
- - lib/colored.rb
137
- - lib/configuration.rb
138
- - lib/content.rb
139
- - lib/css_renderer.rb
140
- - lib/haml_content.rb
141
- - lib/haml_helpers_wlt_extensions.rb
142
- - lib/haml_renderer.rb
143
- - lib/html_with_pygments.rb
144
- - lib/js_renderer.rb
145
- - lib/logging.rb
146
- - lib/md_content.rb
147
- - lib/md_renderer.rb
148
- - lib/page.rb
149
- - lib/post.rb
150
- - lib/renderer.rb
151
- - lib/renderer_factory.rb
152
136
  - lib/wst.rb
137
+ - lib/wst/colored.rb
138
+ - lib/wst/configuration.rb
139
+ - lib/wst/content.rb
140
+ - lib/wst/css_renderer.rb
141
+ - lib/wst/haml_content.rb
142
+ - lib/wst/haml_helpers_wlt_extensions.rb
143
+ - lib/wst/haml_renderer.rb
144
+ - lib/wst/html_with_pygments.rb
145
+ - lib/wst/js_renderer.rb
146
+ - lib/wst/logging.rb
147
+ - lib/wst/main.rb
148
+ - lib/wst/md_content.rb
149
+ - lib/wst/md_renderer.rb
150
+ - lib/wst/page.rb
151
+ - lib/wst/post.rb
152
+ - lib/wst/reader.rb
153
+ - lib/wst/renderer.rb
154
+ - lib/wst/renderer_factory.rb
153
155
  homepage: https://github.com/eunomie/wst
154
156
  licenses:
155
157
  - MIT