fulmar 1.8.5 → 1.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cfe568cca222bdb6219e38d6baae83190d53875
4
- data.tar.gz: 4f3c471f4b47dbbf502a41591cc1a9d9a8b960aa
3
+ metadata.gz: 99ced20c31e852a42ba296fef2e83456379fd192
4
+ data.tar.gz: 1be06bf27f2a58794bea68457e1e72ac3b902d07
5
5
  SHA512:
6
- metadata.gz: 9164acd81b792d4f219c4bb3409a44b0ce6dadc040f2063cb2ff6eed6918d2289502bceb9b2913197637378eab39d1b2b7808e0f4fdf5c69512083bf7804ff78
7
- data.tar.gz: f39fbecf617814bb558413ed16948688dbb09125d92ba4c3c46b6a7a2fb04168aa6669d9ccb1f41bfbb1a6bdf1b08a0d4fc92d06a4d84b74921c2896625869b0
6
+ metadata.gz: 2e76c556be93ddbf070d679425faa1ecab863de50f49b3c37f1a67852ebf5f97afd191379a40305dd18a53f3904e988440edadf9c02dbfc83ec64304bdc7b740
7
+ data.tar.gz: 46bebcb2331f5c03f09f568c68886a957fe234e642cffa4aa8fba1ab0b112f33f9646e48c89f21697fe468248b28e352175a12b2d376ea93fbe99328dd5895b3
@@ -34,7 +34,7 @@ module Fulmar
34
34
  next unless data[:type].blank? || data[:type] == 'git'
35
35
  git = Rugged::Repository.new(data[:path])
36
36
 
37
- checkout(git, data)
37
+ handle_uncommitted_changes(git, data)
38
38
 
39
39
  # Pull
40
40
  shell = Fulmar::Infrastructure::Service::ShellService.new data[:path]
@@ -46,7 +46,34 @@ module Fulmar
46
46
 
47
47
  protected
48
48
 
49
+ ##
50
+ # Runs a defined update policy to avoid git conflicts
51
+ # @param git [Rugged::Repository]
52
+ # @param dependency [Hash]
53
+ def handle_uncommitted_changes(git, dependency)
54
+ policy = dependency[:update_policy] || ''
55
+
56
+ case policy
57
+ when 'reset'
58
+ reset(git)
59
+ when -> (p) { p.nil? || p.empty? }
60
+ puts 'No update policy configured'
61
+ else
62
+ puts "Unexpected update policy #{policy}"
63
+ end
64
+ end
65
+
66
+ ##
67
+ # Reset changes
68
+ # @param git [Rugged::Repository]
69
+ def reset(git)
70
+ head = git.head
71
+ git.reset(head.target_id, :hard) unless head.nil?
72
+ end
73
+
49
74
  def checkout(git, dependency)
75
+ handle_uncommitted_changes(git, dependency)
76
+
50
77
  # Switch to the configured branch/tag/commit
51
78
  if git.branches.select { |b| b.name.split('/').last == dependency[:ref] }.any?
52
79
  checkout_branch(git, dependency[:ref])
@@ -74,18 +74,24 @@ module Fulmar
74
74
  disconnect unless state_before
75
75
  end
76
76
 
77
+ def command(binary)
78
+ command = binary
79
+ command << " -h #{@config[:maria][:host]}" unless @config[:maria][:host].blank?
80
+ command << " -u #{@config[:maria][:user]}" unless @config[:maria][:user].blank?
81
+ command << " --password='#{@config[:maria][:password]}'" unless @config[:maria][:password].blank?
82
+ command
83
+ end
84
+
77
85
  def dump(filename = backup_filename)
78
86
  filename = "#{@config[:remote_path]}/#{filename}" unless filename[0, 1] == '/'
79
87
 
80
- @shell.run "mysqldump -h #{@config[:maria][:host]} -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
81
- "#{@config[:maria][:database]} --single-transaction #{diffable} #{ignore_tables} -r \"#{filename}\""
88
+ @shell.run "#{command('mysqldump')} #{@config[:maria][:database]} --single-transaction #{diffable} #{ignore_tables} -r \"#{filename}\""
82
89
 
83
90
  filename
84
91
  end
85
92
 
86
93
  def load_dump(dump_file, database = @config[:maria][:database])
87
- @shell.run "mysql -h #{@config[:maria][:host]} -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
88
- "-D #{database} < #{dump_file}"
94
+ @shell.run "#{command('mysql')} -D #{database} < #{dump_file}"
89
95
  end
90
96
 
91
97
  def download_dump(filename = backup_filename)
@@ -1,4 +1,4 @@
1
1
  # Provides a global version number
2
2
  module Fulmar
3
- VERSION = '1.8.5'
3
+ VERSION = '1.8.6'
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: 1.8.5
4
+ version: 1.8.6
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: 2015-12-02 00:00:00.000000000 Z
12
+ date: 2016-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler