-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathinstall.rb
53 lines (41 loc) · 944 Bytes
/
install.rb
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
# Install hook code here
require 'ftools'
# keep everything inside fo this scope
class InstallOpenIdActiveRecordStore
def initialize
show_banner
check_system_cosistency
copy_migration_files
end
def here
File.dirname(__FILE__)
end
def sources
Dir.glob(File.join([here, 'migrations', '*.*']))
end
def target
File.join([here, '..', '..', '..', 'db', 'migrate'])
end
def validate_file_existance(file)
abort "File not found: #{target}" unless File.exist? file
end
def show_banner
puts '
** Copying migrations to your application
'
end
def check_system_cosistency
validate_file_existance(target)
sources.each { |file| validate_file_existance(file) }
end
def copy_migration_files
sources.each do |file|
File.copy(file, target)
puts "
Source : #{file}
Target : #{target}
"
end
end
end
InstallOpenIdActiveRecordStore.new