Class: Packtory::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Packtory::RakeTask
- Defined in:
- lib/packtory/rake_task.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_deb ⇒ Object
- #build_package ⇒ Object
- #build_rpm ⇒ Object
- #bundle_standalone ⇒ Object
- #define_tasks ⇒ Object
- #detect_environment ⇒ Object
-
#initialize(which = [ ]) ⇒ RakeTask
constructor
A new instance of RakeTask.
- #spec_with_package ⇒ Object
Constructor Details
Class Method Details
.install_tasks ⇒ Object
3 4 5 |
# File 'lib/packtory/rake_task.rb', line 3 def self.install_tasks new.define_tasks end |
Instance Method Details
#build_deb ⇒ Object
81 82 83 84 85 |
# File 'lib/packtory/rake_task.rb', line 81 def build_deb puts 'Building DEB package file...' packager, pkg_path = Packer.build_deb puts 'Done creating DEB: %s' % pkg_path end |
#build_package ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/packtory/rake_task.rb', line 71 def build_package packages = Packer.config[:packages] packages.each do |pack| build_method = PACKAGE_METHOD_MAP[pack] unless build_method.nil? send(build_method) end end end |
#build_rpm ⇒ Object
87 88 89 90 91 |
# File 'lib/packtory/rake_task.rb', line 87 def build_rpm puts 'Building RPM package file...' packager, pkg_path = Packer.build_rpm puts 'Done creating RPM: %s' % pkg_path end |
#bundle_standalone ⇒ Object
103 104 105 |
# File 'lib/packtory/rake_task.rb', line 103 def bundle_standalone RakeTools.bundle_standalone end |
#define_tasks ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/packtory/rake_task.rb', line 35 def define_tasks @which.each do |task_name| case task_name when :build_package desc 'Create all the packages' task :build_package do build_package end when :build_deb desc 'Create a debian package' task :build_deb do build_deb end when :build_rpm desc 'Create an RPM package' task :build_rpm do build_rpm end when :spec_with_package desc 'Run RSpec code examples with package files' task :spec_with_package do spec_with_package end when :bundle_standalone desc 'Execute bundle --standalone to download and install local copies of gems' task :bundle_standalone do bundle_standalone end else # do nothing end end self end |
#detect_environment ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/packtory/rake_task.rb', line 14 def detect_environment if defined?(::RSpec) unless @which.include?(:spec_with_package) @which << :spec_with_package end end packages = Packer.config[:packages] packages.each do |pack| unless @which.include?(PACKAGE_METHOD_MAP) @which << PACKAGE_METHOD_MAP[pack] end end unless packages.empty? @which << :build_package end @which end |
#spec_with_package ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/packtory/rake_task.rb', line 93 def spec_with_package prefix_path = Packer.config[:deb_prefix] packager = Packer.new sfiles_map = packager.prepare_files(prefix_path) ENV['PACKTORY_WORKING_PATH'] = packager.working_path Rake::Task['spec'].execute end |