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
59
60
61
|
# File 'lib/uas2git/main.rb', line 24
def run!
password = ask('Enter password for ' + @options[:username] + '@' + @options[:host] + ': ') { |q| q.echo = false }
connection = PG::connect(
:host => @options[:host],
:port => '10733',
:user => @options[:username],
:password => password,
:dbname => 'template1'
)
result = connection.exec_params("SELECT db_name($1)", [ @project_name ])
ActiveRecord::Base.establish_connection(
:adapter => 'postgresql',
:host => @options[:host],
:port => '10733',
:username => @options[:username],
:password => password,
:database => result[0]['db_name']
)
repo = Progress.start('Initializing a git repository', 1) do
Progress.step do
Rugged::Repository.init_at('.')
end
end
Migrator.new(repo).migrate!
Progress.start('Checking out the work tree', 1) do
Progress.step do
repo.reset('HEAD', :hard)
end
end
end
|