cloudstrg 0.0.1

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.
Files changed (56) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/lib/cloudstrg/cloudstrg.rb +122 -0
  5. data/lib/cloudstrg/cloudstrg.rb~ +122 -0
  6. data/lib/cloudstrg/version.rb +3 -0
  7. data/lib/cloudstrg.rb +2 -0
  8. data/lib/generators/cloudstrg_generator.rb +19 -0
  9. data/lib/generators/cloudstrg_generator.rb~ +19 -0
  10. data/lib/tasks/cloudstrg_tasks.rake +4 -0
  11. data/lib/templates/cloudstrgdata.rb~ +3 -0
  12. data/lib/templates/cloudstrglist.rb +3 -0
  13. data/lib/templates/cloudstrglist.rb~ +3 -0
  14. data/lib/templates/cloudstrguser.rb +3 -0
  15. data/lib/templates/cloudstrguser.rb~ +0 -0
  16. data/lib/templates/create_cloudstrgdata.rb~ +0 -0
  17. data/lib/templates/create_cloudstrglist.rb~ +13 -0
  18. data/lib/templates/create_cloudstrglists.rb +13 -0
  19. data/lib/templates/create_cloudstrgusers.rb +13 -0
  20. data/lib/templates/create_cloudstrgusers.rb~ +0 -0
  21. data/test/cloudstrg_test.rb +7 -0
  22. data/test/dummy/README.rdoc +261 -0
  23. data/test/dummy/Rakefile +7 -0
  24. data/test/dummy/app/assets/javascripts/application.js +15 -0
  25. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/test/dummy/app/controllers/application_controller.rb +3 -0
  27. data/test/dummy/app/helpers/application_helper.rb +2 -0
  28. data/test/dummy/app/models/cloudstrglist.rb +3 -0
  29. data/test/dummy/app/models/cloudstrglist.rb~ +3 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/test/dummy/config/application.rb +59 -0
  32. data/test/dummy/config/boot.rb +10 -0
  33. data/test/dummy/config/database.yml +25 -0
  34. data/test/dummy/config/environment.rb +5 -0
  35. data/test/dummy/config/environments/development.rb +37 -0
  36. data/test/dummy/config/environments/production.rb +67 -0
  37. data/test/dummy/config/environments/test.rb +37 -0
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/test/dummy/config/initializers/inflections.rb +15 -0
  40. data/test/dummy/config/initializers/mime_types.rb +5 -0
  41. data/test/dummy/config/initializers/secret_token.rb +7 -0
  42. data/test/dummy/config/initializers/session_store.rb +8 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +5 -0
  45. data/test/dummy/config/routes.rb +58 -0
  46. data/test/dummy/config.ru +4 -0
  47. data/test/dummy/db/migrate/20120928105006_create_cloudstrglist.rb +13 -0
  48. data/test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb +13 -0
  49. data/test/dummy/db/schema.rb +28 -0
  50. data/test/dummy/public/404.html +26 -0
  51. data/test/dummy/public/422.html +26 -0
  52. data/test/dummy/public/500.html +25 -0
  53. data/test/dummy/public/favicon.ico +0 -0
  54. data/test/dummy/script/rails +6 -0
  55. data/test/test_helper.rb +15 -0
  56. metadata +167 -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
@@ -0,0 +1,3 @@
1
+ = Cloudstrg
2
+
3
+ This project rocks and uses MIT-LICENSE.
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 = 'Cloudstrg'
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,122 @@
1
+ module CloudStrg
2
+
3
+ ##
4
+ # This method returns an instance of an specified driver
5
+ #
6
+ # Params: the "params" variable must contain the following fields
7
+ # type: the name of the selected driver.
8
+ #
9
+ # Returns:
10
+ # An instance of the specified driver.
11
+ #
12
+ def self.new_driver params
13
+ type = params[:type]
14
+ require "#{type}strg/#{type}strg"
15
+ return Kernel.const_get("#{type.capitalize}Strg").new(params)
16
+ end
17
+
18
+
19
+ ##
20
+ # This method returns a list of the available storage drivers.
21
+ #
22
+ def self.driver_list
23
+ l = Cloudstrglist.find(:all)
24
+ l.sort!
25
+ return l
26
+ end
27
+
28
+ ###
29
+ # This class must be inherited by every single driver definition in order to preserve
30
+ # the coherence between them.
31
+ #
32
+ class CloudStorage
33
+
34
+ ###
35
+ # This method performs the previous configuration that the current driver needs to work.
36
+ #
37
+ # Params: the "params" variable must contain the following fields
38
+ # redirect: the name of the selected driver,
39
+ # username: the name of the selected driver,
40
+ # session: the name of the selected driver.
41
+ #
42
+ # Returns:
43
+ # This method returns two parameters:
44
+ # session: the session variable with the new parameters added,
45
+ # uri: the uri where the user will allow the application to use the desired service,
46
+ # or false if the configuration was completed successfully.
47
+ #
48
+ def config params
49
+ raise NotImplementedError
50
+ end
51
+
52
+ ###
53
+ # This method performs the creation of a file.
54
+ #
55
+ # Params: the "params" variable must contain the following fields
56
+ # filename: the name of the file to create,
57
+ # file_content: the content of the file.
58
+ #
59
+ # Returns:
60
+ # This method returns true if the operation success, otherwise it returns false.
61
+ #
62
+ def create_file params
63
+ raise NotImplementedError
64
+ end
65
+
66
+ #def create_folder params
67
+ # raise NotImplementedError
68
+ #end
69
+
70
+ ###
71
+ # This method performs the request to obtain a desired file content
72
+ #
73
+ # Params: the "params" variable must contain the following fields
74
+ # fileid: the id of the selected file.
75
+ #
76
+ # Returns:
77
+ # This method returns three parameters:
78
+ # filename: the name of the file,
79
+ # fileid: the id of the file,
80
+ # file_content: the content of the file.
81
+ #
82
+ def get_file params
83
+ raise NotImplementedError
84
+ end
85
+
86
+ ###
87
+ # This method performs the update of a file.
88
+ #
89
+ # Params: the "params" variable must contain the following fields
90
+ # filename: the name of the file to edit,
91
+ # fileid: the id of the file,
92
+ # file_content: the content of the file.
93
+ #
94
+ # Returns:
95
+ # This method returns true if the operation success, otherwise it returns false.
96
+ #
97
+ def update_file params
98
+ raise NotImplementedError
99
+ end
100
+
101
+ ###
102
+ # This method performs the remove of a file.
103
+ #
104
+ # Params: the "params" variable must contain the following fields
105
+ # fileid: the id of the file.
106
+ #
107
+ def remove_file params
108
+ raise NotImplementedError
109
+ end
110
+
111
+ ###
112
+ # This method returns a list of the available files created by the application.
113
+ #
114
+ # Returns:
115
+ # This method returns a list of tuples, containing: [[filename, fileid], ...]
116
+ #
117
+ def list_files
118
+ raise NotImplementedError
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,122 @@
1
+ module CloudStrg
2
+
3
+ ##
4
+ # This method returns an instance of an specified driver
5
+ #
6
+ # Params: the "params" variable must contain the following fields
7
+ # type: the name of the selected driver.
8
+ #
9
+ # Returns:
10
+ # An instance of the specified driver.
11
+ #
12
+ def self.new_driver params
13
+ type = params[:type]
14
+ require "#{type}strg"
15
+ return Kernel.const_get("#{type.capitalize}Strg").new(params)
16
+ end
17
+
18
+
19
+ ##
20
+ # This method returns a list of the available storage drivers.
21
+ #
22
+ def self.driver_list
23
+ l = Cloudstrglist.find(:all)
24
+ l.sort!
25
+ return l
26
+ end
27
+
28
+ ###
29
+ # This class must be inherited by every single driver definition in order to preserve
30
+ # the coherence between them.
31
+ #
32
+ class CloudStorage
33
+
34
+ ###
35
+ # This method performs the previous configuration that the current driver needs to work.
36
+ #
37
+ # Params: the "params" variable must contain the following fields
38
+ # redirect: the name of the selected driver,
39
+ # username: the name of the selected driver,
40
+ # session: the name of the selected driver.
41
+ #
42
+ # Returns:
43
+ # This method returns two parameters:
44
+ # session: the session variable with the new parameters added,
45
+ # uri: the uri where the user will allow the application to use the desired service,
46
+ # or false if the configuration was completed successfully.
47
+ #
48
+ def config params
49
+ raise NotImplementedError
50
+ end
51
+
52
+ ###
53
+ # This method performs the creation of a file.
54
+ #
55
+ # Params: the "params" variable must contain the following fields
56
+ # filename: the name of the file to create,
57
+ # file_content: the content of the file.
58
+ #
59
+ # Returns:
60
+ # This method returns true if the operation success, otherwise it returns false.
61
+ #
62
+ def create_file params
63
+ raise NotImplementedError
64
+ end
65
+
66
+ #def create_folder params
67
+ # raise NotImplementedError
68
+ #end
69
+
70
+ ###
71
+ # This method performs the request to obtain a desired file content
72
+ #
73
+ # Params: the "params" variable must contain the following fields
74
+ # fileid: the id of the selected file.
75
+ #
76
+ # Returns:
77
+ # This method returns three parameters:
78
+ # filename: the name of the file,
79
+ # fileid: the id of the file,
80
+ # file_content: the content of the file.
81
+ #
82
+ def get_file params
83
+ raise NotImplementedError
84
+ end
85
+
86
+ ###
87
+ # This method performs the update of a file.
88
+ #
89
+ # Params: the "params" variable must contain the following fields
90
+ # filename: the name of the file to edit,
91
+ # fileid: the id of the file,
92
+ # file_content: the content of the file.
93
+ #
94
+ # Returns:
95
+ # This method returns true if the operation success, otherwise it returns false.
96
+ #
97
+ def update_file params
98
+ raise NotImplementedError
99
+ end
100
+
101
+ ###
102
+ # This method performs the remove of a file.
103
+ #
104
+ # Params: the "params" variable must contain the following fields
105
+ # fileid: the id of the file.
106
+ #
107
+ def remove_file params
108
+ raise NotImplementedError
109
+ end
110
+
111
+ ###
112
+ # This method returns a list of the available files created by the application.
113
+ #
114
+ # Returns:
115
+ # This method returns a list of tuples, containing: [[filename, fileid], ...]
116
+ #
117
+ def list_files
118
+ raise NotImplementedError
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,3 @@
1
+ module Cloudstrg
2
+ VERSION = "0.0.1"
3
+ end
data/lib/cloudstrg.rb ADDED
@@ -0,0 +1,2 @@
1
+ module Cloudstrg
2
+ end
@@ -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
+
@@ -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,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :cloudstrg do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,3 @@
1
+ class Person < ActiveRecord::Base
2
+ attr_accessible :name
3
+ end
@@ -0,0 +1,3 @@
1
+ class Cloudstrglist < ActiveRecord::Base
2
+ attr_accessible :plugin_name
3
+ end
@@ -0,0 +1,3 @@
1
+ class CloudstrgList < ActiveRecord::Base
2
+ attr_accessible :plugin_name
3
+ end
@@ -0,0 +1,3 @@
1
+ class Cloudstrguser < ActiveRecord::Base
2
+ attr_accessible :userid
3
+ end
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ class CreateCloudstrglists < ActiveRecord::Migration
2
+ def up
3
+ create_table :cloudstrglists do |t|
4
+ t.string :plugin_name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def down
11
+ drop_table :cloudstrglist
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCloudstrglists < ActiveRecord::Migration
2
+ def up
3
+ create_table :cloudstrglists do |t|
4
+ t.string :plugin_name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def down
11
+ drop_table :cloudstrglists
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCloudstrgusers < ActiveRecord::Migration
2
+ def up
3
+ create_table :cloudstrgusers do |t|
4
+ t.string :username
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def down
11
+ drop_table :cloudstrgusers
12
+ end
13
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class CloudstrgTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Cloudstrg
6
+ end
7
+ end