fulmar 2.2.3 → 2.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0336132e3fcbed16ff2144fe52793cb878a08537dbcd840aa59c63b78f8ac7f1
4
- data.tar.gz: 52372491d8131f37d8bd0b5926dd262e17cd4cf0e07acc40fc7965a2b761587d
3
+ metadata.gz: dcc60c5ada7e7d4fc50db5b9c03271923d7f78672d12f1aed85e22983b386148
4
+ data.tar.gz: 3a17c4f609b5b85d9348bd18604ea1891ab11ade9006b5a6975201dd3dcb22e5
5
5
  SHA512:
6
- metadata.gz: 39f7077270b7b6fc4b3a5c487827ec14a548acbc47a7faa525195c59da62e0eb322d31c9eaa0e22cc781b96ff6bfdb50066dbc1960b5abddf419d567bdccdb74
7
- data.tar.gz: a4c1faae307fffd31faa4389cbc96dd33831158f30b3e924e15d4f16bf65dca12e3c35796f26d52b3634b279689a43a16dbec7f4aad91b24d214f6b3b79b770f
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.get_model(config)
9
+ def self.get_class(config)
10
10
  case config[:type]
11
11
  when 'rsync_with_versions'
12
- transfer_model = Fulmar::Infrastructure::Model::Transfer::RsyncWithVersions.new(config)
12
+ transfer_class = Fulmar::Infrastructure::Model::Transfer::RsyncWithVersions
13
13
  when 'rsync'
14
- transfer_model = Fulmar::Infrastructure::Model::Transfer::Rsync.new(config)
14
+ transfer_class = Fulmar::Infrastructure::Model::Transfer::Rsync
15
15
  when 'tar'
16
- transfer_model = Fulmar::Infrastructure::Model::Transfer::Tar.new(config)
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
- transfer_model
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
- storage['local_shell'] ||= new_shell(config[:local_path])
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
- storage['remote_shell'] ||= new_shell(config[:remote_path], config.ssh_user_and_host)
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
- storage['file_sync'] ||= Fulmar::FileSync.get_model config
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: Time.now.strftime('%Y-%m-%d_%H%M%S'),
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 /^[A-Z][A-Z0-9\-_]+$/ =~ @config[:version_name]
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
@@ -1,4 +1,4 @@
1
1
  # Provides a global version number
2
2
  module Fulmar
3
- VERSION = '2.2.3'.freeze
3
+ VERSION = '2.2.4'.freeze
4
4
  end
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.3
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-13 00:00:00.000000000 Z
12
+ date: 2018-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler