mendicantx-rubicant 0.0.5 → 0.0.6
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.
data/lib/dotnet/framework.rb
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
require 'configatron'
|
|
2
2
|
require 'win32/registry'
|
|
3
|
+
require 'yaml'
|
|
3
4
|
|
|
4
5
|
module Rubicant::DotNet
|
|
5
6
|
|
|
6
7
|
class Frameworks
|
|
7
8
|
def self.get_framework()
|
|
8
9
|
ENV['framework'] = 'net35' if ENV['framework'].nil?
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
configuration = YAML::load(File.open(File.dirname(__FILE__) + '/frameworks.yml'))
|
|
12
|
+
fail('No configurations exist') if configuration.nil?
|
|
13
|
+
|
|
14
|
+
frameworks = configuration['frameworks']
|
|
15
|
+
fail('No frameworks exist') if frameworks.nil?
|
|
16
|
+
|
|
17
|
+
frameworkConfiguration = frameworks[ENV['framework']]
|
|
11
18
|
fail('Requested framework does not exist in configuration') if frameworkConfiguration.nil?
|
|
12
19
|
return Framework.new(frameworkConfiguration)
|
|
13
20
|
end
|
|
@@ -18,11 +25,11 @@ module Rubicant::DotNet
|
|
|
18
25
|
attr_reader :framework_dir, :sdk_dir
|
|
19
26
|
|
|
20
27
|
def initialize(frameworkConfig)
|
|
21
|
-
framework_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig
|
|
22
|
-
framework_sdk_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig
|
|
28
|
+
framework_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig['framework_registry_path'])
|
|
29
|
+
framework_sdk_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig['framework_sdk_registry_path'])
|
|
23
30
|
begin
|
|
24
|
-
@framework_dir = framework_key.read_s(frameworkConfig
|
|
25
|
-
@sdk_dir = framework_sdk_key.read_s(frameworkConfig
|
|
31
|
+
@framework_dir = framework_key.read_s(frameworkConfig['framework_registry_key']) + "\\#{frameworkConfig['framework_version']}"
|
|
32
|
+
@sdk_dir = framework_sdk_key.read_s(frameworkConfig['framework_sdk_registry_key'])
|
|
26
33
|
rescue Win32::Registry::Error
|
|
27
34
|
puts "Either the Framework or the SDK is not installed for #{ENV['framework']}"
|
|
28
35
|
end
|
|
@@ -64,11 +64,10 @@ using System.Runtime.InteropServices;
|
|
|
64
64
|
puts "Generating assembly info file in: #{opts[:path]}"
|
|
65
65
|
|
|
66
66
|
mkdir_p opts[:path]
|
|
67
|
-
asm_file = File.new("#{opts[:file]}\\AssemblyInfo.cs", "w")
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
File.open("#{opts[:path]}/AssemblyInfo.cs", "w") do |file|
|
|
69
|
+
file.puts(assembly_info)
|
|
70
|
+
end
|
|
72
71
|
|
|
73
72
|
end
|
|
74
73
|
|
data/rakefile.rb
CHANGED
|
@@ -12,7 +12,7 @@ end
|
|
|
12
12
|
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
|
14
14
|
s.name = "Rubicant"
|
|
15
|
-
s.version = "0.0.
|
|
15
|
+
s.version = "0.0.6"
|
|
16
16
|
s.author = "mendicant"
|
|
17
17
|
s.email = "mendicant@beigesunshine.com"
|
|
18
18
|
s.homepage = "http://blog.beigesunshine.com"
|
|
@@ -24,7 +24,6 @@ spec = Gem::Specification.new do |s|
|
|
|
24
24
|
s.test_files = FileList["test/**/when*.rb"].to_a
|
|
25
25
|
s.has_rdoc = false
|
|
26
26
|
s.extra_rdoc_files = []
|
|
27
|
-
s.add_dependency("configatron", ">= 2.1.6")
|
|
28
27
|
s.add_dependency("rake", ">= 0.8.3")
|
|
29
28
|
end
|
|
30
29
|
|
data/rubicant.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "rubicant"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.6"
|
|
4
4
|
s.author = "mendicant"
|
|
5
5
|
s.email = "mendicant@beigesunshine.com"
|
|
6
6
|
s.homepage = "http://blog.beigesunshine.com"
|
|
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
|
|
|
29
29
|
"test/unit/runners/when_calling_ms_build_runner.rb",
|
|
30
30
|
"test/unit/runners/when_calling_ms_build_runner_with_incorrect_parameters.rb"]
|
|
31
31
|
s.has_rdoc = false
|
|
32
|
-
s.add_dependency("configatron", ">= 2.1.6")
|
|
33
32
|
s.add_dependency("rake", ">= 0.8.3")
|
|
34
33
|
|
|
35
34
|
end
|
|
@@ -8,10 +8,14 @@ class WhenCreatingNewFramework < Test::Unit::TestCase
|
|
|
8
8
|
@framework_version = 'framework_version'
|
|
9
9
|
@framework_key = 'framework_key'
|
|
10
10
|
@framework_sdk_key = 'framework_sdk_key'
|
|
11
|
-
@framework_config = StubbedFrameworkConfig.new(@framework_path, @framework_sdk_path, @framework_key, @framework_sdk_key, @framework_version)
|
|
12
11
|
@framework_dir = 'framework_dir'
|
|
13
12
|
@framework_sdk_dir = 'framework_sdk_dir'
|
|
14
13
|
@reg_path = mock()
|
|
14
|
+
@framework_config = {'framework_registry_key' => @framework_key,
|
|
15
|
+
'framework_sdk_registry_key' => @framework_sdk_key,
|
|
16
|
+
'framework_registry_path' => @framework_path,
|
|
17
|
+
'framework_sdk_registry_path' => @framework_sdk_path,
|
|
18
|
+
'framework_version' => @framework_version }
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
def test_should_load_framework_dir_from_registry
|
|
@@ -46,15 +50,3 @@ class WhenCreatingNewFramework < Test::Unit::TestCase
|
|
|
46
50
|
end
|
|
47
51
|
|
|
48
52
|
end
|
|
49
|
-
|
|
50
|
-
class StubbedFrameworkConfig
|
|
51
|
-
attr_reader :framework_registry_key, :framework_sdk_registry_key, :framework_registry_path, :framework_sdk_registry_path, :framework_version
|
|
52
|
-
|
|
53
|
-
def initialize(framework_registry_path, framework_sdk_registry_path, framework_key, framework_sdk_key, framework_version)
|
|
54
|
-
@framework_registry_path = framework_registry_path
|
|
55
|
-
@framework_sdk_registry_path = framework_sdk_registry_path
|
|
56
|
-
@framework_registry_key = framework_key
|
|
57
|
-
@framework_sdk_registry_key = framework_sdk_key
|
|
58
|
-
@framework_version = framework_version
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -7,9 +7,10 @@ class WhenGettingFrameworkInformation < Test::Unit::TestCase
|
|
|
7
7
|
def test_should_load_frameworks_if_not_already_loaded
|
|
8
8
|
framework = 'framework'
|
|
9
9
|
ENV['framework'] = framework
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
file = mock()
|
|
12
|
+
File.stubs(:open).with(any_parameters).returns(file)
|
|
13
|
+
YAML.stubs(:load).with(any_parameters).returns({'frameworks' => { framework => {}} })
|
|
13
14
|
Rubicant::DotNet::Framework.stubs(:new).returns(mock())
|
|
14
15
|
|
|
15
16
|
Rubicant::DotNet::Frameworks.get_framework()
|
|
@@ -19,15 +20,13 @@ class WhenGettingFrameworkInformation < Test::Unit::TestCase
|
|
|
19
20
|
def test_should_fail_if_requested_framework_is_not_in_configuration
|
|
20
21
|
begin
|
|
21
22
|
framework = 'framework'
|
|
22
|
-
ENV['framework'] = framework
|
|
23
|
-
|
|
24
|
-
configatron.frameworks.stubs(:retrieve).with(framework).returns(nil)
|
|
25
|
-
|
|
23
|
+
ENV['framework'] = framework
|
|
24
|
+
YAML.stubs(:load).with(any_parameters).returns({})
|
|
26
25
|
Rubicant::DotNet::Frameworks.get_framework()
|
|
27
26
|
|
|
28
27
|
fail('I wanted a runtime error to be thrown')
|
|
29
28
|
rescue RuntimeError => re
|
|
30
|
-
assert_equal(re.message, '
|
|
29
|
+
assert_equal(re.message, 'No frameworks exist')
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
end
|
|
@@ -37,11 +36,9 @@ class WhenGettingFrameworkInformation < Test::Unit::TestCase
|
|
|
37
36
|
frameworkName = 'framework'
|
|
38
37
|
ENV['framework'] = frameworkName
|
|
39
38
|
frameworkConfiguration = {frameworkName => {}}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Rubicant::DotNet::Framework.expects(:new).with(frameworkConfiguration).returns(framework)
|
|
39
|
+
YAML.stubs(:load).with(any_parameters).returns({'frameworks' => frameworkConfiguration })
|
|
40
|
+
|
|
41
|
+
Rubicant::DotNet::Framework.expects(:new).with({}).returns(framework)
|
|
45
42
|
|
|
46
43
|
result = Rubicant::DotNet::Frameworks.get_framework()
|
|
47
44
|
assert_equal framework, result
|
|
@@ -53,10 +50,8 @@ class WhenGettingFrameworkInformation < Test::Unit::TestCase
|
|
|
53
50
|
ENV['framework'] = nil
|
|
54
51
|
frameworkConfiguration = {'net35' => {}}
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
frameworkConfiguration.stubs(:nil?).returns(false)
|
|
59
|
-
Rubicant::DotNet::Framework.stubs(:new).with(frameworkConfiguration).returns(framework)
|
|
53
|
+
YAML.stubs(:load).with(any_parameters).returns({'frameworks' => frameworkConfiguration })
|
|
54
|
+
Rubicant::DotNet::Framework.stubs(:new).with({}).returns(framework)
|
|
60
55
|
|
|
61
56
|
Rubicant::DotNet::Frameworks.get_framework()
|
|
62
57
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mendicantx-rubicant
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mendicant
|
|
@@ -12,16 +12,6 @@ cert_chain: []
|
|
|
12
12
|
date: 2009-05-16 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
|
-
- !ruby/object:Gem::Dependency
|
|
16
|
-
name: configatron
|
|
17
|
-
type: :runtime
|
|
18
|
-
version_requirement:
|
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
-
requirements:
|
|
21
|
-
- - ">="
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: 2.1.6
|
|
24
|
-
version:
|
|
25
15
|
- !ruby/object:Gem::Dependency
|
|
26
16
|
name: rake
|
|
27
17
|
type: :runtime
|