cim 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ === 0.2.7 2010-10-03
2
+
3
+ * Initial release
@@ -0,0 +1,28 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ lib/cim.rb
6
+ lib/cim/association.rb
7
+ lib/cim/class.rb
8
+ lib/cim/indication.rb
9
+ lib/cim/instance.rb
10
+ lib/cim/meta/feature.rb
11
+ lib/cim/meta/flavor.rb
12
+ lib/cim/meta/named_element.rb
13
+ lib/cim/meta/qualifier.rb
14
+ lib/cim/meta/schema.rb
15
+ lib/cim/meta/scope.rb
16
+ lib/cim/meta/type.rb
17
+ lib/cim/meta/variant.rb
18
+ lib/cim/method.rb
19
+ lib/cim/property.rb
20
+ lib/cim/qualifier.rb
21
+ lib/cim/qualifiers.rb
22
+ lib/cim/reference.rb
23
+ test/test_loading.rb
24
+ test/test_method.rb
25
+ test/test_property.rb
26
+ test/test_qualifier.rb
27
+ test/test_reference.rb
28
+ test/test_type.rb
@@ -0,0 +1,33 @@
1
+ = cim
2
+
3
+ * http://github.com/kkaempf/cim
4
+
5
+ == DESCRIPTION:
6
+
7
+ * Cim is a pure-Ruby implementation of the CIM meta model.
8
+
9
+ Instances of Cim classes are used to define a CIM schema, often
10
+ represented as a .mof file.
11
+
12
+ Hence the primary consumer of Cim is Mofparser, a Ruby based MOF parser.
13
+
14
+ == SYNOPSIS:
15
+
16
+ require 'cim'
17
+
18
+ == REQUIREMENTS:
19
+
20
+ * - none -
21
+
22
+ == INSTALL:
23
+
24
+ * sudo gem install cim
25
+ (resp. rpm -Uhv rubygem-cim)
26
+
27
+ == LICENSE:
28
+
29
+ (The Ruby License)
30
+
31
+ Copyright (c) 2010 Klaus Kämpf <kkaempf@suse.de>
32
+
33
+ See http://www.ruby-lang.org/en/LICENSE.txt for the full text
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/cim'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'cim' do
14
+ self.developer 'Klaus Kämpf', 'kkaempf@suse.de'
15
+
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
18
+
19
+ end
20
+
21
+ require 'newgem/tasks'
22
+ Dir['tasks/**/*.rake'].each { |t| load t }
23
+
24
+ # TODO - want other tests/tasks run by default? Add them to the list
25
+ # remove_task :default
26
+ # task :default => [:spec, :features]
@@ -0,0 +1,29 @@
1
+ # cim
2
+ # A pure-Ruby implementation of the CIM metamodel
3
+ #
4
+ # Written by Klaus Kaempf <kkaempf@suse.de>
5
+ #
6
+
7
+ $:.unshift(File.dirname(__FILE__)) unless
8
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
9
+
10
+ module Cim
11
+ VERSION = '0.2.7'
12
+ cim_dir = File.join(File.dirname(__FILE__),"cim")
13
+ require cim_dir + '/meta/type'
14
+ require cim_dir + '/meta/variant'
15
+ require cim_dir + '/meta/flavor'
16
+ require cim_dir + '/meta/scope'
17
+ require cim_dir + '/meta/named_element'
18
+ require cim_dir + '/meta/qualifier'
19
+ require cim_dir + '/qualifier'
20
+ require cim_dir + '/qualifiers'
21
+ require cim_dir + '/meta/feature'
22
+ require cim_dir + '/property'
23
+ require cim_dir + '/reference'
24
+ require cim_dir + '/method'
25
+ require cim_dir + '/class'
26
+ require cim_dir + '/association'
27
+ require cim_dir + '/instance'
28
+ require cim_dir + '/indication'
29
+ end
@@ -0,0 +1,12 @@
1
+ module Cim
2
+ class Association < Class
3
+ def initialize name, qualifiers, alias_name, superclass, features
4
+ raise "Association needs 'association' qualifier" unless qualifiers.include?(:association, :bool)
5
+ super name, qualifiers, alias_name, superclass, features
6
+ end
7
+ # true if class has associations (association provider)
8
+ def association?
9
+ true
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,53 @@
1
+ module Cim
2
+ require File.join(File.dirname(__FILE__),"qualifier")
3
+ class Class < Cim::Meta::NamedElement
4
+ attr_reader :qualifiers, :alias_name, :superclass, :features
5
+ attr_accessor :parent
6
+ def initialize name, qualifiers, alias_name, superclass, features
7
+ @qualifiers = qualifiers
8
+ @alias_name = alias_name
9
+ @superclass = superclass
10
+ features = nil if features.is_a?(Array) && features.empty?
11
+ @features = features
12
+ # puts "Cim::Schema::Class.new(#{@features})"
13
+ super name
14
+ end
15
+ def add_type t
16
+ @ptype << t
17
+ end
18
+ # true if class has instances (instance provider)
19
+ def instance?
20
+ @features.size > 0
21
+ end
22
+ # true if class has methods (method provider)
23
+ def method?
24
+ @features.each do |f|
25
+ case f
26
+ when Cim::Schema::Method: return true
27
+ end
28
+ end
29
+ false
30
+ end
31
+ # true if class has associations (association provider)
32
+ def association?
33
+ false
34
+ end
35
+ # true if class has indications (indication provider)
36
+ def indication?
37
+ false
38
+ end
39
+ def to_s
40
+ s = ""
41
+ s << "[#{@qualifiers.join(', ')}]\n" if @qualifiers
42
+ s << "class #{@name}"
43
+ s << " AS #{@alias_name}" if @alias_name
44
+ s << " : #{@superclass}" if @superclass
45
+ s << " {"
46
+ if @features
47
+ f = @features.join(";\n ")
48
+ s << "\n #{f};\n"
49
+ end
50
+ s << "}"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,8 @@
1
+ module Cim
2
+ class Indication < Class
3
+ # true if class has indications (indication provider)
4
+ def indication?
5
+ true
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ class Instance
2
+ # FIXME
3
+ end
@@ -0,0 +1,41 @@
1
+ module Cim
2
+ module Meta
3
+ # Shared between Property and Method
4
+ class Feature < NamedElement
5
+ attr_reader :type, :qualifiers
6
+ def initialize type, name, qualifiers
7
+ @type = (type.is_a? Cim::Meta::Type) ? type : Cim::Meta::Type.new(type)
8
+ qualifiers = nil if qualifiers.is_a?(::Array) && qualifiers.empty?
9
+ @qualifiers = qualifiers
10
+ super name
11
+ end
12
+ # if has key qualifier
13
+ def key?
14
+ @qualifiers && @qualifiers.include?(:key,:bool)
15
+ end
16
+ # if static (class-level) feature
17
+ def static?
18
+ false
19
+ end
20
+ # if method
21
+ def method?
22
+ false
23
+ end
24
+ # if reference
25
+ def reference?
26
+ false
27
+ end
28
+ def to_s
29
+ s = ""
30
+ s << "#{@qualifiers}\n " if @qualifiers
31
+ case @type
32
+ when Cim::Meta::Array
33
+ s << "#{@type.type} #{@name}[]"
34
+ else
35
+ s << "#{@type} #{@name}"
36
+ end
37
+ s
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,33 @@
1
+ module Cim
2
+ module Meta
3
+ class FlavorError < ArgumentError
4
+ def initialize flavor
5
+ @flavor = flavor
6
+ end
7
+ def to_s
8
+ "#{@flavor} is not a valid Flavor"
9
+ end
10
+ end
11
+ class Flavors
12
+ FLAVORS = [:amended, :enableoverride, :disableoverride, :restricted, :toinstance, :tosubclass, :translatable]
13
+ attr_reader :flavors
14
+ def initialize flavor
15
+ @flavors = []
16
+ self << flavor
17
+ end
18
+ def << flavor
19
+ flavor.downcase! if flavor.kind_of? String
20
+ f = flavor.to_sym
21
+ raise FlavorError.new("#{flavor}") unless FLAVORS.include? f
22
+ @flavors << f
23
+ self
24
+ end
25
+ def to_sym
26
+ @flavors.first
27
+ end
28
+ def to_s
29
+ "Flavor(#{@flavors.join(', ')})"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ module Cim
2
+ module Meta
3
+ class NamedElement
4
+ attr_reader :name, :characteristics
5
+ def initialize name
6
+ raise "NamedElement must have a name" unless name
7
+ @name = name.to_s
8
+ @characteristics = []
9
+ end
10
+ def << qualifier
11
+ @characteristics << qualifier
12
+ end
13
+ def has? qualifier
14
+ @characteristics.include? qualifier
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,34 @@
1
+ module Cim
2
+ module Meta
3
+ class Qualifier < NamedElement
4
+
5
+ attr_reader :type, :default, :scope, :flavor
6
+
7
+ def initialize name, type = :bool, default = false, scope = nil, flavor = nil
8
+ @type = (type.kind_of? Type) ? type : Type.new(type)
9
+ @default = (default.nil? || default.is_a?(Cim::Meta::Variant)) ? default : Cim::Meta::Variant.new(@type, default)
10
+ @scope = scope
11
+ @flavor = flavor
12
+ super name
13
+ end
14
+
15
+ def == q
16
+ # puts "#{@name}:#{@type} == #{q.name}:#{q.type}"
17
+ (@name.downcase == q.name.downcase) &&
18
+ (@type.nil? || q.type.nil? || (@type == q.type))
19
+ end
20
+
21
+ def to_sym
22
+ @name.downcase.to_sym
23
+ end
24
+
25
+ def to_s
26
+ s = "Qualifier #{@name} : #{@type}"
27
+ s << " = #{@default}" if @default
28
+ s << ",\n\t#{@scope}" if @scope
29
+ s << ",\n\t#{@flavor}" if @flavor
30
+ s
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ module Cim
2
+ module Meta
3
+ class Schema < NamedElement
4
+ # Class schema
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ module Cim
2
+ module Meta
3
+
4
+ class MetaElementError < ArgumentError
5
+ def initialize element, msg = nil
6
+ @element = element
7
+ super msg
8
+ end
9
+ def to_s
10
+ "#{@element} is not a valid meta element for scopes"
11
+ end
12
+ end
13
+
14
+ class Scope
15
+ META_ELEMENTS = [ :schema, :class, :association, :indication, :qualifier, :property, :reference, :method, :parameter, :any ]
16
+ attr_reader :elements
17
+ def initialize element = :any
18
+ @elements = []
19
+ self << element
20
+ end
21
+ def << element
22
+ element.downcase! if element.is_a?(String)
23
+ e = element.to_sym
24
+ raise MetaElementError.new(element) unless META_ELEMENTS.include?(e)
25
+ @elements << e
26
+ self
27
+ end
28
+ def has? qualifier
29
+ @elements.include? qualifier
30
+ end
31
+ def to_s
32
+ "Scope(#{@elements.join(', ')})"
33
+ end
34
+ def to_sym
35
+ @elements.first
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,124 @@
1
+ module Cim
2
+ module Meta
3
+ class Type
4
+ TYPES = [:null,:void,:bool,:char16,:string,:uint8,:sint8,:uint16,:sint16,:uint32,:sint32,:uint64,:sint64,:real32,:real64,:datetime,:class,:reference,:array]
5
+ MATCHES = {
6
+ :null => [],
7
+ :void => [], # WMI
8
+ :bool => [],
9
+ :char16 => [ :null, :string ],
10
+ :string => [ :null ],
11
+ :uint8 => [ :null ],
12
+ :sint8 => [ :null ],
13
+ :uint16 => [ :null, :uint8 ],
14
+ :sint16 => [ :null, :sint8 ],
15
+ :uint32 => [ :null, :uint8, :uint16 ],
16
+ :sint32 => [ :null, :sint8, :sint16 ],
17
+ :uint64 => [ :null, :uint8, :uint16, :sint32 ],
18
+ :sint64 => [ :null, :sint8, :sint16, :sint32 ],
19
+ :real32 => [ :null ],
20
+ :real64 => [ :null, :real32 ],
21
+ :datetime => [ :null ],
22
+ :class => [ :null ],
23
+ :reference => [ :null ],
24
+ :array => [ :null ]
25
+ }
26
+ attr_reader :type
27
+ def initialize type
28
+ type.downcase! if type.is_a? String
29
+ @type = type.to_sym
30
+ raise TypeError.new("#{type}") unless TYPES.include? @type
31
+ end
32
+ def to_s
33
+ @type.to_s
34
+ end
35
+ def to_sym
36
+ @type
37
+ end
38
+ def == t
39
+ case t
40
+ when Type: t.type == @type
41
+ when Symbol: t == @type
42
+ else
43
+ false
44
+ end
45
+ end
46
+ private
47
+ def matches_value type,value
48
+ # puts ">#{type}<{#{type.class}}.matches_value?>#{value.inspect}<{#{value.class}}"
49
+ case value
50
+ when NilClass
51
+ true
52
+ when FalseClass, TrueClass
53
+ type == :bool
54
+ when Integer
55
+ case type
56
+ when :uint8: (0..255) === value
57
+ when :sint8: (-128..127) === value
58
+ when :uint16: (0..65535) === value
59
+ when :sint16: (-32768..32767) === value
60
+ when :uint32: (0..4294967295) === value
61
+ when :sint32: (-2147483648..2147483647) === value
62
+ when :uint64: (0..18446744073709551615) === value
63
+ when :sint64: (-9223372036854775808..9223372036854775807) === value
64
+ else
65
+ false
66
+ end
67
+ when Float
68
+ case type
69
+ when :real32: value.to_i.size == 4
70
+ when :real64: true
71
+ else
72
+ false
73
+ end
74
+ when String
75
+ type == :string
76
+ else
77
+ false
78
+ end
79
+ end
80
+ public
81
+ def matches? x
82
+ # puts ">#{self}<{#{self.class}}.matches?>#{x.inspect}<{#{x.class}}"
83
+ case x
84
+ when Cim::Meta::Type, Cim::Meta::Variant
85
+ return true if x.type == @type
86
+ return true if MATCHES[@type].include? x.type
87
+ false
88
+ when ::Array
89
+ return false unless self.is_a? Cim::Meta::Array
90
+ x.each do |v|
91
+ return false unless matches_value @type,v
92
+ end
93
+ true
94
+ else
95
+ matches_value @type, x
96
+ end
97
+ end
98
+ end
99
+ class Array < Type
100
+ attr_reader :size
101
+ def initialize size, type
102
+ @size = size
103
+ super type
104
+ end
105
+ def to_s
106
+ if @size > 0
107
+ "#{super}[#{@size}]"
108
+ else
109
+ "#{super}[]"
110
+ end
111
+ end
112
+ end
113
+ class Reference < Type
114
+ attr_reader :name
115
+ def initialize name
116
+ @name = name
117
+ super :class
118
+ end
119
+ def to_s
120
+ "#{@name} ref"
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,19 @@
1
+ module Cim
2
+ module Meta
3
+ # A Variant is a typed value
4
+ class Variant
5
+ attr_reader :type, :value
6
+ def initialize type = :null, value = nil
7
+ @type = (type.kind_of? Cim::Meta::Type) ? type : Cim::Meta::Type.new(type)
8
+ @value = value unless value == :null
9
+ end
10
+ def to_s
11
+ if @type == :null
12
+ "null"
13
+ else
14
+ "#{@value.inspect}"
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Cim
2
+ class Method < Cim::Meta::Feature
3
+ attr_reader :parameters
4
+ def initialize type, name, qualifiers = nil, parameters = nil
5
+ parameters = nil if parameters.kind_of?(::Enumerable) && parameters.empty?
6
+ @parameters = parameters
7
+ qualifiers = [ qualifiers ] unless qualifiers.kind_of?(Enumerable)
8
+ super type,name,qualifiers
9
+ end
10
+ def method?
11
+ true
12
+ end
13
+ def to_s
14
+ p = @parameters.join(", ") if @parameters
15
+ "#{super}(#{p})"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Cim
2
+ class Property < Cim::Meta::Feature
3
+ attr_reader :default
4
+ def initialize type, name, qualifiers=nil, default=nil
5
+ @default = default
6
+ unless qualifiers.nil? || qualifiers.kind_of?(Enumerable)
7
+ qualifiers = [ qualifiers ]
8
+ end
9
+ super type, name, qualifiers
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,41 @@
1
+ module Cim
2
+ class Qualifier
3
+ attr_reader :definition, :value, :flavor
4
+ def initialize definition, value = nil, flavor = nil
5
+ raise "Not a Cim::Meta::Qualifier definition: #{definition.inspect}" unless definition.is_a?(Cim::Meta::Qualifier)
6
+ @definition = definition
7
+ @value = value
8
+ @flavor = flavor
9
+ end
10
+ def == q
11
+ # puts "Cim::Schema::Qualifier ->#{self} == #{q.inspect}"
12
+ case q
13
+ when Cim::Schema::Qualifier
14
+ (@definition == q.definition) &&
15
+ (@value == q.value) &&
16
+ (@flavor == q.flavor)
17
+ when Cim::Meta::Qualifier
18
+ @definition == q
19
+ when Symbol
20
+ q.to_s.downcase == @definition.name.downcase && @value.nil? && @flavor.nil?
21
+ else
22
+ false
23
+ end
24
+ end
25
+ def to_sym
26
+ @definition.downcase.to_sym
27
+ end
28
+ def to_s
29
+ s = "#{@definition.name.capitalize}"
30
+ case @value
31
+ when nil:
32
+ when Array:
33
+ s << " {#{@value.join(', ')}}"
34
+ else
35
+ s << "(#{@value.inspect})"
36
+ end
37
+ s << " #{@flavor}" if @flavor
38
+ s
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,53 @@
1
+ module Cim
2
+ # Array of Cim::Schema::Qualifier
3
+ class Qualifiers < Array
4
+ #
5
+ # check if qualifier exists
6
+ #
7
+ alias array_include? include?
8
+ def include? q,type=:null
9
+ # puts "#{self}.include? #{q}:#{type}"
10
+ case q
11
+ when Cim::Schema::Qualifier
12
+ q = q.definition
13
+ when Cim::Meta::Qualifier
14
+ # nothing
15
+ when String
16
+ q = Cim::Meta::Qualifier.new(q,type)
17
+ when Symbol
18
+ q = Cim::Meta::Qualifier.new(q,type)
19
+ else
20
+ raise "Unknown parameter in #{self.class}.include?"
21
+ end
22
+ self.array_include? q
23
+ end
24
+ #
25
+ # get qualifier by name and type
26
+ #
27
+ alias array_access []
28
+ def [] q,type=:null
29
+ case q
30
+ when Fixnum
31
+ return self.array_access[q]
32
+ when Cim::Schema::Qualifier
33
+ q = q.definition
34
+ when Cim::Meta::Qualifier
35
+ # nothing
36
+ when String
37
+ q = Cim::Meta::Qualifier.new(q,type)
38
+ when Symbol
39
+ q = Cim::Meta::Qualifier.new(q,type)
40
+ else
41
+ raise "Unknown parameter in #{self.class}.[]"
42
+ end
43
+ i = self.index(q)
44
+ return self.array_access(i) if i
45
+ i
46
+ end
47
+ def to_s
48
+ return "" if self.empty?
49
+ q = self.join(", ")
50
+ return "[#{q}]"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,7 @@
1
+ module Cim
2
+ class Reference < Property
3
+ def reference?
4
+ true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+ require "cim"
@@ -0,0 +1,28 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require "test/unit"
4
+ require "cim"
5
+
6
+ class MethodTest < Test::Unit::TestCase
7
+ def test_init
8
+ m = Cim::Method.new :real32, "Foo", Cim::Meta::Qualifier.new(:description, :string, "This is a foo method", :class)
9
+ assert m
10
+ assert_equal "Foo", m.name
11
+ assert m.qualifiers.size > 0
12
+ # assert m.qualifiers.include?( :description, :string )
13
+ # assert_equal "This is a foo method", m.description
14
+ assert_equal false, m.to_s.empty?
15
+ end
16
+ def test_nodesc
17
+ m = Cim::Method.new :bool, "Foo"
18
+ assert m
19
+ assert_equal "Foo", m.name
20
+ assert_equal m.type, :bool
21
+ # assert_equal nil, m.description
22
+ end
23
+ def test_raise
24
+ assert_raise TypeError do
25
+ m = Cim::Method.new :foo, "Foo"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require "test/unit"
4
+ require "cim"
5
+
6
+ class PropertyTest < Test::Unit::TestCase
7
+ def test_init
8
+ p = Cim::Property.new :string, "String", Cim::Meta::Qualifier.new(:key, :bool), Cim::Meta::Qualifier.new(:description, :string, "This is a string", :class)
9
+ assert p
10
+ assert p.is_a? Cim::Property
11
+ assert_equal "String", p.name
12
+ # assert p.key?
13
+ end
14
+ def test_name
15
+ p = Cim::Property.new :uint32, "foo"
16
+ assert_equal "foo", p.name
17
+ end
18
+ def test_raise
19
+ assert_raise TypeError do
20
+ p = Cim::Property.new :foo, "foo"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require "test/unit"
4
+ require "cim"
5
+
6
+ class QualifierTest < Test::Unit::TestCase
7
+ def test_key
8
+ q = Cim::Meta::Qualifier.new :key, :bool
9
+ assert q
10
+ end
11
+ def test_raise
12
+ assert_raise RuntimeError do
13
+ Cim::Qualifier.new(:unknown)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require "test/unit"
4
+ require "cim"
5
+
6
+ class ReferenceTest < Test::Unit::TestCase
7
+ def test_init
8
+ r = Cim::Reference.new :string, "String"
9
+ assert r
10
+ assert r.is_a? Cim::Reference
11
+ assert r.kind_of? Cim::Property
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ $: << File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require "test/unit"
4
+ require "cim"
5
+
6
+ class TypeTest < Test::Unit::TestCase
7
+ def test_init
8
+ t = Cim::Meta::Type.new :null
9
+ assert t
10
+ assert_equal "null", t.to_s
11
+ end
12
+ def test_raise
13
+ assert_raise TypeError do
14
+ t = Cim::Meta::Type.new :foo
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cim
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 7
10
+ version: 0.2.7
11
+ platform: ruby
12
+ authors:
13
+ - "Klaus K\xC3\xA4mpf"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-03 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rubyforge
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: hoe
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 21
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 1
50
+ version: 2.6.1
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: |-
54
+ * Cim is a pure-Ruby implementation of the CIM meta model.
55
+
56
+ Instances of Cim classes are used to define a CIM schema, often
57
+ represented as a .mof file.
58
+
59
+ Hence the primary consumer of Cim is Mofparser, a Ruby based MOF parser.
60
+ email:
61
+ - kkaempf@suse.de
62
+ executables: []
63
+
64
+ extensions: []
65
+
66
+ extra_rdoc_files:
67
+ - History.txt
68
+ - Manifest.txt
69
+ files:
70
+ - History.txt
71
+ - Manifest.txt
72
+ - README.rdoc
73
+ - Rakefile
74
+ - lib/cim.rb
75
+ - lib/cim/association.rb
76
+ - lib/cim/class.rb
77
+ - lib/cim/indication.rb
78
+ - lib/cim/instance.rb
79
+ - lib/cim/meta/feature.rb
80
+ - lib/cim/meta/flavor.rb
81
+ - lib/cim/meta/named_element.rb
82
+ - lib/cim/meta/qualifier.rb
83
+ - lib/cim/meta/schema.rb
84
+ - lib/cim/meta/scope.rb
85
+ - lib/cim/meta/type.rb
86
+ - lib/cim/meta/variant.rb
87
+ - lib/cim/method.rb
88
+ - lib/cim/property.rb
89
+ - lib/cim/qualifier.rb
90
+ - lib/cim/qualifiers.rb
91
+ - lib/cim/reference.rb
92
+ - test/test_loading.rb
93
+ - test/test_method.rb
94
+ - test/test_property.rb
95
+ - test/test_qualifier.rb
96
+ - test/test_reference.rb
97
+ - test/test_type.rb
98
+ has_rdoc: true
99
+ homepage: http://github.com/kkaempf/cim
100
+ licenses: []
101
+
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --main
105
+ - README.rdoc
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
126
+ requirements: []
127
+
128
+ rubyforge_project: cim
129
+ rubygems_version: 1.3.7
130
+ signing_key:
131
+ specification_version: 3
132
+ summary: "* Cim is a pure-Ruby implementation of the CIM meta model"
133
+ test_files:
134
+ - test/test_qualifier.rb
135
+ - test/test_method.rb
136
+ - test/test_property.rb
137
+ - test/test_type.rb
138
+ - test/test_loading.rb
139
+ - test/test_reference.rb