Class: Giblish::GitRepoConvert
- Inherits:
-
Object
- Object
- Giblish::GitRepoConvert
- Defined in:
- lib/giblish/application.rb
Overview
Converts a number of branches/tags in a gitrepo according to the given options.
Each branch/tag is converted into a subdir of the given root dir and a summary page with links to the converted docs for each branch/tag is generated within the root dir.
Instance Method Summary collapse
-
#initialize(user_opts) ⇒ GitRepoConvert
constructor
A new instance of GitRepoConvert.
- #make_summary ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(user_opts) ⇒ GitRepoConvert
Returns a new instance of GitRepoConvert.
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/giblish/application.rb', line 137 def initialize(user_opts) raise ArgumentError, "No selection for git branches or tags were found!" unless user_opts.branch_regex || user_opts.tag_regex @user_opts = user_opts.dup # cache the root dir @dst_topdir = @user_opts.dstdir @gm = GitCheckoutManager.new(@user_opts) end |
Instance Method Details
#make_summary ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/giblish/application.rb', line 165 def make_summary # reset the dst dir to the user-given-top @user_opts.dstdir = @dst_topdir # Make sure the summary page is just 'bare-bone' @user_opts.make_searchable = nil @user_opts.copy_asset_folders = nil @user_opts.no_index = true @user_opts.resolve_docid = false @user_opts.doc_attributes["table-caption"] = nil # assign/setup the doc_attr and layout using the same user options as # for the adoc source files on each checkout conf = Configurator.new(@user_opts) s = @gm.summary_provider s.index_basename = conf.config_opts.index_basename data_provider = DataDelegator.new( SrcFromString.new(s.source), conf.doc_attr ) srctree = PathTree.new("/" + conf.config_opts.index_basename + ".adoc", data_provider) TreeConverter.new(srctree, @dst_topdir, conf.).run end |
#run ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/giblish/application.rb', line 148 def run # convert all docs found in the branches/tags that the user asked to parse @gm.each_checkout do |name| # tweak the destination dir to a subdir per branch/tag @user_opts.dstdir = @dst_topdir / Giblish.to_fs_str(name) Giblog.logger.debug { "cmdline: #{@user_opts.inspect}" } configurator = GitRepoConfigurator.new(@user_opts, @gm.repo_root) DirTreeConvert.new(@user_opts).run(configurator) rescue => e Giblog.logger.error { "Conversion of #{name} failed!" } raise e if @user_opts.abort_on_error Giblog.logger.error { e. } end make_summary end |