forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_dev
More file actions
executable file
·60 lines (42 loc) · 1.36 KB
/
Copy pathsetup_dev
File metadata and controls
executable file
·60 lines (42 loc) · 1.36 KB
1
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
#!/usr/bin/env ruby
root = File.expand_path('../../', __FILE__)
puts "Setting up local development environment!"
puts
Dir.chdir root
puts "Running: bundle"
system "bundle"
redis_yml = root + '/config/redis.yml'
database_yml = root + '/config/database.yml'
if !File.exists?(redis_yml)
puts "Creating config/redis.yml"
system "cp #{root}/config/redis.yml.sample #{redis_yml}"
end
if !File.exists?(database_yml)
puts "Creating config/database.yml"
system "cp #{root}/config/database.yml.development-sample #{database_yml}"
puts "Creating development database"
system "bundle exec rake db:create"
puts "Migrating development database"
system "bundle exec rake db:migrate"
puts "Creating test database"
system "RAILS_ENV=test bundle exec rake db:create"
puts "Migrating test database"
system "RAILS_ENV=test bundle exec rake db:migrate"
end
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
if User.count == 0
puts "Setting up an admin user"
admin = User.new
admin.email = "admin@localhost"
admin.username = "admin"
admin.password = "password"
admin.save
admin.grant_admin!
admin.change_trust_level!(:regular)
admin.email_tokens.update_all(confirmed: true)
puts "An administrator was created:"
puts "Username: admin"
puts "Password: password"
puts
puts "To get started run: bundle exec thin start"
end