fulmar 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -9
- data/README.md +3 -0
- data/lib/fulmar/domain/service/configuration_service.rb +17 -4
- data/lib/fulmar/infrastructure/service/database/database_service.rb +12 -2
- data/lib/fulmar/service/common_helper_service.rb +10 -2
- data/lib/fulmar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b184a38399a1bb85893abc9f4cc757ecd97b17
|
4
|
+
data.tar.gz: 752c373642fcc1cb7792dc6388b98b2b1b91e85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bade5b1220e87a60d0f457135401cd19316de60a1bf442fa4f783683b675fcc0300f6b16faece6e08ab5b97fcaef3264e9eeb714d3a413d04ca32e1d4330be63
|
7
|
+
data.tar.gz: 58b425a5cfde5d6be795a05caa89e071083a4431e262de56693eb5fcc8db628ef20743729c90f19be23c75e1e0d082814e3d176a0297b9eb276e9ff20dd3a55b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
Fulmar is a task manager for deployments.
|
4
4
|
|
5
|
+
This project is still under heavy development for the next few weeks. You might want to check back in May 2015. We hope
|
6
|
+
to get this somehow stable until then.
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
@@ -21,12 +21,12 @@ module Fulmar
|
|
21
21
|
|
22
22
|
# Allow access of configuration via array/hash access methods (read access)
|
23
23
|
def [](id)
|
24
|
-
|
24
|
+
ready? ? configuration[:environments][@environment][@target][id] : nil
|
25
25
|
end
|
26
26
|
|
27
27
|
# Allow access of configuration via array/hash access methods (write access)
|
28
28
|
def []=(id, value)
|
29
|
-
if
|
29
|
+
if ready?
|
30
30
|
configuration[:environments][@environment][@target][id] = value
|
31
31
|
else
|
32
32
|
fail 'Environment or target not set. Please set both variables via configuration.environment = \'xxx\' / '\
|
@@ -35,7 +35,7 @@ module Fulmar
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def to_hash
|
38
|
-
|
38
|
+
ready? ? configuration[:environments][@environment][@target] : configuration
|
39
39
|
end
|
40
40
|
|
41
41
|
def base_path
|
@@ -58,6 +58,10 @@ module Fulmar
|
|
58
58
|
@target = target ? target.to_sym : nil
|
59
59
|
end
|
60
60
|
|
61
|
+
def ready?
|
62
|
+
!@environment.nil? && !@target.nil?
|
63
|
+
end
|
64
|
+
|
61
65
|
# Merge another configuration into the currently active one
|
62
66
|
# Useful for supplying a default configuration, as values are not overwritten.
|
63
67
|
# Hashes are merged.
|
@@ -105,10 +109,19 @@ module Fulmar
|
|
105
109
|
# Iterate over all environments and targets to prepare them
|
106
110
|
@config[:environments].each_key do |env|
|
107
111
|
next if env == :all
|
108
|
-
@config[:environments][env].each_key
|
112
|
+
@config[:environments][env].each_key do |target|
|
113
|
+
fill_target(env, target)
|
114
|
+
check_path(env, target)
|
115
|
+
end
|
109
116
|
end
|
110
117
|
@config
|
111
118
|
end
|
119
|
+
|
120
|
+
def check_path(env, target)
|
121
|
+
unless @config[:environments][env][target][:local_path].blank?
|
122
|
+
@config[:environments][env][target][:local_path] = File.expand_path(@config[:environments][env][target][:local_path])
|
123
|
+
end
|
124
|
+
end
|
112
125
|
end
|
113
126
|
end
|
114
127
|
end
|
@@ -24,16 +24,16 @@ module Fulmar
|
|
24
24
|
def initialize(config)
|
25
25
|
@config = config
|
26
26
|
@config.merge DEFAULT_CONFIG
|
27
|
-
@shell = Fulmar::Infrastructure::Service::ShellService.new(config[:local_path], config[:hostname])
|
28
27
|
@tunnel = nil
|
29
28
|
@client = nil
|
29
|
+
initialize_shell
|
30
30
|
config_test
|
31
31
|
end
|
32
32
|
|
33
33
|
def connect
|
34
34
|
options = compile_options
|
35
35
|
|
36
|
-
|
36
|
+
unless local?
|
37
37
|
tunnel.open
|
38
38
|
options[:port] = tunnel.local_port
|
39
39
|
end
|
@@ -62,6 +62,10 @@ module Fulmar
|
|
62
62
|
@connected
|
63
63
|
end
|
64
64
|
|
65
|
+
def local?
|
66
|
+
@config[:maria][:hostname] == 'localhost' || @config[:maria][:hostname] == '127.0.0.1'
|
67
|
+
end
|
68
|
+
|
65
69
|
def tunnel
|
66
70
|
@tunnel ||= Fulmar::Infrastructure::Service::TunnelService.new(@config[:maria][:hostname], @config[:maria][:port])
|
67
71
|
end
|
@@ -128,6 +132,12 @@ module Fulmar
|
|
128
132
|
"#{@config[:maria][:database]}_#{Time.now.strftime('%Y-%m-%dT%H%M%S')}.sql"
|
129
133
|
end
|
130
134
|
|
135
|
+
def initialize_shell
|
136
|
+
path = local? ? @config[:local_path] : @config[:remote_path]
|
137
|
+
@shell = Fulmar::Infrastructure::Service::ShellService.new(path, @config[:hostname])
|
138
|
+
@shell.debug = true if @config[:debug]
|
139
|
+
end
|
140
|
+
|
131
141
|
# Compiles a mysql config hash from valid options of the fulmar config
|
132
142
|
def compile_options
|
133
143
|
possible_options = [:host, :username, :password, :port, :encoding, :socket, :read_timeout, :write_timeout,
|
@@ -20,11 +20,19 @@ module Fulmar
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def local_shell
|
23
|
-
|
23
|
+
fail 'You need to set an environment and a target first' unless configuration.ready?
|
24
|
+
unless @_local_shell
|
25
|
+
@_local_shell = {}
|
26
|
+
end
|
27
|
+
@_local_shell["#{configuration.environment}:#{configuration.target}"] ||= Fulmar::Infrastructure::Service::ShellService.new configuration[:local_path]
|
24
28
|
end
|
25
29
|
|
26
30
|
def remote_shell
|
27
|
-
|
31
|
+
fail 'You need to set an environment and a target first' unless configuration.ready?
|
32
|
+
unless @_remote_shell
|
33
|
+
@_remote_shell = {}
|
34
|
+
end
|
35
|
+
@_remote_shell["#{configuration.environment}:#{configuration.target}"] ||= Fulmar::Infrastructure::Service::ShellService.new(configuration[:remote_path], configuration[:hostname])
|
28
36
|
end
|
29
37
|
|
30
38
|
def file_sync
|
data/lib/fulmar/version.rb
CHANGED