liquidoc 0.9.2 → 0.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c366549d19a6bc289fe1cad1691ae33f0032f2842ab0b27e1f05b7a51825efd
4
- data.tar.gz: 395e62fad08ce71196fdab34441254cce41bfc267ea9df9c2b472617acc457fc
3
+ metadata.gz: a5ca3ecd0b1c24dfa6231479baec2d113e3c6a6255392416ab75d54918f51f3b
4
+ data.tar.gz: 3abde9ab8883e38c7484782afbb7c8a0bf683c45ca05e0ecc5ad62784fb3a52e
5
5
  SHA512:
6
- metadata.gz: da7f20c41c281a2a205f6910ddf414f5b4129d570d54ff794f380adf588593eea787b8830090aec953f1ec78dbaf6d02b5ecd88fe40f9fc2bce30f2b5e23907d
7
- data.tar.gz: 3f7e276a5fb1929ea8467fe829dfcab02ea6a5da3e46c21185744a1433143a8c86f4915bddd3c1f0440bed65489cf7b3af16d810031855420922a1bab4dce99b
6
+ metadata.gz: 07b617083d1467b3d485b341d0192026fce6db31632ac4fc123c8827b39202cfa9968a1e599ff07fa115c5f4878b7e105ed11586271d1d3ce1ebc88a5ee09647
7
+ data.tar.gz: b25ec34f7f2e843e0fabbf5a572f133399e0716c56fe2c2c9e5ddeff93c318645552b6adcd0a4335bd5ebd0693091050b862b0e502fd8bc34442b32a1dd61946
@@ -1,3 +1,3 @@
1
1
  module Liquidoc
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
data/lib/liquidoc.rb CHANGED
@@ -73,22 +73,24 @@ FileUtils::mkdir_p("#{@build_dir}/pre") unless File.exists?("#{@build_dir}/pre")
73
73
  # Establish source, template, index, etc details for build jobs from a config file
74
74
  def config_build config_file, config_vars={}, parse=false
75
75
  @logger.debug "Using config file #{config_file}."
76
- if config_vars or parse
76
+ validate_file_input(config_file, "config")
77
+ if config_vars.length > 0 or parse or contains_liquid(config_file)
78
+ @logger.debug "Config_vars: #{config_vars.length}"
77
79
  # If config variables are passed on the CLI, we want to parse the config file
78
80
  # and use the parsed version for the rest fo this routine
79
81
  config_out = "#{@build_dir}/pre/#{File.basename(config_file)}"
80
82
  liquify(nil,config_file, config_out, config_vars)
81
83
  config_file = config_out
82
84
  @logger.debug "Config parsed! Using #{config_out} for build."
85
+ validate_file_input(config_file, "config")
83
86
  end
84
- validate_file_input(config_file, "config")
85
87
  begin
86
88
  config = YAML.load_file(config_file)
87
- rescue
89
+ rescue Exception => ex
88
90
  unless File.exists?(config_file)
89
91
  @logger.error "Config file #{config_file} not found."
90
92
  else
91
- @logger.error "Problem loading config file #{config_file}. Exiting."
93
+ @logger.error "Problem loading config file #{config_file}. #{ex} Exiting."
92
94
  end
93
95
  raise "ConfigFileError"
94
96
  end
@@ -176,6 +178,16 @@ def validate_config_structure config
176
178
  # TODO More validation needed
177
179
  end
178
180
 
181
+ def contains_liquid filename
182
+ File.open(filename, "r") do |file_proc|
183
+ file_proc.each_line do |row|
184
+ if row.match(/.*\{\%.*\%\}.*|.*\{\{.*\}\}.*/)
185
+ return true
186
+ end
187
+ end
188
+ end
189
+ end
190
+
179
191
  def explainer_init out=nil
180
192
  unless @explainer
181
193
  if out == "STDOUT"
@@ -931,12 +943,15 @@ def generate_site doc, build
931
943
  File.open("#{@build_dir}/pre/_attributes.yml", 'w') { |file| file.write(attrs_yaml) }
932
944
  build.add_config_file("#{@build_dir}/pre/_attributes.yml")
933
945
  config_list = build.prop_files_array.join(',') # flatten the Array back down for the CLI
934
- opts_args = ""
935
946
  quiet = "--quiet" if @quiet || @explicit
936
947
  if build.props['arguments']
937
- opts_args = build.props['arguments'].to_opts_args
948
+ opts_args_file = "#{@build_dir}/pre/jekyll_opts_args.yml"
949
+ opts_args = build.props['arguments']
950
+ File.open(opts_args_file, 'w') { |file|
951
+ file.write(opts_args.to_yaml)}
952
+ config_list << ",#{opts_args_file}"
938
953
  end
939
- base_args = "--config #{config_list} #{opts_args}"
954
+ base_args = "--config #{config_list}"
940
955
  command = "bundle exec jekyll build #{base_args} #{quiet}"
941
956
  if @search_index
942
957
  # TODO enable config-based admin api key ingest once config is dynamic
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dominick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-29 00:00:00.000000000 Z
11
+ date: 2018-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler