jekyll-archimate 0.2.4 → 0.2.5

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
2
  SHA1:
3
- metadata.gz: 286ae636a15d00a41da942349afb0fe96030d76d
4
- data.tar.gz: 1d3f7e8e92b72b9df7b6fabc01b74154b21b898f
3
+ metadata.gz: ff80653eaa463970477dd3dbd4ecca16b3f3479a
4
+ data.tar.gz: c81145111de4852bb3899ca398a03b9d65f7976d
5
5
  SHA512:
6
- metadata.gz: 89d6bb51fd7a584436eb6c7cd34acb4a465ef29c8cc1b17b7265e6699ea263de5c15005557d74cb4050d5a07acc7683f6f54cfdb9afb8c4e4957222747a64bc3
7
- data.tar.gz: e67b30a145482b2a3e5ce3ae2f43c7854a731cea0db1d8ba10e6c2e9f610e66e7e845ce9839b5dc812339aa417cd9c627e2e59ed5e41352118aabc6681bc7c8e
6
+ metadata.gz: d44deb504efcd55b8c068fe0de590056306c0c2825a65357483874567212b9fcab1cfd22fb890f3e238094faf0c1c6f3c2536430e4457373a47d573ea110e5b6
7
+ data.tar.gz: 13924d4aaf7023978733669ce2d12c542782fbfacec46dc4cb46b9599bc5d420d94a85dbc4f9ccdf3279f5d79ca88433c9b6c9de44aba70ac89e9c3f28cf7f28
@@ -13,6 +13,7 @@ module Jekyll
13
13
  end
14
14
 
15
15
  def cache_valid?(archimate_file)
16
+ return false unless archimate_file
16
17
  path = archimate_file.path
17
18
  @cache.key?(path) &&
18
19
  @cache[path].archimate_file.modified_time.to_i == archimate_file.modified_time.to_i
@@ -30,7 +31,7 @@ module Jekyll
30
31
  end
31
32
 
32
33
  def default_archimate_file=(archimate_file)
33
- unless @cache.key?(archimate_file.path)
34
+ unless !archimate_file || @cache.key?(archimate_file.path)
34
35
  raise(
35
36
  "Default ArchiMate file does not exist in cache: #{archimate_file.relative_path}"
36
37
  )
@@ -19,7 +19,10 @@ module Jekyll
19
19
  end
20
20
 
21
21
  def render(context)
22
- baseurl = context.registers[:site].baseurl
22
+ page = context.registers[:page]
23
+ page_dir = File.dirname(page["path"])
24
+ rel_archimate_dir = File.join(page_dir, "archimate")
25
+ baseurl = Dir.exist?(rel_archimate_dir) ? File.dirname(page["url"]) : context.registers[:site].baseurl
23
26
  # TODO: make the archimate_dir configurable in _config.yml and as an
24
27
  # optional argument in the tag.
25
28
  archimate_dir = [baseurl, "archimate", "svg"].join("/")
@@ -5,26 +5,16 @@ module Jekyll
5
5
  class ArchimateGenerator < Jekyll::Generator
6
6
  def generate(site)
7
7
  Jekyll.logger.info "ArchimateGenerator.generate"
8
- archimate_files = site.static_files.select { |static_file| static_file.extname =~ /\.(archimate|xml)$/ }
9
- archimate_file = preload_cache(archimate_files)
10
- return unless needs_generation?
11
- ArchimateSvgGenerator.new(site, archimate_file).generate
12
- ArchimateIndexGenerator.new(site, archimate_file).generate
13
- end
14
-
15
- private
16
-
17
- def needs_generation?
18
- cache.cache_valid?(cache.default_archimate_file)
19
- end
20
-
21
- def preload_cache(archimate_files)
22
- archimate_files.each { |file| cache.model(file) }
23
- cache.default_archimate_file = archimate_files.first # TODO: select file in the `archimate` directory
24
- end
25
-
26
- def cache
27
- @cache ||= ArchimateCache.instance
8
+ site
9
+ .collections
10
+ .values
11
+ .flat_map(&:files)
12
+ .concat(site.static_files)
13
+ .select { |static_file| static_file.extname =~ /\.(archimate|xml)$/ }
14
+ .each do |archimate_file|
15
+ ArchimateSvgGenerator.new(site, archimate_file).generate
16
+ ArchimateIndexGenerator.new(site, archimate_file).generate
17
+ end
28
18
  end
29
19
  end
30
20
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Archimate
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-archimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Morga
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll