packaging_rake_tasks 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/packaging/git_helpers.rb +109 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47be5a27f65d9a027aa8fa4beea8f8abde96ab8a6edd71e3d51b685233535c21
|
4
|
+
data.tar.gz: aab7e6292b15f7b192ea4662a2719cc9f405f133df9332ad31848c2a184a0da9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a11c5d4860ee72e8b97171c6a791557601b69e0a9fa80609c1906d4e169a5088164d2a9da636fb5a2448a4d6f161c0b15dc69c453a2161549aae19c62d145d8
|
7
|
+
data.tar.gz: 6d6370b0738d43364a6bf41456fc1971171b646537b05032984bbfdfbb5469b1733135e059de9772b0b1f9884cdd51f37c6fa1043cc3210d4b594b3fb6a8ec50
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.8
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#--
|
2
|
+
# Rake helpers
|
3
|
+
#
|
4
|
+
# Copyright (C) 2019 SUSE Linux LLC
|
5
|
+
# This library is free software; you can redistribute it and/or modify
|
6
|
+
# it only under the terms of version 2.1 of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful, but WITHOUT
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
12
|
+
# details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
#++
|
18
|
+
|
19
|
+
module Packaging
|
20
|
+
#
|
21
|
+
# Helpers around various git commands
|
22
|
+
module GitHelpers
|
23
|
+
# Create a git tag based on the version and the current branch.
|
24
|
+
#
|
25
|
+
# The optional block can specify the version number to use. If no block
|
26
|
+
# is given, this uses spec_version, i.e. the version number of the first
|
27
|
+
# .spec file in the package/ subdirectory.
|
28
|
+
#
|
29
|
+
# @return [Boolean] true if the tag was created, false if it already existed
|
30
|
+
#
|
31
|
+
def create_version_tag(&block)
|
32
|
+
name = tag_name(&block)
|
33
|
+
if tag_exists?(name)
|
34
|
+
puts "Tag #{name} already exists"
|
35
|
+
false
|
36
|
+
else
|
37
|
+
puts "Creating tag #{name}"
|
38
|
+
git("tag #{name}")
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Check if a tag exists.
|
44
|
+
#
|
45
|
+
# @return Boolean
|
46
|
+
#
|
47
|
+
def tag_exists?(name = nil)
|
48
|
+
name ||= tag_name
|
49
|
+
git("tag").include?(name)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Read the package version from the first .spec file in the packages/
|
53
|
+
# subdirectory.
|
54
|
+
#
|
55
|
+
# @return String
|
56
|
+
#
|
57
|
+
def spec_version
|
58
|
+
# use the first *.spec file found, assume all spec files
|
59
|
+
# contain the same version
|
60
|
+
File.readlines(Dir.glob("package/*.spec").first)
|
61
|
+
.grep(/^\s*Version:\s*/).first.sub("Version:", "").strip
|
62
|
+
end
|
63
|
+
|
64
|
+
# Return the name of the current git branch or "detached" if in "head
|
65
|
+
# detached" state.
|
66
|
+
#
|
67
|
+
# @return String
|
68
|
+
#
|
69
|
+
def branch_name
|
70
|
+
branch = git("branch").grep(/^\* /).first.sub(/^\* /, "")
|
71
|
+
return "detached" if branch =~ /HEAD detached/
|
72
|
+
branch
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check if the current branch is "master".
|
76
|
+
#
|
77
|
+
# @return [Boolean]
|
78
|
+
#
|
79
|
+
def master?
|
80
|
+
branch_name == "master"
|
81
|
+
end
|
82
|
+
|
83
|
+
# Return a suitable tag name based on version and branch.
|
84
|
+
# For "master", this is only the version number.
|
85
|
+
# For branches, this is "branchname-version".
|
86
|
+
# If in "detached head" state, this is "detached-version".
|
87
|
+
#
|
88
|
+
# Like in create_version_tag, the optional block can specify the version
|
89
|
+
# number to use. If no block is given, this uses spec_version, i.e. the
|
90
|
+
# version number of the first .spec file in the package/ subdirectory.
|
91
|
+
#
|
92
|
+
# @return String
|
93
|
+
#
|
94
|
+
def tag_name(&block)
|
95
|
+
branch = branch_name
|
96
|
+
version = block_given? ? block.call : spec_version
|
97
|
+
return version if branch == "master"
|
98
|
+
branch + "-" + version
|
99
|
+
end
|
100
|
+
|
101
|
+
# Call a git subcommand and return its output as an array of strings.
|
102
|
+
#
|
103
|
+
# @return Array<String>
|
104
|
+
#
|
105
|
+
def git(subcmd)
|
106
|
+
`/usr/bin/git #{subcmd}`.split("\n")
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packaging_rake_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- VERSION
|
36
36
|
- lib/packaging.rb
|
37
37
|
- lib/packaging/configuration.rb
|
38
|
+
- lib/packaging/git_helpers.rb
|
38
39
|
- lib/packaging/tasks.rb
|
39
40
|
- lib/tasks/build_dependencies.rake
|
40
41
|
- lib/tasks/check_changelog.rake
|