hoe-packaging 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +106 -102
- data/CONTRIBUTING.md +21 -25
- data/LICENSE.md +635 -635
- data/MAINTENANCE.md +18 -18
- data/README.md +82 -78
- data/lib/hoe/packaging.rb +126 -126
- metadata +11 -13
data/MAINTENANCE.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
# MAINTENANCE POLICY:
|
2
|
-
|
3
|
-
I'm following the Semantic Versioning for its releases: (Major).(Minor).(Patch).
|
4
|
-
|
5
|
-
* Major version: Whenever there is something significant or any backwards
|
6
|
-
incompatible changes.
|
7
|
-
* Minor version: When new, backwards compatible functionality is introduced a
|
8
|
-
minor feature is introduced, or when a set of smaller features is rolled out.
|
9
|
-
* Patch number: When backwards compatible bug fixes are introduced that fix
|
10
|
-
incorrect behavior.
|
11
|
-
* The current stable release will receive security patches and bug fixes
|
12
|
-
(eg. 5.0 -> 5.0.1).
|
13
|
-
* Feature releases will mark the next supported stable release where the minor
|
14
|
-
version is increased numerically by increments of one (eg. 5.0 -> 5.1).
|
15
|
-
|
16
|
-
I encourage everyone to run the latest stable release to ensure that you can
|
17
|
-
easily upgrade to the most secure and feature rich experience. In order to
|
18
|
-
make sure you can easily run the most recent stable release, we are working
|
1
|
+
# MAINTENANCE POLICY:
|
2
|
+
|
3
|
+
I'm following the Semantic Versioning for its releases: (Major).(Minor).(Patch).
|
4
|
+
|
5
|
+
* Major version: Whenever there is something significant or any backwards
|
6
|
+
incompatible changes.
|
7
|
+
* Minor version: When new, backwards compatible functionality is introduced a
|
8
|
+
minor feature is introduced, or when a set of smaller features is rolled out.
|
9
|
+
* Patch number: When backwards compatible bug fixes are introduced that fix
|
10
|
+
incorrect behavior.
|
11
|
+
* The current stable release will receive security patches and bug fixes
|
12
|
+
(eg. 5.0 -> 5.0.1).
|
13
|
+
* Feature releases will mark the next supported stable release where the minor
|
14
|
+
version is increased numerically by increments of one (eg. 5.0 -> 5.1).
|
15
|
+
|
16
|
+
I encourage everyone to run the latest stable release to ensure that you can
|
17
|
+
easily upgrade to the most secure and feature rich experience. In order to
|
18
|
+
make sure you can easily run the most recent stable release, we are working
|
19
19
|
hard to keep the update process simple and reliable.
|
data/README.md
CHANGED
@@ -1,79 +1,83 @@
|
|
1
|
-
# hoe-packaging
|
2
|
-
|
3
|
-
|What | Where |
|
4
|
-
|-----|--------|
|
5
|
-
| code | https://github.com/saigkill/hoe-packaging |
|
6
|
-
| docs | https://github.com/saigkill/hoe-packaging/wiki |
|
7
|
-
| apidoc | http://www.rubydoc.info/gems/hoe-packaging |
|
8
|
-
| bugs & feature requests | https://github.com/saigkill/hoe-packaging/issues |
|
9
|
-
| openhub statistics | https://www.openhub.net/p/hoe-packaging |
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
|
17
|
-
|downloads
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|dependencies|[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=saigkill/hoe-packaging)](https://dependabot.com) |
|
21
|
-
|security | [![Security](https://hakiri.io/github/saigkill/hoe-packaging/master.svg)](https://hakiri.io/github/saigkill/hoe-packaging/master/shield) |
|
22
|
-
|vulnerabilities|[![Known Vulnerabilities](https://snyk.io/test/github/saigkill/hoe-packaging/badge.svg?targetFile=Gemfile.lock)](https://snyk.io/test/github/saigkill/hoe-packaging?targetFile=Gemfile.lock) |
|
23
|
-
|documentation quality | [![Documentation Quality](https://inch-ci.org/github/saigkill/hoe-packaging.svg?branch=master)](https://inch-ci.org/github/saigkill/hoe-packaging) |
|
24
|
-
|
25
|
-
##
|
26
|
-
|
27
|
-
hoe-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
The
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
1
|
+
# hoe-packaging
|
2
|
+
|
3
|
+
|What | Where |
|
4
|
+
|-----|--------|
|
5
|
+
| code | https://github.com/saigkill/hoe-packaging |
|
6
|
+
| docs | https://github.com/saigkill/hoe-packaging/wiki |
|
7
|
+
| apidoc | http://www.rubydoc.info/gems/hoe-packaging |
|
8
|
+
| bugs & feature requests | https://github.com/saigkill/hoe-packaging/issues |
|
9
|
+
| openhub statistics | https://www.openhub.net/p/hoe-packaging |
|
10
|
+
| authors blog | https://saschamanns.de |
|
11
|
+
| min. rubyver | 2.3.0 |
|
12
|
+
|
13
|
+
| What | Status |
|
14
|
+
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
15
|
+
|last public version | [![Last Version](https://badge.fury.io/rb/hoe-packaging.png)](http://rubygems.org/gems/hoe-packaging) |
|
16
|
+
|downloads latest | [![Downloads latest](https://img.shields.io/gem/dtv/hoe-packaging.svg)](http://rubygems.org/gems/hoe-packaging) |
|
17
|
+
|downloads all | [![Downloads all](https://img.shields.io/gem/dt/hoe-packaging.svg)](http://rubygems.org/gems/hoe-packaging) |
|
18
|
+
|code quality | [![Maintainability](https://api.codeclimate.com/v1/badges/5491c830409827e04868/maintainability)](https://codeclimate.com/github/saigkill/hoe-packaging/maintainability) |
|
19
|
+
|continuous integration | ![CI](https://github.com/saigkill/hoe-packaging/workflows/CI/badge.svg?branch=master&event=push) |
|
20
|
+
|dependencies|[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=saigkill/hoe-packaging)](https://dependabot.com) |
|
21
|
+
|security | [![Security](https://hakiri.io/github/saigkill/hoe-packaging/master.svg)](https://hakiri.io/github/saigkill/hoe-packaging/master/shield) |
|
22
|
+
|vulnerabilities|[![Known Vulnerabilities](https://snyk.io/test/github/saigkill/hoe-packaging/badge.svg?targetFile=Gemfile.lock)](https://snyk.io/test/github/saigkill/hoe-packaging?targetFile=Gemfile.lock) |
|
23
|
+
|documentation quality | [![Documentation Quality](https://inch-ci.org/github/saigkill/hoe-packaging.svg?branch=master)](https://inch-ci.org/github/saigkill/hoe-packaging) |
|
24
|
+
|
25
|
+
## SCREENSHOT
|
26
|
+
|
27
|
+
[![Screenshot](https://saschamanns.de/img/screenshots/hoe-manns-screenshots.png)](https://github.com/saigkill/hoe-manns)
|
28
|
+
|
29
|
+
## DESCRIPTION:
|
30
|
+
|
31
|
+
hoe-packaging is a plugin for the hoe ruby projecthelper (https://github.com/seattlerb/hoe). It provides creation of rpm and deb packages,
|
32
|
+
also a deployment to bintray.
|
33
|
+
|
34
|
+
The CHANGELOG.md contains a detailed description on what has changed.
|
35
|
+
|
36
|
+
hoe-packaging is released under the GPL3 License, see the file 'LICENSE.md' for more information.
|
37
|
+
|
38
|
+
The official web site is:
|
39
|
+
|
40
|
+
https://github.com/saigkill/hoe-packaging
|
41
|
+
|
42
|
+
## FEATURES:
|
43
|
+
|
44
|
+
* creating of deb & rpm packages
|
45
|
+
* deploying to bintray.
|
46
|
+
|
47
|
+
This Gem was programmed and tested for Linux systems. If anyone would like to make the methods also fit for other OS, i'm happy about Pull requests.
|
48
|
+
|
49
|
+
See the {Tracker}[https://github.com/saigkill/hoe-packaging/issues] for checking known issues.
|
50
|
+
|
51
|
+
## SYNOPSIS:
|
52
|
+
|
53
|
+
Use in your Rakefile:
|
54
|
+
|
55
|
+
Hoe.plugin :packaging
|
56
|
+
|
57
|
+
Hoe.spec 'yourproject' do
|
58
|
+
...
|
59
|
+
end
|
60
|
+
|
61
|
+
Also add hoe-packaging to your requirements and recreate your Gemfile.
|
62
|
+
|
63
|
+
Read the documentation at: https://github.com/saigkill/hoe-packaging/wiki
|
64
|
+
|
65
|
+
## REQUIREMENTS:
|
66
|
+
|
67
|
+
* fpm
|
68
|
+
* fpm-cookery
|
69
|
+
|
70
|
+
## INSTALL:
|
71
|
+
|
72
|
+
The installation is very easy.
|
73
|
+
|
74
|
+
gem install hoe-packaging
|
75
|
+
|
76
|
+
## DEVELOPERS:
|
77
|
+
|
78
|
+
After checking out the source, run:
|
79
|
+
|
80
|
+
$ rake newb
|
81
|
+
|
82
|
+
This task will install any missing dependencies, run the tests/specs,
|
79
83
|
and generate the RDoc.
|
data/lib/hoe/packaging.rb
CHANGED
@@ -1,126 +1,126 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
# Dependencies
|
17
|
-
|
18
|
-
require 'hoe'
|
19
|
-
|
20
|
-
# Main module for hoe-packaging
|
21
|
-
# TODO: Try to fix this in future
|
22
|
-
# rubocop:disable Style/ClassAndModuleChildren
|
23
|
-
module Hoe::Packaging
|
24
|
-
# Versionizing
|
25
|
-
VERSION = '1.2.
|
26
|
-
attr_accessor :create_packages
|
27
|
-
attr_accessor :deploy_packages
|
28
|
-
|
29
|
-
# Initialize plugin
|
30
|
-
def initialize_packaging
|
31
|
-
require 'fileutils'
|
32
|
-
require 'parseconfig'
|
33
|
-
require 'rainbow/ext/string'
|
34
|
-
require 'fpm'
|
35
|
-
require 'yaml'
|
36
|
-
end
|
37
|
-
|
38
|
-
def define_packaging_tasks
|
39
|
-
# Rake Task for building packages
|
40
|
-
desc 'Creating deb and rpm files'
|
41
|
-
task :create_packages do
|
42
|
-
create_packages_method
|
43
|
-
end
|
44
|
-
|
45
|
-
# Rake task for deploying packages
|
46
|
-
desc 'Deploying packages to bintray'
|
47
|
-
task :deploy_packages do
|
48
|
-
deploy_bintray_method
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Method for creating deb and rpm packages
|
53
|
-
# @return [String] true or false
|
54
|
-
def create_packages_method
|
55
|
-
FileUtils.cd('recipes') do
|
56
|
-
puts 'Creating the deb package'.color(:yellow)
|
57
|
-
system('fpm-cook -t deb')
|
58
|
-
puts 'deb creating done'.color(:green)
|
59
|
-
puts 'Creating the rpm package'.color(:yellow)
|
60
|
-
system('fpm-cook -t rpm')
|
61
|
-
puts 'rpm creating done'.color(:green)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Method for deploying to bintray
|
66
|
-
# TODO: Try to pacify rubocop and reek in future
|
67
|
-
# rubocop:disable Metrics/AbcSize
|
68
|
-
# rubocop:disable Metrics/LineLength
|
69
|
-
# rubocop:disable Metrics/MethodLength
|
70
|
-
# This method smells of :reek:TooManyStatements
|
71
|
-
# @return [String] true or false
|
72
|
-
def deploy_bintray_method
|
73
|
-
project = projectname
|
74
|
-
user, apikey = bintray_config
|
75
|
-
version = version
|
76
|
-
path = 'pool/main/r'
|
77
|
-
debadd = ';deb_distribution=ubuntu;deb_component=main;deb_architecture=i386,amd64'
|
78
|
-
publish = ';publish=1'
|
79
|
-
puts 'Deploying packages to bintray'.color(:yellow)
|
80
|
-
|
81
|
-
FileUtils.cd('recipes/pkg') do
|
82
|
-
filerpm = Dir.glob('*.rpm')
|
83
|
-
filedeb = Dir.glob('*.deb')
|
84
|
-
rpm = filerpm.first.to_s
|
85
|
-
deb = filedeb.first.to_s
|
86
|
-
|
87
|
-
rpmup = system("curl -T #{rpm} -u#{user}:#{apikey} https://api.bintray.com/content/#{user}/rpm/#{project}/v#{version}/#{path}/#{publish}")
|
88
|
-
begin
|
89
|
-
rpmup['message'] == 'success'
|
90
|
-
rescue NoMethodError
|
91
|
-
false
|
92
|
-
end
|
93
|
-
debup = system("curl -T #{deb} -u#{user}:#{apikey} 'https://api.bintray.com/content/#{user}/deb/#{project}/v#{version}/#{path}/#{deb}#{debadd}#{publish}'")
|
94
|
-
begin
|
95
|
-
debup['message'] == 'success'
|
96
|
-
rescue NoMethodError
|
97
|
-
false
|
98
|
-
end
|
99
|
-
end
|
100
|
-
puts 'Deploying succeeded'.color(:green)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Method for getting the project name
|
104
|
-
# @return [String] project Returns project name
|
105
|
-
def projectname
|
106
|
-
pnameraw = File.open(*Dir.glob('README.*'), &:readline)
|
107
|
-
project = pnameraw.gsub(/[^0-9A-Za-z_-]/, '')
|
108
|
-
return project
|
109
|
-
end
|
110
|
-
|
111
|
-
# Method for getting the bintray config
|
112
|
-
# @return [Array] user apikey
|
113
|
-
def bintray_config
|
114
|
-
config = YAML.safe_load(File.read("#{Dir.home}/.hoerc"))
|
115
|
-
user = config['deploy']['username'].to_s
|
116
|
-
apikey = config['deploy']['apikey'].to_s
|
117
|
-
[user, apikey]
|
118
|
-
end
|
119
|
-
|
120
|
-
# Method for getting version
|
121
|
-
# @return [String] version
|
122
|
-
def version
|
123
|
-
version = File.open(*Dir.glob('VERSION'), &:readline)
|
124
|
-
version.chomp.to_s
|
125
|
-
end
|
126
|
-
end
|
1
|
+
# Copyright (C) 2013-2020 Sascha Manns <Sascha.Manns@outlook.de>
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
# Dependencies
|
17
|
+
|
18
|
+
require 'hoe'
|
19
|
+
|
20
|
+
# Main module for hoe-packaging
|
21
|
+
# TODO: Try to fix this in future
|
22
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
23
|
+
module Hoe::Packaging
|
24
|
+
# Versionizing
|
25
|
+
VERSION = '1.2.6'.freeze
|
26
|
+
attr_accessor :create_packages
|
27
|
+
attr_accessor :deploy_packages
|
28
|
+
|
29
|
+
# Initialize plugin
|
30
|
+
def initialize_packaging
|
31
|
+
require 'fileutils'
|
32
|
+
require 'parseconfig'
|
33
|
+
require 'rainbow/ext/string'
|
34
|
+
require 'fpm'
|
35
|
+
require 'yaml'
|
36
|
+
end
|
37
|
+
|
38
|
+
def define_packaging_tasks
|
39
|
+
# Rake Task for building packages
|
40
|
+
desc 'Creating deb and rpm files'
|
41
|
+
task :create_packages do
|
42
|
+
create_packages_method
|
43
|
+
end
|
44
|
+
|
45
|
+
# Rake task for deploying packages
|
46
|
+
desc 'Deploying packages to bintray'
|
47
|
+
task :deploy_packages do
|
48
|
+
deploy_bintray_method
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Method for creating deb and rpm packages
|
53
|
+
# @return [String] true or false
|
54
|
+
def create_packages_method
|
55
|
+
FileUtils.cd('recipes') do
|
56
|
+
puts 'Creating the deb package'.color(:yellow)
|
57
|
+
system('fpm-cook -t deb')
|
58
|
+
puts 'deb creating done'.color(:green)
|
59
|
+
puts 'Creating the rpm package'.color(:yellow)
|
60
|
+
system('fpm-cook -t rpm')
|
61
|
+
puts 'rpm creating done'.color(:green)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Method for deploying to bintray
|
66
|
+
# TODO: Try to pacify rubocop and reek in future
|
67
|
+
# rubocop:disable Metrics/AbcSize
|
68
|
+
# rubocop:disable Metrics/LineLength
|
69
|
+
# rubocop:disable Metrics/MethodLength
|
70
|
+
# This method smells of :reek:TooManyStatements
|
71
|
+
# @return [String] true or false
|
72
|
+
def deploy_bintray_method
|
73
|
+
project = projectname
|
74
|
+
user, apikey = bintray_config
|
75
|
+
version = version
|
76
|
+
path = 'pool/main/r'
|
77
|
+
debadd = ';deb_distribution=ubuntu;deb_component=main;deb_architecture=i386,amd64'
|
78
|
+
publish = ';publish=1'
|
79
|
+
puts 'Deploying packages to bintray'.color(:yellow)
|
80
|
+
|
81
|
+
FileUtils.cd('recipes/pkg') do
|
82
|
+
filerpm = Dir.glob('*.rpm')
|
83
|
+
filedeb = Dir.glob('*.deb')
|
84
|
+
rpm = filerpm.first.to_s
|
85
|
+
deb = filedeb.first.to_s
|
86
|
+
|
87
|
+
rpmup = system("curl -T #{rpm} -u#{user}:#{apikey} https://api.bintray.com/content/#{user}/rpm/#{project}/v#{version}/#{path}/#{publish}")
|
88
|
+
begin
|
89
|
+
rpmup['message'] == 'success'
|
90
|
+
rescue NoMethodError
|
91
|
+
false
|
92
|
+
end
|
93
|
+
debup = system("curl -T #{deb} -u#{user}:#{apikey} 'https://api.bintray.com/content/#{user}/deb/#{project}/v#{version}/#{path}/#{deb}#{debadd}#{publish}'")
|
94
|
+
begin
|
95
|
+
debup['message'] == 'success'
|
96
|
+
rescue NoMethodError
|
97
|
+
false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
puts 'Deploying succeeded'.color(:green)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Method for getting the project name
|
104
|
+
# @return [String] project Returns project name
|
105
|
+
def projectname
|
106
|
+
pnameraw = File.open(*Dir.glob('README.*'), &:readline)
|
107
|
+
project = pnameraw.gsub(/[^0-9A-Za-z_-]/, '')
|
108
|
+
return project
|
109
|
+
end
|
110
|
+
|
111
|
+
# Method for getting the bintray config
|
112
|
+
# @return [Array] user apikey
|
113
|
+
def bintray_config
|
114
|
+
config = YAML.safe_load(File.read("#{Dir.home}/.hoerc"))
|
115
|
+
user = config['deploy']['username'].to_s
|
116
|
+
apikey = config['deploy']['apikey'].to_s
|
117
|
+
[user, apikey]
|
118
|
+
end
|
119
|
+
|
120
|
+
# Method for getting version
|
121
|
+
# @return [String] version
|
122
|
+
def version
|
123
|
+
version = File.open(*Dir.glob('VERSION'), &:readline)
|
124
|
+
version.chomp.to_s
|
125
|
+
end
|
126
|
+
end
|