appshot 0.0.6 → 0.0.7

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.
data/lib/appshot.rb CHANGED
@@ -6,7 +6,7 @@ require 'appshot/filesystem'
6
6
  class Appshot
7
7
  def initialize(config)
8
8
  @appshots = {}
9
- @callables = []
9
+ @callables = []
10
10
  instance_eval(config)
11
11
  end
12
12
 
@@ -48,25 +48,25 @@ class Appshot
48
48
  @callables << Appshot::EBS_Snapshot.new(args)
49
49
  end
50
50
 
51
- def mysql(args={})
52
- @callables << Appshot::Mysql.new(args)
53
- end
51
+ def mysql(args={})
52
+ @callables << Appshot::Mysql.new(args)
53
+ end
54
54
 
55
- def mongodb(args={})
56
- @callables << Appshot::MongoDB.new(args)
57
- end
55
+ def mongodb(args={})
56
+ @callables << Appshot::MongoDB.new(args)
57
+ end
58
58
 
59
- def redis(args={})
60
- @callables << Appshot::Redis.new(args)
61
- end
59
+ def redis(args={})
60
+ @callables << Appshot::Redis.new(args)
61
+ end
62
62
 
63
- def ebs_prune(args={})
63
+ def ebs_prune(args={})
64
64
  @callables << Appshot::EBS_Prune.new(args)
65
- end
65
+ end
66
66
 
67
- ###############
68
- # Internals
69
- ###############
67
+ ###############
68
+ # Internals
69
+ ###############
70
70
 
71
71
  def appshots
72
72
  @appshots
@@ -17,10 +17,12 @@ class Appshot
17
17
  next_action = call_chain.shift
18
18
  @client = Mysql2::Client.new(username: @user, hostname: @host, password: @password, port: @port, database: @name)
19
19
 
20
+ error "Could not get connection to database, check your settings" unless @client
21
+
20
22
  lock
21
23
  next_action.call(call_chain) unless next_action.nil?
22
24
  ensure
23
- unlock
25
+ unlock(@client)
24
26
  end
25
27
 
26
28
  private
@@ -37,8 +39,12 @@ class Appshot
37
39
  end
38
40
  end
39
41
 
40
- def unlock
41
- @client.query("UNLOCK TABLES")
42
+ def unlock(client)
43
+ if client.nil?
44
+ puts "Cannot unlock, no connection to mysql."
45
+ else
46
+ client.query("UNLOCK TABLES")
47
+ end
42
48
  end
43
49
  end
44
50
  end
@@ -1,3 +1,3 @@
1
1
  class Appshot
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -278,7 +278,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
278
  version: '0'
279
279
  segments:
280
280
  - 0
281
- hash: 2272615325912088486
281
+ hash: 3208029143716343797
282
282
  required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  none: false
284
284
  requirements:
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  segments:
289
289
  - 0
290
- hash: 2272615325912088486
290
+ hash: 3208029143716343797
291
291
  requirements: []
292
292
  rubyforge_project:
293
293
  rubygems_version: 1.8.24