Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bd8361b8649e
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fbb3f1e408ed
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on May 3, 2015

  1. Updated daedalus-core.

    brixen committed May 3, 2015
    Copy the full SHA
    ba6115e View commit details
  2. Switch config to .rbxconfig.

    This also adds checking /Users/bshirai/.rbxconfig if it is defined. Use of
    .rbxrc in the current working directory is deprecated.
    brixen committed May 3, 2015
    Copy the full SHA
    fbb3f1e View commit details
Showing with 33 additions and 15 deletions.
  1. +1 −1 Gemfile.lock
  2. +1 −1 gems_list.txt
  3. +31 −13 vm/environment.cpp
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
daedalus-core (0.2.0)
daedalus-core (0.3.0)
rake (10.4.2)
redcard (1.1.0)
rubinius-ast (2.3.2)
2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bundler-1.9.4.gem
daedalus-core-0.2.0.gem
daedalus-core-0.3.0.gem
ffi2-generators-0.1.1.gem
json-1.8.2.gem
minitest-4.7.5.gem
44 changes: 31 additions & 13 deletions vm/environment.cpp
Original file line number Diff line number Diff line change
@@ -238,32 +238,50 @@ namespace rubinius {
utilities::logger::write("command line: %s", args.str().c_str());
}

static void read_config_file(FILE* fp, ConfigParser& config_parser) {
#define RBX_CONFIG_FILE_LINE_MAX 256

char buf[RBX_CONFIG_FILE_LINE_MAX];
while(fgets(buf, RBX_CONFIG_FILE_LINE_MAX, fp)) {
int size = strlen(buf);
if(buf[size-1] == '\n') buf[size-1] = '\0';
if(strncmp(buf, "-X", 2) == 0) {
config_parser.import_line(buf + 2);
}
}
}

void Environment::load_vm_options(int argc, char**argv) {
/* We parse -X options from three sources in the following order:
*
* 1. The file .rbxrc in the current working directory.
* 2. The RBXOPT environment variable.
* 3. The command line options.
* 1. The file $HOME/.rbxconfig if $HOME is defined.
* 2. The file .rbxconfig in the current working directory.
* 3. The RBXOPT environment variable.
* 4. The command line options.
*
* This order permits environment and command line options to override
* "application" configuration. Likewise, command line options can override
* environment configuration.
*/

#define RBX_CONFIG_FILE_LINE_MAX 256
char* home = getenv("HOME");
if(home) {
std::string config_path(home);
config_path += "/.rbxconfig";

// Configuration file.
if(FILE* fp = fopen(".rbxrc", "r")) {
char buf[RBX_CONFIG_FILE_LINE_MAX];
while(fgets(buf, RBX_CONFIG_FILE_LINE_MAX, fp)) {
int size = strlen(buf);
if(buf[size-1] == '\n') buf[size-1] = '\0';
if(strncmp(buf, "-X", 2) == 0) {
config_parser.import_line(buf + 2);
}
if(FILE* fp = fopen(config_path.c_str(), "r")) {
read_config_file(fp, config_parser);
}
}

// Configuration file.
if(FILE* fp = fopen(".rbxconfig", "r")) {
read_config_file(fp, config_parser);
} else if(FILE* fp = fopen(".rbxrc", "r")) {
std::cerr << "Use of config file .rbxrc is deprecated, use .rbxconfig." << std::endl;
read_config_file(fp, config_parser);
}

// Environment.
char* rbxopt = getenv("RBXOPT");
if(rbxopt) {