yore 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1,2 @@
1
- 0.2.4
1
+ 0.3.0
2
+
@@ -82,6 +82,7 @@ class AWSS3Client
82
82
  policy
83
83
  end
84
84
 
85
+ # aContent can be a String or File eg. 'something' or open('file.txt')
85
86
  def put_content(aFilename, aContent, aBucketName)
86
87
  AWS::S3::S3Object.store(aFilename, aContent, aBucketName)
87
88
  end
@@ -89,15 +90,16 @@ class AWSS3Client
89
90
  def upload(aFilename,aBucketName,aObjectName=nil)
90
91
  aObjectName ||= File.basename(aFileName)
91
92
  #AWS::S3::S3Object.store(aObjectName, MiscUtils.string_from_file(aFileName), aBucketName)
92
- content = MiscUtils.string_from_file(aFileName)
93
+ #content = MiscUtils.string_from_file(aFileName)
93
94
 
94
- put_content(aObjectName, content, aBucketName)
95
+ put_content(aObjectName, open(aFilename), aBucketName)
95
96
  end
96
97
 
97
98
  def get_content(aFilename, aBucketName)
98
99
  return AWS::S3::S3Object.value(aFilename, aBucketName)
99
100
  end
100
101
 
102
+ # should replace string_to_file with file object
101
103
  def download(aFilename,aBucketName,aObjectName=nil)
102
104
  aObjectName ||= File.basename(aFilename)
103
105
  #AWS::S3::S3Object.store(aObjectName, MiscUtils.string_from_file(aFilename), aBucketName)
@@ -115,7 +117,7 @@ class AWSS3Client
115
117
  # * This requires the bucket to give WRITE & READ_ACP permissions to this user
116
118
  def upload_backup(aFileName,aBucketName,aObjectName = nil)
117
119
  aObjectName ||= File.basename(aFileName)
118
- AWS::S3::S3Object.store(aObjectName, MiscUtils.string_from_file(aFileName), aBucketName)
120
+ AWS::S3::S3Object.store(aObjectName, open(aFileName), aBucketName)
119
121
  bucket_owner = AWS::S3::Bucket.acl(aBucketName).owner
120
122
  policy = AWS::S3::S3Object.acl(aObjectName,aBucketName)
121
123
  policy.grants.clear
@@ -21,6 +21,7 @@ module YoreCore
21
21
  :basepath => String,
22
22
  :backup_id => String,
23
23
  :backup_email => String,
24
+ :compress => true,
24
25
  :crypto_iv => "3A63775C1E3F291B0925578165EB917E", # apparently a string of up to 32 random hex digits
25
26
  :crypto_key => "07692FC8656F04AE5518B80D38681E038A3C12050DF6CC97CEEC33D800D5E2FE", # apparently a string of up to 64 random hex digits
26
27
  :first_hour => 4,
@@ -258,11 +259,15 @@ module YoreCore
258
259
 
259
260
  shell("tar cv #{aParentDir ? '--directory='+aParentDir.to_s : ''} --file=#{tarfile} --files-from=#{listfile}")
260
261
  shell("rm #{listfile}") unless config[:leave_temp_files]
261
- logger.info "Compressing ..."
262
- tarfile_size = File.size(tarfile)
263
- shell("bzip2 #{tarfile}; mv #{tarfile}.bz2 #{aDestFile}")
264
-
265
- logger.info "Compressed #{'%.1f' % (tarfile_size*1.0/2**10)} KB to #{'%.1f' % (File.size(aDestFile)*1.0/2**10)} KB"
262
+ if config[:compress]
263
+ logger.info "Compressing ..."
264
+ tarfile_size = File.size(tarfile)
265
+ shell("bzip2 #{tarfile}; mv #{tarfile}.bz2 #{aDestFile}")
266
+
267
+ logger.info "Compressed #{'%.1f' % (tarfile_size*1.0/2**10)} KB to #{'%.1f' % (File.size(aDestFile)*1.0/2**10)} KB"
268
+ else
269
+ shell("mv #{tarfile} #{aDestFile}")
270
+ end
266
271
  end
267
272
 
268
273
  def uncompress(aArchive,aDestination=nil,aArchiveContent=nil)
data/yore.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yore}
8
- s.version = "0.2.4"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["buzzware"]
12
- s.date = %q{2011-11-03}
12
+ s.date = %q{2011-11-07}
13
13
  s.default_executable = %q{yore}
14
14
  s.description = %q{yore (as in "days of yore") is a user data management utility for web applications.}
15
15
  s.email = %q{contact@buzzware.com.au}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yore
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - buzzware
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-03 00:00:00 +08:00
18
+ date: 2011-11-07 00:00:00 +08:00
19
19
  default_executable: yore
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency