local_pac 0.1.6 → 0.1.7
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/.rdebugrc +7 -0
- data/.rspec +3 -0
- data/.simplecov +8 -0
- data/.travis.yml +7 -0
- data/.yardopts +5 -0
- data/lib/local_pac/config.rb +15 -5
- data/lib/local_pac/exceptions.rb +3 -0
- data/lib/local_pac/main.rb +0 -1
- data/lib/local_pac/version.rb +1 -1
- data/lib/local_pac.rb +2 -1
- data/share/archlinux/Makefile +5 -0
- data/share/archlinux/PKGBUILD +1 -1
- data/spec/config_spec.rb +1 -1
- data/spec/features/fetch_proxy_pac_spec.rb +3 -1
- data/spec/spec_helper.rb +3 -0
- metadata +7 -1
data/.rdebugrc
ADDED
data/.rspec
ADDED
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/lib/local_pac/config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module LocalPac
|
3
|
+
|
3
4
|
class Config
|
4
5
|
private
|
5
6
|
|
@@ -12,9 +13,7 @@ module LocalPac
|
|
12
13
|
|
13
14
|
def option(option, default_value)
|
14
15
|
define_method option.to_sym do
|
15
|
-
config.
|
16
|
-
config.fetch(option.to_sym, default_value)
|
17
|
-
end
|
16
|
+
config.fetch(option.to_sym, default_value)
|
18
17
|
end
|
19
18
|
|
20
19
|
@options << option
|
@@ -23,8 +22,19 @@ module LocalPac
|
|
23
22
|
|
24
23
|
public
|
25
24
|
|
26
|
-
def initialize(file = available_config_file, config_engine =
|
27
|
-
|
25
|
+
def initialize(file = available_config_file, config_engine = Psych)
|
26
|
+
config_mutex = Mutex.new
|
27
|
+
config_mutex.synchronize do
|
28
|
+
yaml = Psych.load_file(file)
|
29
|
+
|
30
|
+
if yaml.respond_to? :[]
|
31
|
+
@config = yaml.freeze
|
32
|
+
else
|
33
|
+
@config = {}.freeze
|
34
|
+
end
|
35
|
+
end
|
36
|
+
rescue => e
|
37
|
+
fail Exceptions::ConfigFileNotReadable, "Sorry, but there was a problem reading the config file: #{e.message}."
|
28
38
|
end
|
29
39
|
|
30
40
|
option :log_sink, File.join(ENV['HOME'], '.local', 'share', 'local_pac', 'log')
|
data/lib/local_pac/exceptions.rb
CHANGED
data/lib/local_pac/main.rb
CHANGED
data/lib/local_pac/version.rb
CHANGED
data/lib/local_pac.rb
CHANGED
data/share/archlinux/PKGBUILD
CHANGED
@@ -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=('1141ef7b1eafd1b67fe210ae3dde9d72b397b48842ae6b3f377a093af56a9094')
|
14
14
|
|
15
15
|
package() {
|
16
16
|
cd "$srcdir"
|
data/spec/config_spec.rb
CHANGED
@@ -9,6 +9,8 @@ describe 'Fetch proxy pac' do
|
|
9
9
|
EOS
|
10
10
|
end
|
11
11
|
|
12
|
+
let(:compressed_valid_pac_file) { "function FindProxyForURL(){return\"DIRECT\"}" }
|
13
|
+
|
12
14
|
let(:git_repo) { 'git_repo' }
|
13
15
|
|
14
16
|
before(:each) do
|
@@ -37,7 +39,7 @@ describe 'Fetch proxy pac' do
|
|
37
39
|
|
38
40
|
it 'finds an existing proxy pac' do
|
39
41
|
response = get('/v1/pac/file.pac')
|
40
|
-
expect(response.body).to eq(
|
42
|
+
expect(response.body).to eq(compressed_valid_pac_file)
|
41
43
|
end
|
42
44
|
|
43
45
|
it 'exits with 404 if file does not exist' do
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,9 @@ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
|
5
5
|
# Set the rack environment to `test`
|
6
6
|
ENV["RACK_ENV"] = "test"
|
7
7
|
|
8
|
+
require 'simplecov'
|
9
|
+
SimpleCov.start
|
10
|
+
|
8
11
|
# Pull in all of the gems including those in the `test` group
|
9
12
|
require 'bundler'
|
10
13
|
Bundler.require :default, :test, :development
|
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.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -150,6 +150,11 @@ extensions: []
|
|
150
150
|
extra_rdoc_files: []
|
151
151
|
files:
|
152
152
|
- .gitignore
|
153
|
+
- .rdebugrc
|
154
|
+
- .rspec
|
155
|
+
- .simplecov
|
156
|
+
- .travis.yml
|
157
|
+
- .yardopts
|
153
158
|
- Gemfile
|
154
159
|
- LICENSE.txt
|
155
160
|
- Procfile
|
@@ -193,6 +198,7 @@ files:
|
|
193
198
|
- lib/local_pac/ui_logger.rb
|
194
199
|
- lib/local_pac/version.rb
|
195
200
|
- local_pac.gemspec
|
201
|
+
- share/archlinux/Makefile
|
196
202
|
- share/archlinux/PKGBUILD
|
197
203
|
- share/archlinux/startup.erb
|
198
204
|
- share/examples/config.yaml
|