public
Fork of insoshi/insoshi
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/trentono/insoshi.git
Generating keys in rake install
Michael Hartl (author)
Wed Apr 23 20:08:52 -0700 2008
commit  6a531234e43665e34544bff99bce57c684aca63a
tree    af1ec02e275c1be091423044cfbee436c90a3b57
parent  593cafd209abbfb0bc2dc29960f8319d5deb87f7
...
20
21
22
23
 
24
...
20
21
22
 
23
24
0
@@ -20,4 +20,4 @@ tmp/.*
0
 \#*
0
 *~
0
 vendor/**/**/doc/*
0
-
0
+rsa_key*
0
\ No newline at end of file
...
4
5
6
7
8
 
 
 
 
 
 
9
10
11
...
4
5
6
 
 
7
8
9
10
11
12
13
14
15
0
@@ -4,8 +4,12 @@ module Crypto
0
   
0
   def self.create_keys(priv = "rsa_key", pub = "#{priv}.pub", bits = 1024)
0
     private_key = OpenSSL::PKey::RSA.new(bits)
0
- File.open(priv, "w+") { |fp| fp << private_key.to_s }
0
- File.open(pub, "w+") { |fp| fp << private_key.public_key.to_s }
0
+ File.open(priv, "w+") do |fp|
0
+ fp << private_key.to_s
0
+ end unless File.exist?(priv)
0
+ File.open(pub, "w+") do |fp|
0
+ fp << private_key.public_key.to_s
0
+ end unless File.exist?(pub)
0
     private_key
0
   end
0
   
...
5
6
7
 
8
 
 
 
 
 
 
9
...
5
6
7
8
9
10
11
12
13
14
15
16
0
@@ -5,5 +5,12 @@ require 'active_record/fixtures'
0
 desc "Install Insoshi"
0
 task :install => :environment do |t|
0
   Rake::Task["db:migrate"].invoke
0
+ puts "Initializing global preferences"
0
   Preference.create!
0
+ puts "Generating authentication keys"
0
+ Crypto.create_keys
0
+ puts "Writing identification key"
0
+ File.open("identifier", "w") do |f|
0
+ f.write UUID.new
0
+ end unless File.exist?("identifier")
0
 end

Comments

    No one has commented yet.