alula 0.4.10 → 0.4.11a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/lib/alula/cli.rb +10 -1
  2. data/lib/alula/config.rb +3 -0
  3. data/lib/alula/core_ext/tags/video.rb +2 -0
  4. data/lib/alula/processor.rb +1 -1
  5. data/lib/alula/site.rb +6 -0
  6. data/lib/alula/version.rb +9 -2
  7. metadata +80 -280
  8. data/.gitignore +0 -19
  9. data/Gemfile +0 -11
  10. data/Guardfile +0 -9
  11. data/README.md +0 -29
  12. data/Rakefile +0 -17
  13. data/VERSION +0 -1
  14. data/alula.gemspec +0 -48
  15. data/locales/en.yml +0 -11
  16. data/locales/fi.yml +0 -11
  17. data/locales/l10n/ar.yml +0 -199
  18. data/locales/l10n/az.yml +0 -199
  19. data/locales/l10n/bg.yml +0 -199
  20. data/locales/l10n/bn-IN.yml +0 -182
  21. data/locales/l10n/bs.yml +0 -242
  22. data/locales/l10n/ca.yml +0 -199
  23. data/locales/l10n/cs.yml +0 -198
  24. data/locales/l10n/csb.yml +0 -210
  25. data/locales/l10n/cy.yml +0 -199
  26. data/locales/l10n/da.yml +0 -199
  27. data/locales/l10n/de-AT.yml +0 -203
  28. data/locales/l10n/de-CH.yml +0 -203
  29. data/locales/l10n/de.yml +0 -203
  30. data/locales/l10n/dsb.yml +0 -215
  31. data/locales/l10n/el.yml +0 -199
  32. data/locales/l10n/en-AU.yml +0 -205
  33. data/locales/l10n/en-CA.yml +0 -214
  34. data/locales/l10n/en-GB.yml +0 -205
  35. data/locales/l10n/en-IN.yml +0 -205
  36. data/locales/l10n/en-US.yml +0 -205
  37. data/locales/l10n/en.yml +0 -205
  38. data/locales/l10n/eo.yml +0 -201
  39. data/locales/l10n/es-AR.yml +0 -205
  40. data/locales/l10n/es-CL.yml +0 -199
  41. data/locales/l10n/es-CO.yml +0 -205
  42. data/locales/l10n/es-MX.yml +0 -205
  43. data/locales/l10n/es-PE.yml +0 -181
  44. data/locales/l10n/es-VE.yml +0 -205
  45. data/locales/l10n/es.yml +0 -199
  46. data/locales/l10n/et.yml +0 -199
  47. data/locales/l10n/eu.yml +0 -199
  48. data/locales/l10n/fa.yml +0 -199
  49. data/locales/l10n/fi.yml +0 -199
  50. data/locales/l10n/fr-CA.yml +0 -207
  51. data/locales/l10n/fr-CH.yml +0 -207
  52. data/locales/l10n/fr.yml +0 -222
  53. data/locales/l10n/fur.yml +0 -199
  54. data/locales/l10n/gl-ES.yml +0 -178
  55. data/locales/l10n/gsw-CH.yml +0 -199
  56. data/locales/l10n/he.yml +0 -201
  57. data/locales/l10n/hi-IN.yml +0 -199
  58. data/locales/l10n/hi.yml +0 -199
  59. data/locales/l10n/hr.yml +0 -237
  60. data/locales/l10n/hsb.yml +0 -214
  61. data/locales/l10n/hu.yml +0 -199
  62. data/locales/l10n/id.yml +0 -200
  63. data/locales/l10n/is.yml +0 -213
  64. data/locales/l10n/it.yml +0 -205
  65. data/locales/l10n/ja.yml +0 -197
  66. data/locales/l10n/kn.yml +0 -199
  67. data/locales/l10n/ko.yml +0 -197
  68. data/locales/l10n/lo.yml +0 -186
  69. data/locales/l10n/lt.yml +0 -182
  70. data/locales/l10n/lv.yml +0 -215
  71. data/locales/l10n/mk.yml +0 -170
  72. data/locales/l10n/mn.yml +0 -205
  73. data/locales/l10n/nb.yml +0 -207
  74. data/locales/l10n/nl.yml +0 -199
  75. data/locales/l10n/nn.yml +0 -160
  76. data/locales/l10n/pl.yml +0 -221
  77. data/locales/l10n/pt-BR.yml +0 -207
  78. data/locales/l10n/pt-PT.yml +0 -207
  79. data/locales/l10n/quotes.yml +0 -24
  80. data/locales/l10n/rm.yml +0 -182
  81. data/locales/l10n/ro.yml +0 -199
  82. data/locales/l10n/ru.yml +0 -257
  83. data/locales/l10n/sk.yml +0 -213
  84. data/locales/l10n/sl.yml +0 -210
  85. data/locales/l10n/sr-Latn.yml +0 -170
  86. data/locales/l10n/sr.yml +0 -170
  87. data/locales/l10n/sv-SE.yml +0 -199
  88. data/locales/l10n/sw.yml +0 -197
  89. data/locales/l10n/th.yml +0 -173
  90. data/locales/l10n/tl.yml +0 -229
  91. data/locales/l10n/tr.yml +0 -199
  92. data/locales/l10n/uk.yml +0 -257
  93. data/locales/l10n/vi.yml +0 -201
  94. data/locales/l10n/wo.yml +0 -205
  95. data/locales/l10n/zh-CN.yml +0 -199
  96. data/locales/l10n/zh-TW.yml +0 -199
  97. data/template/Gemfile.erb +0 -15
  98. data/template/README +0 -16
  99. data/template/config.yml.erb +0 -42
  100. data/test/fixtures/config_001_simple.yml +0 -2
  101. data/test/fixtures/config_002_l10n.yml +0 -5
  102. data/test/fixtures/pages/invalid-page.markdown +0 -1
  103. data/test/fixtures/pages/multilingual-page.markdown +0 -20
  104. data/test/fixtures/pages/section/subpage.markdown +0 -5
  105. data/test/fixtures/pages/simple-page.markdown +0 -7
  106. data/test/fixtures/posts/2012-07-02-invalid-post.markdown +0 -1
  107. data/test/fixtures/posts/2012-07-02-simple.markdown +0 -7
  108. data/test/fixtures/posts/2012-07-03-full-metadata.markdown +0 -8
  109. data/test/fixtures/posts/2012-07-03-multilingual-full-metadata.markdown +0 -20
  110. data/test/fixtures/theme/test/layouts/default.html.erb +0 -1
  111. data/test/fixtures/theme/test/views/page.html.erb +0 -1
  112. data/test/fixtures/theme/test/views/post.html.erb +0 -1
  113. data/test/minitest_helper.rb +0 -14
  114. data/test/test_config.rb +0 -33
  115. data/test/test_content.rb +0 -30
  116. data/test/test_metadata.rb +0 -83
  117. data/test/test_page.rb +0 -81
  118. data/test/test_post.rb +0 -123
  119. data/test/test_storage.rb +0 -23
  120. data/test/test_storage_file.rb +0 -32
  121. data/test/test_theme.rb +0 -45
  122. data/vendor/assets/images/favicon.png +0 -0
  123. data/vendor/assets/images/grey.gif +0 -0
  124. data/vendor/assets/javascripts/jquery.alula.js.coffee +0 -16
  125. data/vendor/assets/javascripts/jquery.js +0 -4
  126. data/vendor/assets/javascripts/jquery.lazyload.js +0 -210
  127. data/vendor/assets/javascripts/lazyload.js.coffee +0 -15
  128. data/vendor/layouts/feed.xml.builder +0 -19
  129. data/vendor/layouts/sitemap.xml.builder +0 -10
  130. data/vendor/static/favicon.ico +0 -0
  131. data/vendor/views/feed_post.html.haml +0 -1
  132. /data/{LICENSE → MIT-LICENSE} +0 -0
@@ -1,83 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/contents/metadata'
3
-
4
- describe Alula::Content::Metadata do
5
- it "loads empty metadata" do
6
- meta = Alula::Content::Metadata.new
7
- meta.title.must_be_nil
8
- end
9
-
10
- it "accepts simple metadata" do
11
- meta = Alula::Content::Metadata.new
12
- meta.title = "Simple Title"
13
- meta.title.must_equal "Simple Title"
14
- end
15
-
16
- it "load simple payload" do
17
- payload = <<-EOF
18
- title: Simple Title
19
- layout: default
20
- slug: another-slug
21
- EOF
22
-
23
- meta = Alula::Content::Metadata.new
24
- meta.load(payload)
25
-
26
- meta.title.must_equal "Simple Title"
27
- meta.layout.must_equal "default"
28
- meta.slug.must_equal "another-slug"
29
-
30
- meta.languages.must_be_nil
31
- end
32
-
33
- it "localised payload" do
34
- payload = <<-EOF
35
- title:
36
- en: Simple Title
37
- fi: Yksinkertainen otsikko
38
- layout:
39
- en: default
40
- slug:
41
- en: another-slug
42
- fi: yksinkertainen-otsikko
43
- EOF
44
-
45
- meta = Alula::Content::Metadata.new
46
- meta.load(payload)
47
-
48
- # Default language, i.e. first localisation
49
- meta.title.must_equal "Simple Title"
50
- meta.layout.must_equal "default"
51
- meta.slug.must_equal "another-slug"
52
-
53
- # Specific language
54
- meta.title("fi").must_equal "Yksinkertainen otsikko"
55
- meta.layout("fi").must_equal "default"
56
- meta.slug("fi").must_equal "yksinkertainen-otsikko"
57
-
58
- # Fetch proper languages list
59
- meta.languages.must_equal ["en", "fi"]
60
- end
61
-
62
- it "custom date setter" do
63
- require 'time'
64
-
65
- meta = Alula::Content::Metadata.new
66
-
67
- meta.date = "2012-07-02"
68
- meta.date.must_be_kind_of Time
69
- meta.date.year.must_equal 2012
70
- meta.date.month.must_equal 7
71
- meta.date.day.must_equal 2
72
-
73
- d = Time.parse("2012-07-02")
74
- meta.date = d
75
- meta.date.must_be_kind_of Time
76
- meta.date.year.must_equal d.year
77
- meta.date.month.must_equal d.month
78
- meta.date.day.must_equal d.day
79
-
80
- meta.date = "2012-13-45"
81
- meta.date.must_be_nil
82
- end
83
- end
data/test/test_page.rb DELETED
@@ -1,81 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/contents/page'
3
-
4
- describe Alula::Content::Page do
5
- before do
6
- @site = MiniTest::Mock.new
7
- @site.expect :context, {}
8
- @site.expect :config, OpenStruct.new({
9
- permalinks: "/:year/:month/:title/",
10
- pagelinks: "/:locale/:slug/",
11
- locale: "en", hides_base_locale: true,
12
- })
13
- end
14
-
15
- def mock_item(name)
16
- item = MiniTest::Mock.new
17
- item.expect :nil?, false
18
- item.expect :exists?, File.exists?("test/fixtures/pages/#{name}")
19
- item.expect :name, name
20
- if File.exists?("test/fixtures/pages/#{name}")
21
- item.expect :has_payload?, File.read("test/fixtures/pages/#{name}", 3) == "---"
22
- item.expect :read, File.read("test/fixtures/pages/#{name}")
23
- end
24
-
25
- item
26
- end
27
-
28
- let :simple_page do
29
- mock_item("simple-page.markdown")
30
- end
31
-
32
- let :invalid_page do
33
- mock_item("invalid-page.markdown")
34
- end
35
-
36
- let :multilingual_page do
37
- mock_item("multilingual-page.markdown")
38
- end
39
-
40
- let :subpage do
41
- mock_item("section/subpage.markdown")
42
- end
43
-
44
- let :missing_page do
45
- mock_item("missing.page")
46
- end
47
-
48
- it "fails with non-existing file" do
49
- page = Alula::Content::Page.load(item: missing_page, site: @site)
50
- end
51
-
52
- it "loads simple page" do
53
- page = Alula::Content::Page.load(item: simple_page, site: @site)
54
- end
55
-
56
- it "skips invalid page" do
57
- page = Alula::Content::Page.load(item: invalid_page, site: @site)
58
- end
59
-
60
- it "parses simple post" do
61
- page = Alula::Content::Page.load(item: simple_page, site: @site)
62
- page.metadata.title.must_equal "Simple Page"
63
- page.metadata.languages.must_be_nil
64
-
65
- # Parse and render
66
- page.send(:parse_liquid).must_equal "# Header\n\nThis is a simple page.\n"
67
-
68
- page.send(:parse_markdown).must_equal "<h1>Header</h1>\n\n<p>This is a simple page.</p>\n"
69
- end
70
-
71
- it "parses multilingual page" do
72
- page = Alula::Content::Page.load(item: multilingual_page, site: @site)
73
- page.url.must_equal "/about/"
74
- page.url("fi").must_equal "/fi/mina/"
75
- end
76
-
77
- it "parses subpages" do
78
- page = Alula::Content::Page.load(item: subpage, site: @site)
79
- page.url.must_equal "/section/subpage/"
80
- end
81
- end
data/test/test_post.rb DELETED
@@ -1,123 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/contents/post'
3
- require 'alula/config'
4
- require 'alula/storage'
5
-
6
- describe Alula::Content::Post do
7
- before do
8
- @site = MiniTest::Mock.new
9
- @site.expect :context, {}
10
- @site.expect :config, OpenStruct.new({
11
- permalinks: "/:year/:month/:title/",
12
- pagelinks: "/:locale/:slug/",
13
- locale: "en", hides_base_locale: true,
14
- })
15
- end
16
-
17
- def mock_item(name)
18
- item = MiniTest::Mock.new
19
- item.expect :nil?, false
20
- item.expect :exists?, File.exists?("test/fixtures/posts/#{name}")
21
- item.expect :name, name
22
- if File.exists?("test/fixtures/posts/#{name}")
23
- item.expect :has_payload?, File.read("test/fixtures/posts/#{name}", 3) == "---"
24
- item.expect :read, File.read("test/fixtures/posts/#{name}")
25
- end
26
-
27
- item
28
- end
29
-
30
- let :missing_post do
31
- mock_item("invalid.file")
32
- end
33
-
34
- let :simple_post do
35
- mock_item("2012-07-02-simple.markdown")
36
- end
37
-
38
- let :metadata_post do
39
- mock_item("2012-07-03-full-metadata.markdown")
40
- end
41
-
42
- let :invalid_post do
43
- mock_item("2012-07-02-invalid-post.markdown")
44
- end
45
-
46
- let :complex_post do
47
- mock_item("2012-07-03-multilingual-full-metadata.markdown")
48
- end
49
-
50
- it "fails with non-existing file" do
51
- post = Alula::Content::Post.load(item: missing_post, site: @site)
52
- post.must_be_nil
53
- end
54
-
55
- it "skips invalid post" do
56
- post = Alula::Content::Post.load(item: invalid_post, site: @site)
57
- end
58
-
59
- it "parses simple post" do
60
- post = Alula::Content::Post.load(item: simple_post, site: @site)
61
- post.metadata.title.must_equal "Simple Post"
62
- post.metadata.languages.must_be_nil
63
-
64
- # Parse and render
65
- post.send(:parse_liquid).must_equal "# Header\n\nThis is a simple post.\n"
66
- post.send(:parse_markdown).must_equal "<h1>Header</h1>\n\n<p>This is a simple post.</p>\n"
67
-
68
- # Path and URI must be correct
69
- post.path.must_equal "/2012/07/simple-post/index.html"
70
- post.url.must_equal "/2012/07/simple-post/"
71
- end
72
-
73
- it "parses full metadata post" do
74
- post = Alula::Content::Post.load(item: metadata_post, site: @site)
75
- post.url.must_equal "/blog/path/to/long/nonce/to/get/nonce/"
76
- post.path.must_equal "/blog/path/to/long/nonce/to/get/nonce/index.html"
77
- end
78
-
79
- it "parses complex post" do
80
- @site.config.permalinks = "/:locale/:year/:month/:title/"
81
- @site.config.locale = "en"
82
- @site.config.hides_base_locale = true
83
-
84
- post = Alula::Content::Post.load(item: complex_post, site: @site)
85
- post.metadata.title.must_equal "Multilingual Post"
86
- post.metadata.languages.must_equal ["en", "fi"]
87
- post.metadata.title("fi").must_equal "Monikielinen kirjoitelma"
88
-
89
- post.url.must_equal "/2012/07/multilingual-post/"
90
- post.url("fi").must_equal "/fi/2012/07/monikielinen-kirjoitelma/"
91
-
92
- @site.config.hides_base_locale = false
93
- post = Alula::Content::Post.load(item: complex_post, site: @site)
94
- post.url.must_equal "/en/2012/07/multilingual-post/"
95
-
96
- @site.config.permalinks = "/:locale/:year/:slug"
97
- post = Alula::Content::Post.load(item: complex_post, site: @site)
98
- post.url("fi").must_equal "/fi/2012/monikielinen-blogi-kirjoitelma.html"
99
- post.path("fi").must_equal "/fi/2012/monikielinen-blogi-kirjoitelma.html"
100
- end
101
-
102
- it "renders content on simple post" do
103
- # Create mockup layout
104
- view = MiniTest::Mock.new
105
- view.expect :render, "<h1>Header</h1>", [{}]
106
-
107
- layout = MiniTest::Mock.new
108
-
109
- theme = MiniTest::Mock.new
110
- theme.expect :view, view, ["post"]
111
-
112
- site = MiniTest::Mock.new
113
- site.expect :context, {}
114
- site.expect :config, OpenStruct.new({locale: "en"})
115
- site.expect :theme, theme
116
- post = Alula::Content::Post.load(item: simple_post, site: site)
117
-
118
- # Render page using current layout, for all languages
119
- post.render
120
- post.content.must_equal "<h1>Header</h1>"
121
-
122
- end
123
- end
data/test/test_storage.rb DELETED
@@ -1,23 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/storage'
3
- require 'ostruct'
4
-
5
- describe "Storage" do
6
- before do
7
- @site = MiniTest::Mock.new
8
- @site.expect :config, OpenStruct.new({})
9
- end
10
-
11
- it "loads proper provider" do
12
- puts ":: #{@site.config.storage.inspect}"
13
- @site.config.storage = {"none" => {}}
14
- storage = Alula::Storage.load(site: @site)
15
- storage.must_be_nil
16
-
17
- @site.config.storage = {"file" => { "content_path" => 'test/fixtures', "pages_path" => 'test/fixtures/pages',
18
- "posts_path" => 'test/fixtures/posts', "attachments_path" => 'test/fixtures/attachments', "public_path" => 'public' }}
19
- storage = Alula::Storage.load(site: @site)
20
- storage.wont_be_nil
21
-
22
- end
23
- end
@@ -1,32 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/storages/file'
3
- require 'ostruct'
4
-
5
- describe "File Storage" do
6
- before do
7
- @site = MiniTest::Mock.new
8
- @config = {
9
- "content_path" => 'test/fixtures',
10
- "pages_path" => 'test/fixtures/pages',
11
- "posts_path" => 'test/fixtures/posts',
12
- "attachments_path" => 'test/fixtures/attachments',
13
- "public_path" => 'public',
14
- }
15
- end
16
-
17
- it "accept simple configuration" do
18
- storage = Alula::Storage::File.new(@config, site: @site)
19
- end
20
-
21
- it "lists all posts" do
22
- storage = Alula::Storage::File.new(@config, site: @site)
23
- storage.posts.count.must_equal 4
24
- storage.post("2012-07-02-simple.markdown").wont_be_nil
25
- end
26
-
27
- it "list all pages" do
28
- storage = Alula::Storage::File.new(@config, site: @site)
29
- storage.pages.count.must_equal 4
30
- storage.page("simple-page.markdown").wont_be_nil
31
- end
32
- end
data/test/test_theme.rb DELETED
@@ -1,45 +0,0 @@
1
- require "minitest_helper"
2
- require 'alula/theme'
3
- require 'ostruct'
4
-
5
- describe "Themes" do
6
- before do
7
- context = Object.new
8
- context.class.class_eval do
9
- def initialize; @vars = {}; end
10
- def [](key); @vars[key]; end
11
- def []=(key, val); @vars[key] = val; end
12
- def method_missing(meth, *args, &blk); return @vars[meth] if @vars; super; end
13
- end
14
-
15
- @site = MiniTest::Mock.new
16
- @site.expect :config, OpenStruct.new({theme: 'test'})
17
- @site.expect :context, context
18
-
19
- # Register our theme
20
- Alula::Theme.register(:test, "test/fixtures/theme")
21
- end
22
-
23
- it "doesn't load nonexisting theme" do
24
- @site.config.theme = "unknown"
25
- theme = Alula::Theme.load(site: @site)
26
- theme.must_be_nil
27
- end
28
-
29
- it "has working theme" do
30
- @site.config.theme = "test"
31
- theme = Alula::Theme.load(site: @site)
32
- theme.wont_be_nil
33
-
34
- # Find layout
35
- layout = theme.layout("default")
36
- layout.wont_be_nil
37
-
38
- # Find view
39
- view = theme.view("post")
40
- view.wont_be_nil
41
-
42
- # Test rendering
43
- view.render(content: "Theme Test").must_equal "<html><body><p>Theme Test</p></body></html>"
44
- end
45
- end
Binary file
Binary file
@@ -1,16 +0,0 @@
1
- #=require jquery
2
- #
3
- # Copyright Owl Forstry
4
- # Alula JavaScript additions
5
-
6
- # Make sure we have devicePixelRatio always available
7
- jQuery.getDevicePixelRatio = ->
8
- if window.devicePixelRatio is undefined
9
- return 1
10
- else
11
- return window.devicePixelRatio
12
-
13
- # Hide mobile Safari address bar
14
- jQuery ->
15
- delay = (ms, func) -> setTimeout func, ms
16
- delay 0, -> window.scrollTo(0, 1)