tryrb 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7433c7c65a665d4cd86719f2867b18ff718a7679
4
- data.tar.gz: 1e173c59ac6d9b45697d81da0899fc8a38200144
3
+ metadata.gz: 5b3bbd8910a8e4891582adbddb650f4b6a68057a
4
+ data.tar.gz: 8bc050a0aaf2a21a5fa0f74b55dea1f71abee20d
5
5
  SHA512:
6
- metadata.gz: f91459a4b90f0dbb5564531ac0aa99363c685798ea49dbadeddbd1149cec9757f56d6e2dd42e9646542b92275769194c983c2dac38bd98ba9c1a048f1c13d688
7
- data.tar.gz: 8873c2cedaf63641f6cc5f45b6df2d026891777e49f66d6664ce8248116dc5b48b2112456faa2ee475e5aab6a0ed270c97511745f1487450b703c8307fedcdc4
6
+ metadata.gz: baaee8ab40decd8fae34d8b87fcf02777f0aa397c5c4c2efdb036b67b732a9eec656df4c00c9366a8437a8a65c53ca5a113f38bf4f3e58e4ec0fefb0d37acf57
7
+ data.tar.gz: ba2e32d12e7146972d13dfdda3f1d84263470302b1264e03ae602d40ad50b08126cb0150332d286cd0eb9841e46428ca1d948bf45f939d14d685f0a29bebe296
@@ -1,13 +1,10 @@
1
1
  require 'fileutils'
2
2
  require 'thor'
3
3
  require 'tryrb/config'
4
+ require 'yaml'
4
5
 
5
6
  module TryRb
6
7
  class CLI < Thor
7
- def initialize(*)
8
- super
9
- end
10
-
11
8
  no_commands do
12
9
  def conf
13
10
  TryRb::Config.instance
@@ -56,6 +53,7 @@ module TryRb
56
53
  filename = options[:filename]
57
54
  last_n = options[:last_n] || 1
58
55
  names = Dir[File.join(conf.expanded_tmp_dir, '*.rb')]
56
+ .select { |n| n =~ /\d{14}/ }
59
57
  names = names.select { |n| n =~ /#{filename}\.rb$/ } if filename
60
58
  names[-last_n]
61
59
  end
@@ -18,7 +18,7 @@ module TryRb
18
18
  require 'yaml'
19
19
  YAML.load_file(expanded_rc_path)
20
20
  rescue Errno::ENOENT
21
- TryRb::CLI::Shell::Color.new.say("Please run `tryrb config` to configure.", :red)
21
+ print_red("Please run `tryrb config` to configure.")
22
22
  abort
23
23
  end
24
24
 
@@ -30,5 +30,9 @@ module TryRb
30
30
  File.expand_path(tmp_dir)
31
31
  end
32
32
 
33
+ private
34
+ def print_red(str)
35
+ puts "\e[31m#{str}\e[0m"
36
+ end
33
37
  end
34
38
  end
@@ -2,7 +2,7 @@ module TryRb
2
2
  class Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 2
6
6
  PRE = nil
7
7
 
8
8
  class << self
@@ -28,7 +28,7 @@ describe TryRb::Config do
28
28
  end
29
29
  end
30
30
 
31
- describe 'load_file' do
31
+ describe '#load_file' do
32
32
  context 'when file exists at path' do
33
33
  it 'loads data from the file' do
34
34
  config = TryRb::Config.instance
@@ -37,13 +37,20 @@ describe TryRb::Config do
37
37
  end
38
38
  end
39
39
  context 'when file does not exist' do
40
- it 'loads default data' do
40
+ it 'reminds to config and abort' do
41
41
  config = TryRb::Config.instance
42
42
  config.stub(:expanded_rc_path) { fixture_file_path('foorc') }
43
43
  expect(config).to receive(:abort)
44
- TryRb::CLI::Shell::Color.any_instance.stub(:say)
44
+ expect(config).to receive(:puts).with("\e[31mPlease run `tryrb config` to configure.\e[0m")
45
45
  config.load_file
46
46
  end
47
47
  end
48
48
  end
49
+
50
+ describe '#expanded_rc_path' do
51
+ it 'returns right tryrbrc' do
52
+ expect(File).to receive(:expand_path).with('~/.tryrbrc')
53
+ TryRb::Config.instance.expanded_rc_path
54
+ end
55
+ end
49
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tryrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Han
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor