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

Commit

Permalink
Merge pull request #47 from takkii/develop
Browse files Browse the repository at this point in the history
Update.
  • Loading branch information
takkii authored Sep 12, 2024
2 parents 7f312b1 + 392f857 commit e282224
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 120 deletions.
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 [email protected]: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 [email protected]: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__

0 comments on commit e282224

Please sign in to comment.