giblish 0.2.11 → 0.2.12

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: dd6c3796d788f2eb0766ea43701aa2410077c888
4
- data.tar.gz: 10e441b56cfa5086ceb663a4767a9e7e7b2e84e9
3
+ metadata.gz: d124070b2a70ba613898e4ec4a55c0077b4721f8
4
+ data.tar.gz: 9ea41006b11273f084ae4afd2172b0e0ee5c0679
5
5
  SHA512:
6
- metadata.gz: c02ebe9d9f9722b68b7245b303a9884a46397beb8188d8175b1085033a4c31e81dc013f2885221449e481ae8bc0b13f65fcd2ed1bcf91ba553a321bdcc8c4303
7
- data.tar.gz: '000569d7dbdf197b3bfedae58ba99e326ac20e36540f57a2aead9dbe5c458a32a2babf27cef1ce8d8450aa48208f9fe50bc0e632c4223505e8c664b2dcad74ec'
6
+ metadata.gz: 8c0bbd5e18a496e0405fcc9fb752102bb294d433914e46de814ad3923391b267ec8767711de17dd6258e235f2feb26126f3fc8107b8eb3040215c39a851ffe8f
7
+ data.tar.gz: 507dc447a1d08255a81c2cf678e3e7e0571be4317da4bc7ab2286da17ac76f93f7f21d0a2aa25eb2304a20f7c68e676cfb42dfa067e43f745a3db725beac520c
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby
data/README.adoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = giblish
2
2
  Generate docs from asciidoc files in a git repo
3
3
 
4
+ image::https://travis-ci.com/rillbert/giblish.svg?branch=master[build status]
5
+
4
6
  == Purpose
5
7
 
6
8
  giblish is used to convert a source directory tree containing AsciiDoc files to
data/Rakefile CHANGED
@@ -14,6 +14,12 @@ Rake::TestTask.new(:current_test) do |t|
14
14
  # t.test_files = FileList["test/**/docid_test.rb"]
15
15
  end
16
16
 
17
+ Rake::TestTask.new(:sandbox) do |t|
18
+ t.libs << "test"
19
+ t.libs << "lib"
20
+ t.test_files = FileList["test/**/sandbox_test.rb"]
21
+ end
22
+
17
23
 
18
24
  # task :default => :spec
19
25
  task :default => :test
data/giblish.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
 
37
37
  # Usage: spec.add_runtime_dependency "[gem name]", [[version]]
38
- spec.add_runtime_dependency "asciidoctor", "~>1.5", ">= 1.5.6.1"
38
+ spec.add_runtime_dependency "asciidoctor", "~>1.5", ">= 1.5.7.1"
39
39
  spec.add_runtime_dependency "asciidoctor-pdf", [">= 1.5.0.alpha.16"]
40
40
  spec.add_runtime_dependency "asciidoctor-rouge", ["~> 0.3"]
41
41
  spec.add_runtime_dependency "git", "~> 1.3"
@@ -410,6 +410,7 @@ class GitSummaryIndexBuilder
410
410
  def initialize(repo)
411
411
  @branches = []
412
412
  @tags = []
413
+ @git_repo = repo
413
414
  @repo_url = repo.remote.url
414
415
  end
415
416
 
@@ -472,12 +473,32 @@ class GitSummaryIndexBuilder
472
473
  str = <<~TAG_INFO
473
474
  == Tags
474
475
 
476
+ |===
477
+ |Tag |Tag comment |Creator |Tagged commit
478
+
475
479
  TAG_INFO
476
480
 
477
- @tags.each do |t|
481
+ str << @tags.collect do |t|
478
482
  dirname = t.name.tr "/", "_"
479
- str << " * link:#{dirname}/index.html[#{t.name}]\n"
480
- end
483
+ c = @git_repo.gcommit(t.sha)
484
+
485
+ <<~A_ROW
486
+ |link:#{dirname}/index.html[#{t.name}]
487
+ |#{t.annotated? ? t.message : "-"}
488
+ |#{t.annotated? ? t.tagger.name : "-"}
489
+ |#{t.sha[0,8]}... committed at #{c.author.date}
490
+ A_ROW
491
+ end.join("\n")
492
+
493
+ str << "|===\n"
494
+
495
+ # @tags.each do |t|
496
+ # dirname = t.name.tr "/", "_"
497
+ # str << " * link:#{dirname}/index.html[#{t.name}]"
498
+ # if t.annotated?
499
+ # str << "created at #{t.tagger.date} by #{t.tagger.name} with message: #{t.message}"
500
+ # end
501
+ # end
481
502
  str
482
503
  end
483
504
  end
@@ -33,6 +33,15 @@ class CmdLineParser
33
33
  For html this is a name of a css file, for pdf, this is
34
34
  the name of an yml file. If no style is given 'giblish'
35
35
  is used as default.
36
+ -i --include <regexp> include only files with a filename that matches the supplied
37
+ regexp (defaults to '.*\.(?i)adoc$' meaning it matches all
38
+ files ending in .adoc case-insensitive). The matching is made
39
+ on the _file name only_, not the full path (i.e. for the full
40
+ path /my/file.adoc, only file.adoc is used in the matching).
41
+ -j --exclude <regexp> exclude files with filenames matching the supplied
42
+ regexp (no files are excluded by default). The matching is made
43
+ on the _file name only_, not the full path (i.e. for the full
44
+ path /my/file.adoc, only file.adoc is used in the matching).
36
45
  -w --web-root <path> Specifies the top dir (DirectoryRoot) of a file system
37
46
  tree published by a web server. This switch is only used
38
47
  when generating html. The typical use case is that giblish
@@ -95,15 +104,15 @@ ENDHELP
95
104
  def set_log_level
96
105
  log_level = @args[:logLevel] || "warn"
97
106
  case log_level
98
- when "debug" then Giblog.logger.sev_threshold = Logger::DEBUG
99
- when "info" then Giblog.logger.sev_threshold = Logger::INFO
100
- when "warn" then Giblog.logger.sev_threshold = Logger::WARN
101
- when "error" then Giblog.logger.sev_threshold = Logger::ERROR
102
- when "fatal" then Giblog.logger.sev_threshold = Logger::FATAL
103
- else
104
- puts "Invalid log level specified. Run with -h to see supported levels"
105
- puts USAGE
106
- exit 1
107
+ when "debug" then Giblog.logger.sev_threshold = Logger::DEBUG
108
+ when "info" then Giblog.logger.sev_threshold = Logger::INFO
109
+ when "warn" then Giblog.logger.sev_threshold = Logger::WARN
110
+ when "error" then Giblog.logger.sev_threshold = Logger::ERROR
111
+ when "fatal" then Giblog.logger.sev_threshold = Logger::FATAL
112
+ else
113
+ puts "Invalid log level specified. Run with -h to see supported levels"
114
+ puts USAGE
115
+ exit 1
107
116
  end
108
117
  end
109
118
 
@@ -115,15 +124,18 @@ ENDHELP
115
124
  def parse_cmdline(cmdline_args)
116
125
  # default values for cmd line switches
117
126
  @args = {
118
- help: false,
119
- version: false,
120
- force: true,
121
- format: "html",
122
- flatten: false,
123
- suppressBuildRef: false,
124
- localRepoOnly: false,
125
- resolveDocid: false,
126
- webRoot: false
127
+ help: false,
128
+ version: false,
129
+ force: true,
130
+ format: "html",
131
+ # note that the single quotes are important for the regexp
132
+ includeRegexp: '.*\.(?i)adoc$',
133
+ excludeRegexp: nil,
134
+ flatten: false,
135
+ suppressBuildRef: false,
136
+ localRepoOnly: false,
137
+ resolveDocid: false,
138
+ webRoot: false
127
139
  }
128
140
 
129
141
  # set default log level
@@ -136,24 +148,26 @@ ENDHELP
136
148
  next_arg = unflagged_args.first
137
149
  cmdline_args.each do |arg|
138
150
  case arg
139
- when "-h", "--help" then @args[:help] = true
140
- when "-v", "--version" then @args[:version] = true
141
- when "-f", "--format " then next_arg = :format
142
- when "-r", "--resource-dir" then next_arg = :resourceDir
143
- when "-n", "--no-build-ref" then @args[:suppressBuildRef] = true
144
- when "-g", "--git-branches" then next_arg = :gitBranchRegexp
145
- when "-t", "--git-tags" then next_arg = :gitTagRegexp
146
- when "-c", "--local-only" then @args[:localRepoOnly] = true
147
- when "-d", "--resolve-docid" then @args[:resolveDocid] = true
148
- when "-s", "--style" then next_arg = :userStyle
149
- when "-w", "--web-root" then next_arg = :webRoot
150
- when "--log-level" then next_arg = :logLevel
151
- else
152
- if next_arg
153
- @args[next_arg] = arg
154
- unflagged_args.delete(next_arg)
155
- end
156
- next_arg = unflagged_args.first
151
+ when "-h", "--help" then @args[:help] = true
152
+ when "-v", "--version" then @args[:version] = true
153
+ when "-f", "--format " then next_arg = :format
154
+ when "-r", "--resource-dir" then next_arg = :resourceDir
155
+ when "-n", "--no-build-ref" then @args[:suppressBuildRef] = true
156
+ when "-i", "--include" then next_arg = :includeRegexp
157
+ when "-j", "--exclude" then next_arg = :excludeRegexp
158
+ when "-g", "--git-branches" then next_arg = :gitBranchRegexp
159
+ when "-t", "--git-tags" then next_arg = :gitTagRegexp
160
+ when "-c", "--local-only" then @args[:localRepoOnly] = true
161
+ when "-d", "--resolve-docid" then @args[:resolveDocid] = true
162
+ when "-s", "--style" then next_arg = :userStyle
163
+ when "-w", "--web-root" then next_arg = :webRoot
164
+ when "--log-level" then next_arg = :logLevel
165
+ else
166
+ if next_arg
167
+ @args[next_arg] = arg
168
+ unflagged_args.delete(next_arg)
169
+ end
170
+ next_arg = unflagged_args.first
157
171
  end
158
172
  end
159
173
  end
@@ -187,7 +201,7 @@ ENDHELP
187
201
  # The user wants to parse a git repo, check that the srcDirRoot is within a
188
202
  # git repo if the user wants to generate git-branch specific docs
189
203
  @args[:gitRepoRoot] = Giblish::PathManager.find_gitrepo_root(
190
- @args[:srcDirRoot]
204
+ @args[:srcDirRoot]
191
205
  )
192
206
  return unless @args[:gitRepoRoot].nil?
193
207
 
data/lib/giblish/core.rb CHANGED
@@ -330,7 +330,17 @@ class TreeConverter
330
330
 
331
331
  # predicate that decides if a path is a asciidoc file or not
332
332
  def adocfile?(path)
333
- path.extname.casecmp(".ADOC").zero? && path.file?
333
+ fs = path.basename.to_s
334
+
335
+ unless @options[:excludeRegexp].nil?
336
+ # exclude file if user wishes
337
+ er = Regexp.new @options[:excludeRegexp]
338
+ return false unless er.match(fs).nil?
339
+ end
340
+
341
+ # only include files
342
+ ir = Regexp.new @options[:includeRegexp]
343
+ return !ir.match(fs).nil?
334
344
  end
335
345
 
336
346
  # Register the asciidoctor extension that handles doc ids and traverse
@@ -1,3 +1,3 @@
1
1
  module Giblish
2
- VERSION = "0.2.11".freeze
2
+ VERSION = "0.2.12".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giblish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anders Rillbert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-21 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '1.5'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.5.6.1
64
+ version: 1.5.7.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '1.5'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.5.6.1
74
+ version: 1.5.7.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: asciidoctor-pdf
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -138,6 +138,7 @@ extra_rdoc_files: []
138
138
  files:
139
139
  - ".gitignore"
140
140
  - ".rubocop.yml"
141
+ - ".travis.yml"
141
142
  - Gemfile
142
143
  - LICENSE
143
144
  - README.adoc
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
193
  version: '0'
193
194
  requirements: []
194
195
  rubyforge_project:
195
- rubygems_version: 2.5.1
196
+ rubygems_version: 2.5.2.1
196
197
  signing_key:
197
198
  specification_version: 4
198
199
  summary: A tool for publishing asciidoc docs stored in git repos