cloudstrg 0.0.4 → 0.0.5

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 (63) hide show
  1. data/Rakefile +2 -0
  2. data/app/assets/javascripts/cloudstrg/application.js +15 -0
  3. data/app/assets/javascripts/cloudstrg/cloudstrgplugins.js +2 -0
  4. data/app/assets/stylesheets/cloudstrg/application.css +13 -0
  5. data/app/assets/stylesheets/cloudstrg/cloudstrgplugins.css +4 -0
  6. data/app/assets/stylesheets/scaffold.css +56 -0
  7. data/app/controllers/cloudstrg/application_controller.rb +4 -0
  8. data/app/controllers/cloudstrg/cloudstrgplugins_controller.rb +87 -0
  9. data/app/helpers/cloudstrg/application_helper.rb +4 -0
  10. data/app/helpers/cloudstrg/cloudstrgplugins_helper.rb +4 -0
  11. data/app/models/cloudstrg/cloudstrgplugin.rb +5 -0
  12. data/app/views/cloudstrg/cloudstrgplugins/_form.html.erb +25 -0
  13. data/app/views/cloudstrg/cloudstrgplugins/edit.html.erb +6 -0
  14. data/app/views/cloudstrg/cloudstrgplugins/index.html.erb +25 -0
  15. data/app/views/cloudstrg/cloudstrgplugins/new.html.erb +5 -0
  16. data/app/views/cloudstrg/cloudstrgplugins/show.html.erb +15 -0
  17. data/app/views/layouts/cloudstrg/application.html.erb +14 -0
  18. data/config/routes.rb +4 -0
  19. data/db/migrate/20121105173015_create_cloudstrg_cloudstrgplugins.rb +10 -0
  20. data/lib/cloudstrg/cloudstrg.rb +1 -1
  21. data/lib/cloudstrg/engine.rb +5 -0
  22. data/lib/cloudstrg/version.rb +1 -1
  23. data/lib/cloudstrg/version.rb~ +1 -1
  24. data/lib/cloudstrg.rb +2 -0
  25. data/test/dummy/config/initializers/secret_token.rb +1 -1
  26. data/test/dummy/config/routes.rb +2 -56
  27. data/test/dummy/log/development.log +0 -38
  28. data/test/fixtures/cloudstrg/cloudstrgplugins.yml +9 -0
  29. data/test/functional/cloudstrg/cloudstrgplugins_controller_test.rb +51 -0
  30. data/test/integration/navigation_test.rb +10 -0
  31. data/test/unit/cloudstrg/cloudstrgplugin_test.rb +9 -0
  32. data/test/unit/helpers/cloudstrg/cloudstrgplugins_helper_test.rb +6 -0
  33. metadata +31 -44
  34. data/lib/cloudstrg/cloudstrg.rb~ +0 -143
  35. data/lib/generators/cloudstrg_generator.rb +0 -21
  36. data/lib/generators/cloudstrg_generator.rb~ +0 -19
  37. data/lib/templates/cloudstrgdata.rb~ +0 -3
  38. data/lib/templates/cloudstrgfile.rb +0 -3
  39. data/lib/templates/cloudstrgfile.rb~ +0 -3
  40. data/lib/templates/cloudstrglist.rb~ +0 -3
  41. data/lib/templates/cloudstrgplugin.rb +0 -3
  42. data/lib/templates/cloudstrguser.rb +0 -3
  43. data/lib/templates/cloudstrguser.rb~ +0 -0
  44. data/lib/templates/create_cloudstrgdata.rb~ +0 -0
  45. data/lib/templates/create_cloudstrgfiles.rb +0 -16
  46. data/lib/templates/create_cloudstrgfiles.rb~ +0 -16
  47. data/lib/templates/create_cloudstrglist.rb~ +0 -13
  48. data/lib/templates/create_cloudstrgplugins.rb +0 -13
  49. data/lib/templates/create_cloudstrgplugins.rb~ +0 -13
  50. data/lib/templates/create_cloudstrgusers.rb +0 -13
  51. data/lib/templates/create_cloudstrgusers.rb~ +0 -0
  52. data/test/dummy/app/models/cloudstrgfile.rb +0 -3
  53. data/test/dummy/app/models/cloudstrglist.rb +0 -3
  54. data/test/dummy/app/models/cloudstrglist.rb~ +0 -3
  55. data/test/dummy/app/models/cloudstrgplugin.rb +0 -3
  56. data/test/dummy/app/models/cloudstrguser.rb +0 -3
  57. data/test/dummy/db/development.sqlite3 +0 -0
  58. data/test/dummy/db/migrate/20120928105006_create_cloudstrglist.rb +0 -13
  59. data/test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb +0 -13
  60. data/test/dummy/db/migrate/20121010105501567910_create_cloudstrgplugins.rb +0 -13
  61. data/test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb +0 -13
  62. data/test/dummy/db/migrate/20121010105501570549_create_cloudstrgfiles.rb +0 -16
  63. data/test/dummy/db/schema.rb +0 -49
data/Rakefile CHANGED
@@ -20,6 +20,8 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
23
25
 
24
26
 
25
27
 
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ module Cloudstrg
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,87 @@
1
+ require_dependency "cloudstrg/application_controller"
2
+
3
+ module Cloudstrg
4
+ class CloudstrgpluginsController < ApplicationController
5
+ # GET /cloudstrgplugins
6
+ # GET /cloudstrgplugins.json
7
+ def index
8
+ @cloudstrgplugins = Cloudstrgplugin.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @cloudstrgplugins }
13
+ end
14
+ end
15
+
16
+ # GET /cloudstrgplugins/1
17
+ # GET /cloudstrgplugins/1.json
18
+ def show
19
+ @cloudstrgplugin = Cloudstrgplugin.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @cloudstrgplugin }
24
+ end
25
+ end
26
+
27
+ # GET /cloudstrgplugins/new
28
+ # GET /cloudstrgplugins/new.json
29
+ def new
30
+ @cloudstrgplugin = Cloudstrgplugin.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @cloudstrgplugin }
35
+ end
36
+ end
37
+
38
+ # GET /cloudstrgplugins/1/edit
39
+ def edit
40
+ @cloudstrgplugin = Cloudstrgplugin.find(params[:id])
41
+ end
42
+
43
+ # POST /cloudstrgplugins
44
+ # POST /cloudstrgplugins.json
45
+ def create
46
+ @cloudstrgplugin = Cloudstrgplugin.new(params[:cloudstrgplugin])
47
+
48
+ respond_to do |format|
49
+ if @cloudstrgplugin.save
50
+ format.html { redirect_to @cloudstrgplugin, notice: 'Cloudstrgplugin was successfully created.' }
51
+ format.json { render json: @cloudstrgplugin, status: :created, location: @cloudstrgplugin }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @cloudstrgplugin.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /cloudstrgplugins/1
60
+ # PUT /cloudstrgplugins/1.json
61
+ def update
62
+ @cloudstrgplugin = Cloudstrgplugin.find(params[:id])
63
+
64
+ respond_to do |format|
65
+ if @cloudstrgplugin.update_attributes(params[:cloudstrgplugin])
66
+ format.html { redirect_to @cloudstrgplugin, notice: 'Cloudstrgplugin was successfully updated.' }
67
+ format.json { head :no_content }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @cloudstrgplugin.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /cloudstrgplugins/1
76
+ # DELETE /cloudstrgplugins/1.json
77
+ def destroy
78
+ @cloudstrgplugin = Cloudstrgplugin.find(params[:id])
79
+ @cloudstrgplugin.destroy
80
+
81
+ respond_to do |format|
82
+ format.html { redirect_to cloudstrgplugins_url }
83
+ format.json { head :no_content }
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,4 @@
1
+ module Cloudstrg
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Cloudstrg
2
+ module CloudstrgpluginsHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Cloudstrg
2
+ class Cloudstrgplugin < ActiveRecord::Base
3
+ attr_accessible :plugin_name, :version
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ <%= form_for(@cloudstrgplugin) do |f| %>
2
+ <% if @cloudstrgplugin.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@cloudstrgplugin.errors.count, "error") %> prohibited this cloudstrgplugin from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @cloudstrgplugin.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :plugin_name %><br />
16
+ <%= f.text_field :plugin_name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :version %><br />
20
+ <%= f.text_field :version %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing cloudstrgplugin</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @cloudstrgplugin %> |
6
+ <%= link_to 'Back', cloudstrgplugins_path %>
@@ -0,0 +1,25 @@
1
+ <h1>Listing cloudstrgplugins</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Plugin name</th>
6
+ <th>Version</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @cloudstrgplugins.each do |cloudstrgplugin| %>
13
+ <tr>
14
+ <td><%= cloudstrgplugin.plugin_name %></td>
15
+ <td><%= cloudstrgplugin.version %></td>
16
+ <td><%= link_to 'Show', cloudstrgplugin %></td>
17
+ <td><%= link_to 'Edit', edit_cloudstrgplugin_path(cloudstrgplugin) %></td>
18
+ <td><%= link_to 'Destroy', cloudstrgplugin, method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New Cloudstrgplugin', new_cloudstrgplugin_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New cloudstrgplugin</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', cloudstrgplugins_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Plugin name:</b>
5
+ <%= @cloudstrgplugin.plugin_name %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Version:</b>
10
+ <%= @cloudstrgplugin.version %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_cloudstrgplugin_path(@cloudstrgplugin) %> |
15
+ <%= link_to 'Back', cloudstrgplugins_path %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Cloudstrg</title>
5
+ <%= stylesheet_link_tag "cloudstrg/application", :media => "all" %>
6
+ <%= javascript_include_tag "cloudstrg/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Cloudstrg::Engine.routes.draw do
2
+ resources :cloudstrgplugins
3
+
4
+ end
@@ -0,0 +1,10 @@
1
+ class CreateCloudstrgCloudstrgplugins < ActiveRecord::Migration
2
+ def change
3
+ create_table :cloudstrg_cloudstrgplugins do |t|
4
+ t.string :plugin_name
5
+ t.string :version
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -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 = Cloudstrgplugin.select('plugin_name')
23
+ l = Cloudstrg::Cloudstrgplugin.select('plugin_name')
24
24
  l.sort!
25
25
  return l
26
26
  end
@@ -0,0 +1,5 @@
1
+ module Cloudstrg
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Cloudstrg
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Cloudstrg
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Cloudstrg
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/cloudstrg.rb CHANGED
@@ -1,2 +1,4 @@
1
+ require "cloudstrg/engine"
2
+
1
3
  module Cloudstrg
2
4
  end
@@ -4,4 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '22ca413ef53ef41aedbae9ca241e6f8e744818906f780c1f8d5c0e294ae3aa9e003f1ad0da14756088051178d6ab18020a1d032caedc187811637634c5150727'
7
+ Dummy::Application.config.secret_token = '682d87e5814a8139584a8d63b2b49ee5f1eab557af58accaf1d5568364109e0a9bd6895d1c639691341ca83a96ef90615b54a0ed621525ee352fbba14d5b9a5b'
@@ -1,58 +1,4 @@
1
- Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
1
+ Rails.application.routes.draw do
4
2
 
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get 'short'
20
- # post 'toggle'
21
- # end
22
- #
23
- # collection do
24
- # get 'sold'
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get 'recent', :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => 'welcome#index'
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id))(.:format)'
3
+ mount Cloudstrg::Engine => "/cloudstrg"
58
4
  end
@@ -1,41 +1,3 @@
1
1
  Connecting to database specified by database.yml
2
- Connecting to database specified by database.yml
3
-  (0.2ms) select sqlite_version(*)
4
-  (168.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
5
-  (0.2ms) PRAGMA index_list("schema_migrations")
6
-  (110.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
7
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
8
- Migrating to CreateCloudstrglist (20120928105006)
9
-  (0.1ms) begin transaction
10
-  (0.8ms) CREATE TABLE "cloudstrglist" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
11
-  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120928105006')
12
-  (132.5ms) commit transaction
13
- Migrating to CreateCloudstrglists (20120928111625)
14
-  (0.1ms) begin transaction
15
-  (0.6ms) CREATE TABLE "cloudstrglists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
16
-  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120928111625')
17
-  (101.7ms) commit transaction
18
- Migrating to CreateCloudstrgplugins (20121010105501567910)
19
-  (0.2ms) begin transaction
20
-  (0.9ms) CREATE TABLE "cloudstrgplugins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "plugin_name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
21
-  (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501567910')
22
-  (214.0ms) commit transaction
23
- Migrating to CreateCloudstrgusers (20121010105501569078)
24
-  (0.1ms) begin transaction
25
-  (0.9ms) CREATE TABLE "cloudstrgusers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
26
-  (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501569078')
27
-  (122.9ms) commit transaction
28
- Migrating to CreateCloudstrgfiles (20121010105501570549)
29
-  (0.1ms) begin transaction
30
-  (0.7ms) CREATE 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) 
31
-  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20121010105501570549')
32
-  (87.2ms) commit transaction
33
-  (0.9ms) select sqlite_version(*)
34
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
35
-  (0.1ms) PRAGMA index_list("cloudstrgfiles")
36
-  (0.1ms) PRAGMA index_list("cloudstrglist")
37
-  (0.1ms) PRAGMA index_list("cloudstrglists")
38
-  (0.1ms) PRAGMA index_list("cloudstrgplugins")
39
-  (0.1ms) PRAGMA index_list("cloudstrgusers")
40
2
  Connecting to database specified by database.yml
41
3
  Connecting to database specified by database.yml
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ plugin_name: MyString
5
+ version: MyString
6
+
7
+ two:
8
+ plugin_name: MyString
9
+ version: MyString
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Cloudstrg
4
+ class CloudstrgpluginsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @cloudstrgplugin = cloudstrgplugins(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:cloudstrgplugins)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create cloudstrgplugin" do
21
+ assert_difference('Cloudstrgplugin.count') do
22
+ post :create, cloudstrgplugin: { plugin_name: @cloudstrgplugin.plugin_name, version: @cloudstrgplugin.version }
23
+ end
24
+
25
+ assert_redirected_to cloudstrgplugin_path(assigns(:cloudstrgplugin))
26
+ end
27
+
28
+ test "should show cloudstrgplugin" do
29
+ get :show, id: @cloudstrgplugin
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @cloudstrgplugin
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update cloudstrgplugin" do
39
+ put :update, id: @cloudstrgplugin, cloudstrgplugin: { plugin_name: @cloudstrgplugin.plugin_name, version: @cloudstrgplugin.version }
40
+ assert_redirected_to cloudstrgplugin_path(assigns(:cloudstrgplugin))
41
+ end
42
+
43
+ test "should destroy cloudstrgplugin" do
44
+ assert_difference('Cloudstrgplugin.count', -1) do
45
+ delete :destroy, id: @cloudstrgplugin
46
+ end
47
+
48
+ assert_redirected_to cloudstrgplugins_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Cloudstrg
4
+ class CloudstrgpluginTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module Cloudstrg
4
+ class CloudstrgpluginsHelperTest < ActionView::TestCase
5
+ end
6
+ end
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
4
+ version: 0.0.5
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-10 00:00:00.000000000 Z
12
+ date: 2012-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -50,41 +50,42 @@ executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
+ - app/helpers/cloudstrg/cloudstrgplugins_helper.rb
54
+ - app/helpers/cloudstrg/application_helper.rb
55
+ - app/models/cloudstrg/cloudstrgplugin.rb
56
+ - app/assets/stylesheets/cloudstrg/cloudstrgplugins.css
57
+ - app/assets/stylesheets/cloudstrg/application.css
58
+ - app/assets/stylesheets/scaffold.css
59
+ - app/assets/javascripts/cloudstrg/cloudstrgplugins.js
60
+ - app/assets/javascripts/cloudstrg/application.js
61
+ - app/views/cloudstrg/cloudstrgplugins/new.html.erb
62
+ - app/views/cloudstrg/cloudstrgplugins/show.html.erb
63
+ - app/views/cloudstrg/cloudstrgplugins/edit.html.erb
64
+ - app/views/cloudstrg/cloudstrgplugins/_form.html.erb
65
+ - app/views/cloudstrg/cloudstrgplugins/index.html.erb
66
+ - app/views/layouts/cloudstrg/application.html.erb
67
+ - app/controllers/cloudstrg/cloudstrgplugins_controller.rb
68
+ - app/controllers/cloudstrg/application_controller.rb
69
+ - config/routes.rb
70
+ - db/migrate/20121105173015_create_cloudstrg_cloudstrgplugins.rb
53
71
  - lib/cloudstrg/version.rb
54
72
  - lib/cloudstrg/version.rb~
55
- - lib/cloudstrg/cloudstrg.rb~
73
+ - lib/cloudstrg/engine.rb
56
74
  - lib/cloudstrg/cloudstrg.rb
57
75
  - lib/tasks/cloudstrg_tasks.rake
58
- - lib/generators/cloudstrg_generator.rb
59
- - lib/generators/cloudstrg_generator.rb~
60
- - lib/templates/create_cloudstrgdata.rb~
61
- - lib/templates/cloudstrgplugin.rb
62
- - lib/templates/create_cloudstrgfiles.rb
63
- - lib/templates/cloudstrguser.rb~
64
- - lib/templates/cloudstrgfile.rb
65
- - lib/templates/create_cloudstrgusers.rb~
66
- - lib/templates/create_cloudstrgfiles.rb~
67
- - lib/templates/create_cloudstrgplugins.rb
68
- - lib/templates/cloudstrguser.rb
69
- - lib/templates/cloudstrglist.rb~
70
- - lib/templates/create_cloudstrgplugins.rb~
71
- - lib/templates/cloudstrgdata.rb~
72
- - lib/templates/create_cloudstrglist.rb~
73
- - lib/templates/cloudstrgfile.rb~
74
- - lib/templates/create_cloudstrgusers.rb
75
76
  - lib/cloudstrg.rb
76
77
  - MIT-LICENSE
77
78
  - Rakefile
78
79
  - README.rdoc
80
+ - test/functional/cloudstrg/cloudstrgplugins_controller_test.rb
81
+ - test/unit/helpers/cloudstrg/cloudstrgplugins_helper_test.rb
82
+ - test/unit/cloudstrg/cloudstrgplugin_test.rb
79
83
  - test/test_helper.rb
84
+ - test/integration/navigation_test.rb
85
+ - test/fixtures/cloudstrg/cloudstrgplugins.yml
80
86
  - test/dummy/script/rails
81
87
  - test/dummy/config.ru
82
88
  - 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
86
- - test/dummy/app/models/cloudstrglist.rb~
87
- - test/dummy/app/models/cloudstrglist.rb
88
89
  - test/dummy/app/assets/stylesheets/application.css
89
90
  - test/dummy/app/assets/javascripts/application.js
90
91
  - test/dummy/app/views/layouts/application.html.erb
@@ -93,13 +94,6 @@ files:
93
94
  - test/dummy/public/404.html
94
95
  - test/dummy/public/422.html
95
96
  - test/dummy/public/favicon.ico
96
- - test/dummy/db/schema.rb
97
- - test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb
98
- - test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb
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
103
97
  - test/dummy/config/boot.rb
104
98
  - test/dummy/config/routes.rb
105
99
  - test/dummy/config/database.yml
@@ -144,15 +138,15 @@ signing_key:
144
138
  specification_version: 3
145
139
  summary: Base API for cloud storage drivers
146
140
  test_files:
141
+ - test/functional/cloudstrg/cloudstrgplugins_controller_test.rb
142
+ - test/unit/helpers/cloudstrg/cloudstrgplugins_helper_test.rb
143
+ - test/unit/cloudstrg/cloudstrgplugin_test.rb
147
144
  - test/test_helper.rb
145
+ - test/integration/navigation_test.rb
146
+ - test/fixtures/cloudstrg/cloudstrgplugins.yml
148
147
  - test/dummy/script/rails
149
148
  - test/dummy/config.ru
150
149
  - 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
154
- - test/dummy/app/models/cloudstrglist.rb~
155
- - test/dummy/app/models/cloudstrglist.rb
156
150
  - test/dummy/app/assets/stylesheets/application.css
157
151
  - test/dummy/app/assets/javascripts/application.js
158
152
  - test/dummy/app/views/layouts/application.html.erb
@@ -161,13 +155,6 @@ test_files:
161
155
  - test/dummy/public/404.html
162
156
  - test/dummy/public/422.html
163
157
  - test/dummy/public/favicon.ico
164
- - test/dummy/db/schema.rb
165
- - test/dummy/db/migrate/20120928111625_create_cloudstrglists.rb
166
- - test/dummy/db/migrate/20121010105501569078_create_cloudstrgusers.rb
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
171
158
  - test/dummy/config/boot.rb
172
159
  - test/dummy/config/routes.rb
173
160
  - test/dummy/config/database.yml
@@ -1,143 +0,0 @@
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 = Cloudstrgplugin.select('plugin_name')
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
- 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
-
142
- end
143
- end
@@ -1,21 +0,0 @@
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 "cloudstrgplugin.rb", "app/models/cloudstrgplugin.rb"
14
- template "cloudstrguser.rb", "app/models/cloudstrguser.rb"
15
- template "cloudstrgfile.rb", "app/models/cloudstrgfile.rb"
16
- migration_template "create_cloudstrgplugins.rb", "db/migrate/create_cloudstrgplugins.rb"
17
- migration_template "create_cloudstrgusers.rb", "db/migrate/create_cloudstrgusers.rb"
18
- migration_template "create_cloudstrgfiles.rb", "db/migrate/create_cloudstrgfiles.rb"
19
- end
20
- end
21
-
@@ -1,19 +0,0 @@
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
-
@@ -1,3 +0,0 @@
1
- class Person < ActiveRecord::Base
2
- attr_accessible :name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrgfile < ActiveRecord::Base
2
- attr_accessible :username, :strgdriver, :filename, :filehash
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrgfile < ActiveRecord::Base
2
- attr_accessible :userid, :strgdriver, :filename, :filehash
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrglist < ActiveRecord::Base
2
- attr_accessible :plugin_name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrgplugin < ActiveRecord::Base
2
- attr_accessible :plugin_name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrguser < ActiveRecord::Base
2
- attr_accessible :userid
3
- end
File without changes
File without changes
@@ -1,16 +0,0 @@
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
@@ -1,16 +0,0 @@
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
@@ -1,13 +0,0 @@
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
@@ -1,13 +0,0 @@
1
- class CreateCloudstrgplugins < ActiveRecord::Migration
2
- def up
3
- create_table :cloudstrgplugins do |t|
4
- t.string :plugin_name
5
-
6
- t.timestamps
7
- end
8
- end
9
-
10
- def down
11
- drop_table :cloudstrgplugins
12
- end
13
- end
@@ -1,13 +0,0 @@
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
@@ -1,13 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- class Cloudstrgfile < ActiveRecord::Base
2
- attr_accessible :username, :strgdriver, :filename, :filehash
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrglist < ActiveRecord::Base
2
- attr_accessible :plugin_name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrglist < ActiveRecord::Base
2
- attr_accessible :plugin_name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrgplugin < ActiveRecord::Base
2
- attr_accessible :plugin_name
3
- end
@@ -1,3 +0,0 @@
1
- class Cloudstrguser < ActiveRecord::Base
2
- attr_accessible :userid
3
- end
Binary file
@@ -1,13 +0,0 @@
1
- class CreateCloudstrglist < ActiveRecord::Migration
2
- def up
3
- create_table :cloudstrglist 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
@@ -1,13 +0,0 @@
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
@@ -1,13 +0,0 @@
1
- class CreateCloudstrgplugins < ActiveRecord::Migration
2
- def up
3
- create_table :cloudstrgplugins do |t|
4
- t.string :plugin_name
5
-
6
- t.timestamps
7
- end
8
- end
9
-
10
- def down
11
- drop_table :cloudstrgplugins
12
- end
13
- end
@@ -1,13 +0,0 @@
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
@@ -1,16 +0,0 @@
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
@@ -1,49 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended to check this file into your version control system.
13
-
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
24
-
25
- create_table "cloudstrglist", :force => true do |t|
26
- t.string "plugin_name"
27
- t.datetime "created_at", :null => false
28
- t.datetime "updated_at", :null => false
29
- end
30
-
31
- create_table "cloudstrglists", :force => true do |t|
32
- t.string "plugin_name"
33
- t.datetime "created_at", :null => false
34
- t.datetime "updated_at", :null => false
35
- end
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
-
49
- end