Class: Maestro::Plugin::RakeTasks::PackageTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Maestro::Plugin::RakeTasks::PackageTask
- Includes:
- Rake::DSL
- Defined in:
- lib/maestro/plugin/rake_tasks/package_task.rb
Instance Attribute Summary collapse
-
#dest_dir ⇒ Object
The destination directory default: .
-
#directories ⇒ Object
List the directories to package default: [ ‘src’, ‘vendor’, ‘images’ ].
-
#files ⇒ Object
List the files to package default: [ ‘manifest.json’, ‘README.md’, ‘LICENSE’ ].
-
#manifest_template_path ⇒ Object
The path to the manifest template default: ‘./manifest.template.json’.
-
#name ⇒ Object
Name of task.
-
#plugin_name ⇒ Object
The plugin name default read from pom.xml (artifactId).
-
#pom_path ⇒ Object
The path to the pom.xml default: ‘./pom.xml’.
-
#use_pom ⇒ Object
Tells the task to read version and plugin name from a pom.xml file default: true.
-
#verbose ⇒ Object
Use verbose output.
-
#version ⇒ Object
The plugin version default read from pom.xml (version).
Instance Method Summary collapse
-
#initialize(*args, &task_block) ⇒ PackageTask
constructor
A new instance of PackageTask.
- #run_task(verbose) ⇒ Object
- #setup_ivars(args) ⇒ Object
Constructor Details
#initialize(*args, &task_block) ⇒ PackageTask
Returns a new instance of PackageTask.
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 67 def initialize(*args, &task_block) setup_ivars(args) desc "Package a Maestro Ruby plugin into a Zip file" unless ::Rake.application.last_comment task name, *args do |_, task_args| RakeFileUtils.send(:verbose, verbose) do task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block run_task verbose end end end |
Instance Attribute Details
#dest_dir ⇒ Object
The destination directory default:
.
59 60 61 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 59 def dest_dir @dest_dir end |
#directories ⇒ Object
List the directories to package default:
[ 'src', 'vendor', 'images' ]
26 27 28 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 26 def directories @directories end |
#files ⇒ Object
List the files to package default:
[ 'manifest.json', 'README.md', 'LICENSE' ]
31 32 33 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 31 def files @files end |
#manifest_template_path ⇒ Object
The path to the manifest template default:
'./manifest.template.json'
46 47 48 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 46 def manifest_template_path @manifest_template_path end |
#name ⇒ Object
Name of task.
default:
:package
65 66 67 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 65 def name @name end |
#plugin_name ⇒ Object
The plugin name default read from pom.xml (artifactId)
54 55 56 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 54 def plugin_name @plugin_name end |
#pom_path ⇒ Object
The path to the pom.xml default:
'./pom.xml'
41 42 43 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 41 def pom_path @pom_path end |
#use_pom ⇒ Object
Tells the task to read version and plugin name from a pom.xml file default:
true
36 37 38 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 36 def use_pom @use_pom end |
#verbose ⇒ Object
Use verbose output. If this is set to true, the task will print the progress output to stdout.
default:
true
21 22 23 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 21 def verbose @verbose end |
#version ⇒ Object
The plugin version default read from pom.xml (version)
50 51 52 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 50 def version @version end |
Instance Method Details
#run_task(verbose) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 91 def run_task(verbose) parse_pom if @use_pom # Make sure we have a valid name and version abort "ERROR: Plugin name is missing" unless @plugin_name abort "ERROR: Plugin version is missing" unless @version # Add the commit hash to the version if it's available git_version! if File.exists?('.git') # If we use a template, use it to create the manifest update_manifest if File.exists?(@manifest_template_path) # Create the zip file create_zip_file("#{@plugin_name}-#{@version}.zip") end |
#setup_ivars(args) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/maestro/plugin/rake_tasks/package_task.rb', line 80 def setup_ivars(args) @name = args.shift || :package @verbose, @use_pom = true, true @directories = [ 'src', 'vendor', 'images' ] @files = [ 'manifest.json', 'README.md', 'LICENSE' ] @version, @plugin_name = nil, nil @dest_dir = '.' @pom_path = './pom.xml' @manifest_template_path = './manifest.template.json' end |