bookbindery 8.1.0 → 8.2.0

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
  SHA1:
3
- metadata.gz: 6cb870420c8d260fe02e262c3d8db416a668a3fa
4
- data.tar.gz: c2b4a7842bcdbcba9006096c7f5b4e08c04eff33
3
+ metadata.gz: fcd1dc76ec62824fab802bbb5e08808386ef14c7
4
+ data.tar.gz: 8ff5324ec2299c32efb456ce6790bfc4e01f0b60
5
5
  SHA512:
6
- metadata.gz: a45300da2301b2e37ea278f03d221d52592f9a6ad42429b349fe7169f75ae9b15aade134740f9c17a0effd101e807f00476f73970a8a4573ffea1a3ce0210e50
7
- data.tar.gz: 1b3fa518acaa00628b2115d4c166df2272d08ca564416565a36e3d60aa69c82404d8dd97de84f2ed939eb2a04b608b11d8e4dfce8eadcb37f0d042f0a607c8e6
6
+ metadata.gz: b48e8514aa4342a99e7c1baf6e4bd63db7c853b6a98a5ee7023c20e0bb25c8fdccf4ed7b7b3d91362972cb1f9e0faa2e6489fbc3003df285bbf8237b58f7a30d
7
+ data.tar.gz: 2be9a7261db512afdf22020be057ceaae5b5395567e8c2f613a6342fc9eefd5d6ea33dae69549c02b194ddc5ab191848ac4d2ea4b5207eaabbf25aef0029c741
data/bookbinder.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'base64'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'bookbindery'
5
- s.version = '8.1.0'
5
+ s.version = '8.2.0'
6
6
  s.summary = 'Markdown to Rackup application documentation generator'
7
7
  s.description = 'A command line utility to be run in Book repositories to stitch together their constituent Markdown repos into a static-HTML-serving application'
8
8
  s.authors = ['Mike Grafton', 'Lucas Marks', 'Gavin Morgan', 'Nikhil Gajwani', 'Dan Wendorf', 'Brenda Chan', 'Matthew Boedicker', 'Frank Kotsianas', 'Elena Sharma', 'Christa Hartsock', 'Michael Trestman']
@@ -58,6 +58,7 @@ module Bookbinder
58
58
  cloner,
59
59
  ref_override: bind_options.ref_override
60
60
  )
61
+
61
62
  sections = section_repository.fetch(
62
63
  configured_sections: bind_config.sections,
63
64
  destination_dir: output_locations.cloned_preprocessing_dir,
@@ -75,13 +76,15 @@ module Bookbinder
75
76
  if file_system_accessor.file_exist?('redirects.rb')
76
77
  file_system_accessor.copy('redirects.rb', output_locations.final_app_dir)
77
78
  end
79
+
78
80
  generation_result = middleman_runner.run(
79
81
  ["build", bind_options.verbosity].compact.join(" "),
80
82
  streams: bind_options.streams,
81
83
  output_locations: output_locations,
82
84
  config: config_decorator.generate(bind_config, sections),
83
85
  local_repo_dir: bind_options.local_repo_dir,
84
- subnavs: subnavs(sections)
86
+ subnavs: subnavs(sections),
87
+ product_info: product_infos(sections)
85
88
  )
86
89
  if generation_result.success?
87
90
  file_system_accessor.copy(output_locations.build_dir, output_locations.public_dir)
@@ -118,6 +121,14 @@ module Bookbinder
118
121
  def subnavs(sections)
119
122
  sections.map(&:subnav).reduce({}, :merge)
120
123
  end
124
+
125
+ def product_infos(sections)
126
+ temp = Hash.new
127
+ sections.each do |section|
128
+ temp[section.namespace] = section.product_info
129
+ end
130
+ temp
131
+ end
121
132
  end
122
133
  end
123
134
  end
@@ -17,6 +17,8 @@ module Bookbinder
17
17
  @base_config ||= read_config_file
18
18
  @optional_configs ||= read_optional_configs
19
19
 
20
+ # require 'pry'; binding.pry
21
+
20
22
  @config ||= validate(@base_config, @optional_configs)
21
23
  end
22
24
 
@@ -60,8 +60,20 @@ module Bookbinder
60
60
  def inspect
61
61
  config.inspect
62
62
  end
63
+
63
64
  alias_method :subnav_name, :product_id
64
65
 
66
+ def product_info
67
+ return '' if config['product_info'].nil?
68
+ {'use_local_header' => config['product_info']['use_local_header'],
69
+ 'latest_stable_version' => config['product_info']['latest_stable_version'],
70
+ 'changelog_href' => config['product_info']['changelog_href'],
71
+ 'local_header_img' => config['product_info']['local_header_img'],
72
+ 'local_header_title' => config['product_info']['local_header_title'],
73
+ 'local_header_links' => config['product_info']['local_header_links'],
74
+ 'local_header_version_list' => config['product_info']['local_header_version_list']}
75
+ end
76
+
65
77
  private
66
78
 
67
79
  def repo
@@ -1,4 +1,5 @@
1
1
  require_relative '../values/section'
2
+ require_relative '../values/product_info'
2
3
 
3
4
  module Bookbinder
4
5
  module Ingest
@@ -10,6 +11,7 @@ module Bookbinder
10
11
  streams: nil)
11
12
  configured_sections.map do |section_config|
12
13
  streams[:success].puts("Gathering #{section_config.repo_name}")
14
+
13
15
  working_copy = cloner.call(source_repo_name: section_config.repo_name,
14
16
  source_ref: ref_override || section_config.repo_ref,
15
17
  destination_parent_dir: destination_dir,
@@ -35,7 +37,8 @@ module Bookbinder
35
37
  section_config.at_repo_path,
36
38
  section_config.repo_name,
37
39
  working_copy.ref,
38
- section_config.pdf_output_filename
40
+ section_config.pdf_output_filename,
41
+ section_config.product_info
39
42
  )
40
43
  end
41
44
  end
@@ -15,7 +15,8 @@ module Bookbinder
15
15
  output_locations: nil,
16
16
  config: nil,
17
17
  local_repo_dir: nil,
18
- subnavs: nil)
18
+ subnavs: nil,
19
+ product_info: nil)
19
20
  streams[:out].puts "\nRunning middleman...\n\n"
20
21
  Dir.chdir(output_locations.master_dir) do
21
22
  config = {
@@ -27,8 +28,10 @@ module Bookbinder
27
28
  workspace: output_locations.workspace_dir,
28
29
  feedback_enabled: config.feedback_enabled,
29
30
  repo_link_enabled: config.repo_link_enabled,
30
- repo_links: config.repo_links
31
+ repo_links: config.repo_links,
32
+ product_info: product_info
31
33
  }
34
+
32
35
  fs.write(to: "bookbinder_config.yml", text: YAML.dump(config))
33
36
  sheller.run_command({'MM_ROOT' => output_locations.master_dir.to_s},
34
37
  "middleman #{command}",
@@ -0,0 +1,11 @@
1
+ module Bookbinder
2
+ ProductInfo = Struct.new(
3
+ :use_local_header,
4
+ :latest_stable_version,
5
+ :changelog_href,
6
+ :local_header_img,
7
+ :local_header_title
8
+ ) do
9
+
10
+ end
11
+ end
@@ -2,16 +2,18 @@ require_relative '../errors/programmer_mistake'
2
2
  require_relative '../ingest/destination_directory'
3
3
 
4
4
  module Bookbinder
5
- Section = Struct.new(:path_to_repository,
6
- :full_name,
7
- :desired_directory_name,
8
- :subnav_templ,
9
- :desired_subnav_name,
10
- :preprocessor_config,
11
- :at_repo_path,
12
- :repo_name,
13
- :source_ref,
14
- :pdf_output_filename) do
5
+ Section = Struct.new(
6
+ :path_to_repository,
7
+ :full_name,
8
+ :desired_directory_name,
9
+ :subnav_templ,
10
+ :desired_subnav_name,
11
+ :preprocessor_config,
12
+ :at_repo_path,
13
+ :repo_name,
14
+ :source_ref,
15
+ :pdf_output_filename,
16
+ :product_info) do
15
17
 
16
18
  def path_to_repo_dir
17
19
  at_repo_path.nil? ? path_to_repository : path_to_repository.join(at_repo_path)
@@ -26,10 +28,13 @@ module Bookbinder
26
28
  end
27
29
 
28
30
  def subnav
29
- namespace = destination_directory.to_s.gsub('/', '_')
30
31
  {namespace => subnav_name}
31
32
  end
32
33
 
34
+ def namespace
35
+ destination_directory.to_s.gsub('/', '_')
36
+ end
37
+
33
38
  def subnav_name
34
39
  subnav_template || desired_subnav_name || 'default'
35
40
  end
@@ -39,7 +44,7 @@ module Bookbinder
39
44
  rescue NoMethodError => e
40
45
  raise Errors::ProgrammerMistake.new(
41
46
  "path_to_preprocessor_attribute assumes preprocessor_config is available, got nil.\n" +
42
- "Original exception:\n\n#{e.inspect}\n\n#{e.backtrace.join("\n")}"
47
+ "Original exception:\n\n#{e.inspect}\n\n#{e.backtrace.join("\n")}"
43
48
  )
44
49
  end
45
50
 
@@ -104,6 +104,17 @@ module Bookbinder
104
104
  OpenStruct.new config[:template_variables]
105
105
  end
106
106
 
107
+ def product_info
108
+ temp_template_key = template_key
109
+ if config[:product_info][temp_template_key] == ''
110
+ default = {use_local_header: false, changelog_href: '', local_header_img: '', local_header_title: '',
111
+ local_header_links: [''], local_header_version_list: ['']}
112
+ OpenStruct.new default
113
+ else
114
+ OpenStruct.new config[:product_info][temp_template_key]
115
+ end
116
+ end
117
+
107
118
  def quick_links
108
119
  page_src = File.read(current_page.source_file)
109
120
  quicklinks_renderer = QuicklinksRenderer.new(vars)
@@ -117,12 +128,15 @@ module Bookbinder
117
128
  }
118
129
  end
119
130
 
131
+ def template_key
132
+ decreasingly_specific_namespaces.detect { |ns|
133
+ config[:subnav_templates].has_key?(ns)
134
+ }
135
+ end
136
+
120
137
  private
121
138
 
122
139
  def subnav_template_name
123
- template_key = decreasingly_specific_namespaces.detect { |ns|
124
- config[:subnav_templates].has_key?(ns)
125
- }
126
140
  config[:subnav_templates][template_key] || 'default'
127
141
  end
128
142
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookbindery
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Grafton
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: install_bin
20
20
  cert_chain: []
21
- date: 2016-03-08 00:00:00.000000000 Z
21
+ date: 2016-03-21 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: fog-aws
@@ -421,6 +421,7 @@ files:
421
421
  - lib/bookbinder/subnav/template_creator.rb
422
422
  - lib/bookbinder/terminal.rb
423
423
  - lib/bookbinder/values/output_locations.rb
424
+ - lib/bookbinder/values/product_info.rb
424
425
  - lib/bookbinder/values/section.rb
425
426
  - lib/bookbinder/values/subnav_template.rb
426
427
  - lib/bookbinder/values/user_message.rb