cloudstrg 0.0.3 → 0.0.4
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.
- data/lib/cloudstrg/cloudstrg.rb +22 -1
- data/lib/cloudstrg/cloudstrg.rb~ +22 -1
- data/lib/cloudstrg/version.rb +1 -1
- data/lib/cloudstrg/version.rb~ +1 -1
- data/lib/generators/cloudstrg_generator.rb +4 -2
- data/lib/generators/cloudstrg_generator.rb~ +1 -1
- data/lib/templates/cloudstrgfile.rb +3 -0
- data/lib/templates/cloudstrgfile.rb~ +3 -0
- data/lib/templates/cloudstrglist.rb~ +1 -1
- data/lib/templates/cloudstrgplugin.rb +3 -0
- data/lib/templates/create_cloudstrgfiles.rb +16 -0
- data/lib/templates/create_cloudstrgfiles.rb~ +16 -0
- data/lib/templates/create_cloudstrgplugins.rb +13 -0
- data/test/dummy/app/models/cloudstrgfile.rb +3 -0
- data/test/dummy/app/models/cloudstrgplugin.rb +3 -0
- data/test/dummy/app/models/cloudstrguser.rb +3 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20121010105501567910_create_cloudstrgplugins.rb +13 -0
- data/test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb +13 -0
- data/test/dummy/db/migrate/20121010105501570549_create_cloudstrgfiles.rb +16 -0
- data/test/dummy/db/schema.rb +22 -1
- data/test/dummy/log/development.log +41 -0
- metadata +25 -4
- data/lib/templates/cloudstrglist.rb +0 -3
- /data/lib/templates/{create_cloudstrglists.rb → create_cloudstrgplugins.rb~} +0 -0
data/lib/cloudstrg/cloudstrg.rb
CHANGED
@@ -20,7 +20,7 @@ module CloudStrg
|
|
20
20
|
# This method returns a list of the available storage drivers.
|
21
21
|
#
|
22
22
|
def self.driver_list
|
23
|
-
l =
|
23
|
+
l = Cloudstrgplugin.select('plugin_name')
|
24
24
|
l.sort!
|
25
25
|
return l
|
26
26
|
end
|
@@ -118,5 +118,26 @@ module CloudStrg
|
|
118
118
|
raise NotImplementedError
|
119
119
|
end
|
120
120
|
|
121
|
+
def save_hash(username, filename, filecontent)
|
122
|
+
plugin_name = self.class.to_s.split('Strg')[0].downcase
|
123
|
+
|
124
|
+
if Cloudstrgfile.where(:username => username, :strgdriver => plugin_name, :filename => filename).size > 0
|
125
|
+
Cloudstrgfile.delete_all(:username => username, :strgdriver => plugin_name, :filename => filename)
|
126
|
+
end
|
127
|
+
Cloudstrgfile.create :username => username, :filename => filename, :filehash => filecontent.hash.to_s, :strgdriver => plugin_name
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
def check_hash(username, filename, filecontent)
|
132
|
+
plugin_name = self.class.to_s.split('Strg')[0].downcase
|
133
|
+
|
134
|
+
l = Cloudstrgfile.where(:username => username, :strgdriver => plugin_name, :filename => filename)
|
135
|
+
if l.size != 1
|
136
|
+
return l[0].filehash == filecontent.hash.to_s
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
121
142
|
end
|
122
143
|
end
|
data/lib/cloudstrg/cloudstrg.rb~
CHANGED
@@ -20,7 +20,7 @@ module CloudStrg
|
|
20
20
|
# This method returns a list of the available storage drivers.
|
21
21
|
#
|
22
22
|
def self.driver_list
|
23
|
-
l =
|
23
|
+
l = Cloudstrgplugin.select('plugin_name')
|
24
24
|
l.sort!
|
25
25
|
return l
|
26
26
|
end
|
@@ -118,5 +118,26 @@ module CloudStrg
|
|
118
118
|
raise NotImplementedError
|
119
119
|
end
|
120
120
|
|
121
|
+
def save_hash(username, filename, filecontent)
|
122
|
+
plugin_name = self.class.to_s.split('Strg')[0].downcase
|
123
|
+
|
124
|
+
if Cloudstrgfile.where(:username => username, :strgdriver => plugin_name, :filename => filename).size > 0
|
125
|
+
Cloudstrgfile.delete_all(:username => username, :strgdriver => plugin_name, :filename => filename)
|
126
|
+
end
|
127
|
+
Cloudstrgfile.create :username => username, :filename => filename, :filehash => filecontent.hash.to_s, :strgdriver => plugin_name
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
def check_hash(username, filename, filecontent)
|
132
|
+
plugin_name = self.class.to_s.split('Strg')[0].downcase
|
133
|
+
|
134
|
+
l = Cloudstrgfile.where(:username => username, :strgdriver => plugin_name, :filename => filename)
|
135
|
+
if l.size != 1
|
136
|
+
return l[0].filehash == filecontent.hash.to_s
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
121
142
|
end
|
122
143
|
end
|
data/lib/cloudstrg/version.rb
CHANGED
data/lib/cloudstrg/version.rb~
CHANGED
@@ -10,10 +10,12 @@ class CloudstrgGenerator < Rails::Generators::Base
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_model_file
|
13
|
-
template "
|
13
|
+
template "cloudstrgplugin.rb", "app/models/cloudstrgplugin.rb"
|
14
14
|
template "cloudstrguser.rb", "app/models/cloudstrguser.rb"
|
15
|
-
|
15
|
+
template "cloudstrgfile.rb", "app/models/cloudstrgfile.rb"
|
16
|
+
migration_template "create_cloudstrgplugins.rb", "db/migrate/create_cloudstrgplugins.rb"
|
16
17
|
migration_template "create_cloudstrgusers.rb", "db/migrate/create_cloudstrgusers.rb"
|
18
|
+
migration_template "create_cloudstrgfiles.rb", "db/migrate/create_cloudstrgfiles.rb"
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -13,7 +13,7 @@ class CloudstrgGenerator < Rails::Generators::Base
|
|
13
13
|
template "cloudstrglist.rb", "app/models/cloudstrglist.rb"
|
14
14
|
template "cloudstrguser.rb", "app/models/cloudstrguser.rb"
|
15
15
|
migration_template "create_cloudstrglists.rb", "db/migrate/create_cloudstrglists.rb"
|
16
|
-
migration_template "create_cloudstrgusers.rb", "db/migrate/
|
16
|
+
migration_template "create_cloudstrgusers.rb", "db/migrate/create_cloudstrgusers.rb"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateCloudstrgfiles < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :cloudstrgfiles do |t|
|
4
|
+
t.string :username
|
5
|
+
t.string :strgdriver
|
6
|
+
t.string :filename
|
7
|
+
t.string :filehash
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :cloudstrgfiles
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateCloudstrgfiles < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :cloudstrgfiles do |t|
|
4
|
+
t.string :username
|
5
|
+
t.fixnum :strgdriver
|
6
|
+
t.string :filename
|
7
|
+
t.string :filehash
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :cloudstrgfiles
|
15
|
+
end
|
16
|
+
end
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateCloudstrgfiles < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :cloudstrgfiles do |t|
|
4
|
+
t.string :username
|
5
|
+
t.string :strgdriver
|
6
|
+
t.string :filename
|
7
|
+
t.string :filehash
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :cloudstrgfiles
|
15
|
+
end
|
16
|
+
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,16 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20121010105501570549) do
|
15
|
+
|
16
|
+
create_table "cloudstrgfiles", :force => true do |t|
|
17
|
+
t.string "username"
|
18
|
+
t.string "strgdriver"
|
19
|
+
t.string "filename"
|
20
|
+
t.string "filehash"
|
21
|
+
t.datetime "created_at", :null => false
|
22
|
+
t.datetime "updated_at", :null => false
|
23
|
+
end
|
15
24
|
|
16
25
|
create_table "cloudstrglist", :force => true do |t|
|
17
26
|
t.string "plugin_name"
|
@@ -25,4 +34,16 @@ ActiveRecord::Schema.define(:version => 20120928111625) do
|
|
25
34
|
t.datetime "updated_at", :null => false
|
26
35
|
end
|
27
36
|
|
37
|
+
create_table "cloudstrgplugins", :force => true do |t|
|
38
|
+
t.string "plugin_name"
|
39
|
+
t.datetime "created_at", :null => false
|
40
|
+
t.datetime "updated_at", :null => false
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table "cloudstrgusers", :force => true do |t|
|
44
|
+
t.string "username"
|
45
|
+
t.datetime "created_at", :null => false
|
46
|
+
t.datetime "updated_at", :null => false
|
47
|
+
end
|
48
|
+
|
28
49
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Connecting to database specified by database.yml
|
2
|
+
Connecting to database specified by database.yml
|
3
|
+
[1m[36m (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
4
|
+
[1m[35m (168.3ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
5
|
+
[1m[36m (0.2ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
6
|
+
[1m[35m (110.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
7
|
+
[1m[36m (0.3ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
8
|
+
Migrating to CreateCloudstrglist (20120928105006)
|
9
|
+
[1m[35m (0.1ms)[0m begin transaction
|
10
|
+
[1m[36m (0.8ms)[0m [1mCREATE TABLE "cloudstrglist" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
11
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20120928105006')
|
12
|
+
[1m[36m (132.5ms)[0m [1mcommit transaction[0m
|
13
|
+
Migrating to CreateCloudstrglists (20120928111625)
|
14
|
+
[1m[35m (0.1ms)[0m begin transaction
|
15
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "cloudstrglists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
16
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20120928111625')
|
17
|
+
[1m[36m (101.7ms)[0m [1mcommit transaction[0m
|
18
|
+
Migrating to CreateCloudstrgplugins (20121010105501567910)
|
19
|
+
[1m[35m (0.2ms)[0m begin transaction
|
20
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "cloudstrgplugins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
21
|
+
[1m[35m (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501567910')
|
22
|
+
[1m[36m (214.0ms)[0m [1mcommit transaction[0m
|
23
|
+
Migrating to CreateCloudstrgusers (20121010105501569078)
|
24
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "cloudstrgusers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
26
|
+
[1m[35m (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501569078')
|
27
|
+
[1m[36m (122.9ms)[0m [1mcommit transaction[0m
|
28
|
+
Migrating to CreateCloudstrgfiles (20121010105501570549)
|
29
|
+
[1m[35m (0.1ms)[0m begin transaction
|
30
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "cloudstrgfiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "strgdriver" varchar(255), "filename" varchar(255), "filehash" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
31
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501570549')
|
32
|
+
[1m[36m (87.2ms)[0m [1mcommit transaction[0m
|
33
|
+
[1m[35m (0.9ms)[0m select sqlite_version(*)
|
34
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
35
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("cloudstrgfiles")
|
36
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("cloudstrglist")[0m
|
37
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("cloudstrglists")
|
38
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("cloudstrgplugins")[0m
|
39
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("cloudstrgusers")
|
40
|
+
Connecting to database specified by database.yml
|
41
|
+
Connecting to database specified by database.yml
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstrg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -58,14 +58,19 @@ files:
|
|
58
58
|
- lib/generators/cloudstrg_generator.rb
|
59
59
|
- lib/generators/cloudstrg_generator.rb~
|
60
60
|
- lib/templates/create_cloudstrgdata.rb~
|
61
|
+
- lib/templates/cloudstrgplugin.rb
|
62
|
+
- lib/templates/create_cloudstrgfiles.rb
|
61
63
|
- lib/templates/cloudstrguser.rb~
|
64
|
+
- lib/templates/cloudstrgfile.rb
|
62
65
|
- lib/templates/create_cloudstrgusers.rb~
|
66
|
+
- lib/templates/create_cloudstrgfiles.rb~
|
67
|
+
- lib/templates/create_cloudstrgplugins.rb
|
63
68
|
- lib/templates/cloudstrguser.rb
|
64
69
|
- lib/templates/cloudstrglist.rb~
|
70
|
+
- lib/templates/create_cloudstrgplugins.rb~
|
65
71
|
- lib/templates/cloudstrgdata.rb~
|
66
|
-
- lib/templates/cloudstrglist.rb
|
67
72
|
- lib/templates/create_cloudstrglist.rb~
|
68
|
-
- lib/templates/
|
73
|
+
- lib/templates/cloudstrgfile.rb~
|
69
74
|
- lib/templates/create_cloudstrgusers.rb
|
70
75
|
- lib/cloudstrg.rb
|
71
76
|
- MIT-LICENSE
|
@@ -75,6 +80,9 @@ files:
|
|
75
80
|
- test/dummy/script/rails
|
76
81
|
- test/dummy/config.ru
|
77
82
|
- test/dummy/app/helpers/application_helper.rb
|
83
|
+
- test/dummy/app/models/cloudstrgplugin.rb
|
84
|
+
- test/dummy/app/models/cloudstrgfile.rb
|
85
|
+
- test/dummy/app/models/cloudstrguser.rb
|
78
86
|
- test/dummy/app/models/cloudstrglist.rb~
|
79
87
|
- test/dummy/app/models/cloudstrglist.rb
|
80
88
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -87,7 +95,11 @@ files:
|
|
87
95
|
- test/dummy/public/favicon.ico
|
88
96
|
- test/dummy/db/schema.rb
|
89
97
|
- test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb
|
98
|
+
- test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb
|
90
99
|
- test/dummy/db/migrate/20120928105006_create_cloudstrglist.rb
|
100
|
+
- test/dummy/db/migrate/20121010105501570549_create_cloudstrgfiles.rb
|
101
|
+
- test/dummy/db/migrate/20121010105501567910_create_cloudstrgplugins.rb
|
102
|
+
- test/dummy/db/development.sqlite3
|
91
103
|
- test/dummy/config/boot.rb
|
92
104
|
- test/dummy/config/routes.rb
|
93
105
|
- test/dummy/config/database.yml
|
@@ -104,6 +116,7 @@ files:
|
|
104
116
|
- test/dummy/config/environments/production.rb
|
105
117
|
- test/dummy/config/environments/test.rb
|
106
118
|
- test/dummy/Rakefile
|
119
|
+
- test/dummy/log/development.log
|
107
120
|
- test/dummy/README.rdoc
|
108
121
|
- test/cloudstrg_test.rb
|
109
122
|
homepage: http://git.libresoft.es/cloudstrg/
|
@@ -135,6 +148,9 @@ test_files:
|
|
135
148
|
- test/dummy/script/rails
|
136
149
|
- test/dummy/config.ru
|
137
150
|
- test/dummy/app/helpers/application_helper.rb
|
151
|
+
- test/dummy/app/models/cloudstrgplugin.rb
|
152
|
+
- test/dummy/app/models/cloudstrgfile.rb
|
153
|
+
- test/dummy/app/models/cloudstrguser.rb
|
138
154
|
- test/dummy/app/models/cloudstrglist.rb~
|
139
155
|
- test/dummy/app/models/cloudstrglist.rb
|
140
156
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -147,7 +163,11 @@ test_files:
|
|
147
163
|
- test/dummy/public/favicon.ico
|
148
164
|
- test/dummy/db/schema.rb
|
149
165
|
- test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb
|
166
|
+
- test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb
|
150
167
|
- test/dummy/db/migrate/20120928105006_create_cloudstrglist.rb
|
168
|
+
- test/dummy/db/migrate/20121010105501570549_create_cloudstrgfiles.rb
|
169
|
+
- test/dummy/db/migrate/20121010105501567910_create_cloudstrgplugins.rb
|
170
|
+
- test/dummy/db/development.sqlite3
|
151
171
|
- test/dummy/config/boot.rb
|
152
172
|
- test/dummy/config/routes.rb
|
153
173
|
- test/dummy/config/database.yml
|
@@ -164,5 +184,6 @@ test_files:
|
|
164
184
|
- test/dummy/config/environments/production.rb
|
165
185
|
- test/dummy/config/environments/test.rb
|
166
186
|
- test/dummy/Rakefile
|
187
|
+
- test/dummy/log/development.log
|
167
188
|
- test/dummy/README.rdoc
|
168
189
|
- test/cloudstrg_test.rb
|
File without changes
|