Skip to content

Commit e282224

Browse files
authored
Merge pull request #47 from takkii/develop
Update.
2 parents 7f312b1 + 392f857 commit e282224

File tree

4 files changed

+87
-120
lines changed

4 files changed

+87
-120
lines changed

lib/database.rb

-64
This file was deleted.

lib/download.rb

-43
This file was deleted.

lib/frame.rb

+24-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,35 @@ def version
1717

1818
def installer
1919
require 'install'
20+
begin
21+
InstallerRunner.install
22+
rescue LoadError => e
23+
puts e.backtrace
24+
ensure
25+
GC.compact
26+
end
2027
end
2128

2229
def downloader
23-
require 'download'
30+
require 'install'
31+
begin
32+
InstallerRunner.download
33+
rescue LoadError => e
34+
puts e.backtrace
35+
ensure
36+
GC.compact
37+
end
2438
end
25-
39+
2640
def databases
27-
require 'database'
41+
require 'install'
42+
begin
43+
InstallerRunner.database
44+
rescue LoadError => e
45+
puts e.backtrace
46+
ensure
47+
GC.compact
48+
end
2849
end
2950

3051
def default

lib/install.rb

+63-10
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,48 @@
66
# Installer runner.
77
class InstallerRunner
88

9-
def self.run
9+
def self.install
1010
encoding_style
1111
nyasocom_custom_name
1212
end
13-
13+
14+
def self.download
15+
encoding_style
16+
nyasocom_command
17+
end
18+
19+
def self.database
20+
encoding_style
21+
two = ARGV[1]
22+
23+
pt = /\Apostgresql\z/
24+
pg = /\A--pg\z/
25+
26+
if two.nil?
27+
puts <<-EOF
28+
29+
nyasocom_pg project, clone command.
30+
31+
heat db postgresql
32+
33+
heat db --pg
34+
35+
EOF
36+
elsif two.match?(pt)
37+
postgresql
38+
elsif two.match?(pg)
39+
postgresql
40+
else
41+
puts 'No such option is found, please refer to the documentation.'
42+
end
43+
end
44+
1445
private
1546
def self.encoding_style
1647
Encoding.default_internal = 'UTF-8'
1748
Encoding.default_external = 'UTF-8'
1849
end
19-
50+
2051
def self.nyasocom_custom_name
2152
one = ARGV[1]
2253
FileUtils.mkdir_p("./#{one}")
@@ -33,14 +64,36 @@ def self.nyasocom_custom_name
3364
3465
EOF
3566
end
36-
end
3767

38-
begin
39-
InstallerRunner.run
40-
rescue LoadError => e
41-
puts e.backtrace
42-
ensure
43-
GC.compact
68+
def self.nyasocom_command
69+
if system('git clone git@github.com:takkii/nyasocom_oss.git', exception: true)
70+
else
71+
system('git clone https://github.com:takkii/nyasocom_oss.git')
72+
end
73+
FileUtils.cd("./nyasocom_oss")
74+
FileUtils.rm_rf("./.git")
75+
FileUtils.rm_rf("./.github")
76+
puts <<-EOF
77+
78+
Cloned nyasocom_oss with nyasocom_frame.
79+
80+
EOF
81+
end
82+
83+
def self.postgresql
84+
if system('git clone git@github.com:takkii/nyasocom_pg.git', exception: true)
85+
else
86+
system('git clone https://github.com:takkii/nyasocom_pg.git')
87+
end
88+
FileUtils.cd("./nyasocom_pg")
89+
FileUtils.rm_rf("./.git")
90+
FileUtils.rm_rf("./.github")
91+
puts <<-EOF
92+
93+
Cloned nyasocom_pg with nyasocom_frame.
94+
95+
EOF
96+
end
4497
end
4598

4699
__END__

0 commit comments

Comments
 (0)