hightouch 0.1.0 → 0.1.2
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.
- data/Gemfile +2 -0
- data/Gemfile.lock +19 -3
- data/README.md +13 -1
- data/config.rb +1 -2
- data/lib/hightouch/archive.rb +9 -5
- data/lib/hightouch/archive_page_generator.rb +9 -4
- data/lib/hightouch/blog.rb +29 -9
- data/lib/hightouch/blog_posting.rb +12 -7
- data/lib/hightouch/version.rb +1 -1
- data/lib/hightouch.rb +0 -22
- data/source/partials/_sidebar.html.haml +5 -5
- metadata +23 -14
- data/source/templates/category.html.haml +0 -5
- data/source/templates/tag.html.haml +0 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/middleman/middleman.git
|
3
|
-
revision:
|
3
|
+
revision: f76883b53aec64cf583979d170f392c73d618765
|
4
4
|
specs:
|
5
5
|
middleman (3.0.0.beta.2)
|
6
6
|
middleman-core (= 3.0.0.beta.2)
|
@@ -16,7 +16,7 @@ GIT
|
|
16
16
|
tilt (~> 1.3.1)
|
17
17
|
middleman-more (3.0.0.beta.2)
|
18
18
|
coffee-script (~> 2.2.0)
|
19
|
-
compass (~> 0.12.
|
19
|
+
compass (~> 0.12.1)
|
20
20
|
execjs (~> 1.2)
|
21
21
|
haml (~> 3.1.0)
|
22
22
|
middleman-core (= 3.0.0.beta.2)
|
@@ -32,13 +32,14 @@ GEM
|
|
32
32
|
activesupport (3.2.2)
|
33
33
|
i18n (~> 0.6)
|
34
34
|
multi_json (~> 1.0)
|
35
|
+
addressable (2.2.7)
|
35
36
|
chunky_png (1.2.5)
|
36
37
|
coderay (1.0.5)
|
37
38
|
coffee-script (2.2.0)
|
38
39
|
coffee-script-source
|
39
40
|
execjs
|
40
41
|
coffee-script-source (1.2.0)
|
41
|
-
compass (0.12.
|
42
|
+
compass (0.12.1)
|
42
43
|
chunky_png (~> 1.2)
|
43
44
|
fssm (>= 0.2.7)
|
44
45
|
sass (~> 3.1)
|
@@ -49,9 +50,16 @@ GEM
|
|
49
50
|
multi_json (~> 1.0)
|
50
51
|
factory_girl (2.6.3)
|
51
52
|
activesupport (>= 2.3.9)
|
53
|
+
faraday (0.7.6)
|
54
|
+
addressable (~> 2.2)
|
55
|
+
multipart-post (~> 1.1)
|
56
|
+
rack (~> 1.1)
|
57
|
+
faraday_middleware (0.8.5)
|
58
|
+
faraday (>= 0.7.4, < 0.9)
|
52
59
|
ffi (1.0.11)
|
53
60
|
fssm (0.2.8.1)
|
54
61
|
haml (3.1.4)
|
62
|
+
hashie (1.2.0)
|
55
63
|
hike (1.2.1)
|
56
64
|
i18n (0.6.0)
|
57
65
|
listen (0.3.3)
|
@@ -60,7 +68,14 @@ GEM
|
|
60
68
|
rb-inotify (~> 0.8.8)
|
61
69
|
method_source (0.7.1)
|
62
70
|
multi_json (1.1.0)
|
71
|
+
multipart-post (1.1.5)
|
63
72
|
nokogiri (1.5.2)
|
73
|
+
octokit (1.0.0)
|
74
|
+
addressable (~> 2.2)
|
75
|
+
faraday (~> 0.7)
|
76
|
+
faraday_middleware (~> 0.8)
|
77
|
+
hashie (~> 1.2)
|
78
|
+
multi_json (~> 1.0)
|
64
79
|
pry (0.9.8.4)
|
65
80
|
coderay (~> 1.0.5)
|
66
81
|
method_source (~> 0.7.1)
|
@@ -113,6 +128,7 @@ PLATFORMS
|
|
113
128
|
DEPENDENCIES
|
114
129
|
factory_girl
|
115
130
|
middleman!
|
131
|
+
octokit
|
116
132
|
pry
|
117
133
|
rack-codehighlighter
|
118
134
|
redcarpet
|
data/README.md
CHANGED
@@ -5,6 +5,18 @@ hightouch (HT) is a static website generator based on
|
|
5
5
|
inspired by
|
6
6
|
[middleman-blog](https://github.com/middleman/middleman-blog).
|
7
7
|
|
8
|
-
|
8
|
+
# Install
|
9
9
|
|
10
|
+
```ruby
|
11
|
+
gem install hightouch
|
12
|
+
```
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
hightouch new app_name # Or ht new app_name
|
18
|
+
cd app_name
|
19
|
+
bundle install
|
20
|
+
middleman
|
21
|
+
```
|
10
22
|
|
data/config.rb
CHANGED
data/lib/hightouch/archive.rb
CHANGED
@@ -4,23 +4,27 @@ module Hightouch
|
|
4
4
|
|
5
5
|
attribute :name, String
|
6
6
|
attribute :blog, Blog
|
7
|
-
attribute :
|
7
|
+
attribute :blog_posting_cache, Hash, default: {}
|
8
|
+
|
9
|
+
def blog_postings
|
10
|
+
Hash[blog_posting_cache.sort_by { |k, v| v.date_created }.reverse]
|
11
|
+
end
|
8
12
|
|
9
13
|
def add_blog_posting(blog_posting)
|
10
|
-
|
14
|
+
blog_posting_cache[blog_posting.name] = blog_posting
|
11
15
|
end
|
12
16
|
|
13
17
|
def remove_blog_posting(blog_posting)
|
14
|
-
|
18
|
+
blog_posting_cache.delete(blog_posting.name)
|
15
19
|
blog.remove_archive(self) if empty?
|
16
20
|
end
|
17
21
|
|
18
22
|
def empty?
|
19
|
-
|
23
|
+
blog_posting_cache.empty?
|
20
24
|
end
|
21
25
|
|
22
26
|
def count
|
23
|
-
|
27
|
+
blog_posting_cache.size
|
24
28
|
end
|
25
29
|
|
26
30
|
def path
|
@@ -1,9 +1,14 @@
|
|
1
1
|
module Hightouch
|
2
2
|
module ArchivePageGenerator
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
def generate_archive_pages
|
4
|
+
[:categories, :tags, :archives].each do |i|
|
5
|
+
blog.send(i).each do |k, v|
|
6
|
+
template_name = v.class.name.split(/::/).last.downcase
|
7
|
+
page v.path, proxy: "/templates/archive.html", ignore: true do
|
8
|
+
@collection = i
|
9
|
+
@archive_name = v.name
|
10
|
+
end
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
data/lib/hightouch/blog.rb
CHANGED
@@ -2,10 +2,10 @@ module Hightouch
|
|
2
2
|
class Blog
|
3
3
|
include Virtus
|
4
4
|
|
5
|
-
attribute :
|
6
|
-
attribute :
|
7
|
-
attribute :
|
8
|
-
attribute :
|
5
|
+
attribute :archive_cache, Hash, default: {}
|
6
|
+
attribute :category_cache, Hash, default: {}
|
7
|
+
attribute :tag_cache, Hash, default: {}
|
8
|
+
attribute :blog_posting_cache, Hash, default: {}
|
9
9
|
|
10
10
|
attr_reader :app
|
11
11
|
|
@@ -13,28 +13,48 @@ module Hightouch
|
|
13
13
|
@app = app
|
14
14
|
end
|
15
15
|
|
16
|
+
def archives
|
17
|
+
Hash[archive_cache.sort_by { |k, v| v.name }.reverse]
|
18
|
+
end
|
19
|
+
|
20
|
+
def categories
|
21
|
+
Hash[category_cache.sort_by { |k, v| v.name }]
|
22
|
+
end
|
23
|
+
|
24
|
+
def tags
|
25
|
+
Hash[tag_cache.sort_by { |k, v| v.name }]
|
26
|
+
end
|
27
|
+
|
28
|
+
def blog_postings
|
29
|
+
Hash[blog_posting_cache.sort_by { |k, v| v.date_created }.reverse]
|
30
|
+
end
|
31
|
+
|
16
32
|
def create_archive(type, attrs)
|
17
|
-
send(type.name.split(/::/).last.downcase.
|
33
|
+
send("#{type.name.split(/::/).last.downcase}_cache".to_sym)[attrs[:name]] = type.new(attrs)
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_archive(type, key)
|
37
|
+
send("#{type.name.split(/::/).last.downcase}_cache".to_sym)[key]
|
18
38
|
end
|
19
39
|
|
20
40
|
def remove_archive(archive)
|
21
41
|
key = archive.name
|
22
|
-
send(archive.class.name.split(/::/).last.downcase.
|
42
|
+
send("#{archive.class.name.split(/::/).last.downcase}_cache".to_sym).delete(key)
|
23
43
|
end
|
24
44
|
|
25
45
|
def touch_blog_posting(page)
|
26
46
|
key = page.data.title
|
27
|
-
blog_posting =
|
47
|
+
blog_posting = blog_posting_cache[key]
|
28
48
|
|
29
49
|
if blog_posting
|
30
50
|
blog_posting.update
|
31
51
|
else
|
32
|
-
|
52
|
+
blog_posting_cache[key] = BlogPosting.new(page, self)
|
33
53
|
end
|
34
54
|
end
|
35
55
|
|
36
56
|
def blog_posting(path)
|
37
|
-
|
57
|
+
blog_posting_cache.values.select { |v| v.url == path }.first
|
38
58
|
end
|
39
59
|
end
|
40
60
|
end
|
@@ -40,14 +40,19 @@ module Hightouch
|
|
40
40
|
update_archive(@date_created)
|
41
41
|
|
42
42
|
@description = nil
|
43
|
-
@
|
43
|
+
@body = nil
|
44
44
|
end
|
45
45
|
|
46
46
|
def article_body
|
47
|
-
@
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
@body ||= begin
|
48
|
+
body = page.render(layout: false)
|
49
|
+
|
50
|
+
if body =~ DESC_SEPARATOR
|
51
|
+
body.sub!(DESC_SEPARATOR, '')
|
52
|
+
else
|
53
|
+
body
|
54
|
+
end
|
55
|
+
end
|
51
56
|
end
|
52
57
|
|
53
58
|
def description
|
@@ -77,7 +82,7 @@ module Hightouch
|
|
77
82
|
a = association[u]
|
78
83
|
next if a
|
79
84
|
|
80
|
-
a = blog.
|
85
|
+
a = blog.find_archive(type, u) || blog.send(:create_archive, type, name: u, blog: blog)
|
81
86
|
|
82
87
|
a.add_blog_posting(self)
|
83
88
|
association[u] = a
|
@@ -88,7 +93,7 @@ module Hightouch
|
|
88
93
|
name = date_created.strftime('%Y/%m')
|
89
94
|
return if archive && archive.name == name
|
90
95
|
|
91
|
-
archive = blog.
|
96
|
+
archive = blog.find_archive(Archive, name) || blog.create_archive(Archive, name: name, blog: blog)
|
92
97
|
archive.add_blog_posting(self)
|
93
98
|
end
|
94
99
|
end
|
data/lib/hightouch/version.rb
CHANGED
data/lib/hightouch.rb
CHANGED
@@ -37,12 +37,6 @@ module Hightouch
|
|
37
37
|
@blog ||= Blog.new(self)
|
38
38
|
end
|
39
39
|
|
40
|
-
def generate_archive_pages
|
41
|
-
[:categories, :tags, :archives].each do |i|
|
42
|
-
blog.send(i).each { |k, v| generate_archive_page(v) }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
40
|
def font_size_for_tag(tag, opts = {})
|
47
41
|
max_font_size = opts[:max_font_size] || 36
|
48
42
|
min_font_size = opts[:min_font_size] || 11
|
@@ -60,20 +54,6 @@ module Hightouch
|
|
60
54
|
end
|
61
55
|
|
62
56
|
private
|
63
|
-
def generate_category_page(category)
|
64
|
-
name = category.is_a?(String) ? category : category.name
|
65
|
-
page "/blog/#{name}.html", proxy: "/templates/category.html", ignore: true do
|
66
|
-
@category_name = name
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def generate_tag_page(tag)
|
71
|
-
name = tag.is_a?(String) ? tag : tag.name
|
72
|
-
page "/blog/tags/#{name}.html", proxy: "/templates/tag.html", ignore: true do
|
73
|
-
@tag_name = name
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
57
|
def max_tag
|
78
58
|
blog.tags.values.max { |x, y| x.count <=> y.count }
|
79
59
|
end
|
@@ -81,8 +61,6 @@ module Hightouch
|
|
81
61
|
def min_tag
|
82
62
|
blog.tags.values.min { |x, y| x.count <=> y.count }
|
83
63
|
end
|
84
|
-
|
85
|
-
|
86
64
|
end
|
87
65
|
end
|
88
66
|
|
@@ -5,13 +5,13 @@
|
|
5
5
|
%ul
|
6
6
|
- blog.categories.each do |k, v|
|
7
7
|
%li=link_to "#{titleize(humanize(k))} (#{v.count})", v.path
|
8
|
-
%li
|
9
|
-
%h2 Tags
|
10
|
-
%div
|
11
|
-
- blog.tags.each do |k, v|
|
12
|
-
=link_to k, v.path, style: "font-size: #{font_size_for_tag(v)}px;", title: "#{v.count} blog posting#{"s" if v.count > 1}"
|
13
8
|
%li
|
14
9
|
%h2 Archives
|
15
10
|
%ul
|
16
11
|
- blog.archives.each do |k, v|
|
17
12
|
%li=link_to "#{titleize(humanize(k))} (#{v.count})", v.path
|
13
|
+
%li
|
14
|
+
%h2 Tags
|
15
|
+
%div
|
16
|
+
- blog.tags.each do |k, v|
|
17
|
+
=link_to k, v.path, style: "font-size: #{font_size_for_tag(v)}px;", title: "#{v.count} blog posting#{"s" if v.count > 1}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hightouch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman
|
16
|
-
requirement: &
|
16
|
+
requirement: &20215420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0.beta.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20215420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rygments
|
27
|
-
requirement: &
|
27
|
+
requirement: &20214560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.2.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20214560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack-codehighlighter
|
38
|
-
requirement: &
|
38
|
+
requirement: &20213660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.5.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20213660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redcarpet
|
49
|
-
requirement: &
|
49
|
+
requirement: &20163380 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.0.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *20163380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: virtus
|
60
|
-
requirement: &
|
60
|
+
requirement: &20161900 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,18 @@ dependencies:
|
|
65
65
|
version: 0.3.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *20161900
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octokit
|
71
|
+
requirement: &20160140 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *20160140
|
69
80
|
description: Hightouch(HT) will help you to build your web blog in minutes and with
|
70
81
|
helpers to deploy your site to github pages
|
71
82
|
email:
|
@@ -88,8 +99,6 @@ files:
|
|
88
99
|
- lib/hightouch/tag.rb
|
89
100
|
- lib/hightouch/version.rb
|
90
101
|
- lib/hightouch.rb
|
91
|
-
- source/templates/tag.html.haml
|
92
|
-
- source/templates/category.html.haml
|
93
102
|
- source/templates/archive.html.haml
|
94
103
|
- source/stylesheets/pygments-github.css
|
95
104
|
- source/stylesheets/pygments.css
|