adminpanel 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,7 +23,11 @@ In you application.rb
23
23
  config.default_locale = :es
24
24
  no other language is currently supported, but pull requests are welcome.
25
25
 
26
- The gem expects you to have a database with tables as the schema.rb in the root. You have to add your sections in the seeds.rb to add them to the database.
26
+ Then run:
27
+
28
+ rails g adminpanel:install create_migrations
29
+ rake db:migrate
30
+ to create the database that the adminpanel it's expecting.
27
31
 
28
32
  Any doubt feel free to ask me!
29
33
 
@@ -1,3 +1,3 @@
1
1
  module Adminpanel
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,12 @@
1
+ require "rails/generators/active_record"
2
+ module Adminpanel
3
+ module Generators
4
+ class InstallGenerator < ActiveRecord::Generators::Base
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ def create_migrations
8
+ migration_template 'migrations/create_adminpanel_tables.rb', 'db/migrate/create_adminpanel_tables.rb'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ class CreateAdminpanelTables < ActiveRecord::Migration
2
+ def change
3
+ create_table :adminpanel_products do |t|
4
+ t.integer :category_id
5
+ t.string :name
6
+ t.string :brief
7
+ t.text :description
8
+ t.timestamps
9
+ end
10
+
11
+ create_table :adminpanel_users do |t|
12
+ t.string :name
13
+ t.string :email
14
+ t.string :password_digest
15
+ t.string :remember_token
16
+ t.timestamps
17
+ end
18
+ add_index :adminpanel_users, [:email]
19
+ add_index :adminpanel_users, [:remember_token]
20
+
21
+ create_table :adminpanel_galleries do |t|
22
+ t.string :file
23
+ t.timestamps
24
+ end
25
+
26
+ create_table :adminpanel_images do |t|
27
+ t.string :file
28
+ t.integer :foreign_key
29
+ t.string :model
30
+ t.timestamps
31
+ end
32
+
33
+ create_table :adminpanel_sections do |t|
34
+ t.string :name
35
+ t.boolean :has_description
36
+ t.text :description
37
+ t.string :key
38
+ t.boolean :has_image
39
+ t.string :file
40
+ t.timestamps
41
+ end
42
+ add_index :adminpanel_sections, [:key]
43
+
44
+ create_table :adminpanel_categories do |t|
45
+ t.string :name
46
+ t.timestamps
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminpanel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jose Ramon Camacho
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-12-01 00:00:00 Z
19
+ date: 2013-12-02 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails
@@ -313,7 +313,8 @@ files:
313
313
  - lib/adminpanel.rb
314
314
  - lib/adminpanel/engine.rb
315
315
  - lib/adminpanel/version.rb
316
- - schema.rb
316
+ - lib/generators/adminpanel/install/install_generator.rb
317
+ - lib/generators/adminpanel/install/templates/migrations/create_adminpanel_tables.rb
317
318
  homepage: https://github.com/joseramonc/adminpanel
318
319
  licenses:
319
320
  - MIT
data/schema.rb DELETED
@@ -1,65 +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 => 20131120070259) do
15
-
16
- create_table "adminpanel_users", :force => true do |t|
17
- t.string "name"
18
- t.string "email"
19
- t.string "password_digest"
20
- t.string "remember_token"
21
- t.datetime "created_at", :null => false
22
- t.datetime "updated_at", :null => false
23
- end
24
-
25
- create_table "adminpanel_categories", :force => true do |t|
26
- t.string "name"
27
- t.datetime "created_at", :null => false
28
- t.datetime "updated_at", :null => false
29
- end
30
-
31
- create_table "adminpanel_galleries", :force => true do |t|
32
- t.string "file"
33
- t.datetime "created_at", :null => false
34
- t.datetime "updated_at", :null => false
35
- end
36
-
37
- create_table "adminpanel_images", :force => true do |t|
38
- t.string "file"
39
- t.integer "foreign_key"
40
- t.datetime "created_at", :null => false
41
- t.datetime "updated_at", :null => false
42
- t.string "model"
43
- end
44
-
45
- create_table "adminpanel_products", :force => true do |t|
46
- t.string "name"
47
- t.text "description"
48
- t.datetime "created_at", :null => false
49
- t.datetime "updated_at", :null => false
50
- t.integer "category_id"
51
- t.string "brief"
52
- end
53
-
54
- create_table "adminpanel_sections", :force => true do |t|
55
- t.string "name"
56
- t.text "description"
57
- t.string "key"
58
- t.boolean "has_image"
59
- t.string "file"
60
- t.datetime "created_at", :null => false
61
- t.datetime "updated_at", :null => false
62
- t.boolean "has_description"
63
- end
64
-
65
- end