2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/generators/grandstand/install/templates/migration.rb', line 2
def self.up
create_table :grandstand_galleries do |t|
t.integer :position
t.string :name
t.string :url
t.text :description
t.datetime :created_at
t.datetime :updated_at
t.integer :user_id
t.boolean :published, :default => true
end
create_table :grandstand_images do |t|
t.integer :gallery_id
t.string :string
t.text :caption
t.string :file_file_name
t.string :file_content_type
t.string :file_file_size
t.string :file_updated_at
t.integer :position
t.datetime :created_at
t.datetime :updated_at
t.integer :user_id
end
create_table :grandstand_page_sections do |t|
t.integer :page_id
t.string :filter, :limit => 32
t.string :section, :limit => 32
t.integer :position, :default => 0
t.text :content
t.datetime :created_at
t.datetime :updated_at
end
create_table :grandstand_pages do |t|
t.integer :parent_id
t.integer :user_id
t.string :name
t.string :slug
t.string :url
t.integer :position
t.datetime :created_at
t.datetime :updated_at
end
create_table :grandstand_posts do |t|
t.integer :user_id
t.string :name
t.string :url
t.text :body
t.text :preview
t.datetime :created_at
t.datetime :updated_at
t.datetime :posted_at
end
create_table :grandstand_users do |t|
t.string :email
t.string :first_name
t.string :last_name
t.string :encrypted_password, :limit => 40
t.string :salt, :limit => 40
t.string :cookie, :limit => 40
t.datetime :cookie_expires_at
t.datetime :created_at
t.datetime :updated_at
end
user_saved = false
while !user_saved
print 'Please enter an admin account e-mail (default: admin@localhost): '
email = (email_tmp = $stdin.gets.strip).blank? ? 'admin@localhost' : email_tmp
print "Please enter a password for #{email} (default: admin): "
password = (password_tmp = $stdin.gets.strip).blank? ? 'admin' : password_tmp
user = Grandstand::User.create(:email => email, :password => password)
unless user_saved = !user.new_record?
puts " That user could not be saved: #{user.errors.inspect}"
end
end
puts "Creating blog image library..."
Grandstand::Gallery.create(:name => 'Blog Image Library', :published => false)
end
|