octopress-ink 1.0.0.alpha.44 → 1.0.0.alpha.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -6
  3. data/assets/docs/_plugin-template.markdown +9 -21
  4. data/assets/docs/creating-a-plugin.markdown +90 -12
  5. data/lib/octopress-ink/assets/asset.rb +55 -26
  6. data/lib/octopress-ink/assets/coffeescript.rb +22 -0
  7. data/lib/octopress-ink/assets/config.rb +12 -8
  8. data/lib/octopress-ink/assets/doc_page.rb +21 -18
  9. data/lib/octopress-ink/assets/file.rb +9 -7
  10. data/lib/octopress-ink/assets/javascript.rb +7 -0
  11. data/lib/octopress-ink/assets/layout.rb +3 -1
  12. data/lib/octopress-ink/assets/page.rb +12 -10
  13. data/lib/octopress-ink/assets/sass.rb +24 -17
  14. data/lib/octopress-ink/assets/stylesheet.rb +12 -6
  15. data/lib/octopress-ink/assets.rb +1 -4
  16. data/lib/octopress-ink/commands/helpers.rb +7 -4
  17. data/lib/octopress-ink/commands/init.rb +48 -0
  18. data/lib/octopress-ink/commands/list.rb +1 -1
  19. data/lib/octopress-ink/commands/new.rb +126 -49
  20. data/lib/octopress-ink/commands.rb +2 -0
  21. data/lib/octopress-ink/configuration.rb +18 -10
  22. data/lib/octopress-ink/filters.rb +4 -4
  23. data/lib/octopress-ink/generators/plugin_assets.rb +3 -2
  24. data/lib/octopress-ink/helpers/path.rb +4 -4
  25. data/lib/octopress-ink/jekyll/hooks.rb +123 -7
  26. data/lib/octopress-ink/jekyll/page.rb +3 -1
  27. data/lib/octopress-ink/plugin.rb +198 -165
  28. data/lib/octopress-ink/plugin_asset_pipeline.rb +172 -0
  29. data/lib/octopress-ink/plugins.rb +44 -168
  30. data/lib/octopress-ink/tags/javascript.rb +1 -1
  31. data/lib/octopress-ink/tags/render.rb +4 -2
  32. data/lib/octopress-ink/tags/stylesheet.rb +1 -1
  33. data/lib/octopress-ink/utils.rb +42 -0
  34. data/lib/octopress-ink/version.rb +1 -1
  35. data/lib/octopress-ink.rb +70 -34
  36. data/octopress-ink.gemspec +2 -2
  37. data/test/_combine_false.yml +4 -0
  38. data/test/_config.yml +1 -1
  39. data/test/combine_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +15 -0
  40. data/test/{sass_expanded → combine_css}/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +2 -4
  41. data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-media-test.css +0 -0
  42. data/test/{concat_css_false → combine_css_false}/stylesheets/awesome-sauce/plugin-test.css +0 -0
  43. data/test/{concat_css_false → combine_css_false}/stylesheets/site.css +0 -0
  44. data/test/{concat_css_false → combine_css_false}/stylesheets/test.css +0 -0
  45. data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-media-test.css +0 -0
  46. data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test.css +0 -0
  47. data/test/{concat_css_false → combine_css_false}/stylesheets/theme/theme-test2.css +0 -0
  48. data/test/combine_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +7 -0
  49. data/test/{concat_js_false → combine_js_false}/javascripts/site.js +0 -0
  50. data/test/combine_js_false/javascripts/test.js +10 -0
  51. data/test/{concat_js_false → combine_js_false}/javascripts/theme/bar.js +0 -0
  52. data/test/{concat_js_false → combine_js_false}/javascripts/theme/foo.js +0 -0
  53. data/test/copy_layouts_pages/_copy/pages/two.md +0 -1
  54. data/test/copy_test/_copy/pages/two.md +0 -1
  55. data/test/copy_test/_copy/stylesheets/main.scss +4 -1
  56. data/test/expected/index.html +2 -2
  57. data/test/plugins/awesome-sauce/pages/b.html +0 -1
  58. data/test/plugins/awesome-sauce/plugin.rb +1 -1
  59. data/test/plugins/test-theme/javascripts/blah.coffee +1 -0
  60. data/test/plugins/test-theme/plugin.rb +1 -1
  61. data/test/plugins/test-theme/stylesheets/main.scss +4 -1
  62. data/test/source/_plugins/awesome-sauce/config.yml +1 -1
  63. data/test/source/_plugins/theme/config.yml +1 -1
  64. data/test/source/_posts/2014-02-01-test-post.md +1 -0
  65. data/test/source/index.md +2 -2
  66. data/test/test.rb +15 -27
  67. metadata +66 -84
  68. data/lib/octopress-ink/assets/local_asset.rb +0 -47
  69. data/lib/octopress-ink/assets/local_javascript.rb +0 -12
  70. data/lib/octopress-ink/assets/local_sass.rb +0 -30
  71. data/lib/octopress-ink/assets/local_stylesheet.rb +0 -33
  72. data/lib/octopress-ink/helpers/titlecase.rb +0 -37
  73. data/lib/octopress-ink/plugins/asset_pipeline.rb +0 -103
  74. data/test/_concat_false.yml +0 -2
  75. data/test/_sass_compact.yml +0 -4
  76. data/test/_sass_expanded.yml +0 -4
  77. data/test/concat_css/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -1
  78. data/test/concat_css/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -1
  79. data/test/concat_js/javascripts/all-d41d8cd98f00b204e9800998ecf8427e.js +0 -3
  80. data/test/sass_compact/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -18
  81. data/test/sass_compact/stylesheets/print-0dc274efb4e3fba0ae71bd22eef6fb38.css +0 -5
  82. data/test/sass_expanded/stylesheets/all-e10f647557c9d610df6df40a458bc823.css +0 -36
  83. data/test/source/_javascripts/site.js +0 -1
  84. data/test/source/_stylesheets/_foo.scss +0 -1
  85. data/test/source/_stylesheets/site.sass +0 -7
  86. data/test/source/_stylesheets/test.css +0 -1
@@ -1,37 +0,0 @@
1
- class String
2
- def titlecase
3
- small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)
4
-
5
- x = split(" ").map do |word|
6
- # note: word could contain non-word characters!
7
- # downcase all small_words, capitalize the rest
8
- small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : word.smart_capitalize!
9
- word
10
- end
11
- # capitalize first and last words
12
- x.first.to_s.smart_capitalize!
13
- x.last.to_s.smart_capitalize!
14
- # small words are capitalized after colon, period, exclamation mark, question mark
15
- x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
16
- end
17
-
18
- def titlecase!
19
- replace(titlecase)
20
- end
21
-
22
- def smart_capitalize
23
- target = dup
24
- # ignore any leading crazy characters and capitalize the first real character
25
- if target =~ /^['"\(\[']*([a-z])/
26
- i = index($1)
27
- x = target[i,target.length]
28
- # word with capitals and periods mid-word are left alone
29
- target[i,1] = target[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
30
- end
31
- target
32
- end
33
-
34
- def smart_capitalize!
35
- replace(smart_capitalize)
36
- end
37
- end
@@ -1,103 +0,0 @@
1
- # The CSS assets for this plugin are populated at runtime by the add_static_files method of
2
- # the Plugins module.
3
- #
4
- module Octopress
5
- module Ink
6
- class AssetPipelinePlugin < Plugin
7
- def configuration
8
- {
9
- name: "Octopress Asset Pipeline",
10
- description: "Add your CSS and JS to the asset pipeline.",
11
- local: true
12
- }
13
- end
14
-
15
- def config
16
- @config ||= Ink.config
17
- end
18
-
19
- def register_assets
20
-
21
- local_stylesheets.each {|f| add_stylesheet(f) }
22
- local_javascripts.each {|f| add_javascript(f) }
23
-
24
- remove_jekyll_assets @sass if @sass
25
-
26
- if config['concat_js']
27
- remove_jekyll_assets @javascripts if @javascripts
28
- end
29
-
30
- if config['concat_css']
31
- remove_jekyll_assets @css if @css
32
- end
33
- end
34
-
35
- def disabled?(dir, file)
36
- case dir
37
- when stylesheets_dir
38
- config['disable'].include?('site_stylesheets')
39
- when javascripts_dir
40
- config['disable'].include?('site_javascripts')
41
- end
42
- end
43
-
44
- def add_javascript(file)
45
- @javascripts << Assets::LocalJavascript.new(self, javascripts_dir, file)
46
- end
47
-
48
- def add_stylesheet(file)
49
- # accept ['file', 'media_type']
50
- #
51
- if file.is_a? Array
52
- if file.first =~ /\.css/
53
- @css << Assets::LocalStylesheet.new(self, stylesheets_dir, file.first, file.last)
54
- else
55
- @sass << Assets::LocalSass.new(self, stylesheets_dir, file.first, file.last)
56
- end
57
-
58
- # accept 'file'
59
- #
60
- else
61
- if file =~ /\.css/
62
- @css << Assets::LocalStylesheet.new(self, stylesheets_dir, file)
63
- else
64
- @sass << Assets::LocalSass.new(self, stylesheets_dir, file)
65
- end
66
- end
67
- end
68
-
69
- def javascripts_dir
70
- config['javascripts_dir']
71
- end
72
-
73
- def stylesheets_dir
74
- config['stylesheets_dir']
75
- end
76
-
77
- def local_stylesheets
78
- local_files('stylesheets', stylesheets_dir).reject do |f|
79
- File.basename(f) =~ /^_.*?s[ac]ss/
80
- end
81
- end
82
-
83
- def local_javascripts
84
- local_files('javascripts', javascripts_dir)
85
- end
86
-
87
- def local_files(type, dir)
88
- source = Plugins.site.source
89
-
90
- # If they manually specify files
91
- #
92
- if config[type].is_a?(Array) && !config[type].empty?
93
- config[type]
94
- else
95
- dir = File.join(source, dir)
96
- files = glob_assets(dir)
97
- files.map { |f| f.split(dir).last }
98
- end
99
- end
100
- end
101
- end
102
- end
103
-
@@ -1,2 +0,0 @@
1
- concat_css: false
2
- concat_js: false
@@ -1,4 +0,0 @@
1
- # Sass configurations
2
- sass:
3
- style: compact
4
-
@@ -1,4 +0,0 @@
1
- # Sass configurations
2
- sass:
3
- style: expanded
4
-
@@ -1 +0,0 @@
1
- body{margin:2px;padding:2px}.main{color:#444}body{background:#000}.plugin-widget{background:red;color:#fff}.css-plugin{background:#fed}body{display:table}body{background:#aaa111}div{display:table}
@@ -1 +0,0 @@
1
- *{background:none;color:#000}article a:after{content:attr(href)}
@@ -1,3 +0,0 @@
1
- console.log('bar')
2
- console.log('omg')
3
- console.log('local js')
@@ -1,18 +0,0 @@
1
- /* Theme: Classic Theme */
2
- body { margin: 2px; padding: 2px; }
3
-
4
- .main { color: #444; }
5
-
6
- body { background: black; }
7
-
8
- /* Plugin: awesome-sauce */
9
- .plugin-widget { background: red; color: #fff; }
10
-
11
- /* Plugin: Octopress Asset Pipeline */
12
- .css-plugin { background: #fed; }
13
-
14
- body { display: table; }
15
-
16
- body { background: #aaa111; }
17
-
18
- div { display: table; }
@@ -1,5 +0,0 @@
1
- /* Theme: Classic Theme */
2
- * { background: none; color: #000; }
3
-
4
- /* Plugin: Awesome Sauce */
5
- article a:after { content: attr(href); }
@@ -1,36 +0,0 @@
1
- /* Theme: Classic Theme */
2
- body {
3
- margin: 2px;
4
- padding: 2px;
5
- }
6
-
7
- .main {
8
- color: #444;
9
- }
10
-
11
- body {
12
- background: black;
13
- }
14
-
15
- /* Plugin: awesome-sauce */
16
- .plugin-widget {
17
- background: red;
18
- color: #fff;
19
- }
20
-
21
- /* Plugin: Octopress Asset Pipeline */
22
- .css-plugin {
23
- background: #fed;
24
- }
25
-
26
- body {
27
- display: table;
28
- }
29
-
30
- body {
31
- background: #aaa111;
32
- }
33
-
34
- div {
35
- display: table;
36
- }
@@ -1 +0,0 @@
1
- console.log('local js')
@@ -1 +0,0 @@
1
- body { display: table; }
@@ -1,7 +0,0 @@
1
- @import 'foo'
2
-
3
- $bg: #aaa111
4
- body
5
- background: $bg
6
- div
7
- display: table
@@ -1 +0,0 @@
1
- .css-plugin { background: #fed; }