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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: da2c5fa4d72e3ce2a8a03aab7b8c7f76e066ffb9
4
- data.tar.gz: 2f8c4fb2c48f20a7e359a7268663a7e60220509a
2
+ SHA256:
3
+ metadata.gz: a028c7b92fbaf174d300f1d57606e019a297fbf8ce8f68f1bc8c85b62185e089
4
+ data.tar.gz: 9e42f5715c7f3978768f124508be9fb5ec37c4acc71118e1d6bf27a297027907
5
5
  SHA512:
6
- metadata.gz: 6b2b7da914a23d0ebfc777fc5ec5a1d73037deae44b8c6bd30d34c7876ee256e6cd0c3b1ead5ce4afd0d3eb44e796d9fa318cfd901ae6c50a3086701746dd02a
7
- data.tar.gz: 680e15a00e14f4a4d87e034b29085798a1a53c117cbb435260c45a02158b2aade35928239bc2ad453256a339b96dcfb070be29c73906dbd99ae1f439a0da779d
6
+ metadata.gz: 2108a026a55070b74437033f4ecf51ce9b57935221c8f3f2de2b8f6a5829d6a3fb8466433885bf7b4f48d7810b3a63eac34a378428ddc767f7aa42e3993c7950
7
+ data.tar.gz: c6ea8d02ce13695d604f5e2041fb502212b652cfe389ea5a95c212737955fd4593938b3262ee878363c86e0ac29818f47af2a14f10916d210849233f10cebab3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sitefs (1.0.0.beta3)
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 (5.0.1)
21
+ activesupport (6.0.2.1)
23
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
- i18n (~> 0.7)
23
+ i18n (>= 0.7, < 2)
25
24
  minitest (~> 5.1)
26
25
  tzinfo (~> 1.1)
27
- autoloaded (2.1.1)
28
- aws-sdk (2.7.6)
29
- aws-sdk-resources (= 2.7.6)
30
- aws-sdk-core (2.7.6)
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.7.6)
34
- aws-sdk-core (= 2.7.6)
35
- aws-sigv4 (1.0.0)
36
- concurrent-ruby (1.0.4)
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.1.0)
39
- ffi (1.9.18)
40
+ diffy (3.3.0)
41
+ ffi (1.12.2)
40
42
  github-markdown (0.6.9)
41
- html-pipeline (2.6.0)
43
+ html-pipeline (2.12.3)
42
44
  activesupport (>= 2)
43
45
  nokogiri (>= 1.4)
44
- html-pipeline-rouge_filter (1.0.5)
46
+ html-pipeline-rouge_filter (1.0.7)
45
47
  activesupport
46
48
  html-pipeline (>= 1.11)
47
- rouge (~> 2.0.7)
48
- i18n (0.8.0)
49
- jmespath (1.3.1)
50
- libxml-ruby (2.9.0)
51
- listen (3.1.5)
52
- rb-fsevent (~> 0.9, >= 0.9.4)
53
- rb-inotify (~> 0.9, >= 0.9.7)
54
- ruby_dep (~> 1.2)
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.2016.0521)
58
- mini_portile2 (2.2.0)
59
- minitest (5.10.1)
60
- nokogiri (1.8.0)
61
- mini_portile2 (~> 2.2.0)
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
- ratom (0.9.0)
64
- libxml-ruby (~> 2.6)
65
- rb-fsevent (0.9.8)
66
- rb-inotify (0.9.8)
67
- ffi (>= 0.5.0)
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
- ruby_dep (1.5.0)
84
- sass (3.4.24)
85
- slop (4.4.1)
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.5)
88
- tzinfo (1.2.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.14.6
104
+ 1.17.3
data/bin/sitefs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'bundler/setup'
4
4
  require 'yaml'
5
- require 'sitefs'
6
5
  require 'slop'
6
+ require File.expand_path(File.join(__dir__, '../lib/sitefs'))
7
7
 
8
8
  include Sitefs
9
9
 
@@ -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 should_write? config, action, path
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 }
@@ -25,8 +25,6 @@ class Sitefs::FileActionSet
25
25
  end
26
26
 
27
27
  def includes_path? path
28
- path = File.expand_path(path)
29
-
30
28
  output_paths.include? path
31
29
  end
32
30
 
@@ -26,6 +26,7 @@ class Sitefs::Handlers::SingleErb < Sitefs::Handler
26
26
  def pages
27
27
  @pages ||= begin
28
28
  page = Page.new path_helper, attributes
29
+ page.href = path_helper.min_href_for output_path
29
30
  page.published_at = File.birthtime(source_file)
30
31
  [page]
31
32
  end
@@ -15,7 +15,7 @@ class Sitefs::PathHelper
15
15
 
16
16
  dir = File.dirname source_file
17
17
 
18
- File.expand_path(href, dir).sub(root_path, '')
18
+ File.expand_path(href, dir).sub(root_path, '').sub(/index\.html?$/, '')
19
19
  end
20
20
 
21
21
  def min_href_for path
@@ -24,6 +24,8 @@ class Sitefs::RenderContext
24
24
  end
25
25
 
26
26
  class << self
27
+ # Exists so that if there's no render context all the method calls can still
28
+ # work see Renderer#method_missing
27
29
  def nil
28
30
  @nil ||= new(nil)
29
31
  end
@@ -1,3 +1,3 @@
1
1
  module Sitefs
2
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0.beta5"
3
3
  end
@@ -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 ignore_matchers.find {|pattern| File.fnmatch(pattern, path, match_args)}
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
@@ -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.each {|f| puts " modified: #{f}"}
69
- added.each {|f| puts " added: #{f}"}
70
- removed.each {|f| puts " removed: #{f}"}
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
- as.call(walker.config, :write) if has_ungenerated_file
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
@@ -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.beta3
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: 2017-06-15 00:00:00.000000000 Z
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
- rubyforge_project:
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