Fix openwsman.gem creation to include raw SWIG files

SWIG includes its own C preprocessor, thus handling all the
  #if RUBY_VERSION
directives.

This commit drops the swig-generated files in favor of raw swig files.
This makes the resulting gem independant from the host creating the gem.
diff --git a/bindings/ruby/CMakeLists.txt b/bindings/ruby/CMakeLists.txt
index 28d1a90..7ebd41b 100644
--- a/bindings/ruby/CMakeLists.txt
+++ b/bindings/ruby/CMakeLists.txt
@@ -118,7 +118,8 @@
   COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/../openwsman.c" "ext/openwsman"
   COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/../openwsman.h" "ext/openwsman"
   COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/extconf.rb" "ext/openwsman"
-  COMMAND "cp" "*.c" "ext/openwsman"
+  COMMAND "cp" "${CMAKE_CURRENT_BINARY_DIR}/../version.i" "ext/openwsman"
+  COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/../*.i" "ext/openwsman"
   COMMAND "mkdir" "-p" "ext/ruby"
   COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/helpers.h" "ext/ruby"
 
@@ -132,7 +133,8 @@
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/openwsman/*.rb
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/openwsman/*.rb.in
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/*.c
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../*.i
 )
 
 ENDIF( BUILD_RUBY_GEM )
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 025c5ea..03df619 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -28,6 +28,12 @@
 end
 find_header 'libxml/parser.h', '/usr/include/libxml2'
 
+swig = find_executable("swig")
+raise "SWIG not found" unless swig
+
+major, minor, path = RUBY_VERSION.split(".")
+raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -o openwsman_wrap.c openwsman.i")
+
 $CPPFLAGS = "-I/usr/include/openwsman -I.."
 
 create_makefile('_openwsman')
diff --git a/bindings/ruby/openwsman.gemspec.in b/bindings/ruby/openwsman.gemspec.in
index 0b35dfc..6ed5879 100644
--- a/bindings/ruby/openwsman.gemspec.in
+++ b/bindings/ruby/openwsman.gemspec.in
@@ -6,26 +6,26 @@
   s.platform    = Gem::Platform::RUBY
   s.authors     = ["Klaus Kämpf"]
   s.email       = ["kkaempf@suse.de"]
+  s.license     = "BSD 3-clause"
   s.homepage    = "http://openwsman.github.io"
   s.summary = "Ruby client bindings for Openwsman"
   s.description = "The openwsman gem provides a Ruby API to manage
 systems using the WS-Management protocol."
 
   s.required_rubygems_version = ">= 1.3.6"
-  s.add_development_dependency("rake-compiler", [">= 0"])
-  s.add_development_dependency("mocha", [">= 0.9"])
-  s.add_development_dependency("yard", [">= 0.5"])
+  s.add_development_dependency("rake-compiler", ["~> 0"])
+  s.add_development_dependency("mocha", ["~> 0.9"])
+  s.add_development_dependency("yard", ["~> 0.5"])
   if RUBY_VERSION >= "2.1"
     # stdlib test/unit deprecated(broken) with Ruby 2.1 and Minitest 5
     # adding test-unit gem fixes this
-    s.add_development_dependency("test-unit")
+    s.add_development_dependency("test-unit", ["~> 0"])
   end
   s.extensions	<< "ext/openwsman/extconf.rb"
 
   s.files        = Dir.glob("lib/*.rb") +
                    Dir.glob("lib/**/*.rb") +
-                   Dir.glob("ext/*.{h,c}") +
-                   Dir.glob("ext/**/*.{h,c}")
+                   Dir.glob("ext/**/*.{i,h,c}")
 
 #  s.require_path = ''