-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
module Budik | ||
def command_config(_args, opts) | ||
def self.command_config(_args, opts) | ||
_config = Config.instance.load(opts) | ||
end | ||
|
||
def command_run(_args, opts) | ||
def self.command_run(_args, opts) | ||
config.load(opts) | ||
end | ||
|
||
def command_set(_args, opts) | ||
def self.command_set(_args, opts) | ||
end | ||
|
||
def command_sources(_args, opts) | ||
def self.command_sources(_args, opts) | ||
end | ||
|
||
def command_translate(_args, opts) | ||
def self.command_translate(_args, opts) | ||
end | ||
|
||
def command_unset(_args, opts) | ||
def self.command_unset(_args, opts) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
--- | ||
lang: en | ||
strings: | ||
- config: | ||
- example: "This is an example string." | ||
lang: "en" # Do not remove this line. | ||
config: | ||
example: "This is an example string." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'r18n-core' | ||
require 'singleton' | ||
require 'spec_helper' | ||
require 'yaml' | ||
|
||
require 'budik/config' | ||
|
||
describe Budik::Config, '#load' do | ||
context 'with default values' do | ||
it 'loads configuration files' do | ||
opts = {} | ||
config = Budik::Config.instance | ||
config.load(opts) | ||
|
||
expect(config.lang.lang.class).to eq R18n::TranslatedString | ||
expect(config.options).to eq YAML.load_file('./lib/budik/config/options.yml') | ||
expect(config.sources).to eq YAML.load_file('./lib/budik/config/sources.yml') | ||
end | ||
end | ||
|
||
context 'with file overrides' do | ||
it 'loads configuration files' do | ||
opts = { language: 'en', | ||
options: './lib/budik/config/options.yml', | ||
sources: './lib/budik/config/sources.yml' } | ||
config = Budik::Config.instance | ||
config.load(opts) | ||
|
||
expect(config.lang.lang.class).to eq R18n::TranslatedString | ||
expect(config.options).to eq YAML.load_file('./lib/budik/config/options.yml') | ||
expect(config.sources).to eq YAML.load_file('./lib/budik/config/sources.yml') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters