Class: Releasy::Project
- Inherits:
-
Object
- Object
- Releasy::Project
- Includes:
- Rake::DSL, Mixins::CanExcludeEncoding, Mixins::HasPackagers, Mixins::Log
- Defined in:
- lib/releasy/project.rb
Overview
A description of the Ruby application that is being build for release and what packages to make from it.
Constant Summary
- DEFAULT_PACKAGE_FOLDER =
"pkg"
Constants included from Mixins::Log
Mixins::Log::DEFAULT_LOG_LEVEL, Mixins::Log::LOG_LEVELS
Instance Attribute Summary (collapse)
-
- (String) executable
Name of executable to run (defaults to 'bin/').
-
- (Rake::FileList) exposed_files
Files which should always be copied into the archive folder root, so they are always visible to the user.
-
- (Rake::FileList) files
List of files to include in package.
-
- (Object) folder_base
readonly
Base name of folders that will be created, such as “pkg/my_application” or “pkg/my_application_0_1”.
-
- (String) name
Name of the application, such as “My Application”.
-
- (String) output_path
Folder to output to (defaults to 'pkg/').
-
- (String) underscored_name
Project name underscored (as used in file names), which will be derived from #name, but can be manually set.
-
- (String) underscored_version
Version number, underscored so it can be used in file names, which will be derived from #version, but can be manually set.
-
- (String) version
Version number as a string (for example, “1.2.0”).
Instance Method Summary (collapse)
-
- (Project) add_build(type, &block)
Add a type of build to produce.
-
- (Project) add_deploy(type, &block)
Add a deployment method for archived packages.
-
- (Project) add_link(url, title)
Add a link file to be included in the win32 releases.
-
- (nil) create_md5s
Create MD5 hashes for created archives.
-
- (Object) description
Full name of the project, including the version name E.g.
-
- (Project) generate_tasks
Generates all tasks required by the user.
-
- (Project) initialize(&block)
constructor
Can be used with or without a block to generate building and packaging tasks.
-
- (nil) silent
Make the tasks give no output at all.
- - (String) to_s
-
- (Object) underscored_description
Full underscored name of the project.
-
- (nil) verbose
Make the tasks give more detailed output.
Methods included from Mixins::Log
Methods included from Mixins::CanExcludeEncoding
Methods included from Mixins::HasPackagers
Constructor Details
- (Project) initialize { ... } - (Project) initialize {|project| ... } - (Project) initialize
Can be used with or without a block to generate building and packaging tasks.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/releasy/project.rb', line 172 def initialize(&block) super() @builders = [] @deployers = [] @links = {} @files = Rake::FileList.new @exposed_files = Rake::FileList.new @output_path = DEFAULT_PACKAGE_FOLDER @create_md5s = false @name = @underscored_name = @underscored_version = nil @version = @executable = nil setup if block_given? if block.arity <= 0 DSLWrapper.new(self, &block) else yield self end generate_tasks end end |
Instance Attribute Details
- (String) executable
Name of executable to run (defaults to 'bin/<underscored_name>')
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def executable @executable end |
- (Rake::FileList) exposed_files
Files which should always be copied into the archive folder root, so they are always visible to the user. e.g readme, change-log and/or license files.
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def exposed_files @exposed_files end |
- (Rake::FileList) files
List of files to include in package.
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def files @files end |
- (Object) folder_base (readonly)
Base name of folders that will be created, such as “pkg/my_application” or “pkg/my_application_0_1”
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def folder_base @folder_base end |
- (String) name
Name of the application, such as “My Application”.
72 73 74 |
# File 'lib/releasy/project.rb', line 72 def name @name end |
- (String) output_path
Folder to output to (defaults to 'pkg/')
76 77 78 |
# File 'lib/releasy/project.rb', line 76 def output_path @output_path end |
- (String) underscored_name
Project name underscored (as used in file names), which will be derived from #name, but can be manually set.
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def underscored_name @underscored_name end |
- (String) underscored_version
Version number, underscored so it can be used in file names, which will be derived from #version, but can be manually set.
61 62 63 |
# File 'lib/releasy/project.rb', line 61 def underscored_version @underscored_version end |
- (String) version
Version number as a string (for example, “1.2.0”).
74 75 76 |
# File 'lib/releasy/project.rb', line 74 def version @version end |
Instance Method Details
- (Project) add_build(type, &block)
Add a type of build to produce. Must define at least one of these.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/releasy/project.rb', line 202 def add_build(type, &block) raise ArgumentError, "Unsupported output type #{type}" unless Builders.has_type? type raise ArgumentError, "Already have output #{type.inspect}" if @builders.any? {|b| b.type == type } builder = Builders[type].new(self) @builders << builder if block_given? if block.arity <= 0 DSLWrapper.new(builder, &block) else yield builder end end builder end |
- (Project) add_deploy(type, &block)
Add a deployment method for archived packages.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/releasy/project.rb', line 224 def add_deploy(type, &block) raise ArgumentError, "Unsupported deploy type #{type}" unless Deployers.has_type? type raise ArgumentError, "Already have deploy #{type.inspect}" if @deployers.any? {|b| b.type == type } deployer = Deployers[type].new(self) @deployers << deployer if block_given? if block.arity <= 0 DSLWrapper.new(deployer, &block) else yield deployer end end deployer end |
- (Project) add_link(url, title)
Add a link file to be included in the win32 releases. Will create the file title.url for you.
247 248 249 250 251 |
# File 'lib/releasy/project.rb', line 247 def add_link(url, title) @links[url] = title self end |
- (nil) create_md5s
Create MD5 hashes for created archives.
87 |
# File 'lib/releasy/project.rb', line 87 def create_md5s; @create_md5s = true; nil; end |
- (Object) description
Full name of the project, including the version name E.g. “My Application” or “My Application 0.1”
291 |
# File 'lib/releasy/project.rb', line 291 def description; name ? "#{name}#{version ? " #{version}" : ""}" : nil; end |
- (Project) generate_tasks
Generates all tasks required by the user. Automatically called at the end of the block, if #initialize is given a block.
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 |
# File 'lib/releasy/project.rb', line 255 def generate_tasks raise ConfigError, "Must use #add_build at least once before tasks can be generated" if @builders.empty? # Even if there are builders specified, none may work on this platform. return if active_builders.empty? build_outputs = [] build_groups = Hash.new {|h, k| h[k] = [] } active_builders.each do |builder| builder.send :generate_tasks task_name = "build:#{builder.type.to_s.tr("_", ":")}" if builder.type.to_s =~ /_/ task_group = builder.send :task_group build_groups[task_group] << task_name build_outputs << "build:#{task_group}" else build_outputs << task_name end end build_groups.each_pair do |group, tasks| desc "Build all #{group}" task "build:#{group}" => tasks end desc "Build #{description}" task "build" => build_outputs generate_archive_tasks self end |
- (nil) silent
Make the tasks give no output at all.
83 |
# File 'lib/releasy/project.rb', line 83 def silent; Mixins::Log.log_level = :silent; end |
- (String) to_s
98 |
# File 'lib/releasy/project.rb', line 98 def to_s; "<#{self.class}#{name ? " #{name}" : ""}#{version ? " #{version}" : ""}>"; end |
- (Object) underscored_description
Full underscored name of the project. E.g. “my_application” or “my_application_0_1”
293 |
# File 'lib/releasy/project.rb', line 293 def underscored_description; underscored_name ? "#{underscored_name}#{version ? "_#{underscored_version}" : ""}" : nil; end |
- (nil) verbose
Make the tasks give more detailed output.
80 |
# File 'lib/releasy/project.rb', line 80 def verbose; Mixins::Log.log_level = :verbose; end |