Check-in [11502e1206]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Permit staging_path rebuilding (set to nil on .cleanup), and provide :mkdir and :mkdirname creation in staging_path(subdir). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
11502e12066a448825afe479b860444f |
User & Date: | mario 2014-12-30 12:35:50 |
Context
2014-12-30
| ||
12:37 | Introduce @plugins for ensure/cleanup, instead of iterating just [input,output] to also catch filter plugins created inbetween. check-in: 2a683b3ca4 user: mario tags: trunk | |
12:35 | Permit staging_path rebuilding (set to nil on .cleanup), and provide :mkdir and :mkdirname creation in staging_path(subdir). check-in: 11502e1206 user: mario tags: trunk | |
12:34 | Consolidate filename+dirname lowercasing, switch to regex (FNM_EXTGLOB absent in Ruby 1.9.x). check-in: 8f076a2392 user: mario tags: trunk | |
Changes
Changes to lib/fpm/package.rb.
1 2 3 4 5 6 7 8 9 10 | require "fpm/namespace" # local require "fpm/util" # local require "pathname" # stdlib require "find" require "tmpdir" # stdlib require "backports" # gem 'backports' require "socket" # stdlib, for Socket.gethostname require "shellwords" # stdlib, for Shellwords.escape require "erb" # stdlib, for template processing require "cabin" # gem "cabin" | > | 1 2 3 4 5 6 7 8 9 10 11 | require "fpm/namespace" # local require "fpm/util" # local require "pathname" # stdlib require "fileutils" # stdlib require "find" require "tmpdir" # stdlib require "backports" # gem 'backports' require "socket" # stdlib, for Socket.gethostname require "shellwords" # stdlib, for Shellwords.escape require "erb" # stdlib, for template processing require "cabin" # gem "cabin" |
︙ | ︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | attr_accessor :directories # Any other attributes specific to this package. # This is where you'd put rpm, deb, or other specific attributes. attr_accessor :attributes attr_accessor :attrs private def initialize # Attributes for this specific package @attributes = {} | > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | attr_accessor :directories # Any other attributes specific to this package. # This is where you'd put rpm, deb, or other specific attributes. attr_accessor :attributes attr_accessor :attrs attr_writer :staging_path private def initialize # Attributes for this specific package @attributes = {} |
︙ | ︙ | |||
244 245 246 247 248 249 250 | # Output this package to the given path. def output(path) raise NotImplementedError.new("#{self.class.name} does not yet support " \ "creating #{self.type} packages") end # def output | | | > > > > > > > | > > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | # Output this package to the given path. def output(path) raise NotImplementedError.new("#{self.class.name} does not yet support " \ "creating #{self.type} packages") end # def output def staging_path(path=nil, *opts) @staging_path ||= ::Dir.mktmpdir("package-#{type}-staging") #, ::Dir.pwd) if path.nil? return @staging_path else path = File.join(@staging_path, path) # optionally create sub directory if opts.include? :mkdir FileUtils.mkdir_p(path) unless File.exist?(path) elsif opts.include? :mkdirname FileUtils.mkdir_p(File.dirname(path)) end return path end end # def staging_path def build_path(path=nil) @build_path ||= ::Dir.mktmpdir("package-#{type}-build") #, ::Dir.pwd) if path.nil? return @build_path else return File.join(@build_path, path) end end # def build_path # Clean up any temporary storage used by this class. def cleanup cleanup_staging unless logger.level == :debug cleanup_build unless logger.level == :debug end # def cleanup def cleanup_staging if File.directory?(staging_path) logger.debug("Cleaning up staging path", :path => staging_path) FileUtils.rm_r(staging_path) end @staging_path = nil # allow to create staging_path anew end # def cleanup_staging def cleanup_build if File.directory?(build_path) logger.debug("Cleaning up build path", :path => build_path) FileUtils.rm_r(build_path) end @build_path = nil end # def cleanup_build # List all files in the staging_path # # The paths will all be relative to staging_path and will not include that # path. # |
︙ | ︙ |