dropboxstrg 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/lib/dropboxstrg/dropboxstorage.rb~ +118 -0
- data/lib/dropboxstrg/dropboxstrg.rb +118 -0
- data/lib/dropboxstrg/dropboxstrg.rb~ +118 -0
- data/lib/dropboxstrg/version.rb +3 -0
- data/lib/dropboxstrg.rb +2 -0
- data/lib/generators/cloudstrg_generator.rb~ +19 -0
- data/lib/generators/dropboxstrg_generator.rb +16 -0
- data/lib/generators/dropboxstrg_generator.rb~ +19 -0
- data/lib/tasks/dropboxstrg_tasks.rake +4 -0
- data/lib/templates/cloudstrgdata.rb~ +3 -0
- data/lib/templates/cloudstrglist.rb~ +3 -0
- data/lib/templates/cloudstrguser.rb~ +0 -0
- data/lib/templates/create_cloudstrgdata.rb~ +0 -0
- data/lib/templates/create_cloudstrgfields.rb~ +13 -0
- data/lib/templates/create_cloudstrglist.rb~ +13 -0
- data/lib/templates/create_cloudstrgusers.rb~ +0 -0
- data/lib/templates/create_dropboxstrgfields.rb +15 -0
- data/lib/templates/create_dropboxstrgfields.rb~ +11 -0
- data/lib/templates/create_gdrivestrgfields.rb~ +13 -0
- data/test/dropboxstrg_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/test_helper.rb +15 -0
- metadata +175 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
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
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Dropboxstrg'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.libs << 'lib'
|
32
|
+
t.libs << 'test'
|
33
|
+
t.pattern = 'test/**/*_test.rb'
|
34
|
+
t.verbose = false
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
task :default => :test
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'cloudstorage'
|
2
|
+
|
3
|
+
class DropboxStorage < CloudStorage::CloudStorage
|
4
|
+
require 'dropbox_sdk'
|
5
|
+
|
6
|
+
APP_KEY = 'ebwn2abt7mznz56'
|
7
|
+
APP_SECRET = 'g03si51tws05re3'
|
8
|
+
ACCESS_TYPE = :app_folder
|
9
|
+
|
10
|
+
mattr_accessor :session, :client, :user, :redirect_path
|
11
|
+
@session = nil
|
12
|
+
@client = nil
|
13
|
+
@username = nil
|
14
|
+
@redirect_path = nil
|
15
|
+
|
16
|
+
def initialize params
|
17
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
18
|
+
end
|
19
|
+
|
20
|
+
def config params
|
21
|
+
@redirect_path = params[:redirect]
|
22
|
+
@username = params[:username]
|
23
|
+
user = Person.find_by_name(@username)
|
24
|
+
|
25
|
+
session = params[:session]
|
26
|
+
|
27
|
+
if session[:dropbox_rkey] and session[:dropbox_rsecret]
|
28
|
+
begin
|
29
|
+
@session.set_request_token(session[:dropbox_rkey], session[:dropbox_rsecret])
|
30
|
+
@session.get_access_token()
|
31
|
+
user.dropbox_akey = @session.access_token.key
|
32
|
+
user.dropbox_asecret = @session.access_token.secret
|
33
|
+
session[:dropbox_rkey] = nil
|
34
|
+
session[:dropbox_rsecret] = nil
|
35
|
+
user.save()
|
36
|
+
rescue DropboxAuthError
|
37
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
38
|
+
user.dropbox_akey = nil
|
39
|
+
user.dropbox_asecret = nil
|
40
|
+
session[:dropbox_rkey] = nil
|
41
|
+
session[:dropbox_rsecret] = nil
|
42
|
+
user.save()
|
43
|
+
params[:session] = session
|
44
|
+
return config params
|
45
|
+
end
|
46
|
+
else
|
47
|
+
@session.get_request_token()
|
48
|
+
|
49
|
+
if user.dropbox_akey and user.dropbox_asecret
|
50
|
+
@session.set_access_token(user.dropbox_akey, user.dropbox_asecret)
|
51
|
+
else
|
52
|
+
session[:dropbox_rkey] = @session.request_token.key
|
53
|
+
session[:dropbox_rsecret] = @session.request_token.secret
|
54
|
+
return session, @session.get_authorize_url(callback=@redirect_path)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
@client = DropboxClient.new(@session, ACCESS_TYPE)
|
58
|
+
return session, false
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_file params
|
62
|
+
if not @client
|
63
|
+
return false
|
64
|
+
end
|
65
|
+
filename = params[:filename]
|
66
|
+
filename += ".json" if not filename.include? ".json"
|
67
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content])
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_folder params
|
72
|
+
if not @client
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
@client.file_create_folder("/#{@username}")
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_file params
|
79
|
+
if not @client
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
filename = params[:fileid]
|
83
|
+
filename += ".json" if not filename.include? ".json"
|
84
|
+
return filename, filename, @client.get_file("/#{@username}/#{filename}")
|
85
|
+
end
|
86
|
+
|
87
|
+
def update_file params
|
88
|
+
if not @client
|
89
|
+
return false
|
90
|
+
end
|
91
|
+
filename = params[:fileid]
|
92
|
+
filename += ".json" if not filename.include? ".json"
|
93
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content], overwrite=true)
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
def remove_file params
|
98
|
+
if not @client
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
filename = params[:fileid]
|
102
|
+
filename += ".json" if not filename.include? ".json"
|
103
|
+
@client.file_delete("/#{@username}/#{filename}")
|
104
|
+
end
|
105
|
+
|
106
|
+
def list_files
|
107
|
+
if not @client
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
data = @client.metadata("/#{@username}/")
|
111
|
+
lines = []
|
112
|
+
data["contents"].each do |line|
|
113
|
+
lines.append([line["path"].split("/")[-1],line["path"].split("/")[-1]]) if line["path"].include? ".json"
|
114
|
+
end
|
115
|
+
return lines
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'cloudstrg/cloudstrg'
|
2
|
+
|
3
|
+
class DropboxStrg < CloudStrg::CloudStorage
|
4
|
+
require 'dropbox_sdk'
|
5
|
+
|
6
|
+
APP_KEY = 'ebwn2abt7mznz56'
|
7
|
+
APP_SECRET = 'g03si51tws05re3'
|
8
|
+
ACCESS_TYPE = :app_folder
|
9
|
+
|
10
|
+
mattr_accessor :session, :client, :user, :redirect_path
|
11
|
+
@session = nil
|
12
|
+
@client = nil
|
13
|
+
@username = nil
|
14
|
+
@redirect_path = nil
|
15
|
+
|
16
|
+
def initialize params
|
17
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
18
|
+
end
|
19
|
+
|
20
|
+
def config params
|
21
|
+
@redirect_path = params[:redirect]
|
22
|
+
@username = params[:username]
|
23
|
+
user = Cloudstrguser.find_by_name(@username)
|
24
|
+
|
25
|
+
session = params[:session]
|
26
|
+
|
27
|
+
if session[:dropbox_rkey] and session[:dropbox_rsecret]
|
28
|
+
begin
|
29
|
+
@session.set_request_token(session[:dropbox_rkey], session[:dropbox_rsecret])
|
30
|
+
@session.get_access_token()
|
31
|
+
user.dropbox_akey = @session.access_token.key
|
32
|
+
user.dropbox_asecret = @session.access_token.secret
|
33
|
+
session[:dropbox_rkey] = nil
|
34
|
+
session[:dropbox_rsecret] = nil
|
35
|
+
user.save()
|
36
|
+
rescue DropboxAuthError
|
37
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
38
|
+
user.dropbox_akey = nil
|
39
|
+
user.dropbox_asecret = nil
|
40
|
+
session[:dropbox_rkey] = nil
|
41
|
+
session[:dropbox_rsecret] = nil
|
42
|
+
user.save()
|
43
|
+
params[:session] = session
|
44
|
+
return config params
|
45
|
+
end
|
46
|
+
else
|
47
|
+
@session.get_request_token()
|
48
|
+
|
49
|
+
if user.dropbox_akey and user.dropbox_asecret
|
50
|
+
@session.set_access_token(user.dropbox_akey, user.dropbox_asecret)
|
51
|
+
else
|
52
|
+
session[:dropbox_rkey] = @session.request_token.key
|
53
|
+
session[:dropbox_rsecret] = @session.request_token.secret
|
54
|
+
return session, @session.get_authorize_url(callback=@redirect_path)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
@client = DropboxClient.new(@session, ACCESS_TYPE)
|
58
|
+
return session, false
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_file params
|
62
|
+
if not @client
|
63
|
+
return false
|
64
|
+
end
|
65
|
+
filename = params[:filename]
|
66
|
+
filename += ".json" if not filename.include? ".json"
|
67
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content])
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_folder params
|
72
|
+
if not @client
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
@client.file_create_folder("/#{@username}")
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_file params
|
79
|
+
if not @client
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
filename = params[:fileid]
|
83
|
+
filename += ".json" if not filename.include? ".json"
|
84
|
+
return filename, filename, @client.get_file("/#{@username}/#{filename}")
|
85
|
+
end
|
86
|
+
|
87
|
+
def update_file params
|
88
|
+
if not @client
|
89
|
+
return false
|
90
|
+
end
|
91
|
+
filename = params[:fileid]
|
92
|
+
filename += ".json" if not filename.include? ".json"
|
93
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content], overwrite=true)
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
def remove_file params
|
98
|
+
if not @client
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
filename = params[:fileid]
|
102
|
+
filename += ".json" if not filename.include? ".json"
|
103
|
+
@client.file_delete("/#{@username}/#{filename}")
|
104
|
+
end
|
105
|
+
|
106
|
+
def list_files
|
107
|
+
if not @client
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
data = @client.metadata("/#{@username}/")
|
111
|
+
lines = []
|
112
|
+
data["contents"].each do |line|
|
113
|
+
lines.append([line["path"].split("/")[-1],line["path"].split("/")[-1]]) if line["path"].include? ".json"
|
114
|
+
end
|
115
|
+
return lines
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'cloudstrg/cloudstrg'
|
2
|
+
|
3
|
+
class DropboxStorage < CloudStrg::CloudStorage
|
4
|
+
require 'dropbox_sdk'
|
5
|
+
|
6
|
+
APP_KEY = 'ebwn2abt7mznz56'
|
7
|
+
APP_SECRET = 'g03si51tws05re3'
|
8
|
+
ACCESS_TYPE = :app_folder
|
9
|
+
|
10
|
+
mattr_accessor :session, :client, :user, :redirect_path
|
11
|
+
@session = nil
|
12
|
+
@client = nil
|
13
|
+
@username = nil
|
14
|
+
@redirect_path = nil
|
15
|
+
|
16
|
+
def initialize params
|
17
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
18
|
+
end
|
19
|
+
|
20
|
+
def config params
|
21
|
+
@redirect_path = params[:redirect]
|
22
|
+
@username = params[:username]
|
23
|
+
user = Cloudstrguser.find_by_name(@username)
|
24
|
+
|
25
|
+
session = params[:session]
|
26
|
+
|
27
|
+
if session[:dropbox_rkey] and session[:dropbox_rsecret]
|
28
|
+
begin
|
29
|
+
@session.set_request_token(session[:dropbox_rkey], session[:dropbox_rsecret])
|
30
|
+
@session.get_access_token()
|
31
|
+
user.dropbox_akey = @session.access_token.key
|
32
|
+
user.dropbox_asecret = @session.access_token.secret
|
33
|
+
session[:dropbox_rkey] = nil
|
34
|
+
session[:dropbox_rsecret] = nil
|
35
|
+
user.save()
|
36
|
+
rescue DropboxAuthError
|
37
|
+
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
38
|
+
user.dropbox_akey = nil
|
39
|
+
user.dropbox_asecret = nil
|
40
|
+
session[:dropbox_rkey] = nil
|
41
|
+
session[:dropbox_rsecret] = nil
|
42
|
+
user.save()
|
43
|
+
params[:session] = session
|
44
|
+
return config params
|
45
|
+
end
|
46
|
+
else
|
47
|
+
@session.get_request_token()
|
48
|
+
|
49
|
+
if user.dropbox_akey and user.dropbox_asecret
|
50
|
+
@session.set_access_token(user.dropbox_akey, user.dropbox_asecret)
|
51
|
+
else
|
52
|
+
session[:dropbox_rkey] = @session.request_token.key
|
53
|
+
session[:dropbox_rsecret] = @session.request_token.secret
|
54
|
+
return session, @session.get_authorize_url(callback=@redirect_path)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
@client = DropboxClient.new(@session, ACCESS_TYPE)
|
58
|
+
return session, false
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_file params
|
62
|
+
if not @client
|
63
|
+
return false
|
64
|
+
end
|
65
|
+
filename = params[:filename]
|
66
|
+
filename += ".json" if not filename.include? ".json"
|
67
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content])
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_folder params
|
72
|
+
if not @client
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
@client.file_create_folder("/#{@username}")
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_file params
|
79
|
+
if not @client
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
filename = params[:fileid]
|
83
|
+
filename += ".json" if not filename.include? ".json"
|
84
|
+
return filename, filename, @client.get_file("/#{@username}/#{filename}")
|
85
|
+
end
|
86
|
+
|
87
|
+
def update_file params
|
88
|
+
if not @client
|
89
|
+
return false
|
90
|
+
end
|
91
|
+
filename = params[:fileid]
|
92
|
+
filename += ".json" if not filename.include? ".json"
|
93
|
+
@client.put_file("/#{@username}/#{filename}", params[:file_content], overwrite=true)
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
def remove_file params
|
98
|
+
if not @client
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
filename = params[:fileid]
|
102
|
+
filename += ".json" if not filename.include? ".json"
|
103
|
+
@client.file_delete("/#{@username}/#{filename}")
|
104
|
+
end
|
105
|
+
|
106
|
+
def list_files
|
107
|
+
if not @client
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
data = @client.metadata("/#{@username}/")
|
111
|
+
lines = []
|
112
|
+
data["contents"].each do |line|
|
113
|
+
lines.append([line["path"].split("/")[-1],line["path"].split("/")[-1]]) if line["path"].include? ".json"
|
114
|
+
end
|
115
|
+
return lines
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
data/lib/dropboxstrg.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class CloudstrgGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_model_file
|
13
|
+
template "cloudstrglist.rb", "app/models/cloudstrglist.rb"
|
14
|
+
template "cloudstrguser.rb", "app/models/cloudstrguser.rb"
|
15
|
+
migration_template "create_cloudstrglists.rb", "db/migrate/create_cloudstrglists.rb"
|
16
|
+
migration_template "create_cloudstrgusers.rb", "db/migrate/create_cloudstrguser.rb"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class DropboxstrgGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_model_file
|
13
|
+
migration_template "create_dropboxstrgfields.rb", "db/migrate/create_dropboxstrgfields.rb"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class CloudstrgGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_model_file
|
13
|
+
template "cloudstrglist.rb", "app/models/cloudstrglist.rb"
|
14
|
+
template "cloudstrguser.rb", "app/models/cloudstrguser.rb"
|
15
|
+
migration_template "create_cloudstrglists.rb", "db/migrate/create_cloudstrglists.rb"
|
16
|
+
migration_template "create_cloudstrgusers.rb", "db/migrate/create_cloudstrgusers.rb"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateDropboxstrgfields < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :cloudstrgusers, :dropbox_akey, :string
|
4
|
+
add_column :cloudstrgusers, :dropbox_asecret, :string
|
5
|
+
|
6
|
+
Cloudstrglist.create :plugin_name => "dropbox"
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
remove_column :cloudstrgusers, :dropbox_akey
|
11
|
+
remove_column :cloudstrgusers, :dropbox_asecret
|
12
|
+
|
13
|
+
Cloudstrglist.delete_all :plugin_name => "dropbox"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateDropboxstrgfields < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :cloudstrgusers, :dropbox_akey, :string
|
4
|
+
add_column :cloudstrgusers, :dropbox_asecret, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
remove_column :cloudstrgusers, :dropbox_akey
|
9
|
+
remove_column :cloudstrgusers, :dropbox_asecrets
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateCloudstrgfields < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :cloudstrgusers, :gdrive_refresh_token, :string
|
4
|
+
add_column :cloudstrgusers, :gdrive_expires_in, :integer
|
5
|
+
add_column :cloudstrgusers, :gdrive_issued_at, :date
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
remove_column :cloudstrgusers, :gdrive_refresh_token
|
10
|
+
remove_column :cloudstrgusers, :gdrive_expires_in
|
11
|
+
remove_column :cloudstrgusers, :gdrive_issued_at
|
12
|
+
end
|
13
|
+
end
|