iron_hammer 0.3.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/lib/iron_hammer.rb +4 -0
- data/lib/iron_hammer/deploy/create_status.rb +39 -0
- data/lib/iron_hammer/deploy/windows_service.rb +25 -0
- data/lib/iron_hammer/deploy/wmi_service.rb +85 -0
- data/lib/iron_hammer/projects/assembly_info.rb +17 -0
- data/lib/iron_hammer/projects/generic_project.rb +6 -1
- metadata +8 -2
data/Rakefile
CHANGED
@@ -8,11 +8,13 @@ Hoe.plugin :newgem
|
|
8
8
|
|
9
9
|
$hoe = Hoe.spec 'iron_hammer' do
|
10
10
|
self.developer 'Mozair Alves do Carmo Junior', 'macskeptic@gmail.com'
|
11
|
+
self.developer 'Lucas Cavalcanti', 'lucasmrtuner@gmail.com'
|
12
|
+
|
11
13
|
self.post_install_message = File.read('PostInstall.txt')
|
12
14
|
self.rubyforge_name = self.name
|
13
15
|
self.extra_deps = [['rubyzip2','>= 2.0.1'],
|
14
16
|
['builder', '>= 2.1.2']]
|
15
|
-
self.version = '0.
|
17
|
+
self.version = '1.0.0'
|
16
18
|
end
|
17
19
|
|
18
20
|
require 'newgem/tasks'
|
data/lib/iron_hammer.rb
CHANGED
@@ -18,10 +18,14 @@ require 'iron_hammer/default_configuration_behavior'
|
|
18
18
|
require 'iron_hammer/default_deliverables_behavior'
|
19
19
|
require 'iron_hammer/deliverables/configuration_file'
|
20
20
|
require 'iron_hammer/deliverables/deliverable'
|
21
|
+
require 'iron_hammer/deploy/create_status'
|
22
|
+
require 'iron_hammer/deploy/windows_service'
|
23
|
+
require 'iron_hammer/deploy/wmi_service'
|
21
24
|
require 'iron_hammer/hammer'
|
22
25
|
require 'iron_hammer/package'
|
23
26
|
require 'iron_hammer/projects/asp_net_mvc_project'
|
24
27
|
require 'iron_hammer/projects/asp_net_project'
|
28
|
+
require 'iron_hammer/projects/assembly_info'
|
25
29
|
require 'iron_hammer/projects/dependency'
|
26
30
|
require 'iron_hammer/projects/dependency_project'
|
27
31
|
require 'iron_hammer/projects/dll_project'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module IronHammer
|
3
|
+
module Deploy
|
4
|
+
class CreateStatus
|
5
|
+
|
6
|
+
@@status = []
|
7
|
+
@@status[0] = "The request was accepted."
|
8
|
+
@@status[1] = "The request is not supported."
|
9
|
+
@@status[2] = "The user did not have the necessary access."
|
10
|
+
@@status[3] = "The service cannot be stopped because other services that are running are dependent on it."
|
11
|
+
@@status[4] = "The requested control code is not valid, or it is unacceptable to the service."
|
12
|
+
@@status[5] = "The requested control code cannot be sent to the service because the state of the service."
|
13
|
+
@@status[6] = "The service has not been started."
|
14
|
+
@@status[7] = "The service did not respond to the stop request in a timely fashion."
|
15
|
+
@@status[8] = "Unknown failure when stopping the service."
|
16
|
+
@@status[9] = "The directory path to the service executable was not found."
|
17
|
+
@@status[10] = "The service is already stopped"
|
18
|
+
@@status[11] = "The service database is locked."
|
19
|
+
@@status[12] = "A dependency which this service relies on has been removed from the system."
|
20
|
+
@@status[13] = "The service failed to find the service needed from a dependent service."
|
21
|
+
@@status[14] = "The service has been disabled from the system."
|
22
|
+
@@status[15] = "The service does not have the correct authentication to run on the system."
|
23
|
+
@@status[16] = "This service is being removed from the system."
|
24
|
+
@@status[17] = "There is no execution thread for the service."
|
25
|
+
@@status[18] = "There are circular dependencies when stopping the service."
|
26
|
+
@@status[19] = "There is a service running under the same name."
|
27
|
+
@@status[20] = "There are invalid characters in the name of the service."
|
28
|
+
@@status[21] = "Invalid parameters have been passed to the service."
|
29
|
+
@@status[22] = "The account, which this service is to run under is either invalid or lacks the permissions to run the service."
|
30
|
+
@@status[23] = "The service exists in the database of services available from the system."
|
31
|
+
@@status[24] = "The service is currently paused in the system."
|
32
|
+
|
33
|
+
def self.text code
|
34
|
+
@@status[code]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
module IronHammer
|
3
|
+
module Deploy
|
4
|
+
class WindowsService
|
5
|
+
|
6
|
+
def initialize ole_service
|
7
|
+
@service = ole_service
|
8
|
+
end
|
9
|
+
|
10
|
+
def start!
|
11
|
+
@service.StartService
|
12
|
+
end
|
13
|
+
|
14
|
+
def stop!
|
15
|
+
@service.StopService
|
16
|
+
end
|
17
|
+
|
18
|
+
def state
|
19
|
+
@service.State
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
begin
|
2
|
+
require 'win32ole'
|
3
|
+
rescue LoadError
|
4
|
+
class WIN32OLE
|
5
|
+
end unless defined? WIN32OLE
|
6
|
+
end
|
7
|
+
|
8
|
+
module IronHammer
|
9
|
+
module Deploy
|
10
|
+
module ServiceType
|
11
|
+
KERNEL_DRIVER = 0x1
|
12
|
+
FILE_SYSTEM_DRIVER = 0x2
|
13
|
+
ADAPTER = 0x4
|
14
|
+
RECOGNIZER_DRIVER = 0x8
|
15
|
+
OWN_PROCESS = 0x10
|
16
|
+
SHARE_PROCESS = 0x20
|
17
|
+
INTERACTIVE_PROCESS = 0xFF
|
18
|
+
end unless defined? ServiceType
|
19
|
+
|
20
|
+
module ErrorControl
|
21
|
+
IGNORE = 0
|
22
|
+
NORMAL = 1
|
23
|
+
SEVERE = 2
|
24
|
+
CRITICAL = 3
|
25
|
+
end unless defined? ErrorControl
|
26
|
+
|
27
|
+
module StartMode
|
28
|
+
BOOT = "Boot"
|
29
|
+
SYSTEM = "System"
|
30
|
+
AUTOMATIC = "Automatic"
|
31
|
+
MANUAL = "Manual"
|
32
|
+
DISABLED = "Disabled"
|
33
|
+
end unless defined? StartMode
|
34
|
+
|
35
|
+
module DesktopInteraction
|
36
|
+
INTERACT = true
|
37
|
+
DONT_INTERACT = false
|
38
|
+
end unless defined? DesktopInteraction
|
39
|
+
|
40
|
+
class WMIService
|
41
|
+
|
42
|
+
def initialize params ={}
|
43
|
+
computer = params[:computer]
|
44
|
+
user = params[:user]
|
45
|
+
password = params[:password]
|
46
|
+
if user && password
|
47
|
+
@wmi = WIN32OLE.new("WbemScripting.SWbemLocator").ConnectServer(computer, "root\\cimv2", user, password)
|
48
|
+
else
|
49
|
+
@wmi = WIN32OLE.connect("winmgmts:{impersonationLevel=impersonate}!\\\\#{computer}\\root\\cimv2")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def service name
|
54
|
+
services = @wmi.ExecQuery("SELECT * FROM Win32_Service WHERE Name = '#{name}'")
|
55
|
+
services.each do |s|
|
56
|
+
return WindowsService.new s
|
57
|
+
end
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
|
61
|
+
def create! params={}
|
62
|
+
base_service.Create(
|
63
|
+
params[:name] || raise(ArgumentError.new "You must specify a name when creating a service"),
|
64
|
+
params[:display_name] || params[:name],
|
65
|
+
params[:path] || raise(ArgumentError.new "You must specify a path when creating a service"),
|
66
|
+
params[:service_type] || ServiceType::OWN_PROCESS,
|
67
|
+
params[:error_control]|| ErrorControl::NORMAL,
|
68
|
+
params[:start_mode] || StartMode::AUTOMATIC,
|
69
|
+
params[:desktop_interact] || DesktopInteraction::DONT_INTERACT,
|
70
|
+
params[:start_name],
|
71
|
+
params[:start_password],
|
72
|
+
params[:load_order_group],
|
73
|
+
params[:load_order_group_dependencies],
|
74
|
+
params[:service_dependencies]
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
def base_service
|
80
|
+
@base ||= @wmi.Get('Win32_BaseService')
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'iron_hammer/package'
|
2
|
+
require 'iron_hammer/projects/assembly_info'
|
2
3
|
|
3
4
|
module IronHammer
|
4
5
|
module Projects
|
@@ -19,7 +20,7 @@ module IronHammer
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def version
|
22
|
-
'1.0.0.0'
|
23
|
+
assembly_info.version || '1.0.0.0'
|
23
24
|
end
|
24
25
|
|
25
26
|
def deliverables params={}
|
@@ -30,6 +31,10 @@ module IronHammer
|
|
30
31
|
@assembly_name ||= file.assembly_name
|
31
32
|
end
|
32
33
|
|
34
|
+
def assembly_info
|
35
|
+
@assembly_info ||= AssemblyInfo.new File.read(File.join @path, 'Properties', 'AssemblyInfo.cs')
|
36
|
+
end
|
37
|
+
|
33
38
|
def dependencies
|
34
39
|
@dependencies ||= file.dependencies
|
35
40
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_hammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mozair Alves do Carmo Junior
|
8
|
+
- Lucas Cavalcanti
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-05 00:00:00 -02:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
@@ -65,6 +66,7 @@ dependencies:
|
|
65
66
|
description: "Iron Hammer gathers together three components to help automate the build, test and deployment process of C# projects: an Anvil, a Hammer and a Blacksmith."
|
66
67
|
email:
|
67
68
|
- macskeptic@gmail.com
|
69
|
+
- lucasmrtuner@gmail.com
|
68
70
|
executables: []
|
69
71
|
|
70
72
|
extensions: []
|
@@ -82,10 +84,14 @@ files:
|
|
82
84
|
- lib/iron_hammer/default_deliverables_behavior.rb
|
83
85
|
- lib/iron_hammer/deliverables/configuration_file.rb
|
84
86
|
- lib/iron_hammer/deliverables/deliverable.rb
|
87
|
+
- lib/iron_hammer/deploy/create_status.rb
|
88
|
+
- lib/iron_hammer/deploy/wmi_service.rb
|
89
|
+
- lib/iron_hammer/deploy/windows_service.rb
|
85
90
|
- lib/iron_hammer/hammer.rb
|
86
91
|
- lib/iron_hammer/package.rb
|
87
92
|
- lib/iron_hammer/projects/asp_net_mvc_project.rb
|
88
93
|
- lib/iron_hammer/projects/asp_net_project.rb
|
94
|
+
- lib/iron_hammer/projects/assembly_info.rb
|
89
95
|
- lib/iron_hammer/projects/dll_project.rb
|
90
96
|
- lib/iron_hammer/projects/dependency.rb
|
91
97
|
- lib/iron_hammer/projects/dependency_project.rb
|