Skip to content

Commit

Permalink
Merge pull request #46 from coi-gov-pl/feature/enh-10-cover-not-covered
Browse files Browse the repository at this point in the history
Enhancement #10: Raising coverage to more then 80% and cover all Ruby source files
  • Loading branch information
cardil committed Jan 29, 2016
2 parents 6ac56cd + 6a170be commit 5633b79
Show file tree
Hide file tree
Showing 73 changed files with 3,315 additions and 1,529 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file, indent by 2 spaces
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ with:

bundle exec rake acceptance

This will run the tests on an Ubuntu 14.04 virtual machine. You can also
run the integration tests against Centos 6.5 with.
This will run the tests on an Centos 6.5 docker container. You can also
run the integration tests against any other configuration specified in directory `spec/acceptance/nodesets`. For example for Ubuntu 14.04 running on virtualbox via Vagrant you should run:

RS_SET=centos-65-x64-docker bundle exec rake acceptance
RS_SET=ubuntu-14.04-x86_64-vagrant bundle exec rake acceptance

**Caution!** To run Vagrant boxes when you have installed Vagrant in version 1.5 or above, you need to have `bundler` in version range: >= 1.5.2 <= 1.10.5. This is due to fact of invalid version in vagrant-wrapper gem package.

If you don't want to have to recreate the virtual machine every time you
can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
Expand Down
4 changes: 2 additions & 2 deletions lib/facter/jboss_configfile.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.expand_path(File.join(File.dirname(__FILE__), '../puppet_x/coi/jboss/configuration'))
require File.expand_path(File.join(File.dirname(__FILE__), '../puppet_x/coi/jboss'))

Facter.add(:jboss_configfile) do
setcode { Puppet_X::Coi::Jboss::Configuration::configfile }
end
end
22 changes: 2 additions & 20 deletions lib/facter/jboss_fullconfig.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
require File.expand_path(File.join(File.dirname(__FILE__), '../puppet_x/coi/jboss/configuration'))
require File.expand_path(File.join(File.dirname(__FILE__), '../puppet_x/coi/jboss'))

config = Puppet_X::Coi::Jboss::Configuration::read
unless config.nil?
config.each do |key, value|
fact_symbol = "jboss_#{key}".to_sym
Facter.add(fact_symbol) do
setcode { value }
end
end
Facter.add(:jboss_fullconfig) do
setcode do
if RUBY_VERSION < '1.9.0'
class << config
define_method(:to_s, proc { self.inspect })
end
end
config
end
end
end
Puppet_X::Coi::Jboss::Facts.define_fullconfig_fact
10 changes: 4 additions & 6 deletions lib/puppet/parser/functions/jboss_basename.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private basename function
#
# jboss_basename(string) : string
Expand All @@ -8,10 +10,6 @@
# local file system.
module Puppet::Parser::Functions
newfunction(:jboss_basename, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| File.basename(a) end
else
File.basename(args[0])
end
Puppet_X::Coi::Jboss::Functions.jboss_basename args
end
end
end
10 changes: 4 additions & 6 deletions lib/puppet/parser/functions/jboss_dirname.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private dirname function
#
# jboss_dirname(string) : string
Expand All @@ -8,10 +10,6 @@
# local file system.
module Puppet::Parser::Functions
newfunction(:jboss_dirname, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| File.dirname(a) end
else
File.dirname(args[0])
end
Puppet_X::Coi::Jboss::Functions.jboss_dirname args
end
end
end
3 changes: 2 additions & 1 deletion lib/puppet/parser/functions/jboss_hash_setvalue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Sets value to Puppet hash
module Puppet::Parser::Functions
newfunction(:jboss_hash_setvalue) do |args|
raise(Puppet::ParseError, "jboss_hash_setvalue(): wrong lenght of input given (#{args.size} for 3)") if args.size != 3
hash, key, value = args
hash[key] = value
end
end
end
9 changes: 4 additions & 5 deletions lib/puppet/parser/functions/jboss_short_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private short version function
#
# jboss_short_version(string) : string
Expand All @@ -6,9 +8,6 @@
# 'eap-6.2.0.GA' -> '6.2'
module Puppet::Parser::Functions
newfunction(:jboss_short_version, :type => :rvalue) do |args|
version = args[0]
re = /^(?:[a-z]+-)?(\d+\.\d+)\.\d+(?:\.[A-Za-z]+)?$/
m = re.match(version)
if m then m[1] else nil end
Puppet_X::Coi::Jboss::Functions.jboss_short_version args
end
end
end
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/jboss_to_bool.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss/functions/jboss_to_bool')
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private to_bool function
#
Expand All @@ -9,4 +9,4 @@ module Puppet::Parser::Functions
newfunction(:jboss_to_bool, :type => :rvalue) do |args|
Puppet_X::Coi::Jboss::Functions.jboss_to_bool args
end
end
end
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/jboss_to_i.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss/functions/jboss_to_i')
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private to_i function
#
Expand All @@ -9,4 +9,4 @@ module Puppet::Parser::Functions
newfunction(:jboss_to_i, :type => :rvalue) do |args|
Puppet_X::Coi::Jboss::Functions.jboss_to_i args
end
end
end
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/jboss_to_s.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss/functions/jboss_to_s')
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private to_s function
#
Expand All @@ -9,4 +9,4 @@ module Puppet::Parser::Functions
newfunction(:jboss_to_s, :type => :rvalue) do |args|
Puppet_X::Coi::Jboss::Functions.jboss_to_s args
end
end
end
9 changes: 4 additions & 5 deletions lib/puppet/parser/functions/jboss_type_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require File.join(File.dirname(__FILE__), '../../../puppet_x/coi/jboss')

# Jboss AS private type version function
#
# jboss_type_version(string) : string
Expand All @@ -6,9 +8,6 @@
# 'eap-6.2.0.GA' -> 'eap'
module Puppet::Parser::Functions
newfunction(:jboss_type_version, :type => :rvalue) do |args|
version = args[0]
re = /^([a-z]+)-(?:\d+\.\d+)\.\d+(?:\.[A-Za-z]+)?$/
m = re.match(version)
if m then m[1] else nil end
Puppet_X::Coi::Jboss::Functions.jboss_type_version args
end
end
end

0 comments on commit 5633b79

Please sign in to comment.