From 737cf2b46cecf3c43e60b05e16f82167d1173d21 Mon Sep 17 00:00:00 2001 From: TAKAYUKI KAMIYAMA Date: Fri, 13 Sep 2024 05:46:22 +0900 Subject: [PATCH 1/4] Delete. --- lib/database.rb | 64 ------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 lib/database.rb diff --git a/lib/database.rb b/lib/database.rb deleted file mode 100644 index 3bd9aef..0000000 --- a/lib/database.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true -#!/usr/bin/ruby - -require 'fileutils' - -# Installer runner. -class InstallerRunner - def self.run - 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.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 - -begin - InstallerRunner.run -rescue LoadError => e - puts e.backtrace -ensure - GC.compact -end - -__END__ From baf31eef213e4927a5183cf7e1eb3ccace6a244b Mon Sep 17 00:00:00 2001 From: TAKAYUKI KAMIYAMA Date: Fri, 13 Sep 2024 05:46:39 +0900 Subject: [PATCH 2/4] Delete. --- lib/download.rb | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 lib/download.rb diff --git a/lib/download.rb b/lib/download.rb deleted file mode 100644 index 0a81601..0000000 --- a/lib/download.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true -#!/usr/bin/ruby - -require 'fileutils' - -# Installer runner. -class InstallerRunner - def self.run - encoding_style - nyasocom_command - end - - private - 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.encoding_style - Encoding.default_internal = 'UTF-8' - Encoding.default_external = 'UTF-8' - end -end - -begin - InstallerRunner.run -rescue LoadError => e - puts e.backtrace -ensure - GC.compact -end - -__END__ From 8f5a63d7022ead2256a9cb571944986d20a6fcb5 Mon Sep 17 00:00:00 2001 From: TAKAYUKI KAMIYAMA Date: Fri, 13 Sep 2024 05:46:47 +0900 Subject: [PATCH 3/4] Update. --- lib/frame.rb | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/frame.rb b/lib/frame.rb index aa44fe6..f0b4a35 100644 --- a/lib/frame.rb +++ b/lib/frame.rb @@ -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 From 392f8579cf952094a68d13f8d053912423ba1c2e Mon Sep 17 00:00:00 2001 From: TAKAYUKI KAMIYAMA Date: Fri, 13 Sep 2024 05:47:03 +0900 Subject: [PATCH 4/4] Update. --- lib/install.rb | 73 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/lib/install.rb b/lib/install.rb index b37455e..f38716b 100644 --- a/lib/install.rb +++ b/lib/install.rb @@ -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}") @@ -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__