homeostasis 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.md +1 -0
  2. data/lib/homeostasis.rb +10 -6
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
data/README.md CHANGED
@@ -182,6 +182,7 @@ slashes to URLs.
182
182
  TODO
183
183
  ====
184
184
 
185
+ * make each plugin optional
185
186
  * setup homeostasis website
186
187
 
187
188
  License
data/lib/homeostasis.rb CHANGED
@@ -30,7 +30,7 @@ module Homeostasis
30
30
  end
31
31
 
32
32
  def render_multi(path, body = nil, context = nil, locals = {})
33
- body ||= File.read(path)
33
+ body ||= Helpers.read(path)
34
34
  render_templates_for(path).each do |template|
35
35
  blk = proc { body }
36
36
  body = template.new(path, &blk).render(context, locals)
@@ -42,6 +42,10 @@ module Homeostasis
42
42
  File.basename(path).split('.')[1..-1].reverse.map { |ext| Tilt[ext] }.compact
43
43
  end
44
44
 
45
+ def self.read(path)
46
+ File.read(path, encoding: 'UTF-8')
47
+ end
48
+
45
49
  def self.stasis_path
46
50
  @@stasis_path
47
51
  end
@@ -100,7 +104,7 @@ module Homeostasis
100
104
  orig = full_orig[(@stasis.root.length+1)..-1]
101
105
  full_dest = File.join(@stasis.destination, @@mapping[orig])
102
106
  raise "File not found #{full_dest}" if !File.exists?(full_dest)
103
- contents = File.read(full_dest)
107
+ contents = Helpers.read(full_dest)
104
108
  @@mapping.delete(orig)
105
109
  File.delete(full_dest)
106
110
  contents
@@ -124,7 +128,7 @@ module Homeostasis
124
128
  inverted = @@mapping.invert
125
129
  Dir.glob("#{@stasis.destination}/**/*").each do |file|
126
130
  next if file !~ @@replace_matcher || File.directory?(file)
127
- contents = File.read(file)
131
+ contents = Helpers.read(file)
128
132
  front = front_site[inverted[file.sub("#{@stasis.destination}/", "")]]
129
133
  assets.each do |old, new|
130
134
  old = Regexp.escape(old)
@@ -276,7 +280,7 @@ module Homeostasis
276
280
  return nil if path.nil? || path !~ @@matcher
277
281
  Preamble.load(path)
278
282
  rescue
279
- [{}, File.read(path)]
283
+ [{}, Helpers.read(path)]
280
284
  end
281
285
 
282
286
  private
@@ -315,7 +319,7 @@ module Homeostasis
315
319
  return if exts.nil? || exts.length < 2
316
320
 
317
321
  yaml, body = Front.preamble_load(@stasis.path)
318
- body ||= File.read(@stasis.path)
322
+ body ||= Helpers.read(@stasis.path)
319
323
 
320
324
  @tmpfile = Tempfile.new(["temp", ".txt"])
321
325
  @tmpfile.puts(render_multi(@stasis.path, body))
@@ -451,7 +455,7 @@ module Homeostasis
451
455
  post[:path] = post[:path].sub(
452
456
  "/#{@@directory}/#{date}-",
453
457
  File.join('/', @@path, '/'))
454
- post[:body] = render_multi(filename, File.read(filename))
458
+ post[:body] = render_multi(filename, Helpers.read(filename))
455
459
  @@posts << post
456
460
  end
457
461
  @@posts = @@posts.sort_by { |post| post[:date] }.reverse
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Homeostasis
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homeostasis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: