alula 0.4.14 → 0.4.15

Sign up to get free protection for your applications and to get access to all the features.
data/lib/alula/cli.rb CHANGED
@@ -57,7 +57,7 @@ module Alula
57
57
  inside File.expand_path(path) do
58
58
  # Try to find git
59
59
  git=%x{/usr/bin/which git}.strip
60
- if File.executable?(git)
60
+ if File.executable?(git) and !File.directory?(".git")
61
61
  run "#{git} init"
62
62
  end
63
63
 
@@ -18,9 +18,11 @@ module Alula
18
18
  options.templates.collect do |template|
19
19
  posts.collect do |post|
20
20
  archives[post.substitude(template, lang)] ||= {}
21
- key = "archive.title." + template.scan(/:(\w+)*/).flatten.join('-')
22
- archives[post.substitude(template, lang)][:title] ||= I18n.t(key, Hash[post.substitutes(lang).map{|k,v|[k.to_sym,v]}].merge(locale: lang))
23
- archives[post.substitude(template, lang)][:key] ||= key
21
+ title_key = "archive.title." + template.scan(/:(\w+)*/).flatten.join('-')
22
+ description_key = "archive.description." + template.scan(/:(\w+)*/).flatten.join('-')
23
+ archives[post.substitude(template, lang)][:title] ||= I18n.t(title_key, Hash[post.substitutes(lang).map{|k,v|[k.to_sym,v]}].merge(locale: lang))
24
+ archives[post.substitude(template, lang)][:description] ||= I18n.t(description_key, Hash[post.substitutes(lang).map{|k,v|[k.to_sym,v]}].merge(locale: lang))
25
+ archives[post.substitude(template, lang)][:key] ||= title_key
24
26
  archives[post.substitude(template, lang)][:content] ||= {}
25
27
  archives[post.substitude(template, lang)][:content][lang] ||= []
26
28
  archives[post.substitude(template, lang)][:content][lang] << post
@@ -32,7 +34,8 @@ module Alula
32
34
  self.site.content.pages << Alula::Content::Page.new({
33
35
  generator: self,
34
36
  posts: archive[:content],
35
- title: archive[:title],#titles.select {|lang, title| archive.keys.include?(lang)},
37
+ title: archive[:title],
38
+ description: archive[:description],
36
39
  name: name,
37
40
  slug: name,
38
41
  sidebar: false,
@@ -41,22 +44,7 @@ module Alula
41
44
  view: "archive",
42
45
  key: archive[:key],
43
46
  },
44
- # :previous => ->(hook, locale = nil) {
45
- # pos = self.navigation(locale).index(self)
46
- # if pos and pos < (self.navigation(locale).count - 1)
47
- # self.navigation(locale)[pos + 1]
48
- # else
49
- # nil
50
- # end
51
- # },
52
- # :next => ->(hook, locale = nil) {
53
- # pos = self.navigation(locale).index(self)
54
- # if pos and pos > 0
55
- # self.navigation(locale)[pos - 1]
56
- # else
57
- # nil
58
- # end
59
- # },
47
+
60
48
  :navigation => ->(hook, locale = nil) {
61
49
  locale ||= self.current_locale || self.site.config.locale
62
50
  @navigation[locale] ||= self.site.content.pages.select { |item|
@@ -23,9 +23,8 @@ module Alula
23
23
  [ lang, posts.slice(page * self.options.items, self.options.items) ]
24
24
  end
25
25
  ]
26
- titles = Hash[
27
- languages.collect {|lang, x| [lang, I18n.t("paginate.title", locale: lang, page: (page + 1))]}
28
- ]
26
+ titles = Hash[languages.collect {|lang, x| [lang, I18n.t("paginate.title", locale: lang, page: (page + 1))]}]
27
+ descriptions = Hash[languages.collect {|lang, x| [lang, I18n.t("paginate.description", locale: lang, page: (page + 1))]}]
29
28
 
30
29
  self.site.content.pages << Alula::Content::Page.new({
31
30
  generator: self,
@@ -33,6 +32,7 @@ module Alula
33
32
  pagenum: (page + 1),
34
33
  pages: (pages + 1),
35
34
  title: titles,
35
+ description: descriptions,
36
36
  name: "page-#{(page + 1)}",
37
37
  slug: "page-#{(page + 1)}",
38
38
  sidebar: false,
@@ -40,22 +40,6 @@ module Alula
40
40
  site: self.site,
41
41
  view: self.options.view || "paginate",
42
42
  },
43
- # :previous => ->(hook, locale = nil) {
44
- # pos = self.navigation(locale).index(self)
45
- # if pos and pos < (self.navigation(locale).count - 1)
46
- # self.navigation(locale)[pos + 1]
47
- # else
48
- # nil
49
- # end
50
- # },
51
- # :next => ->(hook, locale = nil) {
52
- # pos = self.navigation(locale).index(self)
53
- # if pos and pos > 0
54
- # self.navigation(locale)[pos - 1]
55
- # else
56
- # nil
57
- # end
58
- # },
59
43
  :navigation => ->(hook, locale = nil) {
60
44
  locale ||= self.current_locale || self.site.config.locale
61
45
  @navigation[locale] ||= self.site.content.pages.select { |item| item.metadata.generator == self.generator and item.languages.include?(locale) }
data/lib/alula/site.rb CHANGED
@@ -277,6 +277,7 @@ module Alula
277
277
  index_page.metadata.slug = "index"
278
278
  index_page.metadata.template = "/:locale/:slug"
279
279
  index_page.metadata.title = Hash[index_page.metadata.languages.collect{|lang| [lang, metadata.title(lang)]}]
280
+ index_page.metadata.description = Hash[index_page.metadata.languages.collect{|lang| [lang, metadata.description(lang)]}]
280
281
  end
281
282
  end
282
283
  end
data/lib/alula/version.rb CHANGED
@@ -2,7 +2,7 @@ module Alula
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 14
5
+ PATCH = 15
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 0.4.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-18 00:00:00.000000000 Z
12
+ date: 2012-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie