bookbindery 4.2.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,11 +10,11 @@ module Bookbinder
10
10
  @processes = processes
11
11
  end
12
12
 
13
- def preprocess(objs, *args)
14
- objs.group_by { |obj|
15
- processes.detect ->{ NullProcess.new } { |process| process.applicable_to?(obj) }
16
- }.each do |process, objs|
17
- process.preprocess(objs, *args)
13
+ def preprocess(sections, *args)
14
+ sections.group_by { |section|
15
+ processes.detect ->{ NullProcess.new } { |process| process.applicable_to?(section) }
16
+ }.each do |process, grouped_sections|
17
+ process.preprocess(grouped_sections, *args)
18
18
  end
19
19
  end
20
20
 
@@ -1,3 +1,7 @@
1
+ require 'bookbinder/code_example_reader'
2
+ require 'bookbinder/ingest/cloner_factory'
3
+ require 'bookbinder/ingest/git_accessor'
4
+ require 'bookbinder/local_file_system_accessor'
1
5
  require 'date'
2
6
  require_relative 'archive_drop_down_menu'
3
7
  require_relative 'quicklinks_renderer'
@@ -17,11 +21,16 @@ module Bookbinder
17
21
  module HelperMethods
18
22
 
19
23
  def yield_for_code_snippet(from: nil, at: nil)
20
- code_example_reader = CodeExampleReader.new(out: $stdout)
21
-
22
- working_copy = config[:cloner].call(source_repo_name: from,
23
- source_ref: 'master',
24
- destination_parent_dir: config[:workspace])
24
+ cloner_factory = Ingest::ClonerFactory.new({out: $stdout},
25
+ LocalFileSystemAccessor.new,
26
+ Ingest::GitAccessor.new)
27
+
28
+ cloner = cloner_factory.produce(config[:local_repo_dir])
29
+ code_example_reader = CodeExampleReader.new({out: $stdout},
30
+ LocalFileSystemAccessor.new)
31
+ working_copy = cloner.call(source_repo_name: from,
32
+ source_ref: 'master',
33
+ destination_parent_dir: config[:workspace])
25
34
 
26
35
  snippet, language = code_example_reader.get_snippet_and_language_at(at, working_copy)
27
36
 
@@ -1,5 +1,12 @@
1
1
  require 'bookbinder_helpers'
2
- require 'submodule_aware_assets'
2
+ require 'middleman-syntax'
3
+ require 'middleman-livereload'
4
+ require 'subdirectory_aware_assets'
5
+
6
+ config = YAML.load_file('bookbinder_config.yml')
7
+ config.each do |k, v|
8
+ set k, v
9
+ end
3
10
 
4
11
  set :markdown_engine, :redcarpet
5
12
  set :markdown, :layout_engine => :erb,
@@ -14,10 +21,12 @@ set :js_dir, 'javascripts'
14
21
 
15
22
  set :images_dir, 'images'
16
23
 
17
- set :relative_links, true
24
+ set :relative_links, false
18
25
 
19
- activate :submodule_aware_assets
26
+ activate :subdirectory_aware_assets
20
27
 
21
28
  activate :navigation
22
29
 
23
- activate :syntax
30
+ activate :syntax
31
+
32
+ activate :livereload
@@ -1,4 +1,4 @@
1
- class SubmoduleAwareAssets < ::Middleman::Extension
1
+ class SubdirectoryAwareAssets < ::Middleman::Extension
2
2
  def initialize(app, options_hash={}, &block)
3
3
  super
4
4
 
@@ -9,15 +9,15 @@ class SubmoduleAwareAssets < ::Middleman::Extension
9
9
  end
10
10
 
11
11
  helpers do
12
- def asset_url(path, prefix="")
13
- url = super(path, prefix)
12
+ def asset_url(path, prefix="", options={})
13
+ url = super(path, prefix, options)
14
14
 
15
15
  unless global_asset_at? url
16
16
  current_dir = Pathname('/' + current_resource.destination_path)
17
17
  url = Pathname(url).relative_path_from(current_dir.dirname).to_s
18
18
  end
19
19
 
20
- # middleman assumes your assets live at the top level, but they may be in the subrepo instead
20
+ # middleman assumes your assets live at the top level, but they may be in the nested repos instead
21
21
  # here we start at top level and dive down until we find the real asset
22
22
  current_page_path_parts = current_resource.destination_path.split('/')
23
23
  current_page_path_parts.pop
@@ -42,4 +42,6 @@ class SubmoduleAwareAssets < ::Middleman::Extension
42
42
 
43
43
  end
44
44
 
45
- ::Middleman::Extensions.register(:submodule_aware_assets, SubmoduleAwareAssets)
45
+ ::Middleman::Extensions.register(:subdirectory_aware_assets, SubdirectoryAwareAssets)
46
+
47
+
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: 4.2.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Grafton
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: install_bin
17
17
  cert_chain: []
18
- date: 2015-07-30 00:00:00.000000000 Z
18
+ date: 2015-08-26 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: fog-aws
@@ -65,14 +65,28 @@ dependencies:
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 3.3.5
68
+ version: 3.4.0
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 3.3.5
75
+ version: 3.4.0
76
+ - !ruby/object:Gem::Dependency
77
+ name: middleman-livereload
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 3.4.3
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 3.4.3
76
90
  - !ruby/object:Gem::Dependency
77
91
  name: middleman-syntax
78
92
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +101,20 @@ dependencies:
87
101
  - - ~>
88
102
  - !ruby/object:Gem::Version
89
103
  version: '2.0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: rouge
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '!='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.9.1
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '!='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.9.1
90
118
  - !ruby/object:Gem::Dependency
91
119
  name: redcarpet
92
120
  requirement: !ruby/object:Gem::Requirement
@@ -284,9 +312,9 @@ files:
284
312
  - lib/bookbinder/commands/tag.rb
285
313
  - lib/bookbinder/commands/update_local_doc_repos.rb
286
314
  - lib/bookbinder/commands/version.rb
315
+ - lib/bookbinder/commands/watch.rb
287
316
  - lib/bookbinder/config/archive_menu_configuration.rb
288
317
  - lib/bookbinder/config/aws_credentials.rb
289
- - lib/bookbinder/config/bind_config_factory.rb
290
318
  - lib/bookbinder/config/cf_credentials.rb
291
319
  - lib/bookbinder/config/checkers/archive_menu_checker.rb
292
320
  - lib/bookbinder/config/checkers/dita_section_checker.rb
@@ -295,7 +323,6 @@ files:
295
323
  - lib/bookbinder/config/checkers/required_keys_checker.rb
296
324
  - lib/bookbinder/config/configuration.rb
297
325
  - lib/bookbinder/config/fetcher.rb
298
- - lib/bookbinder/config/remote_bind_configuration.rb
299
326
  - lib/bookbinder/config/remote_yaml_credential_provider.rb
300
327
  - lib/bookbinder/config/section_config.rb
301
328
  - lib/bookbinder/config/validator.rb
@@ -326,7 +353,6 @@ files:
326
353
  - lib/bookbinder/ingest/missing_working_copy.rb
327
354
  - lib/bookbinder/ingest/repo_identifier.rb
328
355
  - lib/bookbinder/ingest/section_repository.rb
329
- - lib/bookbinder/ingest/section_repository_factory.rb
330
356
  - lib/bookbinder/ingest/update_failure.rb
331
357
  - lib/bookbinder/ingest/update_success.rb
332
358
  - lib/bookbinder/ingest/working_copy.rb
@@ -360,7 +386,7 @@ files:
360
386
  - master_middleman/bookbinder_helpers.rb
361
387
  - master_middleman/config.rb
362
388
  - master_middleman/quicklinks_renderer.rb
363
- - master_middleman/submodule_aware_assets.rb
389
+ - master_middleman/subdirectory_aware_assets.rb
364
390
  - install_bin/bookbinder
365
391
  homepage: https://github.com/pivotal-cf/bookbinder
366
392
  licenses:
@@ -1,28 +0,0 @@
1
- require_relative 'remote_bind_configuration'
2
-
3
- module Bookbinder
4
- module Config
5
- class BindConfigFactory
6
- def initialize(version_control_system, config_fetcher)
7
- @version_control_system = version_control_system
8
- @config_fetcher = config_fetcher
9
- end
10
-
11
- def produce(bind_source)
12
- if %w(remote github).include?(bind_source) && config.has_option?('versions')
13
- RemoteBindConfiguration.new(version_control_system, config).fetch
14
- else
15
- config
16
- end
17
- end
18
-
19
- private
20
-
21
- def config
22
- config_fetcher.fetch_config
23
- end
24
-
25
- attr_reader :version_control_system, :config_fetcher
26
- end
27
- end
28
- end
@@ -1,44 +0,0 @@
1
- require 'yaml'
2
- require_relative '../ingest/destination_directory'
3
-
4
- module Bookbinder
5
- module Config
6
- class RemoteBindConfiguration
7
- VersionUnsupportedError = Class.new(RuntimeError)
8
-
9
- def initialize(version_control_system, base_config)
10
- @version_control_system = version_control_system
11
- @base_config = base_config
12
- end
13
-
14
- def fetch
15
- base_config.merge_sections(base_config.versions.flat_map { |version| sections_from(version) })
16
- end
17
-
18
- private
19
-
20
- attr_reader :version_control_system, :base_config
21
-
22
- def sections_from(version)
23
- sections = Configuration.parse(
24
- YAML.load(
25
- version_control_system.read_file(
26
- 'config.yml',
27
- from_repo: base_config.book_repo_url,
28
- checkout: version
29
- )
30
- )).sections
31
- raise VersionUnsupportedError.new(version) if sections.empty?
32
-
33
- sections.map do |section|
34
- section.merge(
35
- Config::SectionConfig.new(
36
- 'repository' => { 'name' => section.repo_name, 'ref' => version },
37
- 'directory' => File.join(version, section.desired_directory_name)
38
- )
39
- )
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,19 +0,0 @@
1
- require_relative 'section_repository'
2
-
3
- module Bookbinder
4
- module Ingest
5
- class SectionRepositoryFactory
6
- def initialize(logger)
7
- @logger = logger
8
- end
9
-
10
- def produce(cloner)
11
- SectionRepository.new(logger, cloner)
12
- end
13
-
14
- private
15
-
16
- attr_reader :logger
17
- end
18
- end
19
- end