Forum: IronRuby Code Review: __FILE__ and $PROGRAM_NAME paths

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-04-21 00:38
(Received via mailing list)
http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2009-04-21 04:02
(Received via mailing list)
Comment left on Github:

Can you move the fixtures up a level and combine them? (Put them in
rubyspec/fixtures instead of rubyspec/command_line/fixtures and
rubyspec/language/fixtures)

Also, shouldn't we move Glob.CanonicalizePath to a more central
location, then use that central location for both the hosting and the
Glob implementation? Seems like this couples the hosting API to Glob,
which doesn't seem good.
Other than that it looks good.

JD

From: Jimmy Schementi
Sent: Monday, April 20, 2009 3:37 PM
To: ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-04-22 02:20
(Received via mailing list)
http://github.com/jschementi/ironruby/commit/57d18...

Code Review changes
- Moves command_line/fixtures/file* and language/fixtures/file* to
fixtures/
- Create RubyUtils.CanonicalizePath, to dependency on
IronRuby.Builtins.Glob from IronRuby.Hosting

    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/program_name_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/file_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/predefined_spec.rb
    * Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs
    * Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs

From: Jim Deville
Sent: Monday, April 20, 2009 6:53 PM
To: Jimmy Schementi; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Comment left on Github:

Can you move the fixtures up a level and combine them? (Put them in
rubyspec/fixtures instead of rubyspec/command_line/fixtures and
rubyspec/language/fixtures)

Also, shouldn't we move Glob.CanonicalizePath to a more central
location, then use that central location for both the hosting and the
Glob implementation? Seems like this couples the hosting API to Glob,
which doesn't seem good.
Other than that it looks good.

JD

From: Jimmy Schementi
Sent: Monday, April 20, 2009 3:37 PM
To: ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-04-22 02:38
(Received via mailing list)
Could you remove

public static MutableString/*!*/ CanonicalizePath(MutableString/*!*/
path) {
   return RubyUtils.CanonicalizePath(path);
}

from Glob and call RubyUtils directly wherever Glob.CanonicalizePath is
used?

Other than that looks good.

Tomas


From: Jimmy Schementi
Sent: Tuesday, April 21, 2009 5:19 PM
To: Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/57d18...

Code Review changes
- Moves command_line/fixtures/file* and language/fixtures/file* to
fixtures/
- Create RubyUtils.CanonicalizePath, to dependency on
IronRuby.Builtins.Glob from IronRuby.Hosting

    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/program_name_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/file_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/predefined_spec.rb
    * Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs
    * Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs

From: Jim Deville
Sent: Monday, April 20, 2009 6:53 PM
To: Jimmy Schementi; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Comment left on Github:

Can you move the fixtures up a level and combine them? (Put them in
rubyspec/fixtures instead of rubyspec/command_line/fixtures and
rubyspec/language/fixtures)

Also, shouldn't we move Glob.CanonicalizePath to a more central
location, then use that central location for both the hosting and the
Glob implementation? Seems like this couples the hosting API to Glob,
which doesn't seem good.
Other than that it looks good.

JD

From: Jimmy Schementi
Sent: Monday, April 20, 2009 3:37 PM
To: ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-04-22 20:40
(Received via mailing list)
http://github.com/jschementi/ironruby/commit/43514...

Remove Glob.CanonicalizePath (in favor of RubyUtils.CanonicalizePath)


-
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs

-          Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs

From: Tomas Matousek
Sent: Tuesday, April 21, 2009 5:38 PM
To: Jimmy Schementi; Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Could you remove

public static MutableString/*!*/ CanonicalizePath(MutableString/*!*/
path) {
   return RubyUtils.CanonicalizePath(path);
}

from Glob and call RubyUtils directly wherever Glob.CanonicalizePath is
used?

Other than that looks good.

Tomas


From: Jimmy Schementi
Sent: Tuesday, April 21, 2009 5:19 PM
To: Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/57d18...

Code Review changes
- Moves command_line/fixtures/file* and language/fixtures/file* to
fixtures/
- Create RubyUtils.CanonicalizePath, to dependency on
IronRuby.Builtins.Glob from IronRuby.Hosting

    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/program_name_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/file_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/predefined_spec.rb
    * Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs
    * Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs

From: Jim Deville
Sent: Monday, April 20, 2009 6:53 PM
To: Jimmy Schementi; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Comment left on Github:

Can you move the fixtures up a level and combine them? (Put them in
rubyspec/fixtures instead of rubyspec/command_line/fixtures and
rubyspec/language/fixtures)

Also, shouldn't we move Glob.CanonicalizePath to a more central
location, then use that central location for both the hosting and the
Glob implementation? Seems like this couples the hosting API to Glob,
which doesn't seem good.
Other than that it looks good.

JD

From: Jimmy Schementi
Sent: Monday, April 20, 2009 3:37 PM
To: ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-04-22 20:40
(Received via mailing list)
Looks good.

Tomas

From: Jimmy Schementi
Sent: Wednesday, April 22, 2009 10:56 AM
To: Tomas Matousek; Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/43514...

Remove Glob.CanonicalizePath (in favor of RubyUtils.CanonicalizePath)


-
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs

-          Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs

From: Tomas Matousek
Sent: Tuesday, April 21, 2009 5:38 PM
To: Jimmy Schementi; Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Could you remove

public static MutableString/*!*/ CanonicalizePath(MutableString/*!*/
path) {
   return RubyUtils.CanonicalizePath(path);
}

from Glob and call RubyUtils directly wherever Glob.CanonicalizePath is
used?

Other than that looks good.

Tomas


From: Jimmy Schementi
Sent: Tuesday, April 21, 2009 5:19 PM
To: Jim Deville; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/57d18...

Code Review changes
- Moves command_line/fixtures/file* and language/fixtures/file* to
fixtures/
- Create RubyUtils.CanonicalizePath, to dependency on
IronRuby.Builtins.Glob from IronRuby.Hosting

    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/command_line/program_name_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/file_spec.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/fixtures/file/sub.rb
    *
Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/language/predefined_spec.rb
    * Merlin/Main/Languages/Ruby/Ruby/Builtins/Glob.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs
    * Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyOptionsParser.cs
    * Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs

From: Jim Deville
Sent: Monday, April 20, 2009 6:53 PM
To: Jimmy Schementi; ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: RE: Code Review: __FILE__ and $PROGRAM_NAME paths

Comment left on Github:

Can you move the fixtures up a level and combine them? (Put them in
rubyspec/fixtures instead of rubyspec/command_line/fixtures and
rubyspec/language/fixtures)

Also, shouldn't we move Glob.CanonicalizePath to a more central
location, then use that central location for both the hosting and the
Glob implementation? Seems like this couples the hosting API to Glob,
which doesn't seem good.
Other than that it looks good.

JD

From: Jimmy Schementi
Sent: Monday, April 20, 2009 3:37 PM
To: ironruby-core@rubyforge.org
Cc: IronRuby External Code Reviewers
Subject: Code Review: __FILE__ and $PROGRAM_NAME paths

http://github.com/jschementi/ironruby/commit/3ef1b...

Makes __FILE__ and $PROGRAM_NAME (and $0) have canonicalized paths when
Ruby is hosted from ir.exe. However, __FILE__ is not messed with when
including a file via require/load. Fixes
http://ironruby.codeplex.com/WorkItem/View.aspx?Wo....
This topic is locked and can not be replied to.