forked from Tendrl/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
40 lines (38 loc) · 946 Bytes
/
Rakefile
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
require './lib/tendrl'
require 'etcd'
require 'yaml'
require 'json'
require 'securerandom'
namespace :etcd do
desc 'Load default Tendrl admin in etcd'
task :load_admin do
p 'Generating default Tendrl admin'
password = 'adminuser'
user = Tendrl::User.find 'admin'
if user
p 'User named admin already exists.'
else
Tendrl::User.save(
Tendrl::UserForm.new(
Tendrl::User.new,
name: 'Admin',
username: 'admin',
email: '[email protected]',
role: 'admin',
password: password,
email_notifications: false
).attributes
)
p 'Generated default admin'
p 'Username: admin'
p "Password: #{password}"
end
end
end
if ENV['RACK_ENV'] != 'production'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new :specs do |task|
task.pattern = Dir['spec/**/*_spec.rb']
end
task :default => ['specs']
end