moneypools-right_wrapper 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,8 +10,7 @@ begin
10
10
  gem.email = "zbelzer@gmail.com"
11
11
  gem.homepage = "http://github.com/moneypools/right_wrapper"
12
12
  gem.authors = ["Zachary Belzer"]
13
- gem.add_development_dependency "right_aws"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ gem.add_dependency "redaranj-right_aws", ">= 1.11.0"
15
14
  end
16
15
  Jeweler::GemcutterTasks.new
17
16
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/right_wrapper.rb CHANGED
@@ -74,11 +74,17 @@ class RightWrapper
74
74
  current_volumes
75
75
  end
76
76
 
77
- def create_snapshot(target_volume)
77
+ def create_snapshot(target_volume, tags={})
78
+ tag_string = ''
78
79
  target_volume_id = target_volume[:aws_id]
79
80
 
80
81
  puts "Creating snapshot of #{target_volume_id}"
81
- snap_id = @ec2.create_snapshot(target_volume_id)[:aws_id]
82
+ unless tags.empty?
83
+ tag_string = tags.map {|k,v| [k.to_s, v.to_s].join(":")}.join(" ")
84
+ puts "-- Tagging snapshot with #{tag_string}"
85
+ end
86
+
87
+ snap_id = @ec2.create_snapshot(target_volume_id, tag_string)[:aws_id]
82
88
 
83
89
  while true
84
90
  snap_data = @ec2.describe_snapshots.detect {|snap| snap[:aws_id] == snap_id}
@@ -91,10 +97,19 @@ class RightWrapper
91
97
 
92
98
  snap_id
93
99
  end
100
+
101
+ def share_snapshot(snap_id, *users)
102
+ puts "Sharing snapshot #{snap_id} with #{users.join(', ')}"
103
+ @ec2.modify_snapshot_attribute_create_volume_permission_add_users(snap_id, *users)
104
+ end
105
+
106
+ def get_tags_for_snapshot(snap)
107
+ snap[:aws_description].squeeze(" ").split(" ").inject({}) { |c, t| key, value = t.split(":"); c[key.to_sym] = value; c}
108
+ end
94
109
 
95
- def delete_snapshot(target_snapshot_id)
96
- puts "Deleting snapshot #{target_snapshot_id}"
97
- @ec2.delete_snapshot(target_snapshot_id)
110
+ def delete_snapshot(snap_id)
111
+ puts "Deleting snapshot #{snap_id}"
112
+ @ec2.delete_snapshot(snap_id)
98
113
  end
99
114
 
100
115
  def create_volume(snap_id, volume_size, zone)
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{moneypools-right_wrapper}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zachary Belzer"]
12
- s.date = %q{2009-11-12}
12
+ s.date = %q{2010-03-19}
13
13
  s.description = %q{Simple wrapper over the right_aws utility providing verbose output and synchronization}
14
14
  s.email = %q{zbelzer@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -37,11 +37,12 @@ Gem::Specification.new do |s|
37
37
  s.specification_version = 3
38
38
 
39
39
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
40
- s.add_development_dependency(%q<right_aws>, [">= 0"])
40
+ s.add_runtime_dependency(%q<redaranj-right_aws>, [">= 1.11.0"])
41
41
  else
42
- s.add_dependency(%q<right_aws>, [">= 0"])
42
+ s.add_dependency(%q<redaranj-right_aws>, [">= 1.11.0"])
43
43
  end
44
44
  else
45
- s.add_dependency(%q<right_aws>, [">= 0"])
45
+ s.add_dependency(%q<redaranj-right_aws>, [">= 1.11.0"])
46
46
  end
47
47
  end
48
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneypools-right_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Belzer
@@ -9,18 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-12 00:00:00 -06:00
12
+ date: 2010-03-19 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: right_aws
17
- type: :development
16
+ name: redaranj-right_aws
17
+ type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 1.11.0
24
24
  version:
25
25
  description: Simple wrapper over the right_aws utility providing verbose output and synchronization
26
26
  email: zbelzer@gmail.com