Sha256: d850994e35dcb4200e650d9ebacb481e49b6c988582a55f4ad27e156ddad789d

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

#!/usr/bin/env ruby

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

# tmpdirディレクトリにコピー
dir = File.dirname(File.expand_path(__FILE__ + "/../"))
home_dir = ENV["HOME"] + "/" + dir.split("/")[-1]
puts "home_dir=#{$home_dir}"
Dir.mktmpdir { |tmpdir|
  outdir = tmpdir + "/" + dir.split("/")[-1]
  FileUtils.mkdir_p outdir
  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

  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

1 entries across 1 versions & 1 rubygems

Version Path
browser_app_base-0.1.1 bin/start_sample.rb