bookbindery 7.5.0 → 8.0.0

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: 0dd2c6b574a77666001273739f0136dd0465e51c
4
- data.tar.gz: 854939e21e33cc8bd187f2b7560966d3b0698cb0
3
+ metadata.gz: 1a0d33f4425ffc7d20e10ef7d4db181383434597
4
+ data.tar.gz: 9e46a1a8c6a91b3c204b337c11db14b49b4297d6
5
5
  SHA512:
6
- metadata.gz: a56e6c5664b07e1b6bc862bc21ad716b299999a36baed3889fec5aa227ca8d8c962e3e71dd0281f6bd677dbdc64ff77e154d53ac6597658e7c2c27f3aa32208a
7
- data.tar.gz: 863e5303ef86d674eba079dd486278e7e11e44f143140b858c8743c2567e31afe73db57315c1946b63b3a159222e460840648b0cbe4cc9a9fd83fb366b62c0cd
6
+ metadata.gz: 64b3f89db50a12afb1d050d5a993c630061a46c158113a318508546e825da51e1b66d0e96bf3da7c92f9276d781a2e69655f1b2adcad8cf61c98d638e50d9ccf
7
+ data.tar.gz: a62cd292cbaa71a015a02d39f6cc88cdeab30f5f3837c72e05e874720b87c38dbc7b8f972e784680ab1b111b635cb8df042ccb0648afca9528ee41751d1e802a
@@ -2,7 +2,7 @@ require 'base64'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'bookbindery'
5
- s.version = '7.5.0'
5
+ s.version = '8.0.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']
@@ -29,11 +29,11 @@ Gem::Specification.new do |s|
29
29
  s.add_runtime_dependency 'rack-rewrite'
30
30
  s.add_runtime_dependency 'therubyracer'
31
31
  s.add_runtime_dependency 'git', '~> 1.2.8'
32
- s.add_runtime_dependency 'sendgrid-ruby'
33
32
  s.add_runtime_dependency 'nokogiri', ['1.6.7.2']
34
33
 
35
34
  s.add_development_dependency 'license_finder'
36
35
  s.add_development_dependency 'pry-byebug'
37
36
  s.add_development_dependency 'rake'
38
37
  s.add_development_dependency 'rspec'
38
+ s.add_development_dependency 'sendgrid-ruby'
39
39
  end
@@ -71,10 +71,9 @@ module Bookbinder
71
71
  ),
72
72
  build_and_push_tarball,
73
73
  bind,
74
- Commands::PushFromLocal.new(streams, logger, configuration_fetcher(Config::Configuration), 'acceptance'),
75
- push_local_to_staging,
74
+ push_local_to,
76
75
  Commands::PushToProd.new(streams, logger, configuration_fetcher(Config::Configuration), Dir.mktmpdir),
77
- Commands::RunPublishCI.new(bind, push_local_to_staging, build_and_push_tarball),
76
+ Commands::RunPublishCI.new(bind, push_local_to, build_and_push_tarball),
78
77
  Commands::Punch.new(streams, configuration_fetcher(Config::Configuration), version_control_system),
79
78
  Commands::UpdateLocalDocRepos.new(
80
79
  streams,
@@ -146,12 +145,11 @@ module Bookbinder
146
145
  )
147
146
  end
148
147
 
149
- def push_local_to_staging
150
- @push_local_to_staging ||= Commands::PushFromLocal.new(
148
+ def push_local_to
149
+ @push_local_to ||= Commands::PushFromLocal.new(
151
150
  streams,
152
151
  logger,
153
- configuration_fetcher(Config::Configuration),
154
- 'staging'
152
+ configuration_fetcher(Config::Configuration)
155
153
  )
156
154
  end
157
155
 
@@ -12,19 +12,19 @@ module Bookbinder
12
12
  REQUIRED_AWS_KEYS = %w(access_key secret_key green_builds_bucket)
13
13
  REQUIRED_CF_KEYS = %w(username password api_endpoint organization app_name)
14
14
 
15
- def initialize(streams, logger, configuration_fetcher, environment)
15
+ def initialize(streams, logger, configuration_fetcher)
16
16
  @streams = streams
17
17
  @logger = logger
18
18
  @configuration_fetcher = configuration_fetcher
19
- @environment = environment
20
19
  end
21
20
 
22
21
  def usage
23
- [command_name,
24
- "Push the contents of final_app to the #{environment} host specified in credentials.yml"]
22
+ ["push_local_to <environment>",
23
+ "Push the contents of final_app to the specified environment using the credentials.yml"]
25
24
  end
26
25
 
27
- def run(_)
26
+ def run(cli_arguments)
27
+ @environment = cli_arguments.first
28
28
  validate
29
29
  deployment = Deploy::Deployment.new(
30
30
  app_dir: './final_app',
@@ -50,6 +50,10 @@ module Bookbinder
50
50
 
51
51
  attr_reader :configuration_fetcher, :environment, :streams
52
52
 
53
+ def command_name
54
+ 'push_local_to'
55
+ end
56
+
53
57
  def config
54
58
  configuration_fetcher.fetch_config
55
59
  end
@@ -58,10 +62,6 @@ module Bookbinder
58
62
  configuration_fetcher.fetch_credentials(environment)
59
63
  end
60
64
 
61
- def command_name
62
- "push_local_to_#{environment}"
63
- end
64
-
65
65
  def creds_error_message
66
66
  <<-ERROR
67
67
  Cannot locate a specific key in credentials.yml.
@@ -12,26 +12,26 @@ module Bookbinder
12
12
 
13
13
  def usage
14
14
  [command_name,
15
- "Run publish, push_local_to_staging, and build_and_push_tarball for CI purposes"]
15
+ "Run publish, push_local_to staging, and build_and_push_tarball for CI purposes"]
16
16
  end
17
17
 
18
- def initialize(publish_command, push_local_to_staging_command, build_and_push_tarball_command)
18
+ def initialize(publish_command, push_local_to_command, build_and_push_tarball_command)
19
19
  @publish_command = publish_command
20
- @push_local_to_staging_command = push_local_to_staging_command
20
+ @push_local_to_command = push_local_to_command
21
21
  @build_and_push_tarball_command = build_and_push_tarball_command
22
22
  end
23
23
 
24
24
  def run(cli_args)
25
25
  command_chain(
26
26
  ->{publish_command.run(['remote'] + cli_args)},
27
- ->{push_local_to_staging_command.run([])},
27
+ ->{push_local_to_command.run(['staging'])},
28
28
  ->{build_and_push_tarball_command.run([])}
29
29
  )
30
30
  end
31
31
 
32
32
  private
33
33
 
34
- attr_reader :publish_command, :push_local_to_staging_command, :build_and_push_tarball_command
34
+ attr_reader :publish_command, :push_local_to_command, :build_and_push_tarball_command
35
35
  end
36
36
  end
37
37
  end
@@ -23,7 +23,7 @@ module Bookbinder
23
23
  end
24
24
 
25
25
  def routes
26
- fetch(host_key) if correctly_formatted_domain_and_routes?(host_key)
26
+ fetch('host') if correctly_formatted_domain_and_routes?
27
27
  end
28
28
 
29
29
  def flat_routes
@@ -31,25 +31,21 @@ module Bookbinder
31
31
  end
32
32
 
33
33
  def space
34
- fetch(space_key)
34
+ fetch('space')
35
35
  end
36
36
 
37
37
  private
38
38
 
39
39
  attr_reader :creds, :environment
40
40
 
41
- def production?
42
- environment == 'production'
43
- end
44
-
45
41
  def fetch(key)
46
- creds.fetch(key)
42
+ creds.fetch('env').fetch(environment).fetch(key)
47
43
  rescue KeyError => e
48
44
  raise CredentialKeyError, e
49
45
  end
50
46
 
51
- def correctly_formatted_domain_and_routes?(deploy_environment)
52
- routes_hash = fetch(deploy_environment)
47
+ def correctly_formatted_domain_and_routes?
48
+ routes_hash = fetch('host')
53
49
  domains = routes_hash.keys
54
50
  domains.each { |domain| correctly_formatted_domain?(domain, routes_hash) }
55
51
  end
@@ -61,14 +57,6 @@ module Bookbinder
61
57
  raise "Hosts in credentials must be nested as an array under the desired domain #{domain}." unless routes_hash[domain].is_a? Array
62
58
  raise "Did you mean to provide a hostname for the domain #{domain}? Check your credentials.yml." if routes_hash[domain].any?(&:nil?)
63
59
  end
64
-
65
- def host_key
66
- "#{environment}_host"
67
- end
68
-
69
- def space_key
70
- "#{environment}_space"
71
- end
72
60
  end
73
61
  end
74
62
  end
@@ -0,0 +1,49 @@
1
+ module Bookbinder
2
+ module Config
3
+ module Checkers
4
+ class ProductsChecker
5
+ MissingRequiredKeyError = Class.new(RuntimeError)
6
+ MissingProductsKeyError = Class.new(RuntimeError)
7
+ MissingProductIdError = Class.new(RuntimeError)
8
+
9
+ def check(config)
10
+ @config = config
11
+
12
+ if section_product_ids.count > 0
13
+ if config.products.empty?
14
+ MissingProductsKeyError.new('You must specify at least one product under the products key in config.yml')
15
+ elsif missing_products.count != 0
16
+ MissingProductIdError.new("Your config.yml is missing required product id under the products key. Required product ids are #{missing_products.join(", ")}.")
17
+ elsif invalid_products.any?
18
+ MissingRequiredKeyError.new("Your config.yml is missing required key(s) for products #{invalid_product_ids}. Required keys are #{required_product_keys.join(", ")}.")
19
+ end
20
+ end
21
+ end
22
+
23
+ attr_reader :config
24
+
25
+ private
26
+
27
+ def invalid_products
28
+ config.products.map {|product_config| product_config unless product_config.valid? }
29
+ end
30
+
31
+ def invalid_product_ids
32
+ invalid_products.map(&:id).join(', ')
33
+ end
34
+
35
+ def missing_products
36
+ section_product_ids - config.products.map(&:id)
37
+ end
38
+
39
+ def required_product_keys
40
+ Bookbinder::Config::ProductConfig::CONFIG_REQUIRED_KEYS
41
+ end
42
+
43
+ def section_product_ids
44
+ config.sections.map(&:product_id).compact.uniq
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,14 +1,14 @@
1
1
  module Bookbinder
2
2
  module Config
3
3
  module Checkers
4
- class TopicsChecker
4
+ class SubnavTopicsChecker
5
5
  MissingRequiredKeyError = Class.new(RuntimeError)
6
6
 
7
7
  def check(config)
8
8
  @config = config
9
9
 
10
- if invalid_subnavs.any?
11
- MissingRequiredKeyError.new("Your config.yml is missing required key(s) for subnav(s) #{invalid_subnav_names}. Required keys are #{required_topic_keys.join(", ")}.")
10
+ if invalid_products.any?
11
+ MissingRequiredKeyError.new("Your config.yml is missing required key(s) for subnav_topics in product id(s) #{invalid_product_ids}. Required keys are #{required_topic_keys.join(", ")}.")
12
12
  end
13
13
  end
14
14
 
@@ -16,16 +16,16 @@ module Bookbinder
16
16
 
17
17
  private
18
18
 
19
- def invalid_subnavs
20
- config.subnavs.select { |subnav_config| invalid_topics(subnav_config.topics).any? }
19
+ def invalid_products
20
+ config.products.select { |product_config| invalid_topics(product_config.subnav_topics).any? }
21
21
  end
22
22
 
23
23
  def invalid_topics(topics)
24
24
  topics.map {|topic| topic unless topic.valid? }
25
25
  end
26
26
 
27
- def invalid_subnav_names
28
- invalid_subnavs.map(&:subnav_name).join(', ')
27
+ def invalid_product_ids
28
+ invalid_products.map(&:id).join(', ')
29
29
  end
30
30
 
31
31
  def required_topic_keys
@@ -2,7 +2,7 @@ require_relative '../../../lib/bookbinder/config/dita_config_generator'
2
2
  require_relative '../ingest/destination_directory'
3
3
  require_relative '../ingest/repo_identifier'
4
4
  require_relative 'section_config'
5
- require_relative 'subnav_config'
5
+ require_relative 'product_config'
6
6
 
7
7
  module Bookbinder
8
8
  module Config
@@ -53,7 +53,7 @@ module Bookbinder
53
53
 
54
54
  def initialize(config)
55
55
  @config = config
56
- @subnavs = assemble_subnavs || []
56
+ @products = assemble_products || []
57
57
  end
58
58
 
59
59
  CONFIG_REQUIRED_KEYS = %w(book_repo public_host)
@@ -97,15 +97,15 @@ module Bookbinder
97
97
 
98
98
  alias_method :eql?, :==
99
99
 
100
- attr_reader :subnavs
100
+ attr_reader :products
101
101
 
102
102
  private
103
103
 
104
- def assemble_subnavs
105
- if config[:subnavs]
106
- config[:subnavs].map do |subnav|
107
- subnav.merge!({'subnav_exclusions' => subnav_exclusions})
108
- Config::SubnavConfig.new(subnav)
104
+ def assemble_products
105
+ if config[:products]
106
+ config[:products].map do |product|
107
+ product.merge!({'subnav_exclusions' => subnav_exclusions})
108
+ Config::ProductConfig.new(product)
109
109
  end
110
110
  end
111
111
  end
@@ -2,14 +2,14 @@ require_relative '../config/topic_config'
2
2
 
3
3
  module Bookbinder
4
4
  module Config
5
- class SubnavConfig
5
+ class ProductConfig
6
6
  def initialize(config)
7
7
  @config = config
8
- @topics = assemble_topics || []
8
+ @subnav_topics = assemble_topics || []
9
9
  end
10
10
 
11
- def subnav_name
12
- config['name']
11
+ def id
12
+ config['id']
13
13
  end
14
14
 
15
15
  def pdf_config
@@ -20,20 +20,25 @@ module Bookbinder
20
20
  config['subnav_exclusions'] || []
21
21
  end
22
22
 
23
+ def specifies_subnav?
24
+ !subnav_topics.empty?
25
+ end
26
+
23
27
  def valid?
24
28
  (CONFIG_REQUIRED_KEYS - config.keys).empty?
25
29
  end
26
30
 
27
- CONFIG_REQUIRED_KEYS = %w(name topics)
31
+ CONFIG_REQUIRED_KEYS = %w(id subnav_topics)
28
32
 
29
- attr_reader :topics
33
+ attr_reader :subnav_topics
34
+ alias_method :subnav_name, :id
30
35
 
31
36
  private
32
37
 
33
38
  attr_reader :config
34
39
 
35
40
  def assemble_topics
36
- config['topics'].map{|topic| Config::TopicConfig.new(topic)} if config['topics']
41
+ config['subnav_topics'].map{|topic| Config::TopicConfig.new(topic)} if config['subnav_topics']
37
42
  end
38
43
  end
39
44
  end
@@ -11,8 +11,8 @@ module Bookbinder
11
11
  config['subnav_template']
12
12
  end
13
13
 
14
- def subnav_name
15
- config['subnav_name']
14
+ def product_id
15
+ config['product_id']
16
16
  end
17
17
 
18
18
  def desired_directory_name
@@ -60,6 +60,7 @@ module Bookbinder
60
60
  def inspect
61
61
  config.inspect
62
62
  end
63
+ alias_method :subnav_name, :product_id
63
64
 
64
65
  private
65
66
 
@@ -4,8 +4,8 @@ require_relative 'checkers/required_keys_checker'
4
4
  require_relative 'checkers/repository_name_presence_checker'
5
5
  require_relative 'checkers/ditamap_presence_checker'
6
6
  require_relative 'checkers/section_presence_checker'
7
- require_relative 'checkers/subnavs_checker'
8
- require_relative 'checkers/topics_checker'
7
+ require_relative 'checkers/products_checker'
8
+ require_relative 'checkers/subnav_topics_checker'
9
9
 
10
10
  module Bookbinder
11
11
  module Config
@@ -22,8 +22,8 @@ module Bookbinder
22
22
  Checkers::SectionPresenceChecker.new,
23
23
  Checkers::DitamapPresenceChecker.new,
24
24
  Checkers::ArchiveMenuChecker.new(@file_system_accessor),
25
- Checkers::SubnavsChecker.new,
26
- Checkers::TopicsChecker.new
25
+ Checkers::ProductsChecker.new,
26
+ Checkers::SubnavTopicsChecker.new
27
27
  ].map do |checker|
28
28
  checker.check(config)
29
29
  end
@@ -103,7 +103,7 @@ module Bookbinder
103
103
  if dest_dir.exist?
104
104
  Git.open(dest_dir)
105
105
  else
106
- Git.clone(url, name, path: path)
106
+ Git.clone(url, name, path: path, recursive: true)
107
107
  end
108
108
  end
109
109
  end
@@ -21,8 +21,8 @@ module Bookbinder
21
21
  )
22
22
  end
23
23
 
24
- config.subnavs.each do |subnav|
25
- subnav_generator.generate(subnav)
24
+ config.products.each do |product|
25
+ subnav_generator.generate(product)
26
26
  end
27
27
  end
28
28
 
@@ -24,7 +24,7 @@ module Bookbinder
24
24
  def get_links_and_headers
25
25
  menu_items = []
26
26
 
27
- config.topics.map do |topic|
27
+ config.subnav_topics.map do |topic|
28
28
  menu_items << { text: topic.title, title: true }
29
29
  menu_items << { url: "/#{topic.toc_path}.html", text: topic.toc_nav_name }
30
30
 
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: 7.5.0
4
+ version: 8.0.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-02-16 00:00:00.000000000 Z
21
+ date: 2016-02-23 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: fog-aws
@@ -216,20 +216,6 @@ dependencies:
216
216
  - - "~>"
217
217
  - !ruby/object:Gem::Version
218
218
  version: 1.2.8
219
- - !ruby/object:Gem::Dependency
220
- name: sendgrid-ruby
221
- requirement: !ruby/object:Gem::Requirement
222
- requirements:
223
- - - ">="
224
- - !ruby/object:Gem::Version
225
- version: '0'
226
- type: :runtime
227
- prerelease: false
228
- version_requirements: !ruby/object:Gem::Requirement
229
- requirements:
230
- - - ">="
231
- - !ruby/object:Gem::Version
232
- version: '0'
233
219
  - !ruby/object:Gem::Dependency
234
220
  name: nokogiri
235
221
  requirement: !ruby/object:Gem::Requirement
@@ -300,6 +286,20 @@ dependencies:
300
286
  - - ">="
301
287
  - !ruby/object:Gem::Version
302
288
  version: '0'
289
+ - !ruby/object:Gem::Dependency
290
+ name: sendgrid-ruby
291
+ requirement: !ruby/object:Gem::Requirement
292
+ requirements:
293
+ - - ">="
294
+ - !ruby/object:Gem::Version
295
+ version: '0'
296
+ type: :development
297
+ prerelease: false
298
+ version_requirements: !ruby/object:Gem::Requirement
299
+ requirements:
300
+ - - ">="
301
+ - !ruby/object:Gem::Version
302
+ version: '0'
303
303
  description: A command line utility to be run in Book repositories to stitch together
304
304
  their constituent Markdown repos into a static-HTML-serving application
305
305
  email: gmorgan@gopivotal.com
@@ -340,19 +340,19 @@ files:
340
340
  - lib/bookbinder/config/checkers/archive_menu_checker.rb
341
341
  - lib/bookbinder/config/checkers/ditamap_presence_checker.rb
342
342
  - lib/bookbinder/config/checkers/duplicate_section_name_checker.rb
343
+ - lib/bookbinder/config/checkers/products_checker.rb
343
344
  - lib/bookbinder/config/checkers/repository_name_presence_checker.rb
344
345
  - lib/bookbinder/config/checkers/required_keys_checker.rb
345
346
  - lib/bookbinder/config/checkers/section_presence_checker.rb
346
- - lib/bookbinder/config/checkers/subnavs_checker.rb
347
- - lib/bookbinder/config/checkers/topics_checker.rb
347
+ - lib/bookbinder/config/checkers/subnav_topics_checker.rb
348
348
  - lib/bookbinder/config/configuration.rb
349
349
  - lib/bookbinder/config/configuration_decorator.rb
350
350
  - lib/bookbinder/config/dita_config_generator.rb
351
351
  - lib/bookbinder/config/fetcher.rb
352
352
  - lib/bookbinder/config/imprint/configuration.rb
353
+ - lib/bookbinder/config/product_config.rb
353
354
  - lib/bookbinder/config/remote_yaml_credential_provider.rb
354
355
  - lib/bookbinder/config/section_config.rb
355
- - lib/bookbinder/config/subnav_config.rb
356
356
  - lib/bookbinder/config/topic_config.rb
357
357
  - lib/bookbinder/config/validator.rb
358
358
  - lib/bookbinder/config/yaml_loader.rb
@@ -1,49 +0,0 @@
1
- module Bookbinder
2
- module Config
3
- module Checkers
4
- class SubnavsChecker
5
- MissingRequiredKeyError = Class.new(RuntimeError)
6
- MissingSubnavsKeyError = Class.new(RuntimeError)
7
- MissingSubnavNameError = Class.new(RuntimeError)
8
-
9
- def check(config)
10
- @config = config
11
-
12
- if section_subnav_names.count > 0
13
- if config.subnavs.empty?
14
- MissingSubnavsKeyError.new("You must specify at least one subnav under the subnavs key in config.yml")
15
- elsif missing_subnavs.count != 0
16
- MissingSubnavNameError.new("Your config.yml is missing required subnav names under the subnavs key. Required subnav names are #{missing_subnavs.join(", ")}.")
17
- elsif invalid_subnavs.any?
18
- MissingRequiredKeyError.new("Your config.yml is missing required key(s) for subnavs #{invalid_subnav_names}. Required keys are #{required_subnav_keys.join(", ")}.")
19
- end
20
- end
21
- end
22
-
23
- attr_reader :config
24
-
25
- private
26
-
27
- def invalid_subnavs
28
- config.subnavs.map {|subnav_config| subnav_config unless subnav_config.valid? }
29
- end
30
-
31
- def invalid_subnav_names
32
- invalid_subnavs.map(&:subnav_name).join(", ")
33
- end
34
-
35
- def missing_subnavs
36
- section_subnav_names - config.subnavs.map(&:subnav_name)
37
- end
38
-
39
- def required_subnav_keys
40
- Bookbinder::Config::SubnavConfig::CONFIG_REQUIRED_KEYS
41
- end
42
-
43
- def section_subnav_names
44
- config.sections.map(&:subnav_name).compact.uniq
45
- end
46
- end
47
- end
48
- end
49
- end