Sha256: ec94e6dcce1400ba94b81d78ee030c12e90e2fd200bb7376bb1068eef25e14ee

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

#!/usr/bin/env ruby

require "fileutils"
require "facter"
require "tmpdir"
require "json"

# tmpdirディレクトリにコピー
dir = File.dirname(File.expand_path(__FILE__ + "/../"))
home_dir = ENV["HOME"] + "/" + dir.split("/")[-1].gsub(/-[0-9\.-]+/,"")
puts "home_dir=#{home_dir}"
Dir.mktmpdir { |tmpdir|
  outdir = tmpdir + "/" + dir.split("/")[-1]
  FileUtils.mkdir_p outdir
  FileUtils.mkdir_p home_dir
  puts outdir
  Dir.glob("#{dir}/lib/*") do |f|
    if f =~ /config$/
      # configはhomeにコピー
      if !File.exists? "#{home_dir}/config"
        puts "#{f} => #{home_dir}/"
        FileUtils.cp_r f, "#{home_dir}/"
      end
    else
      puts "#{f} => #{outdir}/"
      FileUtils.cp_r f, "#{outdir}/"
    end
  end
  begin
  json = JSON.parse(File.read("#{home_dir}/config/setting.json"))
  old_version = json["version"]
  rescue
    old_version = ""
  end
  json = JSON.parse(File.read("#{dir}/lib/config/setting.json"))
  new_version = json["version"]
  puts "#{old_version} == #{new_version}"
  if old_version.to_s != new_version.to_s
    FileUtils.cp "#{dir}/lib/config/setting.json", "#{home_dir}/config/setting.json"
  end

  FileUtils.cd "#{outdir}"
  kernel = Facter.value(:kernel)
  if kernel == "windows"
    system "rubyw ./start.rb"
  elsif kernel == "Linux"
    system "ruby ./start.rb"
  else
    system "ruby ./start.rb"
  end
  FileUtils.cd ENV["HOME"]
}

Version data entries

13 entries across 7 versions & 3 rubygems

Version Path
python_uml_class-0.1.0 bin/start_python_uml_class.rb
python_uml_class-0.1.0 bin/start_python_uml_class.rbw
ruby_uml_class-0.5.0 bin/start_ruby_uml_class.rbw
ruby_uml_class-0.5.0 bin/start_ruby_uml_class.rb
ruby_uml_class-0.4.0 bin/start_ruby_uml_class.rbw
ruby_uml_class-0.4.0 bin/start_ruby_uml_class.rb
ruby_uml_class-0.3.0 bin/start_ruby_uml_class.rbw
ruby_uml_class-0.3.0 bin/start_ruby_uml_class.rb
ruby_uml_class-0.2.0 bin/start_ruby_uml_class.rbw
ruby_uml_class-0.2.0 bin/start_ruby_uml_class.rb
ruby_uml_class-0.1.0 bin/start_ruby_uml_class.rbw
ruby_uml_class-0.1.0 bin/start_ruby_uml_class.rb
browser_app_base-0.1.7 bin/start_sample.rb