to_pass 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/to_pass/algorithm_reader.rb +5 -3
- data/test/fixtures/user_alg.yml +18 -0
- data/test/helper.rb +7 -0
- data/test/test_algorithm_reader.rb +6 -0
- data/test/test_integration.rb +7 -0
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -19,8 +19,8 @@ class ToPass::AlgorithmReader
|
|
19
19
|
'~/.to_pass/algorithms',
|
20
20
|
"#{File.dirname(__FILE__)}/../algorithms"
|
21
21
|
].each do |dir|
|
22
|
-
dir = Pathname.new(dir)
|
23
|
-
@load_path << dir
|
22
|
+
dir = Pathname.new(dir).expand_path
|
23
|
+
@load_path << dir if dir.exist?
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,10 +38,12 @@ class ToPass::AlgorithmReader
|
|
38
38
|
if file.exist?
|
39
39
|
file
|
40
40
|
else
|
41
|
-
|
41
|
+
next
|
42
42
|
end
|
43
43
|
end.compact.first
|
44
44
|
|
45
|
+
raise LoadError, "algorithm #{@algorithm} could not be found in #{load_path}" if fn.nil?
|
46
|
+
|
45
47
|
YAML.load_file(fn.expand_path)
|
46
48
|
end
|
47
49
|
end
|
data/test/helper.rb
CHANGED
@@ -21,6 +21,13 @@ Test::Unit::TestCase.class_eval do
|
|
21
21
|
assert_class_defined klass
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
|
26
|
+
def with_algorithm_in_user_dir
|
27
|
+
`mkdir -p ~/to_pass/algorithms; cp -f #{File.dirname(__FILE__)}/fixtures/user_alg.yml ~/.to_pass/algorithms/user_alg.yml`
|
28
|
+
yield
|
29
|
+
`rm ~/.to_pass/algorithms/user_alg.yml`
|
30
|
+
end
|
24
31
|
end
|
25
32
|
|
26
33
|
require 'lib/to_pass'
|
data/test/test_integration.rb
CHANGED
@@ -27,4 +27,11 @@ class TestIntegration < Test::Unit::TestCase
|
|
27
27
|
assert_equal 't35t', str.to_pass
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_cli_usage_with_user_algorithm
|
32
|
+
with_algorithm_in_user_dir do
|
33
|
+
assert_equal "le1/2%z", `bin/to_pass 'leasbpc' -a user_alg`.chomp
|
34
|
+
assert_equal "le1/2%z", `bin/to_pass 'luke eats all sausagages because peter cries' -a user_alg`.chomp
|
35
|
+
end
|
36
|
+
end
|
30
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_pass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthias Viehweger
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-14 00:00:00 +02:00
|
19
19
|
default_executable: to_pass
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/to_pass/converter.rb
|
75
75
|
- lib/to_pass/integration.rb
|
76
76
|
- lib/to_pass/string_conversions.rb
|
77
|
+
- test/fixtures/user_alg.yml
|
77
78
|
- test/helper.rb
|
78
79
|
- test/test_algorithm_reader.rb
|
79
80
|
- test/test_base.rb
|