trusted-sandbox 0.1.4 → 0.1.5

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: 4e79ee5b95826f3f6b958d64ba41aa5bc69698be
4
- data.tar.gz: 674ce0e484bc9f25a1daadd890806ec5cbec1c49
3
+ metadata.gz: e5f75b96f03f9ca8924a9118d1c7d21150bdbd8b
4
+ data.tar.gz: 31f575d8c76f7ea9626d064730d7a0e11ba6aa73
5
5
  SHA512:
6
- metadata.gz: 758f1b48f60299af80576785a12b6c19e3d1e93d119c5fc54922d36b943585cc4114639cae7db200003b04b6782491813a7eaf506d7936fb300093307ffbe445
7
- data.tar.gz: 0ebb3139a9378b6dda3bc53251bbcbc04b6f78d5e739bcdec0a91a59fc66a425207772355d8f03d867ecf29b9d8406948c175136da77764124f81d167ac938f1
6
+ metadata.gz: 98b4ad0606c946a56b08578b14378eb0e3ad43163c84cfe46731b07e61b9c7f89a78eea674567b565ce59d24f3746d235bdeac390649d96bb8122a9987bf29fc
7
+ data.tar.gz: 1ebac5f5156d49a7688da383b157d7b115fd7ea6e57e77f39b56fb23da25f6a403b2cf545d0b2dae7bbc17e7d38d4a70a2c1c7775bad4a9da75f61ca3b291ce3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusted-sandbox (0.1.3)
4
+ trusted-sandbox (0.1.5)
5
5
  docker-api (~> 1.13)
6
6
  thor (~> 0.19)
7
7
 
data/README.md CHANGED
@@ -77,12 +77,13 @@ an earlier version. Refer to the Docker documentation to see how to install the
77
77
 
78
78
  Note that on a Linux server the docker daemon runs as root, and the root user owns the socket used to connect to the
79
79
  daemon. In order to avoid the need to run your application with sudo privileges, add the application user to the
80
- `docker` group (keep `${USER}` for the connected user or change to suit your needs):
80
+ `docker` group:
81
81
  ```
82
+ # keep `${USER}` for the connected user or change to suit your needs
82
83
  $ sudo gpasswd -a ${USER} docker
83
84
  $ sudo service docker.io restart
84
85
  ```
85
- then reconnect to your shell session and try the following (without sudo):
86
+ then reconnect to shell session and try the following (without sudo):
86
87
  ```
87
88
  $ docker images
88
89
  ```
@@ -136,6 +137,8 @@ environment variables.
136
137
  Trusted Sandbox uses the `docker-api` gem to communicate with docker. `docker-api`'s defaults work quite well for a
137
138
  Linux host, and you should be good by omitting `docker_url` and `docker_cert_path` all together.
138
139
 
140
+ The following configurations work for a Mac OS host:
141
+
139
142
  ```ruby
140
143
  # If omitted ENV['DOCKER_HOST'] is used. If it is not set, docker-api defaults are used.
141
144
  docker_url: https://192.168.59.103:2376
@@ -443,9 +446,6 @@ You should not override user quota related parameters, as they must be prepared
443
446
  Trusted Sandbox comes with one ready-to-use image that includes Ruby 2.1.2. It is hosted on Docker Hub under
444
447
  `vaharoni/trusted_sandbox:ruby-2.1.2.v2`.
445
448
 
446
- We are actively looking for contributors who are willing to help expand the library of Docker images to support other
447
- languages and environments.
448
-
449
449
  To use a different image from your Docker Hub account simply change the configuration parameters in the YAML file.
450
450
 
451
451
  To customize the provided images, run the following. It will copy the image definition to your current directory under
@@ -33,7 +33,7 @@ module TrustedSandbox
33
33
  return {} unless yaml_path
34
34
 
35
35
  env ||= ENV['TRUSTED_SANDBOX_ENV'] || ENV['RAILS_ENV'] || 'development'
36
- YAML.load_file(yaml_path)[env]
36
+ YAML.load_file(yaml_path)[env] || {}
37
37
  end
38
38
 
39
39
  def self.uid_pool
@@ -1,3 +1,3 @@
1
1
  module TrustedSandbox
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -1,6 +1,75 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe TrustedSandbox do
4
+ describe '#config_overrides_from_file' do
5
+ context 'when file does not exist' do
6
+ before do
7
+ stub(File).exist? { false }
8
+ end
9
+
10
+ it 'returns empty hash' do
11
+ TrustedSandbox.config_overrides_from_file.should == {}
12
+ end
13
+ end
14
+
15
+ context 'when file exists' do
16
+ before do
17
+ stub(File).exist? { true }
18
+ end
19
+
20
+ context 'no environment' do
21
+ before do
22
+ @dev_hash = {'dev' => true}
23
+ stub(YAML).load_file { {'development' => @dev_hash} }
24
+ end
25
+
26
+ it 'returns the hash from the development environment' do
27
+ TrustedSandbox.config_overrides_from_file.should == @dev_hash
28
+ end
29
+ end
30
+
31
+ context 'test environment' do
32
+ before do
33
+ @test_hash = {'test' => true}
34
+ stub(YAML).load_file { {'test' => @test_hash} }
35
+ end
36
+
37
+ context 'from TRUSTED_SANDBOX_ENV' do
38
+ before do
39
+ ENV['TRUSTED_SANDBOX_ENV'] = 'test'
40
+ end
41
+
42
+ it 'returns the hash from the test environment' do
43
+ TrustedSandbox.config_overrides_from_file.should == @test_hash
44
+ end
45
+ end
46
+
47
+ context 'from RAILS_ENV' do
48
+ before do
49
+ ENV['RAILS_ENV'] = 'test'
50
+ end
51
+
52
+ it 'returns the hash from the test environment' do
53
+ TrustedSandbox.config_overrides_from_file.should == @test_hash
54
+ end
55
+ end
56
+ end
57
+
58
+ context 'file does not contain environment key' do
59
+ before do
60
+ @dev_hash = {'dev' => true}
61
+ stub(YAML).load_file { {'development' => @dev_hash} }
62
+ ENV['TRUSTED_SANDBOX_ENV'] = 'test'
63
+ end
64
+
65
+ it 'returns an empty hash' do
66
+ TrustedSandbox.config_overrides_from_file.should == {}
67
+ end
68
+ end
69
+ end
70
+
71
+ end
72
+
4
73
  describe '#with_options' do
5
74
  before do
6
75
  @default_network_access = TrustedSandbox.config.network_access
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusted-sandbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amit Aharoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2014-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler