make an initial setup with the console, so that the passwords do not
apear anywhere
This commit is contained in:
parent
88f8fadc9e
commit
e0833de4a5
4
Gemfile
4
Gemfile
@ -14,3 +14,7 @@ gem 'redclothcoderay'
|
|||||||
gem 'coderay'
|
gem 'coderay'
|
||||||
gem 'RedCloth'
|
gem 'RedCloth'
|
||||||
gem 'redcarpet'
|
gem 'redcarpet'
|
||||||
|
|
||||||
|
group :install do
|
||||||
|
gem 'highline'
|
||||||
|
end
|
||||||
|
@ -58,6 +58,7 @@ GEM
|
|||||||
fastercsv (1.5.4)
|
fastercsv (1.5.4)
|
||||||
fssm (0.2.7)
|
fssm (0.2.7)
|
||||||
haml (3.1.2)
|
haml (3.1.2)
|
||||||
|
highline (1.6.2)
|
||||||
json (1.4.6)
|
json (1.4.6)
|
||||||
rack (1.3.2)
|
rack (1.3.2)
|
||||||
rack-flash (0.1.2)
|
rack-flash (0.1.2)
|
||||||
@ -86,6 +87,7 @@ DEPENDENCIES
|
|||||||
data_mapper
|
data_mapper
|
||||||
dm-postgres-adapter
|
dm-postgres-adapter
|
||||||
haml
|
haml
|
||||||
|
highline
|
||||||
rack-flash
|
rack-flash
|
||||||
redcarpet
|
redcarpet
|
||||||
redclothcoderay
|
redclothcoderay
|
||||||
|
31
Rakefile
31
Rakefile
@ -1,22 +1,28 @@
|
|||||||
$LOAD_PATH << File.expand_path(File.dirname(__FILE__)) + '/'
|
$LOAD_PATH << File.expand_path(File.dirname(__FILE__)) + '/'
|
||||||
|
|
||||||
|
def require_files
|
||||||
require 'libs'
|
require 'libs'
|
||||||
require 'rake/functions'
|
require 'rake/functions'
|
||||||
|
end
|
||||||
require 'dm-migrations'
|
|
||||||
|
|
||||||
namespace :dm do
|
namespace :dm do
|
||||||
desc 'migrate to the database model'
|
desc 'migrate to the database model'
|
||||||
task :migrate do
|
task :migrate do
|
||||||
|
require_files
|
||||||
|
require 'dm-migrations'
|
||||||
DataMapper.auto_migrate!
|
DataMapper.auto_migrate!
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'upgrade the database to the latest model'
|
desc 'upgrade the database to the latest model'
|
||||||
task :upgrade do
|
task :upgrade do
|
||||||
|
require_files
|
||||||
|
require 'dm-migrations'
|
||||||
DataMapper.auto_upgrade!
|
DataMapper.auto_upgrade!
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'fill the database with dummy data from seeds.rb'
|
desc 'fill the database with dummy data from seeds.rb'
|
||||||
task :seed do
|
task :seed do
|
||||||
|
require_files
|
||||||
require 'seeds'
|
require 'seeds'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -26,9 +32,30 @@ task :console do
|
|||||||
sh "irb -rubygems -I#{File.expand_path(File.dirname(__FILE__))} -r libs"
|
sh "irb -rubygems -I#{File.expand_path(File.dirname(__FILE__))} -r libs"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :account do
|
||||||
|
desc 'create a new account'
|
||||||
|
task :create do
|
||||||
|
require_files
|
||||||
|
require 'highline'
|
||||||
|
h = HighLine.new
|
||||||
|
acc = Account.new
|
||||||
|
acc.username = h.ask('username: ')
|
||||||
|
acc.password = h.ask('password: '){|q| q.echo = false }
|
||||||
|
acc.password_confirmation = h.ask('password again: '){|q| q.echo = false }
|
||||||
|
acc.email = h.ask('email: ')
|
||||||
|
acc.role = :admin
|
||||||
|
if acc.save
|
||||||
|
puts "account saved with id #{acc.id}"
|
||||||
|
else
|
||||||
|
puts "failure at saving the account: #{acc.errors.first}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
namespace :import do
|
namespace :import do
|
||||||
desc 'import all posts from this directory'
|
desc 'import all posts from this directory'
|
||||||
task :jekyll do
|
task :jekyll do
|
||||||
|
require_files
|
||||||
path = ask("Where are the jekyll posts?")
|
path = ask("Where are the jekyll posts?")
|
||||||
template = ask("What is the default template? (textile, markdown, ...?)")
|
template = ask("What is the default template? (textile, markdown, ...?)")
|
||||||
if path.nil?
|
if path.nil?
|
||||||
|
Loading…
Reference in New Issue
Block a user