Service
The Box plugin, as the name suggests, utilizes the stand-alone box tool to build packages.
Directories that a typically excluded from a distribution.
File pattern are files/dirs that are typically ignored.
Default patterns of files to include in a manifest file.
Default package types passed to the box command.
Globs of files and/or directories to exclude from manifest. This is not used unless master is set to true.
Standard files to ignore. Defaults to hidden files (.*). Unlike exclude these match against the basename, rather than the full pathname. This is not used unless master is set to true.
Globs of files and/or directories to include in manifest. This is not used unless master is set to true.
Manifest file to use. Default is MANIFEST case-insensitve with optional .txt extension.
Regenerate manifest (true or false)? The default is false. Unless this is set to true a MANIFEST file must already be present in the project’s root directory.
It is generally considered good practice to manually manitain a MANIFEST file. However, if a project has complex packaging needs, such as special manifests per specific package types, then auto-generating the MANIFEST file proves invaluable.
Regenerate manifest (true or false)? The default is false. Unless this is set to true a MANIFEST file must already be present in the project’s root directory.
It is generally considered good practice to manually manitain a MANIFEST file. However, if a project has complex packaging needs, such as special manifests per specific package types, then auto-generating the MANIFEST file proves invaluable.
Collect distributable files. This methid is called and cached by files.
# File plug/syckle/services/box.rb, line 183 def collect_files(with_dirs=false) files = [] Dir.chdir(project.source) do files = amass(distribute, exclude, ignore) #files += Dir.multiglob_r(*distribute) #files -= Dir.multiglob_r(*exclude) #files -= Dir.multiglob_r(*ignore) #files -= Dir.multiglob_r(project.pack.to_s) #package_directory end # Do not include symlinks files.reject!{ |f| FileTest.symlink?(f) } # Option to exclude directories unless with_dirs files = files.select{ |f| !File.directory?(f) } end return files end
Generate a manifest.
TODO: Use Mast? TODO: Compare manifests and skip overwrite if they are the same?
# File plug/syckle/services/box.rb, line 158 def create_manifest #(*files) return if dryrun? manifest_file = manifest || 'MANIFEST' # files = files().flatten.compact files = ['**/*'] if files.empty? #Dir.chdir(project.root) do files = multiglob(*files).sort rm(manifest_file) if File.exist?(manifest_file) File.open(manifest_file, 'w') do |f| f << files.join("\n") end #end end
Set file patterns to exclude from package. This is a special writer to allow for a single glob or a list of globs.
# File plug/syckle/services/box.rb, line 85 def exclude=(val) @exclude = [val].flatten end
List of files included in the package. This is generated using include and exclude.
# File plug/syckle/services/box.rb, line 176 def files @files ||= collect_files(true) end
Set file patterns to ignore. This is a special writer to allow for a single glob or a list of globs.
# File plug/syckle/services/box.rb, line 91 def ignore=(val) @ignore = [val].flatten end
Set file patterns used to select files to distribute in package. This is a special writer to allow for a single glob or a list of globs.
# File plug/syckle/services/box.rb, line 79 def include=(val) @include = [val].flatten end
# File plug/syckle/services/box.rb, line 96 def initialize_defaults super @manifest = project.root.glob('MANIFEST{,.txt}', :casefold).first @types = DEFAULT_TYPES @include = DEFAULT_INCLUDE #metadata.distribute || DEFAULT_INCLUDE @exclude = DEFAULT_EXCLUDE @ignore = DEFAULT_IGNORE @spec = false end
# File plug/syckle/services/box.rb, line 114 def package require 'box' loc = Dir.pwd # DEPRECATE: safe option is replaced by dryrun opts = { :force => force?, :dryrun => dryrun?, :safe => dryrun?, :spec => spec } #p spec create_manifest if master? #(*files) types.each do |type| case type when 'zip' status("Building #{package_name}.zip") box = ::Box::Zip.new(loc, opts) when 'gz', 'tar' #TODO: probably remove tar status("Building #{package_name}.tar.gz") box = ::Box::Gz.new(loc, opts) when 'gem' status("Building #{package_name}.gem") box = ::Box::Gem.new(loc, opts) end box.package end #report_package_built(file) end
Returns package name from metadata. This is generally in the form or +#{package}-#{version}+.
# File plug/syckle/services/box.rb, line 149 def package_name metadata.package_name end
Check for available MANIFEST file if needed.
# File plug/syckle/services/box.rb, line 107 def preconfigure if !master && !manifest #project.root.glob('MANIFEST{,.txt}', :casefold).first abort "No Manifest file available for Box.\nUse 'master' option or create a MANIFEST file." end end
Generated with the Darkfish Rdoc Generator 2.