fulmar 1.8.5 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ced20c31e852a42ba296fef2e83456379fd192
|
4
|
+
data.tar.gz: 1be06bf27f2a58794bea68457e1e72ac3b902d07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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 "
|
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)
|
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: 1.8.
|
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:
|
12
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|