module Hoe::Packaging
rubocop:disable Style/ClassAndModuleChildren
Constants
- VERSION
Versionizing
Attributes
create_packages[RW]
deploy_packages[RW]
Public Instance Methods
bintray_config()
click to toggle source
Method for getting the bintray config @return [Array] user apikey
# File lib/hoe/packaging.rb, line 110 def bintray_config config = YAML.safe_load(File.read("#{Dir.home}/.hoerc")) user = config['deploy']['username'].to_s apikey = config['deploy']['apikey'].to_s [user, apikey] end
create_packages_method()
click to toggle source
Method for creating deb and rpm packages @return [String] true or false
# File lib/hoe/packaging.rb, line 52 def create_packages_method FileUtils.cd('recipes') do puts 'Creating the deb package'.color(:yellow) system('fpm-cook -t deb') puts 'deb creating done'.color(:green) puts 'Creating the rpm package'.color(:yellow) system('fpm-cook -t rpm') puts 'rpm creating done'.color(:green) end end
define_packaging_tasks()
click to toggle source
# File lib/hoe/packaging.rb, line 36 def define_packaging_tasks # Rake Task for building packages desc 'Creating deb and rpm files' task :create_packages do create_packages_method end # Rake task for deploying packages desc 'Deploying packages to bintray' task :deploy_packages do deploy_bintray_method end end
deploy_bintray_method()
click to toggle source
Method for deploying to bintray rubocop:disable Metrics/AbcSize rubocop:disable Metrics/LineLength rubocop:disable Metrics/MethodLength This method smells of :reek:TooManyStatements @return [String] true or false
# File lib/hoe/packaging.rb, line 69 def deploy_bintray_method project = projectname user, apikey = bintray_config version = version path = 'pool/main/r' debadd = ';deb_distribution=ubuntu;deb_component=main;deb_architecture=i386,amd64' publish = ';publish=1' puts 'Deploying packages to bintray'.color(:yellow) FileUtils.cd('recipes/pkg') do filerpm = Dir.glob('*.rpm') filedeb = Dir.glob('*.deb') rpm = filerpm.first.to_s deb = filedeb.first.to_s rpmup = system("curl -T #{rpm} -u#{user}:#{apikey} https://api.bintray.com/content/#{user}/rpm/#{project}/v#{version}/#{path}/#{publish}") begin rpmup['message'] == 'success' rescue NoMethodError false end debup = system("curl -T #{deb} -u#{user}:#{apikey} 'https://api.bintray.com/content/#{user}/deb/#{project}/v#{version}/#{path}/#{deb}#{debadd}#{publish}'") begin debup['message'] == 'success' rescue NoMethodError false end end puts 'Deploying succeeded'.color(:green) end
initialize_packaging()
click to toggle source
Initialize plugin
# File lib/hoe/packaging.rb, line 28 def initialize_packaging require 'fileutils' require 'parseconfig' require 'rainbow/ext/string' require 'fpm' require 'yaml' end
projectname()
click to toggle source
Method for getting the project name @return [String] project Returns project name
# File lib/hoe/packaging.rb, line 102 def projectname pnameraw = File.open(*Dir.glob('README.*'), &:readline) project = pnameraw.gsub(/[^0-9A-Za-z_-]/, '') return project end
version()
click to toggle source
Method for getting version @return [String] version
# File lib/hoe/packaging.rb, line 119 def version version = File.open(*Dir.glob('VERSION'), &:readline) version.chomp.to_s end