Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Update. #47

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions lib/database.rb

This file was deleted.

43 changes: 0 additions & 43 deletions lib/download.rb

This file was deleted.

27 changes: 24 additions & 3 deletions lib/frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,35 @@ def version

def installer
require 'install'
begin
InstallerRunner.install
rescue LoadError => e
puts e.backtrace
ensure
GC.compact
end
end

def downloader
require 'download'
require 'install'
begin
InstallerRunner.download
rescue LoadError => e
puts e.backtrace
ensure
GC.compact
end
end

def databases
require 'database'
require 'install'
begin
InstallerRunner.database
rescue LoadError => e
puts e.backtrace
ensure
GC.compact
end
end

def default
Expand Down
73 changes: 63 additions & 10 deletions lib/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,48 @@
# Installer runner.
class InstallerRunner

def self.run
def self.install
encoding_style
nyasocom_custom_name
end


def self.download
encoding_style
nyasocom_command
end

def self.database
encoding_style
two = ARGV[1]

pt = /\Apostgresql\z/
pg = /\A--pg\z/

if two.nil?
puts <<-EOF

nyasocom_pg project, clone command.

heat db postgresql

heat db --pg

EOF
elsif two.match?(pt)
postgresql
elsif two.match?(pg)
postgresql
else
puts 'No such option is found, please refer to the documentation.'
end
end

private
def self.encoding_style
Encoding.default_internal = 'UTF-8'
Encoding.default_external = 'UTF-8'
end

def self.nyasocom_custom_name
one = ARGV[1]
FileUtils.mkdir_p("./#{one}")
Expand All @@ -33,14 +64,36 @@ def self.nyasocom_custom_name

EOF
end
end

begin
InstallerRunner.run
rescue LoadError => e
puts e.backtrace
ensure
GC.compact
def self.nyasocom_command
if system('git clone git@github.com:takkii/nyasocom_oss.git', exception: true)
else
system('git clone https://github.com:takkii/nyasocom_oss.git')
end
FileUtils.cd("./nyasocom_oss")
FileUtils.rm_rf("./.git")
FileUtils.rm_rf("./.github")
puts <<-EOF

Cloned nyasocom_oss with nyasocom_frame.

EOF
end

def self.postgresql
if system('git clone git@github.com:takkii/nyasocom_pg.git', exception: true)
else
system('git clone https://github.com:takkii/nyasocom_pg.git')
end
FileUtils.cd("./nyasocom_pg")
FileUtils.rm_rf("./.git")
FileUtils.rm_rf("./.github")
puts <<-EOF

Cloned nyasocom_pg with nyasocom_frame.

EOF
end
end

__END__
Loading