mayl 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/mayl CHANGED
@@ -2,4 +2,4 @@
2
2
  $: << 'lib'
3
3
  require 'mayl'
4
4
 
5
- Mayl::Repl.new(ARGV[1]).start
5
+ Mayl::Repl.new(ARGV[0]).start
@@ -17,9 +17,13 @@ module Mayl
17
17
  #
18
18
  # Returns an Array of Locale objects.
19
19
  def self.load(path)
20
- Dir[File.expand_path(path) << "/*.yml"].map { |filename|
20
+ locales = Dir[File.expand_path(path) << "/*.yml"].map { |filename|
21
21
  Locale.new filename, YAML.load(File.read(filename))
22
22
  }
23
+
24
+ abort "Error: No locales found under ./#{path}" if locales.empty?
25
+
26
+ locales
23
27
  end
24
28
  end
25
29
  end
@@ -8,7 +8,7 @@ module Mayl
8
8
  #
9
9
  # path - The path to get the locales from (defaults to 'config/locales').
10
10
  def initialize(path)
11
- path ||= 'config/locales'
11
+ path ||= 'config/locales'
12
12
  @env = Env.new(path)
13
13
  @parser = Parser.new(@env)
14
14
  end
@@ -20,7 +20,7 @@ module Mayl
20
20
  locales = @env.locales.map(&:name)
21
21
  prompt = "> "
22
22
  puts "Detected locales: #{locales.join(', ')}"
23
- while (print prompt; input = gets)
23
+ while (print prompt; input = $stdin.gets)
24
24
  begin
25
25
  value = @parser.parse(input.chomp).execute
26
26
  @env.last_value = value
@@ -1,4 +1,4 @@
1
1
  module Mayl
2
2
  # The version of the Mayl gem.
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  module Mayl
4
4
  describe Repl do
5
5
  before do
6
- @repl = Mayl::Repl.new('some/path.yml')
6
+ @repl = Mayl::Repl.new('test/support')
7
7
  end
8
8
 
9
9
  it 'parses and executes commands' do
@@ -12,7 +12,7 @@ module Mayl
12
12
  @baz = stub
13
13
  @baz.expects(:execute)
14
14
 
15
- @repl.expects(:gets).times(3).returns("foo bar\n", "baz lol\n", nil)
15
+ $stdin.expects(:gets).times(3).returns("foo bar\n", "baz lol\n", nil)
16
16
 
17
17
  @repl.parser.expects(:parse).with('foo bar').returns @foo
18
18
  @repl.parser.expects(:parse).with('baz lol').returns @baz
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mayl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: