fulmar 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fulmar/domain/service/file_sync_service.rb +5 -6
- data/lib/fulmar/domain/service/helper/common_helper.rb +7 -3
- data/lib/fulmar/infrastructure/model/transfer/base.rb +8 -0
- data/lib/fulmar/infrastructure/model/transfer/rsync_with_versions.rb +4 -2
- data/lib/fulmar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc60c5ada7e7d4fc50db5b9c03271923d7f78672d12f1aed85e22983b386148
|
4
|
+
data.tar.gz: 3a17c4f609b5b85d9348bd18604ea1891ab11ade9006b5a6975201dd3dcb22e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63fc9a9a7785ffa6592aaf5abd3ca18c8c6ea4300e45a87a8af0ddb356326d7f43bb7d35f28b3514a6d568df8b4021fa8b885f87acecfaa70ca0c2a198922ba
|
7
|
+
data.tar.gz: e44c0945ca27ce4be7765610c04c5a55a19d36a9751b701f665601ffaeee4ab7231af01499df6c0da67284e17bc6b91cf5eaf11becb9d3ba887eebeaf54c84f3
|
@@ -6,21 +6,20 @@ require 'fulmar/infrastructure/model/transfer/tar'
|
|
6
6
|
module Fulmar
|
7
7
|
# Creates the required transfer model from the configuration
|
8
8
|
class FileSync
|
9
|
-
def self.
|
9
|
+
def self.get_class(config)
|
10
10
|
case config[:type]
|
11
11
|
when 'rsync_with_versions'
|
12
|
-
|
12
|
+
transfer_class = Fulmar::Infrastructure::Model::Transfer::RsyncWithVersions
|
13
13
|
when 'rsync'
|
14
|
-
|
14
|
+
transfer_class = Fulmar::Infrastructure::Model::Transfer::Rsync
|
15
15
|
when 'tar'
|
16
|
-
|
16
|
+
transfer_class = Fulmar::Infrastructure::Model::Transfer::Tar
|
17
17
|
else
|
18
18
|
help = config[:type] == '' ? 'Add a "type: " field to your deployment yaml file. ' : ''
|
19
|
-
transfer_model = nil
|
20
19
|
raise "Transfer type '#{config[:type]}' is not valid. #{help}Valid values are: rsync, rsync_with_versions."
|
21
20
|
end
|
22
21
|
|
23
|
-
|
22
|
+
transfer_class
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
@@ -22,16 +22,20 @@ module Fulmar
|
|
22
22
|
|
23
23
|
# @return [Fulmar::Shell]
|
24
24
|
def local_shell
|
25
|
-
|
25
|
+
cache_id = "local_shell-#{config[:local_path]}"
|
26
|
+
storage[cache_id] ||= new_shell(config[:local_path])
|
26
27
|
end
|
27
28
|
|
28
29
|
# @return [Fulmar::Shell]
|
29
30
|
def remote_shell
|
30
|
-
|
31
|
+
cache_id = "remote_shell-#{config[:remote_path]}-#{config.ssh_user_and_host}"
|
32
|
+
storage[cache_id] ||= new_shell(config[:remote_path], config.ssh_user_and_host)
|
31
33
|
end
|
32
34
|
|
33
35
|
def file_sync
|
34
|
-
|
36
|
+
file_sync_model = Fulmar::FileSync.get_class config
|
37
|
+
cache_id = "file_sync-#{file_sync_model.config_hash(config)}"
|
38
|
+
storage[cache_id] ||= file_sync_model.new(config.clone)
|
35
39
|
end
|
36
40
|
|
37
41
|
def render_templates
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fulmar/shell'
|
2
|
+
require 'digest'
|
2
3
|
|
3
4
|
module Fulmar
|
4
5
|
module Infrastructure
|
@@ -47,6 +48,13 @@ module Fulmar
|
|
47
48
|
# Placeholder for consistent api, currently only implemented in rsync_with_versions
|
48
49
|
true
|
49
50
|
end
|
51
|
+
|
52
|
+
# Generate a hash over all relevant config values to allow more precise caching
|
53
|
+
def self.config_hash(config)
|
54
|
+
id_string = self.class.to_s
|
55
|
+
id_string << DEFAULT_CONFIG.keys.map { |key| config[key].to_s }.join('-')
|
56
|
+
Digest::SHA256.hexdigest id_string
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
52
60
|
end
|
@@ -28,7 +28,7 @@ module Fulmar
|
|
28
28
|
},
|
29
29
|
symlinks: {},
|
30
30
|
limit_releases: 5,
|
31
|
-
version_name:
|
31
|
+
version_name: 'time',
|
32
32
|
shared: []
|
33
33
|
}.freeze
|
34
34
|
|
@@ -49,7 +49,9 @@ module Fulmar
|
|
49
49
|
@remote_shell = Fulmar::Shell.new @config[:remote_path], @config.ssh_user_and_host
|
50
50
|
@remote_shell.debug = @config[:debug]
|
51
51
|
|
52
|
-
if
|
52
|
+
if @config[:version_name] == 'time'
|
53
|
+
@config[:version_name] = Time.now.strftime(TIME_FOLDER)
|
54
|
+
elsif /^[A-Z][A-Z0-9\-_]+$/ =~ @config[:version_name]
|
53
55
|
@config[:version_name] = ENV[@config[:version_name]].split('/').last
|
54
56
|
end
|
55
57
|
end
|
data/lib/fulmar/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulmar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Siegl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-02-
|
12
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|