nanoc_starter_set 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nanoc_starter_set.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tyson Tate
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # NanocStarterSet
2
+
3
+ NanocStarterSet is a gem that makes it easy to start a Nanoc site with sensible
4
+ defaults and some handy batteries included. It uses:
5
+
6
+ * [kramdown](http://kramdown.rubyforge.org) for Markdown parsing with fenced
7
+ code blocks.
8
+ * [compass](http://compass-style.org) for SCSS and a large library of helpful
9
+ mixins / helpers.
10
+ * [rainpress](http://code.google.com/p/rainpress/) for compressing CSS.
11
+ * [uglifier](https://github.com/lautis/uglifier) for compressing JavaScript.
12
+ * [typogruby](http://avdgaag.github.com/typogruby/) for nice typography.
13
+
14
+ I recommend using
15
+ [prettify](http://code.google.com/p/google-code-prettify/) if you want to
16
+ syntax-highlight Markdown's fenced code blocks.
17
+
18
+ The included helpers and nanoc rules give you things like:
19
+
20
+ * A `/css/all.css` file that contains a joined and compressed copy of all your
21
+ CSS files.
22
+ * A `/js/all.js` file that contains a joined and compressed copy of all your
23
+ JavaScript files.
24
+ * ERB processing of your source files, if you suffix it with ".erb"
25
+
26
+ ## Installation
27
+
28
+ ```console
29
+ % gem install nanoc_starter_set
30
+ % nanoc create-site my_site
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ In your site's root, create a Gemfile:
36
+
37
+ ```ruby
38
+ source "https://rubygems.org"
39
+ gem 'nanoc_starter_set'
40
+ ```
41
+
42
+ Install the gems:
43
+
44
+ ```console
45
+ $ bundle install
46
+ ```
47
+
48
+ Add the following to lib/default.rb:
49
+
50
+ ```ruby
51
+ require 'nanoc_starter_set/setup'
52
+ ```
53
+
54
+ And in your Rules file, at the top:
55
+
56
+ ```ruby
57
+ eval NanocStarterSet.asset_rules
58
+ ```
59
+
60
+ Eval is necessary here because nanoc does some instance_eval hackery here that
61
+ breaks our ability to just 'load' or 'include' or 'require' the code.
62
+
63
+ ## Recommended layout
64
+
65
+ ```html
66
+ <!DOCTYPE html>
67
+ <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
68
+ <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
69
+ <html>
70
+ <head>
71
+ <meta charset="utf-8">
72
+ <meta name="viewport" content="width=device-width" />
73
+ <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
74
+
75
+ <title><%= @item[:title] %></title>
76
+
77
+ <link rel="stylesheet" href="/css/all.css">
78
+ </head>
79
+ <body class="<%= body_class %>">
80
+ <div id="main">
81
+ <%= yield %>
82
+ </div>
83
+ <script src="/js/all.js"></script>
84
+ <script>
85
+ /* Highlight all <pre> tags with a <code> child */
86
+ var preTags = document.getElementsByTagName( "pre" );
87
+ for (var i = 0; i < preTags.length; i += 1) {
88
+ var preTag = preTags[i];
89
+ var codeTag = preTag.children[0];
90
+ if ( codeTag && codeTag.tagName == "CODE" ) {
91
+ preTag.className += " prettyprint";
92
+ }
93
+ }
94
+ prettyPrint();
95
+ </script>
96
+ </body>
97
+ </html>
98
+ ```
99
+
100
+ ## Markdown
101
+
102
+ Kramdown does fenced code blocks like this:
103
+
104
+ ```md
105
+ ~~~ css
106
+ .my-example {
107
+ color: red;
108
+ }
109
+ ~~~
110
+ ```
111
+
112
+ ## CSS
113
+
114
+ Create an 'all' CSS file:
115
+
116
+ ```console
117
+ $ mkdir -p content/css
118
+ $ touch content/css/all.scss.erb
119
+ ```
120
+
121
+ With these contents:
122
+
123
+ ```erb
124
+ ---
125
+ all: true
126
+ ---
127
+
128
+ <% asset_items( :css ).each do |item| %>
129
+ <%= item.compiled_content %>
130
+ <% end %>
131
+ ```
132
+
133
+ You can change the order of files by prefixing a number to their name:
134
+ "01_reset.css", etc.
135
+
136
+ ## JS
137
+
138
+ Create an 'all' JS file:
139
+
140
+ ```console
141
+ $ mkdir -p content/js
142
+ $ touch content/js/all.js.erb
143
+ ```
144
+
145
+ With these contents:
146
+
147
+ ```erb
148
+ ---
149
+ all: true
150
+ ---
151
+
152
+ <% asset_items( :js ).each do |item| %>
153
+ <%= item.compiled_content %>
154
+ <% end %>
155
+ ```
156
+
157
+ You can change the order of files by prefixing a number to their name:
158
+ "01_jquery.js", etc.
159
+
160
+ Read the source of the gem to see what other functions it gives you.
161
+ Setup and integration and documentation could be much easier, of course.
162
+ It's just a hack to make my life easier.
163
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ require "nanoc_starter_set/version"
2
+
3
+ module NanocStarterSet
4
+ # In your Rules file:
5
+ #
6
+ # eval NanocStarterSet.asset_rules
7
+ #
8
+ # I know, amazing, right?
9
+ def self.asset_rules
10
+ path = File.expand_path(File.join(__FILE__, "..", "nanoc_starter_set", "rules.rb" ) )
11
+ File.read path
12
+ end
13
+ end
14
+
@@ -0,0 +1,10 @@
1
+ http_path = "/"
2
+ project_path = "."
3
+ css_dir = "output/css"
4
+ sass_dir = "content/css"
5
+ images_dir = "output/images"
6
+
7
+ sass_options = {
8
+ :syntax => :scss
9
+ }
10
+
@@ -0,0 +1,54 @@
1
+ # Setup compass
2
+
3
+ require 'compass'
4
+ Compass.add_project_configuration File.expand_path(File.join(__FILE__, "..", "compass_config.rb"))
5
+
6
+ # Setup nanoc
7
+
8
+ include Nanoc3::Helpers::Rendering
9
+ include Nanoc3::Helpers::Blogging
10
+ include Nanoc3::Helpers::Tagging
11
+ include Nanoc3::Helpers::Rendering
12
+ include Nanoc3::Helpers::LinkTo
13
+
14
+ # Asset Helpers
15
+
16
+ # Process an asset file, sprockets-style
17
+ def run_filters( item )
18
+ item[:filename].scan( /\.\w+/ ).reverse.each do |suffix|
19
+ case suffix
20
+ when ".erb" ; filter :erb
21
+ when ".scss" ; filter :sass, Compass.sass_engine_options
22
+ when ".md" ; filter :kramdown, {
23
+ enable_coderay: false,
24
+ remove_block_html_tags: false,
25
+ }
26
+ when ".html" ; filter :typogruby
27
+ end
28
+ end
29
+ end
30
+
31
+ def asset_items( folder )
32
+ items.select do |item|
33
+ item.identifier =~ %r{^/#{folder}/}
34
+ end.reject do |item|
35
+ item.attributes[:all]
36
+ end.map do |item|
37
+ item
38
+ end.sort_by( &:identifier )
39
+ end
40
+
41
+ # Other helpers
42
+
43
+ def body_class
44
+ @item[:layout] || @item[:kind]
45
+ end
46
+
47
+ def pretty_date( date )
48
+ attribute_to_time( date ).strftime( "%b %-d, %Y" )
49
+ end
50
+
51
+ def partial( name, vars = {} )
52
+ render "partials/#{name}", vars
53
+ end
54
+
@@ -0,0 +1,36 @@
1
+ #
2
+ # CSS
3
+ #
4
+
5
+ compile '/css/*/' do
6
+ run_filters item
7
+ filter :rainpress if item[:all]
8
+ end
9
+
10
+ # Only make a single /css/all.css file
11
+ route '/css/*/' do
12
+ if item[:all]
13
+ item.identifier.chop+".css"
14
+ else
15
+ nil
16
+ end
17
+ end
18
+
19
+ #
20
+ # JS
21
+ #
22
+
23
+ compile '/js/*/' do
24
+ run_filters item
25
+ filter :uglify_js, { comments: false } if item[:all]
26
+ end
27
+
28
+ # Only make a single /js/all.css file
29
+ route '/js/*/' do
30
+ if item[:all]
31
+ item.identifier.chop+".js"
32
+ else
33
+ nil
34
+ end
35
+ end
36
+
@@ -0,0 +1,3 @@
1
+ require 'nanoc_starter_set'
2
+ require 'nanoc_starter_set/helpers'
3
+
@@ -0,0 +1,3 @@
1
+ module NanocStarterSet
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nanoc_starter_set/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nanoc_starter_set"
8
+ spec.version = NanocStarterSet::VERSION
9
+ spec.authors = ["Tyson Tate"]
10
+ spec.email = ["tyson@tysontate.com"]
11
+ spec.description = %q{Sensible defaults for a Nanoc site.}
12
+ spec.summary = %q{NanocStarterSet includes all the batteries you need to a sensible Markdown / SCSS based site with nice typography and compressed CSS / JS.}
13
+ spec.homepage = "https://github.com/tysontate/nanoc_starter_set"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "bundler", "~> 1.3"
22
+ # The site engine
23
+ spec.add_dependency "nanoc", "~> 3.6.1"
24
+ # Compress CSS
25
+ spec.add_dependency "rainpress", "~> 1.0"
26
+ # Use Compass + SCSS for CSS
27
+ spec.add_dependency "compass", "~> 0.12.2"
28
+ # Compress JS
29
+ spec.add_dependency "uglifier", "~> 1.3.0"
30
+ # Markdown
31
+ spec.add_dependency "kramdown", "~> 1.0.1"
32
+ # Nicer typography
33
+ spec.add_dependency "typogruby", "~> 1.0.15"
34
+ # Watch for changes with 'nanoc autocompile'
35
+ spec.add_dependency "mime-types", "~> 1.21"
36
+ spec.add_dependency "rack", "~> 1.5.2"
37
+ # Rake tasks
38
+ spec.add_dependency "rake", "~> 10.0.3"
39
+ spec.add_dependency "stringex", "~> 1.5.1"
40
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nanoc_starter_set
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tyson Tate
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: nanoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 3.6.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.6.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: rainpress
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: compass
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.12.2
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.12.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: uglifier
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.3.0
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.3.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: kramdown
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.0.1
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.1
110
+ - !ruby/object:Gem::Dependency
111
+ name: typogruby
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.15
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.0.15
126
+ - !ruby/object:Gem::Dependency
127
+ name: mime-types
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: '1.21'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.21'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rack
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 1.5.2
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.5.2
158
+ - !ruby/object:Gem::Dependency
159
+ name: rake
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 10.0.3
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 10.0.3
174
+ - !ruby/object:Gem::Dependency
175
+ name: stringex
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ~>
180
+ - !ruby/object:Gem::Version
181
+ version: 1.5.1
182
+ type: :runtime
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: 1.5.1
190
+ description: Sensible defaults for a Nanoc site.
191
+ email:
192
+ - tyson@tysontate.com
193
+ executables: []
194
+ extensions: []
195
+ extra_rdoc_files: []
196
+ files:
197
+ - .gitignore
198
+ - Gemfile
199
+ - LICENSE.txt
200
+ - README.md
201
+ - Rakefile
202
+ - lib/nanoc_starter_set.rb
203
+ - lib/nanoc_starter_set/compass_config.rb
204
+ - lib/nanoc_starter_set/helpers.rb
205
+ - lib/nanoc_starter_set/rules.rb
206
+ - lib/nanoc_starter_set/setup.rb
207
+ - lib/nanoc_starter_set/version.rb
208
+ - nanoc_starter_set.gemspec
209
+ homepage: https://github.com/tysontate/nanoc_starter_set
210
+ licenses:
211
+ - MIT
212
+ post_install_message:
213
+ rdoc_options: []
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
223
+ none: false
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project:
230
+ rubygems_version: 1.8.23
231
+ signing_key:
232
+ specification_version: 3
233
+ summary: NanocStarterSet includes all the batteries you need to a sensible Markdown
234
+ / SCSS based site with nice typography and compressed CSS / JS.
235
+ test_files: []
236
+ has_rdoc: