local_pac 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +1 -1
- data/lib/local_pac.rb +2 -0
- data/lib/local_pac/pac_manager.rb +16 -4
- data/lib/local_pac/version.rb +1 -1
- data/local_pac.gemspec +1 -0
- data/share/archlinux/PKGBUILD +9 -6
- data/spec/pac_manager_spec.rb +14 -0
- metadata +17 -1
data/LICENSE.txt
CHANGED
data/lib/local_pac.rb
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
module LocalPac
|
2
2
|
class PacManager
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
attr_reader :cache, :null_file, :paths, :creator
|
7
|
+
|
8
|
+
public
|
9
|
+
|
3
10
|
def initialize(paths = default_paths, creator = PacFile)
|
4
11
|
@paths = Array(paths)
|
5
12
|
@creator = creator
|
13
|
+
@cache = ActiveSupport::Cache::MemoryStore.new
|
14
|
+
@null_file = proc { NullPacFile.new }
|
6
15
|
end
|
7
16
|
|
8
17
|
def find(name)
|
9
|
-
|
10
|
-
|
18
|
+
name = File.basename(name, '.pac').to_sym
|
19
|
+
|
20
|
+
cache.fetch(name) do
|
21
|
+
pac_files.find(null_file) { |f| f.name == name }
|
22
|
+
end
|
11
23
|
end
|
12
24
|
|
13
25
|
private
|
14
26
|
|
15
27
|
def pac_files
|
16
|
-
|
17
|
-
memo.concat Dir.glob(File.join(path, '*.pac')).collect { |f|
|
28
|
+
paths.reduce([]) do |memo, path|
|
29
|
+
memo.concat Dir.glob(File.join(path, '*.pac')).collect { |f| creator.new(f) }
|
18
30
|
end
|
19
31
|
end
|
20
32
|
|
data/lib/local_pac/version.rb
CHANGED
data/local_pac.gemspec
CHANGED
data/share/archlinux/PKGBUILD
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Maintainer: Max Meyer <dev@fedux.org>
|
2
2
|
pkgname=local_pac
|
3
|
-
pkgver=0.0.
|
4
|
-
pkgrel=
|
3
|
+
pkgver=0.0.5
|
4
|
+
pkgrel=2
|
5
5
|
pkgdesc="local pacfile serving server"
|
6
6
|
arch=(i686 x86_64)
|
7
7
|
url="https://github.com/dg-vrnetze/${pkgname}"
|
@@ -10,7 +10,7 @@ depends=(ruby)
|
|
10
10
|
makedepends=(rubygems filegen)
|
11
11
|
source=(http://gems.rubyforge.org/gems/$pkgname-$pkgver.gem)
|
12
12
|
noextract=($pkgname-$pkgver.gem)
|
13
|
-
sha256sums=('
|
13
|
+
sha256sums=('aa2edfd0ae50bced4b9f53ad60262a82dd2d016ceba2895e6f5bdbe1e9aea0c1')
|
14
14
|
|
15
15
|
package() {
|
16
16
|
cd "$srcdir"
|
@@ -30,10 +30,13 @@ package() {
|
|
30
30
|
|
31
31
|
chmod a+x ${pkgdir}/${_bin_dir}/${pkgname}
|
32
32
|
rm -r ${pkgdir}/${_library_dir}/cache
|
33
|
+
rm -r ${pkgdir}/${_library_dir}/{build_info,doc}
|
33
34
|
|
34
|
-
install ${pkgdir}/$_share_dir/systemd/${pkgname}.service ${pkgdir}/$_systemd_dir
|
35
|
-
install ${pkgdir}/$_share_dir/systemd/${pkgname}@.service ${pkgdir}/$_systemd_dir
|
36
|
-
install ${pkgdir}/$_share_dir/systemd/${pkgname}.socket ${pkgdir}/$_systemd_dir
|
35
|
+
install -D -m644 ${pkgdir}/$_share_dir/systemd/${pkgname}.service ${pkgdir}/$_systemd_dir
|
36
|
+
install -D -m644 ${pkgdir}/$_share_dir/systemd/${pkgname}@.service ${pkgdir}/$_systemd_dir
|
37
|
+
install -D -m644 ${pkgdir}/$_share_dir/systemd/${pkgname}.socket ${pkgdir}/$_systemd_dir
|
38
|
+
|
39
|
+
install -D -m644 ${pkgdir}${_share_dir}/../LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
37
40
|
}
|
38
41
|
|
39
42
|
# vim:set ts=2 sw=2 et:
|
data/spec/pac_manager_spec.rb
CHANGED
@@ -18,5 +18,19 @@ describe PacManager do
|
|
18
18
|
file = manager.find('file1')
|
19
19
|
expect(file.nil?).to be_true
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'caches files', :focus do
|
23
|
+
directory = create_directory 'pac_files'
|
24
|
+
file_path = create_file 'pac_files/file1.pac'
|
25
|
+
|
26
|
+
manager = PacManager.new(directory)
|
27
|
+
file = manager.find('file1')
|
28
|
+
expect(file.path).to eq(file_path)
|
29
|
+
|
30
|
+
delete_file 'pac_files/file1.pac'
|
31
|
+
|
32
|
+
file = manager.find('file1')
|
33
|
+
expect(file.path).to eq(file_path)
|
34
|
+
end
|
21
35
|
end
|
22
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: local_pac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: activesupport
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: ! 'This gem helps you to serve proxy.pacs locallly
|
47
63
|
|
48
64
|
'
|