tigefa 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +0 -144
- data/LICENSE +1 -1
- data/README.markdown +6 -10
- data/Rakefile +6 -13
- data/bin/tigefa +22 -26
- data/features/create_sites.feature +0 -11
- data/features/include_tag.feature +0 -22
- data/features/markdown.feature +4 -41
- data/features/site_configuration.feature +4 -33
- data/features/site_data.feature +4 -4
- data/features/step_definitions/{tigefa_steps.rb → jekyll_steps.rb} +17 -32
- data/features/support/env.rb +2 -38
- data/lib/site_template/_config.yml +2 -2
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +1 -0
- data/lib/site_template/css/main.css +15 -15
- data/lib/tigefa.rb +2 -5
- data/lib/tigefa/cleaner.rb +8 -8
- data/lib/tigefa/commands/build.rb +8 -14
- data/lib/tigefa/commands/new.rb +1 -1
- data/lib/tigefa/commands/serve.rb +0 -2
- data/lib/tigefa/configuration.rb +5 -21
- data/lib/tigefa/converters/markdown/kramdown_parser.rb +1 -1
- data/lib/tigefa/converters/markdown/maruku_parser.rb +1 -6
- data/lib/tigefa/convertible.rb +6 -17
- data/lib/tigefa/core_ext.rb +0 -19
- data/lib/tigefa/deprecator.rb +1 -1
- data/lib/tigefa/filters.rb +2 -12
- data/lib/tigefa/generators/pagination.rb +6 -9
- data/lib/tigefa/page.rb +1 -1
- data/lib/tigefa/post.rb +4 -4
- data/lib/tigefa/related_posts.rb +1 -1
- data/lib/tigefa/site.rb +50 -90
- data/lib/tigefa/stevenson.rb +4 -4
- data/lib/tigefa/tags/gist.rb +1 -9
- data/lib/tigefa/tags/highlight.rb +1 -1
- data/lib/tigefa/tags/include.rb +32 -75
- data/lib/tigefa/tags/post_url.rb +4 -6
- data/lib/tigefa/url.rb +0 -2
- data/site/_includes/docs_contents.html +1 -1
- data/site/_includes/docs_contents_mobile.html +1 -1
- data/site/_includes/top.html +1 -1
- data/site/docs/configuration.md +0 -19
- data/site/docs/deployment-methods.md +3 -3
- data/site/docs/drafts.md +3 -4
- data/site/docs/history.md +3 -147
- data/site/docs/installation.md +0 -10
- data/site/docs/migrations.md +240 -3
- data/site/docs/pages.md +7 -7
- data/site/docs/pagination.md +37 -16
- data/site/docs/plugins.md +7 -72
- data/site/docs/posts.md +1 -1
- data/site/docs/structure.md +0 -17
- data/site/docs/templates.md +7 -40
- data/site/docs/upgrading.md +3 -3
- data/site/docs/usage.md +1 -1
- data/site/docs/variables.md +2 -2
- data/test/helper.rb +1 -4
- data/test/test_configuration.rb +7 -16
- data/test/test_convertible.rb +1 -1
- data/test/test_excerpt.rb +3 -3
- data/test/test_filters.rb +0 -11
- data/test/test_generated_site.rb +1 -1
- data/test/test_kramdown.rb +5 -32
- data/test/test_new_command.rb +1 -1
- data/test/test_page.rb +0 -10
- data/test/test_post.rb +1 -12
- data/test/test_redcloth.rb +3 -3
- data/test/test_site.rb +64 -58
- data/test/test_tags.rb +35 -68
- data/tigefa.gemspec +15 -39
- metadata +101 -126
- checksums.yaml +0 -7
- data/features/data.feature +0 -65
- data/lib/tigefa/entry_filter.rb +0 -35
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +0 -19
- data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +0 -43
- data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +0 -21
- data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +0 -30
- data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +0 -18
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +0 -27
- data/site/docs/datafiles.md +0 -63
- data/test/source/_config.dev.toml +0 -2
- data/test/source/_data/languages.yml +0 -2
- data/test/source/_data/members.yaml +0 -7
- data/test/source/_data/products.yml +0 -1
- data/test/source/_includes/tmp +0 -1
- data/test/source/_layouts/post/simple.html +0 -1
- data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
- data/test/source/exploit.md +0 -5
- data/test/source/products.yml +0 -4
- data/test/source/symlink-test/_data +0 -1
- data/test/test_entry_filter.rb +0 -74
@@ -18,27 +18,6 @@ Feature: Site configuration
|
|
18
18
|
Then the _mysite directory should exist
|
19
19
|
And I should see "Changing destination directory" in "_mysite/index.html"
|
20
20
|
|
21
|
-
Scenario Outline: Similarly named source and destination
|
22
|
-
Given I have a blank site in "<source>"
|
23
|
-
And I have an "<source>/index.md" page that contains "markdown"
|
24
|
-
And I have a configuration file with:
|
25
|
-
| key | value |
|
26
|
-
| source | <source> |
|
27
|
-
| destination | <dest> |
|
28
|
-
When I run jekyll
|
29
|
-
Then the <source> directory should exist
|
30
|
-
And the "<dest>/index.html" file should <file_exist> exist
|
31
|
-
And I should see "markdown" in "<source>/index.md"
|
32
|
-
|
33
|
-
Examples:
|
34
|
-
| source | dest | file_exist |
|
35
|
-
| mysite_source | mysite | |
|
36
|
-
| mysite | mysite_dest | |
|
37
|
-
| mysite/ | mysite | not |
|
38
|
-
| mysite | ./mysite | not |
|
39
|
-
| mysite/source | mysite | not |
|
40
|
-
| mysite | mysite/dest | |
|
41
|
-
|
42
21
|
Scenario: Exclude files inline
|
43
22
|
Given I have an "Rakefile" file that contains "I want to be excluded"
|
44
23
|
And I have an "README" file that contains "I want to be excluded"
|
@@ -67,28 +46,28 @@ Feature: Site configuration
|
|
67
46
|
And I have a configuration file with "markdown" set to "rdiscount"
|
68
47
|
When I run jekyll
|
69
48
|
Then the _site directory should exist
|
70
|
-
And I should see "<a href
|
49
|
+
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
|
71
50
|
|
72
51
|
Scenario: Use Kramdown for markup
|
73
52
|
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
74
53
|
And I have a configuration file with "markdown" set to "kramdown"
|
75
54
|
When I run jekyll
|
76
55
|
Then the _site directory should exist
|
77
|
-
And I should see "<a href
|
56
|
+
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
|
78
57
|
|
79
58
|
Scenario: Use Redcarpet for markup
|
80
59
|
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
81
60
|
And I have a configuration file with "markdown" set to "redcarpet"
|
82
61
|
When I run jekyll
|
83
62
|
Then the _site directory should exist
|
84
|
-
And I should see "<a href
|
63
|
+
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
|
85
64
|
|
86
65
|
Scenario: Use Maruku for markup
|
87
66
|
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
88
67
|
And I have a configuration file with "markdown" set to "maruku"
|
89
68
|
When I run jekyll
|
90
69
|
Then the _site directory should exist
|
91
|
-
And I should see "<a href
|
70
|
+
And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
|
92
71
|
|
93
72
|
Scenario: Highlight code with pygments
|
94
73
|
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
@@ -225,11 +204,3 @@ Feature: Site configuration
|
|
225
204
|
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
|
226
205
|
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
|
227
206
|
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
|
228
|
-
|
229
|
-
Scenario: Add a gem-based plugin
|
230
|
-
Given I have an "index.html" file that contains "Whatever"
|
231
|
-
And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
|
232
|
-
When I run jekyll
|
233
|
-
Then the _site directory should exist
|
234
|
-
And I should see "Whatever" in "_site/index.html"
|
235
|
-
And I should see "this is a test" in "_site/test.txt"
|
data/features/site_data.feature
CHANGED
@@ -4,10 +4,10 @@ Feature: Site data
|
|
4
4
|
In order to make the site slightly dynamic
|
5
5
|
|
6
6
|
Scenario: Use page variable in a page
|
7
|
-
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@
|
7
|
+
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com"
|
8
8
|
When I run jekyll
|
9
9
|
Then the _site directory should exist
|
10
|
-
And I should see "Contact: email@
|
10
|
+
And I should see "Contact: email@me.com" in "_site/contact.html"
|
11
11
|
|
12
12
|
Scenario Outline: Use page.path variable in a page
|
13
13
|
Given I have a <dir> directory
|
@@ -95,10 +95,10 @@ Feature: Site data
|
|
95
95
|
|
96
96
|
Scenario: Use configuration date in site payload
|
97
97
|
Given I have an "index.html" page that contains "{{ site.url }}"
|
98
|
-
And I have a configuration file with "url" set to "http://
|
98
|
+
And I have a configuration file with "url" set to "http://mysite.com"
|
99
99
|
When I run jekyll
|
100
100
|
Then the _site directory should exist
|
101
|
-
And I should see "http://
|
101
|
+
And I should see "http://mysite.com" in "_site/index.html"
|
102
102
|
|
103
103
|
Scenario: Access Jekyll version via jekyll.version
|
104
104
|
Given I have an "index.html" page that contains "{{ jekyll.version }}"
|
@@ -7,14 +7,14 @@ end
|
|
7
7
|
World(Test::Unit::Assertions)
|
8
8
|
|
9
9
|
Given /^I have a blank site in "(.*)"$/ do |path|
|
10
|
-
FileUtils.
|
10
|
+
FileUtils.mkdir(path)
|
11
11
|
end
|
12
12
|
|
13
13
|
Given /^I do not have a "(.*)" directory$/ do |path|
|
14
14
|
File.directory?("#{TEST_DIR}/#{path}")
|
15
15
|
end
|
16
16
|
|
17
|
-
# Like "I have a foo file" but gives a yaml front matter so
|
17
|
+
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
|
18
18
|
Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
|
19
19
|
File.open(file, 'w') do |f|
|
20
20
|
f.write <<EOF
|
@@ -38,18 +38,7 @@ Given /^I have an? (.*) (layout|theme) that contains "(.*)"$/ do |name, type, te
|
|
38
38
|
else
|
39
39
|
'_theme'
|
40
40
|
end
|
41
|
-
|
42
|
-
destination_path = File.dirname(destination_file)
|
43
|
-
unless File.exist?(destination_path)
|
44
|
-
FileUtils.mkdir_p(destination_path)
|
45
|
-
end
|
46
|
-
File.open(destination_file, 'w') do |f|
|
47
|
-
f.write(text)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
Given /^I have an? "(.*)" file with content:$/ do |file, text|
|
52
|
-
File.open(file, 'w') do |f|
|
41
|
+
File.open(File.join(folder, name + '.html'), 'w') do |f|
|
53
42
|
f.write(text)
|
54
43
|
end
|
55
44
|
end
|
@@ -122,19 +111,19 @@ Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table|
|
|
122
111
|
end
|
123
112
|
|
124
113
|
|
125
|
-
When /^I run
|
114
|
+
When /^I run jekyll$/ do
|
126
115
|
run_jekyll
|
127
116
|
end
|
128
117
|
|
129
|
-
When /^I run
|
118
|
+
When /^I run jekyll with drafts$/ do
|
130
119
|
run_jekyll(:drafts => true)
|
131
120
|
end
|
132
121
|
|
133
|
-
When /^I call
|
122
|
+
When /^I call jekyll new with test_blank --blank$/ do
|
134
123
|
call_jekyll_new(:path => "test_blank", :blank => true)
|
135
124
|
end
|
136
125
|
|
137
|
-
When /^I debug
|
126
|
+
When /^I debug jekyll$/ do
|
138
127
|
run_jekyll(:debug => true)
|
139
128
|
end
|
140
129
|
|
@@ -148,42 +137,38 @@ When /^I delete the file "(.*)"$/ do |file|
|
|
148
137
|
File.delete(file)
|
149
138
|
end
|
150
139
|
|
151
|
-
Then /^the (.*) directory should
|
140
|
+
Then /^the (.*) directory should exist$/ do |dir|
|
152
141
|
assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
|
153
142
|
end
|
154
143
|
|
155
|
-
Then /^the (.*) directory should not exist$/ do |dir|
|
156
|
-
assert !File.directory?(dir), "The directory \"#{dir}\" exists"
|
157
|
-
end
|
158
|
-
|
159
144
|
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
|
160
|
-
|
145
|
+
assert Regexp.new(text).match(File.open(file).readlines.join)
|
161
146
|
end
|
162
147
|
|
163
148
|
Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
|
164
|
-
assert_equal text,
|
149
|
+
assert_equal text, File.open(file).readlines.join.strip
|
165
150
|
end
|
166
151
|
|
167
152
|
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
|
168
|
-
assert_no_match Regexp.new(text),
|
153
|
+
assert_no_match Regexp.new(text), File.read(file)
|
169
154
|
end
|
170
155
|
|
171
156
|
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
|
172
|
-
|
157
|
+
assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
|
173
158
|
end
|
174
159
|
|
175
|
-
Then /^the "(.*)" file should
|
176
|
-
assert File.file?(file)
|
160
|
+
Then /^the "(.*)" file should exist$/ do |file|
|
161
|
+
assert File.file?(file)
|
177
162
|
end
|
178
163
|
|
179
164
|
Then /^the "(.*)" file should not exist$/ do |file|
|
180
|
-
assert !File.exists?(file)
|
165
|
+
assert !File.exists?(file)
|
181
166
|
end
|
182
167
|
|
183
168
|
Then /^I should see today's time in "(.*)"$/ do |file|
|
184
|
-
assert_match Regexp.new(
|
169
|
+
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join
|
185
170
|
end
|
186
171
|
|
187
172
|
Then /^I should see today's date in "(.*)"$/ do |file|
|
188
|
-
assert_match Regexp.new(Date.today.to_s),
|
173
|
+
assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
|
189
174
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
if RUBY_VERSION > '1.9'
|
2
|
-
require 'coveralls'
|
3
|
-
Coveralls.wear_merged!
|
4
|
-
end
|
5
|
-
|
6
1
|
require 'fileutils'
|
7
2
|
require 'rr'
|
8
3
|
require 'test/unit'
|
@@ -12,7 +7,7 @@ TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
|
12
7
|
JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll')
|
13
8
|
|
14
9
|
def run_jekyll(opts = {})
|
15
|
-
command =
|
10
|
+
command = JEKYLL_PATH.clone
|
16
11
|
command << " build"
|
17
12
|
command << " --drafts" if opts[:drafts]
|
18
13
|
command << " >> /dev/null 2>&1" if opts[:debug].nil?
|
@@ -20,7 +15,7 @@ def run_jekyll(opts = {})
|
|
20
15
|
end
|
21
16
|
|
22
17
|
def call_jekyll_new(opts = {})
|
23
|
-
command =
|
18
|
+
command = JEKYLL_PATH.clone
|
24
19
|
command << " new"
|
25
20
|
command << " #{opts[:path]}" if opts[:path]
|
26
21
|
command << " --blank" if opts[:blank]
|
@@ -40,36 +35,5 @@ def location(folder, direction)
|
|
40
35
|
[before || '.', after || '.']
|
41
36
|
end
|
42
37
|
|
43
|
-
def file_contents(path)
|
44
|
-
File.open(path) do |file|
|
45
|
-
file.readlines.join # avoid differences with \n and \r\n line endings
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def seconds_agnostic_datetime(datetime = Time.now)
|
50
|
-
pieces = datetime.to_s.split(" ")
|
51
|
-
if pieces.size == 6 # Ruby 1.8.7
|
52
|
-
date = pieces[0..2].join(" ")
|
53
|
-
time = seconds_agnostic_time(pieces[3])
|
54
|
-
zone = pieces[4..5].join(" ")
|
55
|
-
else # Ruby 1.9.1 or greater
|
56
|
-
date, time, zone = pieces
|
57
|
-
time = seconds_agnostic_time(time)
|
58
|
-
end
|
59
|
-
[
|
60
|
-
Regexp.escape(date),
|
61
|
-
"#{time}:\\d{2}",
|
62
|
-
Regexp.escape(zone)
|
63
|
-
].join("\\ ")
|
64
|
-
end
|
65
|
-
|
66
|
-
def seconds_agnostic_time(time)
|
67
|
-
if time.is_a? Time
|
68
|
-
time = time.strftime("%H:%M:%S")
|
69
|
-
end
|
70
|
-
hour, minutes, _ = time.split(":")
|
71
|
-
"#{hour}:#{minutes}"
|
72
|
-
end
|
73
|
-
|
74
38
|
# work around "invalid option: --format" cucumber bug (see #296)
|
75
39
|
Test::Unit.run = true if RUBY_VERSION < '1.9'
|
@@ -1,3 +1,3 @@
|
|
1
|
-
name: Your New Jekyll Site
|
2
|
-
markdown:
|
1
|
+
name: Your New tigefa as Jekyll Site
|
2
|
+
markdown: kromdown
|
3
3
|
pygments: true
|
@@ -34,16 +34,16 @@ a:visited { color: #a0a; }
|
|
34
34
|
/* Home
|
35
35
|
/*
|
36
36
|
/*****************************************************************************/
|
37
|
-
.posts {
|
37
|
+
ul.posts {
|
38
38
|
list-style-type: none;
|
39
39
|
margin-bottom: 2em;
|
40
40
|
}
|
41
41
|
|
42
|
-
.posts li {
|
42
|
+
ul.posts li {
|
43
43
|
line-height: 1.75em;
|
44
44
|
}
|
45
45
|
|
46
|
-
.posts span {
|
46
|
+
ul.posts span {
|
47
47
|
color: #aaa;
|
48
48
|
font-family: Monaco, "Courier New", monospace;
|
49
49
|
font-size: 80%;
|
@@ -63,38 +63,38 @@ a:visited { color: #a0a; }
|
|
63
63
|
line-height: 1.5em;
|
64
64
|
}
|
65
65
|
|
66
|
-
.header a {
|
66
|
+
.site .header a {
|
67
67
|
font-weight: bold;
|
68
68
|
text-decoration: none;
|
69
69
|
}
|
70
70
|
|
71
|
-
.title {
|
71
|
+
.site .header h1.title {
|
72
72
|
display: inline-block;
|
73
73
|
margin-bottom: 2em;
|
74
74
|
}
|
75
75
|
|
76
|
-
.title a {
|
76
|
+
.site .header h1.title a {
|
77
77
|
color: #a00;
|
78
78
|
}
|
79
79
|
|
80
|
-
.title a:hover {
|
80
|
+
.site .header h1.title a:hover {
|
81
81
|
color: #000;
|
82
82
|
}
|
83
83
|
|
84
|
-
.header a.extra {
|
84
|
+
.site .header a.extra {
|
85
85
|
color: #aaa;
|
86
86
|
margin-left: 1em;
|
87
87
|
}
|
88
88
|
|
89
|
-
.header a.extra:hover {
|
89
|
+
.site .header a.extra:hover {
|
90
90
|
color: #000;
|
91
91
|
}
|
92
92
|
|
93
|
-
.meta {
|
93
|
+
.site .meta {
|
94
94
|
color: #aaa;
|
95
95
|
}
|
96
96
|
|
97
|
-
.footer {
|
97
|
+
.site .footer {
|
98
98
|
font-size: 80%;
|
99
99
|
color: #666;
|
100
100
|
border-top: 4px solid #eee;
|
@@ -102,22 +102,22 @@ a:visited { color: #a0a; }
|
|
102
102
|
overflow: hidden;
|
103
103
|
}
|
104
104
|
|
105
|
-
.footer .contact {
|
105
|
+
.site .footer .contact {
|
106
106
|
float: left;
|
107
107
|
margin-right: 3em;
|
108
108
|
}
|
109
109
|
|
110
|
-
.footer .contact a {
|
110
|
+
.site .footer .contact a {
|
111
111
|
color: #8085C1;
|
112
112
|
}
|
113
113
|
|
114
|
-
.footer .rss {
|
114
|
+
.site .footer .rss {
|
115
115
|
margin-top: 1.1em;
|
116
116
|
margin-right: -.2em;
|
117
117
|
float: right;
|
118
118
|
}
|
119
119
|
|
120
|
-
.footer .rss img {
|
120
|
+
.site .footer .rss img {
|
121
121
|
border: 0;
|
122
122
|
}
|
123
123
|
|
data/lib/tigefa.rb
CHANGED
@@ -20,13 +20,11 @@ require 'fileutils'
|
|
20
20
|
require 'time'
|
21
21
|
require 'safe_yaml'
|
22
22
|
require 'English'
|
23
|
-
require 'pathname'
|
24
23
|
|
25
24
|
# 3rd party
|
26
25
|
require 'liquid'
|
27
26
|
require 'maruku'
|
28
27
|
require 'colorator'
|
29
|
-
require 'toml'
|
30
28
|
|
31
29
|
# internal requires
|
32
30
|
require 'tigefa/core_ext'
|
@@ -46,7 +44,6 @@ require 'tigefa/static_file'
|
|
46
44
|
require 'tigefa/errors'
|
47
45
|
require 'tigefa/related_posts'
|
48
46
|
require 'tigefa/cleaner'
|
49
|
-
require 'tigefa/entry_filter'
|
50
47
|
|
51
48
|
# extensions
|
52
49
|
require 'tigefa/plugin'
|
@@ -62,8 +59,8 @@ require_all 'tigefa/tags'
|
|
62
59
|
|
63
60
|
SafeYAML::OPTIONS[:suppress_warnings] = true
|
64
61
|
|
65
|
-
module
|
66
|
-
VERSION = '1.1.
|
62
|
+
module Jekyll
|
63
|
+
VERSION = '1.1.3'
|
67
64
|
|
68
65
|
# Public: Generate a Jekyll configuration Hash by merging the default
|
69
66
|
# options with anything in _config.yml, and adding the given options on top.
|
data/lib/tigefa/cleaner.rb
CHANGED
@@ -2,7 +2,7 @@ require 'set'
|
|
2
2
|
|
3
3
|
module Tigefa
|
4
4
|
class Site
|
5
|
-
# Handles the cleanup of a site's destination before
|
5
|
+
# Handles the cleanup of a site's destination before the site is built.
|
6
6
|
class Cleaner
|
7
7
|
def initialize(site)
|
8
8
|
@site = site
|
@@ -15,14 +15,14 @@ module Tigefa
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
# Private: The list of files and directories to be deleted during cleanup process
|
18
|
+
# Private: The list of files and directories to be deleted during the cleanup process
|
19
19
|
#
|
20
|
-
# Returns an Array
|
20
|
+
# Returns an Array with the file and directory paths
|
21
21
|
def obsolete_files
|
22
22
|
(existing_files - new_files - new_dirs + replaced_files).to_a
|
23
23
|
end
|
24
24
|
|
25
|
-
# Private: The list of existing files,
|
25
|
+
# Private: The list of existing files, except those included in keep_files and hidden files.
|
26
26
|
#
|
27
27
|
# Returns a Set with the file paths
|
28
28
|
def existing_files
|
@@ -33,7 +33,7 @@ module Tigefa
|
|
33
33
|
files
|
34
34
|
end
|
35
35
|
|
36
|
-
# Private: The list of files to be created when site is built.
|
36
|
+
# Private: The list of files to be created when the site is built.
|
37
37
|
#
|
38
38
|
# Returns a Set with the file paths
|
39
39
|
def new_files
|
@@ -42,7 +42,7 @@ module Tigefa
|
|
42
42
|
files
|
43
43
|
end
|
44
44
|
|
45
|
-
# Private: The list of directories to be created when site is built.
|
45
|
+
# Private: The list of directories to be created when the site is built.
|
46
46
|
# These are the parent directories of the files in #new_files.
|
47
47
|
#
|
48
48
|
# Returns a Set with the directory paths
|
@@ -57,7 +57,7 @@ module Tigefa
|
|
57
57
|
new_dirs.select { |dir| File.file?(dir) }.to_set
|
58
58
|
end
|
59
59
|
|
60
|
-
# Private:
|
60
|
+
# Private: creates a regular expression from the config's keep_files array
|
61
61
|
#
|
62
62
|
# Examples
|
63
63
|
# ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
|
@@ -70,4 +70,4 @@ module Tigefa
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
|
-
end
|
73
|
+
end
|