chdorner-gdocs-migration 0.1.0 → 0.2.0

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.
@@ -24,6 +24,7 @@ $:.unshift(File.dirname(__FILE__)) unless
24
24
 
25
25
  require File.expand_path(File.dirname(__FILE__) + "/gdocs-migration/cli")
26
26
  require File.expand_path(File.dirname(__FILE__) + "/gdocs-migration/migration")
27
+ require File.expand_path(File.dirname(__FILE__) + "/gdocs-migration/models/document")
27
28
 
28
29
  module GDocsMigration
29
30
  end
@@ -24,7 +24,9 @@ require 'highline/import'
24
24
 
25
25
  module GDocsMigration
26
26
  class Migration
27
+
27
28
  def initialize(from, to)
29
+ @documents = []
28
30
  @from = from
29
31
  @to = to
30
32
  @from_client = GData::Client::DocList.new
@@ -37,10 +39,27 @@ module GDocsMigration
37
39
 
38
40
  login
39
41
 
42
+ fetch
43
+
40
44
  puts "";puts "Migration complete"
41
45
  puts "";puts "**************************"
42
46
  end
43
47
 
48
+ def fetch
49
+ puts "Fetching all documents from #{@from}:"
50
+
51
+ feed = @from_client.get("http://docs.google.com/feeds/documents/private/full/").to_xml
52
+ feed.elements.each('entry') do |entry|
53
+ type = entry.elements['category[@scheme = "http://schemas.google.com/g/2005#kind"]'].attributes['label']
54
+
55
+ document = GDocsMigration::Model::Document.new type
56
+ document.title = entry.elements['title'].text
57
+
58
+ puts "Fetched #{document.type} #{document.title}"
59
+ end
60
+ puts ""
61
+ end
62
+
44
63
  def login
45
64
  begin
46
65
  from_pass = ask("Password for #{@from}:") { |q| q.echo = "*" }
@@ -0,0 +1,33 @@
1
+ # Copyright (c) 2009 Christof Dorner
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # 'Software'), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ module GDocsMigration
23
+ module Model
24
+ class Document
25
+ attr_accessor :title
26
+ attr_accessor :type
27
+
28
+ def initialize(type_p)
29
+ @type = type_p
30
+ end
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chdorner-gdocs-migration
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
  - chdorner
@@ -55,11 +55,11 @@ files:
55
55
  - lib/gdocs-migration.rb
56
56
  - lib/gdocs-migration/cli.rb
57
57
  - lib/gdocs-migration/migration.rb
58
+ - lib/gdocs-migration/models/document.rb
58
59
  - LICENSE
59
60
  - README.rdoc
60
61
  has_rdoc: false
61
62
  homepage: http://github.com/chdorner/gdocs-migration
62
- licenses:
63
63
  post_install_message:
64
64
  rdoc_options:
65
65
  - --charset=UTF-8
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements: []
81
81
 
82
82
  rubyforge_project:
83
- rubygems_version: 1.3.5
83
+ rubygems_version: 1.2.0
84
84
  signing_key:
85
85
  specification_version: 3
86
86
  summary: Migrates GDocs between Google accounts