bookbindery 7.4.1 → 7.4.2

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: 9d225bd3d28fdef85c86ec917d027bec3bcc4483
4
- data.tar.gz: f157d890f256df0cbf440ad067fd3bd4f9ca9320
3
+ metadata.gz: 0dd396ac809a3cfc82e3a7e98cdfeaf15287d78e
4
+ data.tar.gz: 7dd488851672dde25b5950828b5782628a9dce39
5
5
  SHA512:
6
- metadata.gz: acc94366d9f8c9c34033efd62ff094073930e2a37b11159a9c7749f9bd39370f3cd77da869f5227979cbfd2cec9af855513656e7c64bcffe7221b7bd2386d26b
7
- data.tar.gz: ca82a98a8448e99948321a5552f58ad50fdaa3bb30ae995335f06a81ed7d102dec912bfcf9ce36ff81f36333430bd21c9caaab145284bcb0c4ff88fbd5eb620b
6
+ metadata.gz: 50e14db758e54d6d6c304bfa1b23f74b11474c3f1b82aed93ccf9eb17a0b22e15aec13f98d857d465becb40a671de281590d6b9a67a60b5a84ecc5ecdc0ee3df
7
+ data.tar.gz: b553660104239c4b622ed4eee0def989befca26bf3ef106a404380ea8da9cc31466eee26a6a9386b2505dec025077392cd0fa41326652eb3f213c5bac91c8226
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 = '7.4.1'
5
+ s.version = '7.4.2'
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']
@@ -46,7 +46,7 @@ module Bookbinder
46
46
  # The routes will then be recreated from the creds repo.
47
47
  result = sheller.run_command(
48
48
  environment_variables,
49
- "#{cf_binary_path} push #{deploy_target_app} -s cflinuxfs2 --no-route -m 256M -i 3",
49
+ "#{cf_binary_path} push #{deploy_target_app} -b ruby_buildpack -s cflinuxfs2 --no-route -m 256M -i 3",
50
50
  streams
51
51
  )
52
52
  raise "Could not deploy app to #{deploy_target_app}" unless result.success?
@@ -24,7 +24,7 @@ module Bookbinder
24
24
  if base_config.repo_link_enabled
25
25
  sections.reduce({}) {|config, section|
26
26
  config.merge(
27
- section.desired_directory_name => {
27
+ section.destination_directory.to_s => {
28
28
  'repo' => section.repo_name,
29
29
  'ref' => section.source_ref,
30
30
  'at_path' => section.at_repo_path
@@ -1,5 +1,6 @@
1
1
  require 'git'
2
2
  require_relative '../directory_helpers'
3
+ require_relative '../local_filesystem_accessor'
3
4
  require_relative 'update_failure'
4
5
  require_relative 'update_success'
5
6
 
@@ -62,16 +63,31 @@ module Bookbinder
62
63
  end
63
64
  end
64
65
 
65
- def author_date(path, exclusion_flag: '[exclude]')
66
+ def author_date(path, exclusion_flag: '[exclude]', dita: false)
67
+ fs = LocalFilesystemAccessor.new
68
+
69
+ if dita
70
+ source_dir = 'preprocessing'
71
+ path_to_file = path.sub(/\.html(.md)?(.erb)?/, '.xml')
72
+ else
73
+ source_dir = source_dir_name
74
+ path_to_file = path
75
+ end
76
+
77
+
66
78
  Pathname(path).dirname.ascend do |current_dir|
67
- if current_dir.to_s.include?(source_dir_name) && current_dir.entries.include?(Pathname(".git"))
79
+ if (
80
+ current_dir.to_s.include?(source_dir) &&
81
+ current_dir.entries.include?(Pathname(".git")) &&
82
+ fs.source_file_exists?(Pathname(path).dirname, path_to_file)
83
+ )
84
+
68
85
  git = Git.open(current_dir)
69
- logs = git.gblob(path).log
86
+ logs = git.gblob(path_to_file).log
70
87
 
71
88
  last_non_excluded_commit = logs.detect { |log| !log.message.include?(exclusion_flag) }
72
89
 
73
- return Time.now if last_non_excluded_commit.nil?
74
- return last_non_excluded_commit.author.date
90
+ return last_non_excluded_commit.author.date if last_non_excluded_commit
75
91
  end
76
92
  end
77
93
  end
@@ -94,5 +94,15 @@ module Bookbinder
94
94
  map(&:chomp).
95
95
  map(&Pathname.method(:new))
96
96
  end
97
+
98
+ def source_file_exists?(directory, path_to_file)
99
+ path = Pathname(path_to_file.split('/').last)
100
+ source_file_found = false
101
+
102
+ Pathname(directory).ascend do |dir|
103
+ source_file_found = true if dir.entries.any? { |entry| entry == path }
104
+ end
105
+ source_file_found
106
+ end
97
107
  end
98
108
  end
@@ -66,9 +66,14 @@ module Bookbinder
66
66
  current_page.add_metadata({page: {repo_link_disabled: true}})
67
67
  end
68
68
 
69
- def render_repo_link
70
- if config[:repo_link_enabled] && !current_page.metadata[:page][:repo_link_disabled] && repo_url
71
- "<a href='#{repo_url}'>View the source for this page in GitHub</a>"
69
+ def render_repo_link(include_environments: [])
70
+ if config[:repo_link_enabled] && repo_url && !current_page.metadata[:page][:repo_link_disabled]
71
+ id = 'repo-link'
72
+ whitelisted_envs = include_environments.join(" ")
73
+ default_display = 'display: none;'
74
+ display_text = 'View the source for this page in GitHub'
75
+
76
+ "<a id='#{id}' data-whitelist='#{whitelisted_envs}' style='#{default_display}' href='#{repo_url}'>#{display_text}</a>"
72
77
  end
73
78
  end
74
79
 
@@ -78,10 +83,13 @@ module Bookbinder
78
83
  @_out_buf.concat "<div class='mermaid'>#{escaped_text}</div>"
79
84
  end
80
85
 
81
- def modified_date(format="%B %-d, %Y")
82
- git_accessor = Ingest::GitAccessor.new
83
- date = git_accessor.author_date(current_page.source_file) || Time.new(1984,1,1)
84
- "Page last updated: #{date.strftime(format)}"
86
+ def modified_date(format: "%B %-d, %Y", default_date: nil)
87
+ date = page_last_modified_date
88
+ author_date = date.strftime(format) if date
89
+
90
+ display_date = author_date || default_date
91
+
92
+ "Page last updated: #{display_date}" if display_date
85
93
  end
86
94
 
87
95
  def breadcrumbs
@@ -122,24 +130,68 @@ module Bookbinder
122
130
  'NUMERIC_CLASS_PREFIX'
123
131
  end
124
132
 
133
+ def page_last_modified_date
134
+ git_accessor = Ingest::GitAccessor.new
135
+
136
+ if current_page.data.dita
137
+ git_accessor.author_date(preprocessing_path(current_page.source_file), dita: true)
138
+ else
139
+ git_accessor.author_date(current_page.source_file)
140
+ end
141
+ end
142
+
125
143
  def repo_url
126
144
  nested_dir, filename = parse_out_nested_dir_and_filename
127
- repo_dir = config[:repo_links].keys.select{|key| nested_dir.include? key }[0]
145
+
146
+ repo_dir = match_repo_dir(nested_dir)
128
147
  page_repo_config = config[:repo_links][repo_dir]
129
148
 
130
149
  if page_repo_config && page_repo_config['ref']
131
- at_path = at_path(page_repo_config)
132
- ref = Pathname(page_repo_config['ref'])
133
150
  org_repo = Pathname(page_repo_config['repo'])
134
-
151
+ ref = Pathname(page_repo_config['ref'])
152
+ at_path = at_path(page_repo_config)
135
153
  nested_dir = extract_nested_directory(nested_dir, repo_dir)
136
154
 
137
- "http://github.com/#{org_repo.join(Pathname('blob'), ref, Pathname(nested_dir), at_path, filename)}.md.erb"
155
+ "http://github.com/#{org_repo.join(Pathname('tree'), ref, Pathname(nested_dir), at_path, source_file(filename))}"
138
156
  end
139
157
  end
140
158
 
159
+ def match_repo_dir(nested_dir)
160
+ config[:repo_links].keys
161
+ .select{ |key| nested_dir.match(/^#{key}/) }
162
+ .sort_by{ |key| key.length }
163
+ .last
164
+ end
165
+
166
+ def source_file(filename)
167
+ fs = LocalFilesystemAccessor.new
168
+
169
+ if current_page.data.dita
170
+ source_filename = "#{filename}.xml"
171
+
172
+ if fs.source_file_exists?(Pathname(preprocessing_path(current_page.source_file)).dirname,
173
+ source_filename)
174
+ source_filename
175
+ else
176
+ ''
177
+ end
178
+ else
179
+ "#{filename}.html.md.erb"
180
+ end
181
+ end
182
+
183
+ def preprocessing_path(current_source_path)
184
+ root_path, nested_repo_path = current_source_path.split('source')
185
+
186
+ root_path.gsub!('/output/master_middleman', '')
187
+
188
+ "#{root_path}output/preprocessing/sections#{nested_repo_path}"
189
+ end
190
+
141
191
  def parse_out_nested_dir_and_filename
142
- current_page.path.match(/\/?(.*?)\/?([^\/]*.html$?)/).captures
192
+ current_page.path
193
+ .match(/\/?(.*?)\/?([^\/]*)\.html$?/)
194
+ .captures
143
195
  end
144
196
 
145
197
  def extract_nested_directory(nested_dir, repo_dir)
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.4.1
4
+ version: 7.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Grafton
@@ -18,272 +18,272 @@ authors:
18
18
  autorequire:
19
19
  bindir: install_bin
20
20
  cert_chain: []
21
- date: 2015-12-04 00:00:00.000000000 Z
21
+ date: 2016-01-04 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: fog-aws
25
25
  requirement: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.7.1
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ~>
35
35
  - !ruby/object:Gem::Version
36
36
  version: 0.7.1
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: ansi
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.4'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - "~>"
48
+ - - ~>
49
49
  - !ruby/object:Gem::Version
50
50
  version: '1.4'
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: unf
53
53
  requirement: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ~>
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0.1'
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - "~>"
62
+ - - ~>
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0.1'
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: middleman
67
67
  requirement: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ~>
70
70
  - !ruby/object:Gem::Version
71
71
  version: 3.4.0
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - "~>"
76
+ - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: 3.4.0
79
79
  - !ruby/object:Gem::Dependency
80
80
  name: middleman-livereload
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - "~>"
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
85
  version: 3.4.3
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - "~>"
90
+ - - ~>
91
91
  - !ruby/object:Gem::Version
92
92
  version: 3.4.3
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: middleman-syntax
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - "~>"
97
+ - - ~>
98
98
  - !ruby/object:Gem::Version
99
99
  version: '2.0'
100
100
  type: :runtime
101
101
  prerelease: false
102
102
  version_requirements: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - "~>"
104
+ - - ~>
105
105
  - !ruby/object:Gem::Version
106
106
  version: '2.0'
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: rouge
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - "!="
111
+ - - '!='
112
112
  - !ruby/object:Gem::Version
113
113
  version: 1.9.1
114
114
  type: :runtime
115
115
  prerelease: false
116
116
  version_requirements: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "!="
118
+ - - '!='
119
119
  - !ruby/object:Gem::Version
120
120
  version: 1.9.1
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: redcarpet
123
123
  requirement: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "~>"
125
+ - - ~>
126
126
  - !ruby/object:Gem::Version
127
127
  version: 3.2.3
128
128
  type: :runtime
129
129
  prerelease: false
130
130
  version_requirements: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - "~>"
132
+ - - ~>
133
133
  - !ruby/object:Gem::Version
134
134
  version: 3.2.3
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: anemone
137
137
  requirement: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ">="
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  type: :runtime
143
143
  prerelease: false
144
144
  version_requirements: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ">="
146
+ - - '>='
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: css_parser
151
151
  requirement: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">="
153
+ - - '>='
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  type: :runtime
157
157
  prerelease: false
158
158
  version_requirements: !ruby/object:Gem::Requirement
159
159
  requirements:
160
- - - ">="
160
+ - - '>='
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  - !ruby/object:Gem::Dependency
164
164
  name: puma
165
165
  requirement: !ruby/object:Gem::Requirement
166
166
  requirements:
167
- - - ">="
167
+ - - '>='
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  type: :runtime
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ">="
174
+ - - '>='
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  - !ruby/object:Gem::Dependency
178
178
  name: rack-rewrite
179
179
  requirement: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ">="
181
+ - - '>='
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  type: :runtime
185
185
  prerelease: false
186
186
  version_requirements: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - ">="
188
+ - - '>='
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  - !ruby/object:Gem::Dependency
192
192
  name: therubyracer
193
193
  requirement: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ">="
195
+ - - '>='
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  type: :runtime
199
199
  prerelease: false
200
200
  version_requirements: !ruby/object:Gem::Requirement
201
201
  requirements:
202
- - - ">="
202
+ - - '>='
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  - !ruby/object:Gem::Dependency
206
206
  name: git
207
207
  requirement: !ruby/object:Gem::Requirement
208
208
  requirements:
209
- - - "~>"
209
+ - - ~>
210
210
  - !ruby/object:Gem::Version
211
211
  version: 1.2.8
212
212
  type: :runtime
213
213
  prerelease: false
214
214
  version_requirements: !ruby/object:Gem::Requirement
215
215
  requirements:
216
- - - "~>"
216
+ - - ~>
217
217
  - !ruby/object:Gem::Version
218
218
  version: 1.2.8
219
219
  - !ruby/object:Gem::Dependency
220
220
  name: sendgrid-ruby
221
221
  requirement: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ">="
223
+ - - '>='
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  type: :runtime
227
227
  prerelease: false
228
228
  version_requirements: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ">="
230
+ - - '>='
231
231
  - !ruby/object:Gem::Version
232
232
  version: '0'
233
233
  - !ruby/object:Gem::Dependency
234
234
  name: license_finder
235
235
  requirement: !ruby/object:Gem::Requirement
236
236
  requirements:
237
- - - ">="
237
+ - - '>='
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  type: :development
241
241
  prerelease: false
242
242
  version_requirements: !ruby/object:Gem::Requirement
243
243
  requirements:
244
- - - ">="
244
+ - - '>='
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  - !ruby/object:Gem::Dependency
248
248
  name: pry-byebug
249
249
  requirement: !ruby/object:Gem::Requirement
250
250
  requirements:
251
- - - ">="
251
+ - - '>='
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  type: :development
255
255
  prerelease: false
256
256
  version_requirements: !ruby/object:Gem::Requirement
257
257
  requirements:
258
- - - ">="
258
+ - - '>='
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  - !ruby/object:Gem::Dependency
262
262
  name: rake
263
263
  requirement: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ">="
265
+ - - '>='
266
266
  - !ruby/object:Gem::Version
267
267
  version: '0'
268
268
  type: :development
269
269
  prerelease: false
270
270
  version_requirements: !ruby/object:Gem::Requirement
271
271
  requirements:
272
- - - ">="
272
+ - - '>='
273
273
  - !ruby/object:Gem::Version
274
274
  version: '0'
275
275
  - !ruby/object:Gem::Dependency
276
276
  name: rspec
277
277
  requirement: !ruby/object:Gem::Requirement
278
278
  requirements:
279
- - - ">="
279
+ - - '>='
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
282
  type: :development
283
283
  prerelease: false
284
284
  version_requirements: !ruby/object:Gem::Requirement
285
285
  requirements:
286
- - - ">="
286
+ - - '>='
287
287
  - !ruby/object:Gem::Version
288
288
  version: '0'
289
289
  description: A command line utility to be run in Book repositories to stitch together
@@ -414,12 +414,12 @@ require_paths:
414
414
  - lib
415
415
  required_ruby_version: !ruby/object:Gem::Requirement
416
416
  requirements:
417
- - - ">="
417
+ - - '>='
418
418
  - !ruby/object:Gem::Version
419
419
  version: '2.0'
420
420
  required_rubygems_version: !ruby/object:Gem::Requirement
421
421
  requirements:
422
- - - ">="
422
+ - - '>='
423
423
  - !ruby/object:Gem::Version
424
424
  version: '0'
425
425
  requirements: []