alula 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/lib/alula/cli.rb CHANGED
@@ -55,6 +55,12 @@ module Alula
55
55
  end
56
56
 
57
57
  inside File.expand_path(path) do
58
+ # Try to find git
59
+ git=%x{/usr/bin/which git}.strip
60
+ if File.executable?(git)
61
+ run "#{git} init"
62
+ end
63
+
58
64
  # Run bundle command
59
65
  run "bundle install"
60
66
  end
data/lib/alula/content.rb CHANGED
@@ -27,18 +27,14 @@ module Alula
27
27
  generate_content
28
28
  end
29
29
 
30
- def by_name(name)
31
- (self.pages + self.posts + self.attachments).each do |item|
32
- return item if item.name == name
33
- end
34
- nil
35
- end
36
-
37
- def by_slug(slug)
38
- (self.pages + self.posts + self.attachments).each do |item|
39
- return item if item.slug == slug
30
+ def method_missing(meth, *args, &blk)
31
+ if m = /^by_(\S+)$/.match(meth)
32
+ return (self.pages + self.posts + self.attachments).find do |item|
33
+ item.send(m[1]) == args.first
34
+ end
40
35
  end
41
- nil
36
+
37
+ super
42
38
  end
43
39
 
44
40
  private
@@ -33,7 +33,7 @@ module Alula
33
33
 
34
34
  if m[2]
35
35
  m[2].scan(/(\S+):["]?((?:.(?!["]?\s+(?:\S+):|[>"]))+.)["]?/) do |name, value|
36
- @options[name] = value
36
+ @options[name] = value.strip
37
37
  end
38
38
  end
39
39
  end
@@ -0,0 +1,15 @@
1
+ module Alula
2
+ class LinkToTag < Tag
3
+ def content
4
+ target = if @options["href"]
5
+ @options["href"]
6
+ elsif @options["slug"]
7
+ item = @context.site.content.by_slug(@options["slug"])
8
+ item.nil? ? "" : item.url
9
+ end
10
+ @context.link_to(@options["source"], target)
11
+ end
12
+ end
13
+ end
14
+
15
+ Alula::Tag.register :link_to, Alula::LinkToTag
data/lib/alula/theme.rb CHANGED
@@ -36,6 +36,9 @@ module Alula
36
36
 
37
37
  def searchpath(type, name)
38
38
  [
39
+ # Blog custom
40
+ ::File.join(self.site.storage.path(:custom), type, "#{name}.*"),
41
+
39
42
  # Theme path
40
43
  ::File.join(self.path, type, "#{name}.*"),
41
44
 
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.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -483,6 +483,7 @@ files:
483
483
  - lib/alula/core_ext/tags/attachment.rb
484
484
  - lib/alula/core_ext/tags/blockquote.rb
485
485
  - lib/alula/core_ext/tags/image.rb
486
+ - lib/alula/core_ext/tags/link_to.rb
486
487
  - lib/alula/core_ext/tags/locale.rb
487
488
  - lib/alula/core_ext/tags/video.rb
488
489
  - lib/alula/generator.rb
@@ -643,7 +644,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
643
644
  version: '0'
644
645
  segments:
645
646
  - 0
646
- hash: 935586330715583609
647
+ hash: -3940758227593037558
647
648
  required_rubygems_version: !ruby/object:Gem::Requirement
648
649
  none: false
649
650
  requirements:
@@ -652,7 +653,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
652
653
  version: '0'
653
654
  segments:
654
655
  - 0
655
- hash: 935586330715583609
656
+ hash: -3940758227593037558
656
657
  requirements: []
657
658
  rubyforge_project:
658
659
  rubygems_version: 1.8.23