sitefs 1.0.0.beta3 → 1.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +46 -43
- data/bin/sitefs +1 -1
- data/lib/sitefs/file_action.rb +14 -1
- data/lib/sitefs/file_action_set.rb +0 -2
- data/lib/sitefs/handlers/single_erb.rb +1 -0
- data/lib/sitefs/path_helper.rb +1 -1
- data/lib/sitefs/render_context.rb +2 -0
- data/lib/sitefs/version.rb +1 -1
- data/lib/sitefs/walker.rb +15 -4
- data/lib/sitefs/watcher.rb +13 -5
- data/sitefs.gemspec +0 -1
- metadata +3 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a028c7b92fbaf174d300f1d57606e019a297fbf8ce8f68f1bc8c85b62185e089
|
4
|
+
data.tar.gz: 9e42f5715c7f3978768f124508be9fb5ec37c4acc71118e1d6bf27a297027907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2108a026a55070b74437033f4ecf51ce9b57935221c8f3f2de2b8f6a5829d6a3fb8466433885bf7b4f48d7810b3a63eac34a378428ddc767f7aa42e3993c7950
|
7
|
+
data.tar.gz: c6ea8d02ce13695d604f5e2041fb502212b652cfe389ea5a95c212737955fd4593938b3262ee878363c86e0ac29818f47af2a14f10916d210849233f10cebab3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sitefs (1.0.0.
|
4
|
+
sitefs (1.0.0.beta5)
|
5
5
|
autoloaded (~> 2)
|
6
6
|
aws-sdk (~> 2)
|
7
7
|
diffy (~> 3)
|
@@ -10,7 +10,6 @@ PATH
|
|
10
10
|
html-pipeline-rouge_filter (~> 1.0)
|
11
11
|
listen (~> 3.1)
|
12
12
|
mime-types (~> 3)
|
13
|
-
ratom (~> 0.9)
|
14
13
|
rinku (~> 2.0)
|
15
14
|
sass (~> 3.4)
|
16
15
|
slop (~> 4)
|
@@ -19,54 +18,54 @@ PATH
|
|
19
18
|
GEM
|
20
19
|
remote: https://rubygems.org/
|
21
20
|
specs:
|
22
|
-
activesupport (
|
21
|
+
activesupport (6.0.2.1)
|
23
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
-
i18n (
|
23
|
+
i18n (>= 0.7, < 2)
|
25
24
|
minitest (~> 5.1)
|
26
25
|
tzinfo (~> 1.1)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
aws-sdk
|
26
|
+
zeitwerk (~> 2.2)
|
27
|
+
autoloaded (2.2.1)
|
28
|
+
aws-eventstream (1.0.3)
|
29
|
+
aws-sdk (2.11.454)
|
30
|
+
aws-sdk-resources (= 2.11.454)
|
31
|
+
aws-sdk-core (2.11.454)
|
31
32
|
aws-sigv4 (~> 1.0)
|
32
33
|
jmespath (~> 1.0)
|
33
|
-
aws-sdk-resources (2.
|
34
|
-
aws-sdk-core (= 2.
|
35
|
-
aws-sigv4 (1.
|
36
|
-
|
34
|
+
aws-sdk-resources (2.11.454)
|
35
|
+
aws-sdk-core (= 2.11.454)
|
36
|
+
aws-sigv4 (1.1.1)
|
37
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
38
|
+
concurrent-ruby (1.1.6)
|
37
39
|
diff-lcs (1.3)
|
38
|
-
diffy (3.
|
39
|
-
ffi (1.
|
40
|
+
diffy (3.3.0)
|
41
|
+
ffi (1.12.2)
|
40
42
|
github-markdown (0.6.9)
|
41
|
-
html-pipeline (2.
|
43
|
+
html-pipeline (2.12.3)
|
42
44
|
activesupport (>= 2)
|
43
45
|
nokogiri (>= 1.4)
|
44
|
-
html-pipeline-rouge_filter (1.0.
|
46
|
+
html-pipeline-rouge_filter (1.0.7)
|
45
47
|
activesupport
|
46
48
|
html-pipeline (>= 1.11)
|
47
|
-
rouge (
|
48
|
-
i18n (
|
49
|
-
|
50
|
-
|
51
|
-
listen (3.1
|
52
|
-
rb-fsevent (~> 0.
|
53
|
-
rb-inotify (~> 0.9, >= 0.9.
|
54
|
-
|
55
|
-
mime-types (3.1)
|
49
|
+
rouge (>= 2.0.0, < 4)
|
50
|
+
i18n (1.8.2)
|
51
|
+
concurrent-ruby (~> 1.0)
|
52
|
+
jmespath (1.4.0)
|
53
|
+
listen (3.2.1)
|
54
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
55
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
56
|
+
mime-types (3.3.1)
|
56
57
|
mime-types-data (~> 3.2015)
|
57
|
-
mime-types-data (3.
|
58
|
-
mini_portile2 (2.
|
59
|
-
minitest (5.
|
60
|
-
nokogiri (1.8
|
61
|
-
mini_portile2 (~> 2.
|
58
|
+
mime-types-data (3.2019.1009)
|
59
|
+
mini_portile2 (2.4.0)
|
60
|
+
minitest (5.14.0)
|
61
|
+
nokogiri (1.10.8)
|
62
|
+
mini_portile2 (~> 2.4.0)
|
62
63
|
rake (12.0.0)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
rinku (2.0.2)
|
69
|
-
rouge (2.0.7)
|
64
|
+
rb-fsevent (0.10.3)
|
65
|
+
rb-inotify (0.10.1)
|
66
|
+
ffi (~> 1.0)
|
67
|
+
rinku (2.0.6)
|
68
|
+
rouge (3.16.0)
|
70
69
|
rspec (3.5.0)
|
71
70
|
rspec-core (~> 3.5.0)
|
72
71
|
rspec-expectations (~> 3.5.0)
|
@@ -80,13 +79,17 @@ GEM
|
|
80
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
80
|
rspec-support (~> 3.5.0)
|
82
81
|
rspec-support (3.5.0)
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
sass (3.7.4)
|
83
|
+
sass-listen (~> 4.0.0)
|
84
|
+
sass-listen (4.0.0)
|
85
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
86
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
87
|
+
slop (4.8.0)
|
86
88
|
stamp (0.6.0)
|
87
|
-
thread_safe (0.3.
|
88
|
-
tzinfo (1.2.
|
89
|
+
thread_safe (0.3.6)
|
90
|
+
tzinfo (1.2.6)
|
89
91
|
thread_safe (~> 0.1)
|
92
|
+
zeitwerk (2.2.2)
|
90
93
|
|
91
94
|
PLATFORMS
|
92
95
|
ruby
|
@@ -98,4 +101,4 @@ DEPENDENCIES
|
|
98
101
|
sitefs!
|
99
102
|
|
100
103
|
BUNDLED WITH
|
101
|
-
1.
|
104
|
+
1.17.3
|
data/bin/sitefs
CHANGED
data/lib/sitefs/file_action.rb
CHANGED
@@ -37,6 +37,15 @@ class Sitefs::FileAction
|
|
37
37
|
type
|
38
38
|
end
|
39
39
|
|
40
|
+
def content_causes_error?
|
41
|
+
begin
|
42
|
+
content
|
43
|
+
nil
|
44
|
+
rescue => error
|
45
|
+
error
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
40
49
|
def content
|
41
50
|
if @content.respond_to?(:call)
|
42
51
|
@content = @content.call
|
@@ -123,7 +132,11 @@ class Sitefs::FileAction
|
|
123
132
|
|
124
133
|
case action
|
125
134
|
when :write
|
126
|
-
if
|
135
|
+
if error = content_causes_error?
|
136
|
+
log :exception, path
|
137
|
+
puts error.message
|
138
|
+
puts error.backtrace
|
139
|
+
elsif should_write? config, action, path
|
127
140
|
log :generate, path
|
128
141
|
FileUtils.mkdir_p dirname
|
129
142
|
File.open(path, 'w') { |file| file.write content }
|
data/lib/sitefs/path_helper.rb
CHANGED
data/lib/sitefs/version.rb
CHANGED
data/lib/sitefs/walker.rb
CHANGED
@@ -40,8 +40,10 @@ class Sitefs::Walker
|
|
40
40
|
IGNORE_MATCHERS = [
|
41
41
|
'**/node_modules',
|
42
42
|
'**/.sass-cache',
|
43
|
+
'**/.sass-cache/**/*.scssc',
|
43
44
|
'**/.git',
|
44
45
|
'**/.DS_Store',
|
46
|
+
"**/#{Sitefs::MANIFEST_FILENAME}"
|
45
47
|
]
|
46
48
|
|
47
49
|
def initialize config
|
@@ -52,19 +54,29 @@ class Sitefs::Walker
|
|
52
54
|
@config.root_path
|
53
55
|
end
|
54
56
|
|
57
|
+
def ignore_matchers
|
58
|
+
IGNORE_MATCHERS | config.ignore_patterns
|
59
|
+
end
|
60
|
+
|
61
|
+
def match_args
|
62
|
+
match_args = File::FNM_CASEFOLD | File::FNM_EXTGLOB | File::FNM_PATHNAME | File::FNM_DOTMATCH
|
63
|
+
end
|
64
|
+
|
65
|
+
def path_should_be_ignored path
|
66
|
+
ignore_matchers.find {|pattern| File.fnmatch(pattern, path, match_args)}
|
67
|
+
end
|
68
|
+
|
55
69
|
def walk
|
56
70
|
reg = FileRegistry.new
|
57
71
|
|
58
72
|
Dir.chdir root_path
|
59
73
|
|
60
|
-
ignore_matchers = IGNORE_MATCHERS | config.ignore_patterns
|
61
74
|
handlers = HANDLERS.map_keys {|ext| File.join('**', "*.#{ext}") }
|
62
|
-
match_args = File::FNM_CASEFOLD | File::FNM_EXTGLOB | File::FNM_PATHNAME
|
63
75
|
|
64
76
|
Find.find root_path do |full_path|
|
65
77
|
path = full_path.sub(root_path, '')
|
66
78
|
|
67
|
-
if
|
79
|
+
if path_should_be_ignored(path)
|
68
80
|
Find.prune if File.directory?(path)
|
69
81
|
next
|
70
82
|
end
|
@@ -72,7 +84,6 @@ class Sitefs::Walker
|
|
72
84
|
if handler_class = handlers.find_value { |pattern, handler_class| File.fnmatch(pattern, path, match_args)}
|
73
85
|
handler = handler_class.new(root_path, full_path)
|
74
86
|
|
75
|
-
|
76
87
|
reg << handler if handler.should_generate?(config)
|
77
88
|
end
|
78
89
|
end
|
data/lib/sitefs/watcher.rb
CHANGED
@@ -63,21 +63,29 @@ class Sitefs::Watcher
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def change modified, added, removed
|
66
|
-
puts "Change detected:"
|
67
66
|
|
68
|
-
modified.
|
69
|
-
added.
|
70
|
-
removed.
|
67
|
+
modified = modified.map{|f| f.sub(root_path, '')}.select{|f| !walker.path_should_be_ignored(f)}
|
68
|
+
added = added.map{|f| f.sub(root_path, '')}.select{|f| !walker.path_should_be_ignored(f)}
|
69
|
+
removed = removed.map{|f| f.sub(root_path, '')}.select{|f| !walker.path_should_be_ignored(f)}
|
71
70
|
|
72
71
|
all = (modified | added | removed)
|
73
72
|
|
73
|
+
return if all.empty?
|
74
|
+
|
74
75
|
as = action_set
|
75
76
|
|
76
77
|
has_ungenerated_file = all.find do |path|
|
77
78
|
!as.includes_path?(path)
|
78
79
|
end
|
79
80
|
|
80
|
-
|
81
|
+
if has_ungenerated_file
|
82
|
+
puts "Change detected:"
|
83
|
+
modified.each {|f| puts " modified: #{f}"}
|
84
|
+
added.each {|f| puts " added: #{f}"}
|
85
|
+
removed.each {|f| puts " removed: #{f}"}
|
86
|
+
puts "Perform actions: "
|
87
|
+
as.call(walker.config, :write)
|
88
|
+
end
|
81
89
|
|
82
90
|
puts ''
|
83
91
|
end
|
data/sitefs.gemspec
CHANGED
@@ -33,7 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency 'listen', '~> 3.1'
|
34
34
|
spec.add_dependency 'sass', '~> 3.4'
|
35
35
|
spec.add_dependency 'stamp', '~> 0.6'
|
36
|
-
spec.add_dependency 'ratom', '~> 0.9'
|
37
36
|
spec.add_dependency 'autoloaded', '~> 2'
|
38
37
|
spec.add_dependency 'slop', '~> 4'
|
39
38
|
spec.add_dependency 'diffy', '~> 3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitefs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tal Atlas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.6'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: ratom
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.9'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.9'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: autoloaded
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -327,8 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
327
313
|
- !ruby/object:Gem::Version
|
328
314
|
version: 1.3.1
|
329
315
|
requirements: []
|
330
|
-
|
331
|
-
rubygems_version: 2.6.12
|
316
|
+
rubygems_version: 3.0.6
|
332
317
|
signing_key:
|
333
318
|
specification_version: 4
|
334
319
|
summary: A simple static site generator
|