octopress-ink 1.0.0.alpha.18 → 1.0.0.alpha.19

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
  SHA1:
3
- metadata.gz: c888518337b350c4592c3808f128f21393f30e12
4
- data.tar.gz: 8733d8937ac4bdc95426e0112aeb3a242bc63f05
3
+ metadata.gz: 9f2fb82a20098cdfe2f3e53ba1d8698b2c687afb
4
+ data.tar.gz: 70ccb3b9d8223443f105e6457b000dbdb5e8efc9
5
5
  SHA512:
6
- metadata.gz: 560806fb9ef8998368bc7511bc77d8c6ffed88ea4c141a1e11b8136ae9d391acd329d9c01f008b7ce50d94c787b097f30eae8cbf1cffc25a4058ba1ac2405a92
7
- data.tar.gz: d3563681fbf6e66639eb31d6c98b8b5760d2f2ac9aba7ceba84bb99f53be6b67a5eb8f1be5c848a6f0bda4ce476f7ba0c691ed618648e0255a982e585d099dfa
6
+ metadata.gz: 5d98ccf5704b0055c3acc922eda1bd69dc38387022cabe493bfefc553795af644747ed2cbac4c585e262f8431f94618b4ae99e01787dd1c896479dc8785c88c6
7
+ data.tar.gz: b2c296c4fcce0c5f40928448b72423b48b29c0b50969d5b27e4e54054566e78b0ee2ce0b18a9f2794765058f42ed1b7cf64e497a781d739e23e164dddc5674e3
@@ -2,6 +2,7 @@ module Octopress
2
2
  module Assets
3
3
  autoload :Asset, 'octopress-ink/assets/asset'
4
4
  autoload :Config, 'octopress-ink/assets/config'
5
+ autoload :RootAsset, 'octopress-ink/assets/root'
5
6
  autoload :Javascript, 'octopress-ink/assets/javascript'
6
7
  autoload :Stylesheet, 'octopress-ink/assets/stylesheet'
7
8
  autoload :Sass, 'octopress-ink/assets/sass'
@@ -9,6 +9,7 @@ module Octopress
9
9
  @root = plugin.assets_path
10
10
  @dir = File.join(plugin.namespace, type)
11
11
  @exists = {}
12
+ file_check
12
13
  end
13
14
 
14
15
  def file
@@ -25,7 +26,7 @@ module Octopress
25
26
  files = files.flatten.reject { |f| !exists? f }
26
27
 
27
28
  unless files.size
28
- raise IOError.new "Could not find #{File.basename(@file)} at #{file}"
29
+ raise IOError.new "Could not find #{File.basename(@file)} at #{@file}"
29
30
  end
30
31
  @found_file = Pathname.new files[0]
31
32
  end
@@ -89,6 +90,11 @@ module Octopress
89
90
  end
90
91
  end
91
92
 
93
+ def file_check
94
+ if @plugin.type != 'local_plugin' and !exists? plugin_path
95
+ raise "\nPlugin: #{@plugin.name}: Could not find #{File.basename(@file)} at #{plugin_path}".red
96
+ end
97
+ end
92
98
 
93
99
  def exists?(file)
94
100
  @exists[file] ||= File.exists?(file)
@@ -0,0 +1,28 @@
1
+ # These are files which need to be in added to the root of the site directory
2
+ # Use root assets for files like robots.text or favicon.ico
3
+
4
+
5
+ module Octopress
6
+ module Assets
7
+ class RootAsset < Asset
8
+
9
+ def initialize(plugin, type, file)
10
+ @root = plugin.assets_path
11
+ @plugin = plugin
12
+ @dir = ''
13
+ @type = type
14
+ @exists = {}
15
+ @file = file
16
+ file_check
17
+ end
18
+
19
+ def copy(site)
20
+ unless exists? local_plugin_path(site)
21
+ site.static_files << StaticFile.new(plugin_path, destination)
22
+ end
23
+ end
24
+
25
+ end
26
+ end
27
+ end
28
+
@@ -9,6 +9,7 @@ module Octopress
9
9
  @root = plugin.assets_path
10
10
  @dir = File.join(plugin.namespace, type)
11
11
  @exists = {}
12
+ file_check
12
13
  end
13
14
 
14
15
  def tag
@@ -9,6 +9,7 @@ module Octopress
9
9
  @root = plugin.assets_path
10
10
  @dir = File.join(plugin.namespace, type)
11
11
  @exists = {}
12
+ file_check
12
13
  end
13
14
 
14
15
  def media
@@ -1,6 +1,6 @@
1
1
  module Octopress
2
2
  class Plugin
3
- attr_accessor :name, :type, :asset_override, :assets_path, :config,
3
+ attr_accessor :name, :type, :asset_override, :assets_path,
4
4
  :layouts_dir, :stylesheets_dir, :javascripts_dir, :files_dir, :includes_dir, :images_dir,
5
5
  :layouts, :includes, :stylesheets, :javascripts, :images, :sass, :fonts, :files
6
6
 
@@ -20,6 +20,7 @@ module Octopress
20
20
  @stylesheets = []
21
21
  @javascripts = []
22
22
  @images = []
23
+ @root_files = []
23
24
  @sass = []
24
25
  @fonts = []
25
26
  @files = []
@@ -34,7 +35,7 @@ module Octopress
34
35
  end
35
36
 
36
37
  def add_config
37
- @config = Assets::Config.new(self, @config_file)
38
+ @configs = Assets::Config.new(self, @config_file)
38
39
  end
39
40
 
40
41
  def namespace
@@ -82,6 +83,14 @@ module Octopress
82
83
  @images << Assets::Asset.new(self, @images_dir, file)
83
84
  end
84
85
 
86
+ def add_root_files(files)
87
+ files.each { |f| add_root_file(f) }
88
+ end
89
+
90
+ def add_root_file(file)
91
+ @files << Assets::RootAsset.new(self, @files_dir, file)
92
+ end
93
+
85
94
  def add_font(file)
86
95
  @fonts << Assets::Asset.new(self, @fonts_dir, file)
87
96
  end
@@ -147,7 +156,8 @@ module Octopress
147
156
  end
148
157
 
149
158
  def configs(site)
150
- @config.read(site)
159
+ @config ||= @configs.read(site)
160
+ @config
151
161
  end
152
162
  end
153
163
  end
@@ -11,7 +11,7 @@ module Octopress
11
11
  def render(context)
12
12
  content = Helpers::ContentFor.render(context, @block_name)
13
13
  if @block_name == 'head'
14
- content = "<meta name='generator' content='Octopress #{Octopress::Ink::VERSION}'>\n" + content
14
+ content.insert 0, "<meta name='generator' content='Octopress #{Octopress::Ink::VERSION}'>\n"
15
15
  end
16
16
  content
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Ink
3
- VERSION = "1.0.0.alpha.18"
3
+ VERSION = "1.0.0.alpha.19"
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ default favicon
@@ -0,0 +1 @@
1
+ override favicon
@@ -0,0 +1 @@
1
+ I like robots
@@ -1,4 +1,4 @@
1
- <meta name='generator' content='Octopress 1.0.0.alpha.17'>
1
+ <meta name='generator' content='Octopress 1.0.0.alpha.19'>
2
2
  Testing head tag
3
3
  Testing that content_for is additive
4
4
 
@@ -0,0 +1 @@
1
+ default favicon
@@ -0,0 +1 @@
1
+ override favicon
@@ -0,0 +1 @@
1
+ I like robots
@@ -1,4 +1,4 @@
1
- <meta name='generator' content='Octopress 1.0.0.alpha.17'>
1
+ <meta name='generator' content='Octopress 1.0.0.alpha.19'>
2
2
  Testing head tag
3
3
  Testing that content_for is additive
4
4
 
@@ -0,0 +1 @@
1
+ I like robots
@@ -9,6 +9,7 @@ class TestTheme < Octopress::Plugin
9
9
  add_stylesheets ['theme-test.css', 'theme-test2.css']
10
10
  add_stylesheet 'theme-media-test@print.css'
11
11
  add_sass 'main.scss'
12
+ add_root_files ['favicon.ico', 'favicon.png']
12
13
  end
13
14
  end
14
15
 
@@ -21,6 +22,7 @@ class TestPlugin < Octopress::Plugin
21
22
  def add_assets
22
23
  add_stylesheet 'plugin-test.css'
23
24
  add_stylesheet 'plugin-media-test.css', 'print'
25
+ add_root_file 'robots.txt'
24
26
  super
25
27
  end
26
28
  end
@@ -0,0 +1 @@
1
+ default favicon
@@ -0,0 +1 @@
1
+ some favicon
@@ -0,0 +1 @@
1
+ override favicon
data/test/test.rb CHANGED
@@ -1,14 +1,20 @@
1
1
  require 'colorator'
2
2
 
3
- has_failed = false
3
+ @has_failed = false
4
+ @failures = {}
5
+
6
+ def pout(str)
7
+ print str
8
+ $stdout.flush
9
+ end
4
10
 
5
11
  def test(file, dir)
6
12
  if diff = diff_file(file, dir)
7
- puts "Failed #{file}".red
8
- puts diff
9
- has_failed = true
13
+ @failures[file] = diff
14
+ pout "F".red
15
+ @has_failed = true
10
16
  else
11
- puts "Passed #{file}".green
17
+ pout ".".green
12
18
  end
13
19
  end
14
20
 
@@ -63,10 +69,31 @@ def test_stylesheets(dir, concat_css=true)
63
69
  end
64
70
  end
65
71
 
72
+ def test_root_assets(dir)
73
+ root_assets = %w{favicon.ico favicon.png robots.txt}
74
+ root_assets.each { |file| test(file, dir) }
75
+ end
76
+
77
+ def print_failures
78
+ puts "\n"
79
+ if @has_failed
80
+ @failures.each do |name, diff|
81
+ puts "Failure in #{name}:".red
82
+ puts "---------"
83
+ puts diff
84
+ puts "---------"
85
+ end
86
+ abort
87
+ else
88
+ puts "All passed!".green
89
+ end
90
+ end
91
+
66
92
  test_tags('expected')
67
93
  test_layouts('expected')
68
94
  test_stylesheets('concat_css')
69
95
  test_configs('expected')
96
+ test_root_assets('expected')
70
97
 
71
98
  build '_concat_css_false.yml'
72
99
  test_stylesheets('concat_css_false', false)
@@ -77,5 +104,5 @@ test_stylesheets('sass_compact')
77
104
  build '_sass_expanded.yml'
78
105
  test_stylesheets('sass_expanded')
79
106
 
80
- abort if has_failed
107
+ print_failures
81
108
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-ink
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.18
4
+ version: 1.0.0.alpha.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
@@ -101,6 +101,7 @@ files:
101
101
  - lib/octopress-ink/assets/include.rb
102
102
  - lib/octopress-ink/assets/javascript.rb
103
103
  - lib/octopress-ink/assets/layout.rb
104
+ - lib/octopress-ink/assets/root.rb
104
105
  - lib/octopress-ink/assets/sass.rb
105
106
  - lib/octopress-ink/assets/static_file.rb
106
107
  - lib/octopress-ink/assets/static_file_content.rb
@@ -137,11 +138,14 @@ files:
137
138
  - test/concat_css_false/theme/stylesheets/theme-media-test.css
138
139
  - test/concat_css_false/theme/stylesheets/theme-test.css
139
140
  - test/concat_css_false/theme/stylesheets/theme-test2.css
141
+ - test/expected/favicon.ico
142
+ - test/expected/favicon.png
140
143
  - test/expected/index.html
141
144
  - test/expected/layout_tests/local.html
142
145
  - test/expected/layout_tests/plugin_layout.html
143
146
  - test/expected/layout_tests/theme.html
144
147
  - test/expected/layout_tests/theme_override.html
148
+ - test/expected/robots.txt
145
149
  - test/expected/tag_tests/content_for.html
146
150
  - test/expected/tag_tests/footer.html
147
151
  - test/expected/tag_tests/head.html
@@ -156,11 +160,14 @@ files:
156
160
  - test/sass_compact/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
157
161
  - test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css
158
162
  - test/sass_expanded/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
163
+ - test/site/favicon.ico
164
+ - test/site/favicon.png
159
165
  - test/site/index.html
160
166
  - test/site/layout_tests/local.html
161
167
  - test/site/layout_tests/plugin_layout.html
162
168
  - test/site/layout_tests/theme.html
163
169
  - test/site/layout_tests/theme_override.html
170
+ - test/site/robots.txt
164
171
  - test/site/stylesheets/all-5f4148b9fde2541e99deb55ebf3fe695.css
165
172
  - test/site/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
166
173
  - test/site/tag_tests/content_for.html
@@ -185,12 +192,15 @@ files:
185
192
  - test/source/_layouts/head.html
186
193
  - test/source/_layouts/local.html
187
194
  - test/source/_plugins/awesome-sauce/config.yml
195
+ - test/source/_plugins/awesome-sauce/files/robots.txt
188
196
  - test/source/_plugins/awesome-sauce/includes/some-include.html
189
197
  - test/source/_plugins/awesome-sauce/layouts/test-layout.html
190
198
  - test/source/_plugins/awesome-sauce/stylesheets/plugin-media-test.css
191
199
  - test/source/_plugins/awesome-sauce/stylesheets/plugin-test.css
192
200
  - test/source/_plugins/bundler.rb
193
201
  - test/source/_plugins/test-theme/config.yml
202
+ - test/source/_plugins/test-theme/files/favicon.ico
203
+ - test/source/_plugins/test-theme/files/favicon.png
194
204
  - test/source/_plugins/test-theme/files/test.html
195
205
  - test/source/_plugins/test-theme/includes/bar.html
196
206
  - test/source/_plugins/test-theme/includes/greet.html
@@ -203,6 +213,7 @@ files:
203
213
  - test/source/_plugins/test-theme/stylesheets/theme-media-test@print.css
204
214
  - test/source/_plugins/test-theme/stylesheets/theme-test.css
205
215
  - test/source/_plugins/test-theme/stylesheets/theme-test2.css
216
+ - test/source/favicon.png
206
217
  - test/source/index.md
207
218
  - test/source/layout_tests/local.html
208
219
  - test/source/layout_tests/plugin_layout.html
@@ -261,11 +272,14 @@ test_files:
261
272
  - test/concat_css_false/theme/stylesheets/theme-media-test.css
262
273
  - test/concat_css_false/theme/stylesheets/theme-test.css
263
274
  - test/concat_css_false/theme/stylesheets/theme-test2.css
275
+ - test/expected/favicon.ico
276
+ - test/expected/favicon.png
264
277
  - test/expected/index.html
265
278
  - test/expected/layout_tests/local.html
266
279
  - test/expected/layout_tests/plugin_layout.html
267
280
  - test/expected/layout_tests/theme.html
268
281
  - test/expected/layout_tests/theme_override.html
282
+ - test/expected/robots.txt
269
283
  - test/expected/tag_tests/content_for.html
270
284
  - test/expected/tag_tests/footer.html
271
285
  - test/expected/tag_tests/head.html
@@ -280,11 +294,14 @@ test_files:
280
294
  - test/sass_compact/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
281
295
  - test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css
282
296
  - test/sass_expanded/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
297
+ - test/site/favicon.ico
298
+ - test/site/favicon.png
283
299
  - test/site/index.html
284
300
  - test/site/layout_tests/local.html
285
301
  - test/site/layout_tests/plugin_layout.html
286
302
  - test/site/layout_tests/theme.html
287
303
  - test/site/layout_tests/theme_override.html
304
+ - test/site/robots.txt
288
305
  - test/site/stylesheets/all-5f4148b9fde2541e99deb55ebf3fe695.css
289
306
  - test/site/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css
290
307
  - test/site/tag_tests/content_for.html
@@ -309,12 +326,15 @@ test_files:
309
326
  - test/source/_layouts/head.html
310
327
  - test/source/_layouts/local.html
311
328
  - test/source/_plugins/awesome-sauce/config.yml
329
+ - test/source/_plugins/awesome-sauce/files/robots.txt
312
330
  - test/source/_plugins/awesome-sauce/includes/some-include.html
313
331
  - test/source/_plugins/awesome-sauce/layouts/test-layout.html
314
332
  - test/source/_plugins/awesome-sauce/stylesheets/plugin-media-test.css
315
333
  - test/source/_plugins/awesome-sauce/stylesheets/plugin-test.css
316
334
  - test/source/_plugins/bundler.rb
317
335
  - test/source/_plugins/test-theme/config.yml
336
+ - test/source/_plugins/test-theme/files/favicon.ico
337
+ - test/source/_plugins/test-theme/files/favicon.png
318
338
  - test/source/_plugins/test-theme/files/test.html
319
339
  - test/source/_plugins/test-theme/includes/bar.html
320
340
  - test/source/_plugins/test-theme/includes/greet.html
@@ -327,6 +347,7 @@ test_files:
327
347
  - test/source/_plugins/test-theme/stylesheets/theme-media-test@print.css
328
348
  - test/source/_plugins/test-theme/stylesheets/theme-test.css
329
349
  - test/source/_plugins/test-theme/stylesheets/theme-test2.css
350
+ - test/source/favicon.png
330
351
  - test/source/index.md
331
352
  - test/source/layout_tests/local.html
332
353
  - test/source/layout_tests/plugin_layout.html