gdata-backup 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 91de6879e185cabefeae708c5de69a75bd72c6bf
4
+ data.tar.gz: 53e0ef5a5b29e2bfdaf1a2406563b5dcd3797c77
5
+ SHA512:
6
+ metadata.gz: 1063980e0e64fa6d5ff8a2b34b25ae0dd58245948850bd1c7c320627dfd64ed80e1f9dab41f0ae29e6a209d6ff366b9a4a13cf149c8ffd9bdbf02166f4984902
7
+ data.tar.gz: ae2de5eacf25a23f8c662ad1e0ee283c95c41705e72b4b58abe357c22ea7368169ac858fa9cc8c7f6dde962ac226bee75dea8ccda8d113c38357dbc380e5d2aa
data/README.md CHANGED
@@ -8,7 +8,7 @@ Installation
8
8
  ============
9
9
 
10
10
  ```
11
- bundle
11
+ gem install gdata-backup
12
12
  ```
13
13
 
14
14
  Configuration
@@ -23,6 +23,6 @@ Backup Google Drive documents as Open Document Format files.
23
23
  gem.add_development_dependency 'rake'
24
24
  gem.add_development_dependency 'pry'
25
25
  gem.add_development_dependency 'pry-doc'
26
- gem.add_development_dependency 'rspec'
26
+ gem.add_development_dependency 'rspec', '~> 2.14.1'
27
27
  end
28
28
 
@@ -10,8 +10,7 @@ module Gdata
10
10
  def initialize(account_username, path)
11
11
  @path = path
12
12
  store = Imap::Backup::Configuration::Store.new
13
- @config = store.data
14
- @account = @config[:accounts].find { |a| a[:username] == account_username }
13
+ @account = store.accounts.find { |a| a[:username] == account_username }
15
14
  raise 'account unknown' if @account.nil?
16
15
  @log = Logger.new(STDOUT)
17
16
  @log.level = Logger::INFO
@@ -2,7 +2,7 @@ module Gdata
2
2
  class Backup
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- REVISION = 1
5
+ REVISION = 2
6
6
  VERSION = [MAJOR, MINOR, REVISION].map(&:to_s).join('.')
7
7
  end
8
8
  end
@@ -1,9 +1,9 @@
1
1
  $: << '../lib'
2
2
 
3
- require 'gdata/download'
3
+ require 'gdata/backup'
4
4
  require "rexml/document"
5
5
 
6
- describe Gdata::Download do
6
+ describe Gdata::Backup do
7
7
 
8
8
  def canned_doc_list_response
9
9
  s = <<EOT
@@ -26,30 +26,24 @@ EOT
26
26
  before :each do
27
27
  @config = stub('Imap::Backup::Configuration::Store')
28
28
  Imap::Backup::Configuration::Store.stub!(:new).and_return(@config)
29
- @data = {:accounts => [{:username => 'account_username'}]}
30
- @config.stub!(:data).and_return(@data)
31
- end
32
-
33
- it 'should load config' do
34
- Imap::Backup::Configuration::Store.should_receive(:new).and_return(@config)
35
- @config.should_receive(:data).and_return(@data)
36
-
37
- Gdata::Download.new('account_username', '/a/path')
29
+ @accounts = [{:username => 'account_username'}]
30
+ @config.stub!(:accounts).and_return(@accounts)
38
31
  end
39
32
 
40
33
  it 'should fail if the account is not configured' do
41
34
  expect do
42
- Gdata::Download.new('unknown_username', '/a/path')
35
+ described_class.new('unknown_username', '/a/path')
43
36
  end.to raise_error(/unknown/)
44
37
  end
45
38
 
46
39
  end
47
40
 
48
- context '#documents' do
41
+ context '#run' do
42
+ let(:path) { "/a/path" }
49
43
 
50
44
  before :each do
51
- @data = {:accounts => [{:username => 'jdoe@example.com', :password => 'secret'}]}
52
- @config = stub('Imap::Backup::Configuration::Store', :data => @data)
45
+ @accounts = [{:username => 'jdoe@example.com', :password => 'secret'}]
46
+ @config = stub('Imap::Backup::Configuration::Store', :accounts => @accounts)
53
47
  Imap::Backup::Configuration::Store.stub!(:new).and_return(@config)
54
48
  @doc_list_client = stub('GData::Client::DocList')
55
49
  @doc_list_client.stub!(:clientlogin => true)
@@ -57,34 +51,26 @@ EOT
57
51
  @doc_list_client.stub!(:get).
58
52
  with('https://docs.google.com/feeds/documents/private/full').
59
53
  and_return(canned_doc_list_response)
54
+ allow(File).to receive(:directory?).and_call_original
55
+ allow(File).to receive(:directory?).with(path) { true }
60
56
  end
61
57
 
62
- subject { Gdata::Download.new('jdoe@example.com', '/a/path') }
58
+ subject { described_class.new('jdoe@example.com', path) }
63
59
 
64
60
  it 'should log in' do
65
61
  @doc_list_client. should_receive(:clientlogin).
66
62
  with('jdoe@example.com', 'secret').
67
63
  and_return(true)
68
64
 
69
- subject.documents
65
+ subject.run
70
66
  end
71
67
 
72
68
  it 'should list documents' do
73
69
  @doc_list_client. should_receive(:get).
74
70
  and_return(canned_doc_list_response)
75
71
 
76
- subject.documents
72
+ subject.run
77
73
  end
78
-
79
- it 'should return document information' do
80
- documents = subject.documents
81
-
82
- documents. should == [{:file_name => 'Doc1.odt',
83
- :url => 'https://docs.google.com/feeds/download/documents/export/Export?id=XXXXXXXX&exportFormat=odt'},
84
- {:file_name => 'Doc2.odt',
85
- :url => 'https://docs.google.com/feeds/download/documents/export/Export?id=YYYYYYYY&exportFormat=odt'}]
86
- end
87
-
88
74
  end
89
75
 
90
76
  end
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdata-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joe Yates
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: gdata
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: imap-backup
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pry
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: pry-doc
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: 2.14.1
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
- version: '0'
96
+ version: 2.14.1
110
97
  description: Google Drive backup
111
98
  email:
112
99
  - joe.g.yates@gmail.com
@@ -115,7 +102,7 @@ executables:
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
- - .gitignore
105
+ - ".gitignore"
119
106
  - Gemfile
120
107
  - README.md
121
108
  - Rakefile
@@ -126,33 +113,26 @@ files:
126
113
  - spec/download_spec.rb
127
114
  homepage: https://github.com/joeyates/gdata-backup
128
115
  licenses: []
116
+ metadata: {}
129
117
  post_install_message:
130
118
  rdoc_options: []
131
119
  require_paths:
132
120
  - lib
133
121
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
122
  requirements:
136
- - - ! '>='
123
+ - - ">="
137
124
  - !ruby/object:Gem::Version
138
125
  version: '0'
139
- segments:
140
- - 0
141
- hash: -2792609340228659123
142
126
  required_rubygems_version: !ruby/object:Gem::Requirement
143
- none: false
144
127
  requirements:
145
- - - ! '>='
128
+ - - ">="
146
129
  - !ruby/object:Gem::Version
147
130
  version: '0'
148
- segments:
149
- - 0
150
- hash: -2792609340228659123
151
131
  requirements: []
152
132
  rubyforge_project:
153
- rubygems_version: 1.8.23
133
+ rubygems_version: 2.4.5
154
134
  signing_key:
155
- specification_version: 3
135
+ specification_version: 4
156
136
  summary: Backup Google Drive documents as Open Document Format files.
157
137
  test_files:
158
138
  - spec/download_spec.rb