vagrant-registration 0.0.17 → 0.0.18
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/CHANGELOG.md +4 -2
- data/README.md +7 -1
- data/lib/vagrant-registration/action.rb +10 -3
- data/lib/vagrant-registration/action/register.rb +12 -2
- data/lib/vagrant-registration/action/unregister_on_destroy.rb +56 -0
- data/lib/vagrant-registration/action/unregister_on_halt.rb +57 -0
- data/lib/vagrant-registration/config.rb +2 -0
- data/lib/vagrant-registration/plugin.rb +9 -4
- data/lib/vagrant-registration/version.rb +1 -1
- data/plugins/guests/redhat/cap/registration.rb +10 -0
- data/plugins/guests/redhat/cap/subscription_manager.rb +7 -0
- data/plugins/guests/redhat/plugin.rb +10 -0
- data/vagrant-registration-0.0.16/.gitignore +34 -0
- data/vagrant-registration-0.0.16/CHANGELOG.md +3 -0
- data/vagrant-registration-0.0.16/Gemfile +9 -0
- data/vagrant-registration-0.0.16/LICENSE.md +339 -0
- data/vagrant-registration-0.0.16/README.md +149 -0
- data/vagrant-registration-0.0.16/Rakefile +25 -0
- data/vagrant-registration-0.0.16/Vagrantfile +44 -0
- data/vagrant-registration-0.0.16/dummy.box +0 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration.rb +21 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration/action.rb +22 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration/action/register.rb +113 -0
- data/{lib → vagrant-registration-0.0.16/lib}/vagrant-registration/action/unregister.rb +0 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration/config.rb +39 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration/plugin.rb +74 -0
- data/vagrant-registration-0.0.16/lib/vagrant-registration/version.rb +5 -0
- data/vagrant-registration-0.0.16/plugins/guests/redhat/cap/registration.rb +72 -0
- data/vagrant-registration-0.0.16/plugins/guests/redhat/cap/subscription_manager.rb +63 -0
- data/vagrant-registration-0.0.16/plugins/guests/redhat/plugin.rb +62 -0
- data/vagrant-registration-0.0.16/tests/helpers.sh +128 -0
- data/vagrant-registration-0.0.16/tests/run.sh +59 -0
- data/vagrant-registration-0.0.16/tests/vagrantfiles/Vagrantfile.rhel_multi_machine +19 -0
- data/vagrant-registration-0.0.16/tests/vagrantfiles/Vagrantfile.rhel_wrong_credentials +14 -0
- data/vagrant-registration-0.0.16/vagrant-registration.gemspec +49 -0
- data/vagrant-registration-0.0.17/.gitignore +34 -0
- data/vagrant-registration-0.0.17/CHANGELOG.md +3 -0
- data/vagrant-registration-0.0.17/Gemfile +9 -0
- data/vagrant-registration-0.0.17/LICENSE.md +339 -0
- data/vagrant-registration-0.0.17/README.md +149 -0
- data/vagrant-registration-0.0.17/Rakefile +25 -0
- data/vagrant-registration-0.0.17/Vagrantfile +44 -0
- data/vagrant-registration-0.0.17/dummy.box +0 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration.rb +21 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/action.rb +22 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/action/register.rb +113 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/action/unregister.rb +56 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/config.rb +39 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/plugin.rb +74 -0
- data/vagrant-registration-0.0.17/lib/vagrant-registration/version.rb +5 -0
- data/vagrant-registration-0.0.17/plugins/guests/redhat/cap/registration.rb +72 -0
- data/vagrant-registration-0.0.17/plugins/guests/redhat/cap/subscription_manager.rb +63 -0
- data/vagrant-registration-0.0.17/plugins/guests/redhat/plugin.rb +62 -0
- data/vagrant-registration-0.0.17/tests/helpers.sh +128 -0
- data/vagrant-registration-0.0.17/tests/run.sh +59 -0
- data/vagrant-registration-0.0.17/tests/vagrantfiles/Vagrantfile.rhel_multi_machine +19 -0
- data/vagrant-registration-0.0.17/tests/vagrantfiles/Vagrantfile.rhel_wrong_credentials +14 -0
- data/vagrant-registration-0.0.17/vagrant-registration.gemspec +49 -0
- data/vagrant-registration-0.0.17/vagrant-registration.spec +90 -0
- metadata +93 -45
@@ -0,0 +1,63 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestRedHat
|
3
|
+
module Cap
|
4
|
+
class SubscriptionManager
|
5
|
+
# Test that we have subscription-manager installed
|
6
|
+
def self.subscription_manager(machine)
|
7
|
+
machine.communicate.test("/usr/sbin/subscription-manager", sudo: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Register the machine using 'register' option, config is (Open)Struct
|
11
|
+
def self.subscription_manager_register(machine, config)
|
12
|
+
command = "subscription-manager register #{configuration_to_options(config)}"
|
13
|
+
machine.communicate.execute("cmd=$(#{command}); if [ \"$?\" != \"0\" ]; then echo $cmd | grep 'This system is already registered' || (echo $cmd 1>&2 && exit 1) ; fi", sudo: true)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Unregister the machine using 'unregister' option
|
17
|
+
def self.subscription_manager_unregister(machine)
|
18
|
+
machine.communicate.execute("subscription-manager unregister || :", sudo: true)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Return required configuration options for subscription-manager
|
22
|
+
def self.subscription_manager_credentials(machine)
|
23
|
+
[[:username, :password], [:org, :activationkey]]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return secret options for subscription-manager
|
27
|
+
def self.subscription_manager_secrets(machine)
|
28
|
+
[:password]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# Build additional subscription-manager options based on plugin configuration
|
34
|
+
def self.configuration_to_options(config)
|
35
|
+
config.force = true unless config.force
|
36
|
+
|
37
|
+
# --auto-attach cannot be used in case of org/activationkey registration
|
38
|
+
if config.org && config.activationkey
|
39
|
+
config.auto_attach = false
|
40
|
+
else
|
41
|
+
config.auto_attach = true unless config.auto_attach
|
42
|
+
end
|
43
|
+
|
44
|
+
options = []
|
45
|
+
options << "--username='#{config.username}'" if config.username
|
46
|
+
options << "--password='#{config.password}'" if config.password
|
47
|
+
options << "--serverurl='#{config.serverurl}'" if config.serverurl
|
48
|
+
options << "--baseurl='#{config.baseurl}'" if config.baseurl
|
49
|
+
options << "--org='#{config.org}'" if config.org
|
50
|
+
options << "--environment='#{config.environment}'" if config.environment
|
51
|
+
options << "--name='#{config.name}'" if config.name
|
52
|
+
options << "--auto-attach" if config.auto_attach
|
53
|
+
options << "--activationkey='#{config.activationkey}'" if config.activationkey
|
54
|
+
options << "--servicelevel='#{config.servicelevel}'" if config.servicelevel
|
55
|
+
options << "--release='#{config.release}'" if config.release
|
56
|
+
options << "--force" if config.force
|
57
|
+
options << "--type='#{config.type}'" if config.type
|
58
|
+
options.join(' ')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestRedHat
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
guest_capability("redhat", "registration_register") do
|
7
|
+
require_relative "cap/registration"
|
8
|
+
Cap::Registration
|
9
|
+
end
|
10
|
+
|
11
|
+
guest_capability("redhat", "registration_unregister") do
|
12
|
+
require_relative "cap/registration"
|
13
|
+
Cap::Registration
|
14
|
+
end
|
15
|
+
|
16
|
+
guest_capability("redhat", "registration_manager_installed") do
|
17
|
+
require_relative "cap/registration"
|
18
|
+
Cap::Registration
|
19
|
+
end
|
20
|
+
|
21
|
+
guest_capability("redhat", "registration_credentials") do
|
22
|
+
require_relative "cap/registration"
|
23
|
+
Cap::Registration
|
24
|
+
end
|
25
|
+
|
26
|
+
guest_capability("redhat", "registration_secrets") do
|
27
|
+
require_relative "cap/registration"
|
28
|
+
Cap::Registration
|
29
|
+
end
|
30
|
+
|
31
|
+
guest_capability("redhat", "registration_manager") do
|
32
|
+
require_relative "cap/registration"
|
33
|
+
Cap::Registration
|
34
|
+
end
|
35
|
+
|
36
|
+
guest_capability("redhat", "subscription_manager") do
|
37
|
+
require_relative "cap/subscription_manager"
|
38
|
+
Cap::SubscriptionManager
|
39
|
+
end
|
40
|
+
|
41
|
+
guest_capability("redhat", "subscription_manager_register") do
|
42
|
+
require_relative "cap/subscription_manager"
|
43
|
+
Cap::SubscriptionManager
|
44
|
+
end
|
45
|
+
|
46
|
+
guest_capability("redhat", "subscription_manager_unregister") do
|
47
|
+
require_relative "cap/subscription_manager"
|
48
|
+
Cap::SubscriptionManager
|
49
|
+
end
|
50
|
+
|
51
|
+
guest_capability("redhat", "subscription_manager_credentials") do
|
52
|
+
require_relative "cap/subscription_manager"
|
53
|
+
Cap::SubscriptionManager
|
54
|
+
end
|
55
|
+
|
56
|
+
guest_capability("redhat", "subscription_manager_secrets") do
|
57
|
+
require_relative "cap/subscription_manager"
|
58
|
+
Cap::SubscriptionManager
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Set up test environment
|
2
|
+
function setup_tests() {
|
3
|
+
check_credentials
|
4
|
+
install_dependencies
|
5
|
+
|
6
|
+
# Test results that should be printed at the end
|
7
|
+
TEST_RESULTS=''
|
8
|
+
FAILED=0
|
9
|
+
SUCCEDED=0
|
10
|
+
EXIT_CODE=0
|
11
|
+
}
|
12
|
+
|
13
|
+
# Print test results
|
14
|
+
function print_results() {
|
15
|
+
if [ "$TEST_RESULTS" != "" ]; then
|
16
|
+
printf "\n$TEST_RESULTS\n"
|
17
|
+
fi
|
18
|
+
printf "\n$SUCCEDED succeded, $FAILED failed.\n"
|
19
|
+
exit $EXIT_CODE
|
20
|
+
}
|
21
|
+
|
22
|
+
# Clean up before each test
|
23
|
+
function clean_up() {
|
24
|
+
# Clean up Vagrant metadata
|
25
|
+
rm -rf $DIR/.vagrant
|
26
|
+
}
|
27
|
+
|
28
|
+
# Check that we have credentials to run the test suite
|
29
|
+
function check_credentials() {
|
30
|
+
if [ "$VAGRANT_REGISTRATION_USERNAME" = "" ] || [ "$VAGRANT_REGISTRATION_PASSWORD" = "" ]; then
|
31
|
+
echo "VAGRANT_REGISTRATION_USERNAME and VAGRANT_REGISTRATION_PASSWORD needs to be provided."
|
32
|
+
exit 1
|
33
|
+
fi
|
34
|
+
if [ "$VAGRANT_REGISTRATION_ORG" = "" ] || [ "$VAGRANT_REGISTRATION_ACTIVATIONKEY" = "" ]; then
|
35
|
+
echo "VAGRANT_REGISTRATION_ORG and VAGRANT_REGISTRATION_ACTIVATIONKEY needs to be provided."
|
36
|
+
exit 1
|
37
|
+
fi
|
38
|
+
}
|
39
|
+
|
40
|
+
# Install vagrant and vagrant-registration
|
41
|
+
function install_dependencies() {
|
42
|
+
# Install Vagrant if it's not present
|
43
|
+
PLUGIN_INSTALLED=$(vagrant --help)
|
44
|
+
if [ $? -ne 0 ]; then
|
45
|
+
sudo yum install vagrant-libvirt -y
|
46
|
+
fi
|
47
|
+
|
48
|
+
# Uninstall vagrant-registration if installed
|
49
|
+
# TODO: Uninstall RPM package if needed
|
50
|
+
PLUGIN_INSTALLED=$(vagrant plugin list | grep vagrant-registration)
|
51
|
+
if [ -z "$PLUGIN_INSTALLED" ]; then
|
52
|
+
vagrant plugin uninstall vagrant-registration
|
53
|
+
fi
|
54
|
+
|
55
|
+
# Install vagrant-registration from current sources
|
56
|
+
rm -rf pkg
|
57
|
+
rake build
|
58
|
+
vagrant plugin install pkg/vagrant-registration*.gem
|
59
|
+
}
|
60
|
+
|
61
|
+
# Test that command succeded
|
62
|
+
#
|
63
|
+
# Usage:
|
64
|
+
#
|
65
|
+
# test_success TEST_NAME COMMAND_TO_RUN
|
66
|
+
#
|
67
|
+
# Example:
|
68
|
+
#
|
69
|
+
# test_success "ls won't fail" "ls -all"
|
70
|
+
function test_success() {
|
71
|
+
eval $2 >&1 >/dev/null
|
72
|
+
if [ $? -ne 0 ]; then
|
73
|
+
printf "F"
|
74
|
+
FAILED=$((FAILED + 1))
|
75
|
+
EXIT_CODE=1
|
76
|
+
TEST_RESULTS="$TEST_RESULTS\nTest '$1' failed with command:"
|
77
|
+
TEST_RESULTS="$TEST_RESULTS\n $2"
|
78
|
+
else
|
79
|
+
SUCCEDED=$((SUCCEDED + 1))
|
80
|
+
printf '.'
|
81
|
+
fi
|
82
|
+
}
|
83
|
+
|
84
|
+
# Test that command failed
|
85
|
+
#
|
86
|
+
# Usage:
|
87
|
+
#
|
88
|
+
# test_failure TEST_NAME COMMAND_TO_RUN
|
89
|
+
#
|
90
|
+
# Example:
|
91
|
+
#
|
92
|
+
# test_failure "this should fail" "echoo"
|
93
|
+
function test_failure() {
|
94
|
+
eval $2 >&1 >/dev/null
|
95
|
+
if [ $? -ne 0 ]; then
|
96
|
+
SUCCEDED=$((SUCCEDED + 1))
|
97
|
+
printf '.'
|
98
|
+
else
|
99
|
+
printf "F"
|
100
|
+
FAILED=$((FAILED + 1))
|
101
|
+
EXIT_CODE=1
|
102
|
+
TEST_RESULTS="$TEST_RESULTS\nTest '$1' dit not fail with command:"
|
103
|
+
TEST_RESULTS="$TEST_RESULTS\n $2"
|
104
|
+
fi
|
105
|
+
}
|
106
|
+
|
107
|
+
# Test that command produced an expected output
|
108
|
+
#
|
109
|
+
# Usage:
|
110
|
+
#
|
111
|
+
# test_output TEST_NAME COMMAND_TO_RUN EXPECTED_OUTPUT
|
112
|
+
#
|
113
|
+
# Example:
|
114
|
+
#
|
115
|
+
# test_output "echo abc outputs abc" "echo 'abc'" "abc"
|
116
|
+
function test_output() {
|
117
|
+
eval $2 >&1| grep "$3" >/dev/null
|
118
|
+
if [ $? -ne 0 ]; then
|
119
|
+
printf "F"
|
120
|
+
FAILED=$((FAILED + 1))
|
121
|
+
EXIT_CODE=1
|
122
|
+
TEST_RESULTS="$TEST_RESULTS\nTest '$1' failed with command:"
|
123
|
+
TEST_RESULTS="$TEST_RESULTS\n $2 | grep '$3'"
|
124
|
+
else
|
125
|
+
SUCCEDED=$((SUCCEDED + 1))
|
126
|
+
printf '.'
|
127
|
+
fi
|
128
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This tests test vagrant-registration plugin running on Fedora
|
4
|
+
# with libvirt. If you do not have Vagrant installed or if you
|
5
|
+
# have vagrant-libvirt package on your system, Vagrant will be
|
6
|
+
# installed or vagrant-libvirt removed respectively. In that case
|
7
|
+
# you need sudo to run the tests. If you do not run Fedora, make
|
8
|
+
# sure you have Vagrant installed (any provider should do if you
|
9
|
+
# add RHEL box called 'rhel-7').
|
10
|
+
#
|
11
|
+
# IMPORTANT: Tests need valid credentials to actually test
|
12
|
+
# registration. This can be provided in form of environment
|
13
|
+
# variables.
|
14
|
+
#
|
15
|
+
# NOTE: This will install a development version of
|
16
|
+
# vagrant-registration on your system.
|
17
|
+
#
|
18
|
+
# == subscription-manager
|
19
|
+
#
|
20
|
+
# For testing subscription-manager on RHEL export
|
21
|
+
# VAGRANT_REGISTRATION_USERNAME with VAGRANT_REGISTRATION_PASSWORD
|
22
|
+
# for username/password registration and VAGRANT_REGISTRATION_ORG
|
23
|
+
# with VAGRANT_REGISTRATION_ACTIVATIONKEY for org/activationkey one.
|
24
|
+
#
|
25
|
+
|
26
|
+
DIR=$(dirname $(readlink -f "$0"))
|
27
|
+
|
28
|
+
# Import test helpers
|
29
|
+
. $DIR/helpers.sh
|
30
|
+
|
31
|
+
setup_tests
|
32
|
+
|
33
|
+
# Test correct username/password and org/activationkey credentials in a multi-machine setup
|
34
|
+
clean_up
|
35
|
+
export VAGRANT_VAGRANTFILE=$DIR/vagrantfiles/Vagrantfile.rhel_multi_machine
|
36
|
+
|
37
|
+
test_success 'vagrant up on RHEL multi_machine setup' 'vagrant up rhel1-valid-credentials'
|
38
|
+
|
39
|
+
test_output 'first machine is registered with given username/password' \
|
40
|
+
'vagrant ssh rhel1-valid-credentials -c '\''sudo subscription-manager register'\''' \
|
41
|
+
'This system is already registered.'
|
42
|
+
|
43
|
+
test_success 'vagrant halt on RHEL multi_machine setup' 'vagrant halt rhel1-valid-credentials'
|
44
|
+
test_success 'vagrant halt on RHEL multi_machine setup' 'vagrant destroy'
|
45
|
+
test_success 'vagrant up on RHEL multi_machine setup' 'vagrant up rhel2-valid-credentials'
|
46
|
+
|
47
|
+
test_output 'second machine is registered with given org/activationkey' \
|
48
|
+
'vagrant ssh rhel2-valid-credentials -c '\''sudo subscription-manager register'\''' \
|
49
|
+
'This system is already registered.'
|
50
|
+
|
51
|
+
test_success 'vagrant halt on RHEL multi_machine setup' 'vagrant destroy'
|
52
|
+
|
53
|
+
# Test wrong credentials
|
54
|
+
clean_up
|
55
|
+
export VAGRANT_VAGRANTFILE=$DIR/vagrantfiles/Vagrantfile.rhel_wrong_credentials
|
56
|
+
test_failure 'vagrant up on RHEL with wrong credentials should fail' 'vagrant up'
|
57
|
+
test_success 'vagrant destroy on RHEL with wrong credentials' 'vagrant destroy'
|
58
|
+
|
59
|
+
print_results
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Spin 3 RHEL machines that will be registered
|
2
|
+
|
3
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] ||= 'libvirt'
|
4
|
+
ENV['VAGRANT_REGISTRATION_RHEL_BOX'] ||= 'rhel-7.0'
|
5
|
+
|
6
|
+
Vagrant.configure('2') do |config|
|
7
|
+
config.vm.box = ENV['VAGRANT_REGISTRATION_RHEL_BOX']
|
8
|
+
|
9
|
+
config.vm.define "rhel1-valid-credentials" do |c|
|
10
|
+
c.registration.username = ENV['VAGRANT_REGISTRATION_USERNAME']
|
11
|
+
c.registration.password = ENV['VAGRANT_REGISTRATION_PASSWORD']
|
12
|
+
end
|
13
|
+
|
14
|
+
config.vm.define "rhel2-valid-credentials" do |c|
|
15
|
+
c.registration.org = ENV['VAGRANT_REGISTRATION_ORG']
|
16
|
+
c.registration.activationkey = ENV['VAGRANT_REGISTRATION_ACTIVATIONKEY']
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Spin 1 RHEL machine with wrong credentials
|
2
|
+
|
3
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] ||= 'libvirt'
|
4
|
+
ENV['VAGRANT_REGISTRATION_RHEL_BOX'] ||= 'rhel-7.0'
|
5
|
+
|
6
|
+
Vagrant.configure('2') do |config|
|
7
|
+
config.vm.box = ENV['VAGRANT_REGISTRATION_RHEL_BOX']
|
8
|
+
|
9
|
+
config.vm.define "rhel1-wrong-credentials" do |c|
|
10
|
+
c.registration.username = 'wrong_username'
|
11
|
+
c.registration.password = 'wrong_password'
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
2
|
+
require "vagrant-registration/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "vagrant-registration"
|
6
|
+
s.version = VagrantPlugins::Registration::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.license = "GPL-2.0"
|
9
|
+
s.authors = ["Langdon White", "Josef Strzibny", "et al"]
|
10
|
+
s.email = ["langdon@fedoraproject.org", "strzibny@strzibny.name"]
|
11
|
+
s.summary = "Automatic guest registration for Vagrant"
|
12
|
+
s.description = "Enables guests to be registered automatically which is especially useful for RHEL or SLES guests."
|
13
|
+
s.homepage = "https://github.com/projectatomic/adb-vagrant-registration"
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
|
16
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
17
|
+
# the "!" syntax, but it should mostly work correctly.
|
18
|
+
root_path = File.dirname(__FILE__)
|
19
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
20
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
21
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
22
|
+
gitignore = File.readlines(gitignore_path)
|
23
|
+
gitignore.map! { |line| line.chomp.strip }
|
24
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
25
|
+
|
26
|
+
unignored_files = all_files.reject do |file|
|
27
|
+
# Ignore any directories, the gemspec only cares about files
|
28
|
+
next true if File.directory?(file)
|
29
|
+
|
30
|
+
# Ignore any paths that match anything in the gitignore. We do
|
31
|
+
# two tests here:
|
32
|
+
#
|
33
|
+
# - First, test to see if the entire path matches the gitignore.
|
34
|
+
# - Second, match if the basename does, this makes it so that things
|
35
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
36
|
+
# as git).
|
37
|
+
#
|
38
|
+
gitignore.any? do |ignore|
|
39
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
40
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
s.files = unignored_files
|
45
|
+
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
46
|
+
s.require_path = 'lib'
|
47
|
+
|
48
|
+
s.add_development_dependency 'yard'
|
49
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# Generated from vagrant-registration-0.0.11.gem by gem2rpm -*- rpm-spec -*-
|
2
|
+
%global gem_name vagrant-registration
|
3
|
+
|
4
|
+
Name: rubygem-%{gem_name}
|
5
|
+
Version: 0.0.11
|
6
|
+
Release: 1%{?dist}
|
7
|
+
Summary: Enables guests to have a registration capability
|
8
|
+
Group: Development/Languages
|
9
|
+
License: GPL-2.0
|
10
|
+
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
11
|
+
BuildRequires: ruby(release)
|
12
|
+
BuildRequires: rubygems-devel >= 1.3.6
|
13
|
+
BuildRequires: ruby
|
14
|
+
# BuildRequires: rubygem(yard)
|
15
|
+
BuildArch: noarch
|
16
|
+
###$$$$$$$$$$$$$$$$$
|
17
|
+
Requires: ruby(rubygems) >= 1.3.6
|
18
|
+
|
19
|
+
BuildRequires: ruby
|
20
|
+
BuildRequires: rubygems-devel >= 1.3.6
|
21
|
+
# BuildRequires: rubygem(yard)
|
22
|
+
###$$$$$$$$$$$$$$$$$
|
23
|
+
|
24
|
+
%description
|
25
|
+
Enables guests to have a registration capability, this is expecially useful on
|
26
|
+
RHEL or SLES.
|
27
|
+
|
28
|
+
|
29
|
+
%package doc
|
30
|
+
Summary: Documentation for %{name}
|
31
|
+
Group: Documentation
|
32
|
+
Requires: %{name} = %{version}-%{release}
|
33
|
+
BuildArch: noarch
|
34
|
+
|
35
|
+
%description doc
|
36
|
+
Documentation for %{name}.
|
37
|
+
|
38
|
+
%prep
|
39
|
+
gem unpack %{SOURCE0}
|
40
|
+
|
41
|
+
%setup -q -D -T -n %{gem_name}-%{version}
|
42
|
+
|
43
|
+
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
44
|
+
|
45
|
+
%build
|
46
|
+
# Create the gem as gem install only works on a gem file
|
47
|
+
gem build %{gem_name}.gemspec
|
48
|
+
|
49
|
+
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
|
50
|
+
# by default, so that we can move it into the buildroot in %%install
|
51
|
+
%gem_install
|
52
|
+
|
53
|
+
%install
|
54
|
+
mkdir -p %{buildroot}%{gem_dir}
|
55
|
+
cp -a .%{gem_dir}/* \
|
56
|
+
%{buildroot}%{gem_dir}/
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
# Run the test suite
|
62
|
+
%check
|
63
|
+
pushd .%{gem_instdir}
|
64
|
+
|
65
|
+
popd
|
66
|
+
|
67
|
+
%files
|
68
|
+
%dir %{gem_instdir}
|
69
|
+
%exclude %{gem_instdir}/.gitignore
|
70
|
+
%license %{gem_instdir}/LICENSE.md
|
71
|
+
%{gem_instdir}/dummy.box
|
72
|
+
%{gem_libdir}
|
73
|
+
%{gem_instdir}/plugins
|
74
|
+
%exclude %{gem_cache}
|
75
|
+
%{gem_spec}
|
76
|
+
|
77
|
+
%files doc
|
78
|
+
%doc %{gem_docdir}
|
79
|
+
%doc %{gem_instdir}/CHANGELOG.md
|
80
|
+
%{gem_instdir}/Gemfile
|
81
|
+
%doc %{gem_instdir}/README.md
|
82
|
+
%{gem_instdir}/Rakefile
|
83
|
+
%{gem_instdir}/Vagrantfile
|
84
|
+
%doc %{gem_instdir}/doc
|
85
|
+
%{gem_instdir}/tests
|
86
|
+
%{gem_instdir}/vagrant-registration.gemspec
|
87
|
+
|
88
|
+
%changelog
|
89
|
+
* Mon Apr 27 2015 Josef Stribny <jstribny@redhat.com> - 0.0.11-1
|
90
|
+
- Initial package
|