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

Commit

Permalink
Merge pull request #46 from takkii/develop
Browse files Browse the repository at this point in the history
Update.
  • Loading branch information
takkii authored Mar 5, 2024
2 parents 37495a4 + a2be4fe commit 4be00fa
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions install.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require 'open3'
require 'fileutils'

# Installer runner.
class InstallerRunner
# default encoding utf-8, change encode here.
def self.encoding_style
Encoding.default_internal = 'UTF-8'
Encoding.default_external = 'UTF-8'
end

def self.run
encoding_style
if File.exist?(File.expand_path('~/dict/php_dict.txt'))
puts 'Already have a php_dict File ... do nothing.'
else
stdout_php = Open3.capture3("php ./dict/php_dict.php")
stdout_php
FileUtils.mv(['./php_dict.txt'], "./dict")
puts 'Created, ./dict/php_dict.txt'
end
end
end

begin
InstallerRunner.run
rescue StandardError => e
puts e.backtrace
ensure
GC.compact
end

__END__

0 comments on commit 4be00fa

Please sign in to comment.