windows で日本ユーザ名 でgemをするとき

windows vista で日本語名でユーザが登録されているときに、
rails しようとするとエラーが出ちゃいます。

gemが C:\Users\日本語ユーザ名\.gem に保存しようとしているため。

そんな時は、環境変数に、GEM_PATH を追加して、保存したい場所を新たに指定すると
そこに保存されるよう。


#ここからは軽くソース追ってみた。

Ruby1.9.2\bin\gem から
Ruby1.9.2\lib\ruby\1.9.1\rubygems\gem_runner.rb の

  def do_configuration(args)
    Gem.configuration = @config_file_class.new(args)
    Gem.use_paths(Gem.configuration[:gemhome], Gem.configuration[:gempath])
    Gem::Command.extra_args = Gem.configuration[:gem]
    @doc_manager_class.configured_args = Gem.configuration[:rdoc]
  end

@config_file_class.new(args) から

Ruby1.9.2\lib\ruby\1.9.1\rubygems\config_file.rb の

  def initialize(arg_list)
    @config_file_name = nil
    need_config_file_name = false

    arg_list = arg_list.map do |arg|
      if need_config_file_name then
        @config_file_name = arg
        need_config_file_name = false
        nil
      elsif arg =~ /^--config-file=(.*)/ then
        @config_file_name = $1
        nil
      elsif arg =~ /^--config-file$/ then
        need_config_file_name = true
        nil
      else
        arg
      end
    end.compact

    @backtrace = DEFAULT_BACKTRACE
    @benchmark = DEFAULT_BENCHMARK
    @bulk_threshold = DEFAULT_BULK_THRESHOLD
    @verbose = DEFAULT_VERBOSITY
    @update_sources = DEFAULT_UPDATE_SOURCES

    operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
    platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
    system_config = load_file SYSTEM_WIDE_CONFIG_FILE
    user_config = load_file config_file_name.dup.untaint

    @hash = operating_system_config.merge platform_config
    @hash = @hash.merge system_config
    @hash = @hash.merge user_config

    # HACK these override command-line args, which is bad
    @backtrace        = @hash[:backtrace]        if @hash.key? :backtrace
    @benchmark        = @hash[:benchmark]        if @hash.key? :benchmark
    @bulk_threshold   = @hash[:bulk_threshold]   if @hash.key? :bulk_threshold
    @home             = @hash[:gemhome]          if @hash.key? :gemhome
    @path             = @hash[:gempath]          if @hash.key? :gempath
    @update_sources   = @hash[:update_sources]   if @hash.key? :update_sources
    @verbose          = @hash[:verbose]          if @hash.key? :verbose

    load_rubygems_api_key

    Gem.sources = @hash[:sources] if @hash.key? :sources
    handle_arguments arg_list
  end

の下記のところで、データを取り出すようだ。

operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
    platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
    system_config = load_file SYSTEM_WIDE_CONFIG_FILE
    user_config = load_file config_file_name.dup.untaint


\rubygems\commands\environment_command.rb

  def execute
    out = ''
    arg = options[:args][0]
    case arg
    when /^packageversion/ then
      out << Gem::RubyGemsPackageVersion
    when /^version/ then
      out << Gem::VERSION
    when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
      out << Gem.dir
    when /^gempath/, /^path/, /^GEM_PATH/ then
      out << Gem.path.join(File::PATH_SEPARATOR)
    when /^remotesources/ then
      out << Gem.sources.join("\n")
    when nil then
      out = "RubyGems Environment:\n"

      out << "  - RUBYGEMS VERSION: #{Gem::VERSION}\n"

      out << "  - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
      out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
      out << ") [#{RUBY_PLATFORM}]\n"

      out << "  - INSTALLATION DIRECTORY: #{Gem.dir}\n"

      out << "  - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?

      out << "  - RUBY EXECUTABLE: #{Gem.ruby}\n"

      out << "  - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"

      out << "  - RUBYGEMS PLATFORMS:\n"
      Gem.platforms.each do |platform|
        out << "    - #{platform}\n"
      end

      out << "  - GEM PATHS:\n"
      out << "     - #{Gem.dir}\n"

      path = Gem.path.dup
      path.delete Gem.dir
      path.each do |p|
        out << "     - #{p}\n"
      end

      out << "  - GEM CONFIGURATION:\n"
      Gem.configuration.each do |name, value|
        value = value.gsub(/./, '*') if name == 'gemcutter_key'
        out << "     - #{name.inspect} => #{value.inspect}\n"
      end

      out << "  - REMOTE SOURCES:\n"
      Gem.sources.each do |s|
        out << "     - #{s}\n"
      end

    else
      raise Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
    end
    say out
    true
  end