gumdrop 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +3 -0
- data/License +1 -1
- data/Notes.md +9 -1
- data/gumdrop.gemspec +4 -4
- data/lib/gumdrop/cli.rb +13 -3
- data/lib/gumdrop/content.rb +17 -15
- data/lib/gumdrop/context.rb +116 -111
- data/lib/gumdrop/data_manager.rb +93 -71
- data/lib/gumdrop/generator.rb +23 -18
- data/lib/gumdrop/server.rb +62 -110
- data/lib/gumdrop/site.rb +295 -0
- data/lib/gumdrop/version.rb +1 -1
- data/lib/gumdrop/view_helpers.rb +1 -1
- data/lib/gumdrop.rb +7 -114
- data/templates/backbone/Gumdrop +8 -8
- data/templates/backbone/config.ru +0 -4
- data/templates/backbone/source/default.htaccess.erb +2 -1
- data/templates/backbone/source/index.html.erb +1 -1
- data/templates/backbone/source/theme/templates/site.template.slim +1 -1
- data/templates/default/Gumdrop +7 -5
- data/templates/default/config.ru +0 -3
- data/templates/default/source/default.htaccess.erb +2 -1
- data/templates/default/source/theme/templates/site.template.slim +1 -1
- metadata +100 -97
- data/lib/gumdrop/build.rb +0 -116
- data/lib/gumdrop/dsl.rb +0 -30
- data/lib/gumdrop/logging.rb +0 -35
- data/lib/gumdrop/pager.rb +0 -49
- data/lib/gumdrop/utils.rb +0 -20
data/lib/gumdrop/dsl.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Gumdrop
|
2
|
-
module DSL
|
3
|
-
|
4
|
-
def self.generate(&block)
|
5
|
-
# Auto-generated, numerical, key for a site-level generator
|
6
|
-
Gumdrop.generators[Gumdrop.generators.keys.length] = Generator.new(block)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.content_filter(&block)
|
10
|
-
Gumdrop.content_filters << block
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.skip(path)
|
14
|
-
Gumdrop.blacklist << path
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.ignore(path)
|
18
|
-
Gumdrop.greylist << path
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.view_helpers(&block)
|
22
|
-
Gumdrop::ViewHelpers.class_eval &block
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.configure(&block)
|
26
|
-
Gumdrop::Configurator.instance_eval &block
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
data/lib/gumdrop/logging.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# Logging support
|
2
|
-
|
3
|
-
require 'logger'
|
4
|
-
|
5
|
-
module Gumdrop
|
6
|
-
|
7
|
-
module Logging
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
def log
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def info
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def warn
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def error
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def debug
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
data/lib/gumdrop/pager.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Gumdrop
|
2
|
-
class Pager
|
3
|
-
attr_reader :all, :pages, :base_url, :current_page, :page_sets
|
4
|
-
|
5
|
-
def initialize(articles, base_path="/page", page_size=5)
|
6
|
-
@all= articles
|
7
|
-
@page_size= page_size
|
8
|
-
@base_path= base_path
|
9
|
-
@page_sets= @all.in_groups_of(page_size, false)
|
10
|
-
@pages= []
|
11
|
-
@current_page=1
|
12
|
-
@page_sets.each do |art_ary|
|
13
|
-
@pages << HashObject.new({
|
14
|
-
items: art_ary,
|
15
|
-
page: @current_page,
|
16
|
-
uri: "#{base_path}/#{current_page}",
|
17
|
-
pager: self
|
18
|
-
})
|
19
|
-
@current_page += 1
|
20
|
-
end
|
21
|
-
@current_page= nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def length
|
25
|
-
@pages.length
|
26
|
-
end
|
27
|
-
|
28
|
-
def first
|
29
|
-
@pages.first
|
30
|
-
end
|
31
|
-
|
32
|
-
def last
|
33
|
-
@pages.last
|
34
|
-
end
|
35
|
-
|
36
|
-
def each
|
37
|
-
@current_page=1
|
38
|
-
@pages.each do |page_set|
|
39
|
-
yield page_set
|
40
|
-
@current_page += 1
|
41
|
-
end
|
42
|
-
@current_page= nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def [](key)
|
46
|
-
@pages[key]
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/lib/gumdrop/utils.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
|
2
|
-
module Gumdrop
|
3
|
-
|
4
|
-
module Utils
|
5
|
-
|
6
|
-
def self.content_hash(base_path)
|
7
|
-
Hash.new do |hash, key|
|
8
|
-
templates= Dir["#{base_path}#{key}*"]
|
9
|
-
if templates.length > 0
|
10
|
-
Content.new( templates[0] )
|
11
|
-
else
|
12
|
-
puts "NOT FOUND: #{key}"
|
13
|
-
nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|