lib/ruby_learner/common.rb in ruby_learner-1.1.10 vs lib/ruby_learner/common.rb in ruby_learner-1.1.11
- old
+ new
@@ -43,6 +43,21 @@
def get_app_ver(app_name: String)
app_vers = Open3.capture3("gem list #{app_name}")
latest_ver = app_vers[0].chomp.gsub(' (', '-').gsub(')','')
return latest_ver
end
+
+ def change_theme(color: String, gem_dir: String)
+ chmoded = 0
+ file_path = "#{gem_dir}/lib/datas/theme_color.txt"
+ begin
+ File.write(file_path, "#{color}")
+ puts "your ruby_learner's color is #{color}!!"
+ rescue => error
+ system "sudo chmod go+w #{file_path}"
+ chmoded += 1
+ retry if chmoded < 2
+ puts "FileWrite error #{error.message}"
+ puts "you should input $sudo chmod go+w #{file_path}"
+ end
+ end
end