sitepress-cli 0.1.23 → 0.1.24
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.
- checksums.yaml +4 -4
- data/lib/sitepress/compiler.rb +6 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14c315ff7925c7226ecbe15952d6f76e388bb662
|
4
|
+
data.tar.gz: 95e039b11e6d7eb758ff11d2373fc902a7ec68e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95652bf5e886def861c70f8e1237a0ca2ab69bde70d74efcc037028b5e4a3bd6d0fa28d106fa660c331454bd8a2e32499d47b9865679ce8398f29b2c69726137
|
7
|
+
data.tar.gz: 6f973d6728a9b3defa18eeda18ddb55d6481d521956a2efce5a785566e4044952d05fa668f9c0bf95cc7ed4267f0e0062b91545433a161332a6d6fb850d08647
|
data/lib/sitepress/compiler.rb
CHANGED
@@ -6,34 +6,31 @@ module Sitepress
|
|
6
6
|
class Compiler
|
7
7
|
include FileUtils
|
8
8
|
|
9
|
-
def initialize(site: )
|
9
|
+
def initialize(site:, stdout: $stdout)
|
10
10
|
@site = site
|
11
|
+
@stdout = stdout
|
11
12
|
end
|
12
13
|
|
13
14
|
# Iterates through all pages and writes them to disk
|
14
15
|
def compile(target_path:)
|
15
16
|
target_path = Pathname.new(target_path)
|
16
|
-
# TODO: Should file operations go here? Probably not.
|
17
17
|
mkdir_p target_path
|
18
18
|
root = Pathname.new("/")
|
19
|
-
puts "Compiling #{@site.root_path.expand_path}"
|
19
|
+
@stdout.puts "Compiling #{@site.root_path.expand_path}"
|
20
20
|
@site.resources.each do |resource|
|
21
21
|
# These are root `resource.request_path`
|
22
22
|
derooted = Pathname.new(resource.request_path).relative_path_from(root)
|
23
23
|
path = target_path.join(derooted)
|
24
24
|
mkdir_p path.dirname
|
25
|
-
puts " #{path}"
|
25
|
+
@stdout.puts " #{path}"
|
26
26
|
File.open(path.expand_path, "w"){ |f| f.write render(resource) }
|
27
27
|
end
|
28
|
-
puts "Successful compilation to #{target_path.expand_path}"
|
28
|
+
@stdout.puts "Successful compilation to #{target_path.expand_path}"
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
32
|
def render(resource)
|
33
|
-
|
34
|
-
helpers = HelperLoader.new paths: Dir.glob(@site.root_path.join("helpers/**.rb"))
|
35
|
-
context = helpers.context(locals: { current_page: resource, site: @site })
|
36
|
-
ResourceRenderer.new(resource: resource).render(context: context)
|
33
|
+
RenderingContext.new(resource: resource, site: @site).render
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitepress-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sitepress-server
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.24
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.24
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|