t 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/t/rcfile.rb CHANGED
@@ -2,14 +2,13 @@ require 'singleton'
2
2
 
3
3
  module T
4
4
  class RCFile
5
- FILE_NAME = '.trc'
6
- attr_reader :path
7
-
8
5
  include Singleton
6
+ attr_reader :path
7
+ FILE_NAME = '.trc'
9
8
 
10
9
  def initialize
11
10
  @path = File.join(File.expand_path("~"), FILE_NAME)
12
- @data = load
11
+ @data = load_file
13
12
  end
14
13
 
15
14
  def [](username)
@@ -59,7 +58,7 @@ module T
59
58
  @data == default_structure
60
59
  end
61
60
 
62
- def load
61
+ def load_file
63
62
  require 'yaml'
64
63
  YAML.load_file(@path)
65
64
  rescue Errno::ENOENT
@@ -68,7 +67,7 @@ module T
68
67
 
69
68
  def path=(path)
70
69
  @path = path
71
- @data = load
70
+ @data = load_file
72
71
  @path
73
72
  end
74
73
 
data/lib/t/version.rb CHANGED
@@ -13,7 +13,7 @@ module T
13
13
 
14
14
  # @return [Integer]
15
15
  def self.patch
16
- 0
16
+ 1
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
data/spec/rcfile_spec.rb CHANGED
@@ -160,19 +160,19 @@ describe T::RCFile do
160
160
  end
161
161
  end
162
162
 
163
- describe '#load' do
163
+ describe '#load_file' do
164
164
  context 'when file exists at path' do
165
165
  it 'should load data from file' do
166
166
  rcfile = T::RCFile.instance
167
167
  rcfile.path = fixture_path + "/.trc"
168
- rcfile.load['profiles']['testcli']['abc123']['username'].should == 'testcli'
168
+ rcfile.load_file['profiles']['testcli']['abc123']['username'].should == 'testcli'
169
169
  end
170
170
  end
171
171
  context 'when file does not exist at path' do
172
172
  it 'should load default structure' do
173
173
  rcfile = T::RCFile.instance
174
174
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
175
- rcfile.load.keys.sort.should == ['configuration', 'profiles']
175
+ rcfile.load_file.keys.sort.should == ['configuration', 'profiles']
176
176
  end
177
177
  end
178
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: