sandboxy 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -0
- data/examples/rails_example/config/routes.rb +2 -0
- data/examples/rails_example/db/migrate/{20170826222427_sandboxy_migration.rb → 20170827105828_sandboxy_migration.rb} +0 -0
- data/examples/rails_example/db/schema.rb +11 -1
- data/lib/sandboxy/configuration.rb +5 -3
- data/lib/sandboxy/middleware.rb +4 -1
- data/lib/sandboxy/railtie.rb +3 -1
- data/lib/sandboxy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0900175ab295d91c3afe0ae5dcb2de0b1d82612
|
4
|
+
data.tar.gz: 2777176852c4b7abbf7d5ec92c2ef427bc94ae4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f65c09ea2e4982e6013cf1cbbc8672a1d236187052c2580418fb7cfe6c72c2d52dfa859e1d26ede4828be0cb50d746eb507f83e5c6c6825c640ac1b57b347e7
|
7
|
+
data.tar.gz: 152653d0560fc783bf4f0b7d56dc01cc955b37fb8674f2bfe03818bca506c22fdf45dcd785769bc08974dc401ded0a750d97a6d30cd03d19b73ca28dab9ca272
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -19,6 +19,7 @@ Sandboxy allows you to use virtual data-oriented environments inside a Rails app
|
|
19
19
|
* [To Do](#to-do)
|
20
20
|
* [Contributing](#contributing)
|
21
21
|
* [Contributors](#contributors)
|
22
|
+
* [Semantic Versioning](#semantic-versioning)
|
22
23
|
* [License](#license)
|
23
24
|
|
24
25
|
---
|
@@ -178,6 +179,10 @@ Give the people some :heart: who are working on this project. See them all at:
|
|
178
179
|
|
179
180
|
https://github.com/slooob/sandboxy/graphs/contributors
|
180
181
|
|
182
|
+
### Semantic Versioning
|
183
|
+
|
184
|
+
Sandboxy follows Semantic Versioning 2.0 as defined at http://semver.org.
|
185
|
+
|
181
186
|
## License
|
182
187
|
|
183
188
|
MIT License
|
File without changes
|
@@ -10,7 +10,17 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20170827105828) do
|
14
|
+
|
15
|
+
create_table "bars", force: :cascade do |t|
|
16
|
+
t.datetime "created_at", null: false
|
17
|
+
t.datetime "updated_at", null: false
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table "foos", force: :cascade do |t|
|
21
|
+
t.datetime "created_at", null: false
|
22
|
+
t.datetime "updated_at", null: false
|
23
|
+
end
|
14
24
|
|
15
25
|
create_table "sandboxy", force: :cascade do |t|
|
16
26
|
t.string "sandboxed_type", null: false
|
@@ -2,7 +2,7 @@ module Sandboxy
|
|
2
2
|
|
3
3
|
def self.environment
|
4
4
|
config = get_config
|
5
|
-
if config&.key
|
5
|
+
if config&.key(:environment)
|
6
6
|
config[:environment]
|
7
7
|
else
|
8
8
|
'live'
|
@@ -19,7 +19,7 @@ module Sandboxy
|
|
19
19
|
|
20
20
|
def self.retain_environment
|
21
21
|
config = get_config
|
22
|
-
if config&.key
|
22
|
+
if config&.key(:retain_environment)
|
23
23
|
config[:retain_environment]
|
24
24
|
else
|
25
25
|
false
|
@@ -34,9 +34,11 @@ module Sandboxy
|
|
34
34
|
require 'yaml'
|
35
35
|
|
36
36
|
begin
|
37
|
-
YAML.load_file 'config/sandboxy.yml'
|
37
|
+
config = YAML.load_file 'config/sandboxy.yml'
|
38
38
|
rescue Exception
|
39
39
|
end
|
40
|
+
|
41
|
+
return config if config
|
40
42
|
end
|
41
43
|
|
42
44
|
end
|
data/lib/sandboxy/middleware.rb
CHANGED
@@ -6,9 +6,12 @@ module Sandboxy
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def call env
|
9
|
+
require 'sandboxy'
|
10
|
+
|
9
11
|
previous_sandbox = $sandbox
|
10
12
|
$sandbox = Sandboxy.environment == 'sandbox' ? true : false
|
11
|
-
|
13
|
+
|
14
|
+
puts 'Sandbox: Moved to ' + Sandboxy.environment.to_s + ' environment' if $sandbox != previous_sandbox
|
12
15
|
end
|
13
16
|
|
14
17
|
end
|
data/lib/sandboxy/railtie.rb
CHANGED
@@ -11,7 +11,9 @@ module Sandboxy
|
|
11
11
|
end
|
12
12
|
|
13
13
|
initializer 'sandboxy.configure_rails_initialization' do |app|
|
14
|
-
|
14
|
+
require 'sandboxy'
|
15
|
+
puts 'Sandboxy: Using ' + Sandboxy.environment.to_s + ' environment'
|
16
|
+
|
15
17
|
$sandbox = Sandboxy.environment == 'sandbox' ? true : false
|
16
18
|
app.middleware.use(Sandboxy::Middleware) unless Sandboxy.retain_environment
|
17
19
|
end
|
data/lib/sandboxy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandboxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Slooob
|
@@ -208,9 +208,9 @@ files:
|
|
208
208
|
- examples/rails_example/config/routes.rb
|
209
209
|
- examples/rails_example/config/sandboxy.yml
|
210
210
|
- examples/rails_example/config/secrets.yml
|
211
|
-
- examples/rails_example/db/migrate/20170826222427_sandboxy_migration.rb
|
212
211
|
- examples/rails_example/db/migrate/20170826223227_create_foos.rb
|
213
212
|
- examples/rails_example/db/migrate/20170826223243_create_bars.rb
|
213
|
+
- examples/rails_example/db/migrate/20170827105828_sandboxy_migration.rb
|
214
214
|
- examples/rails_example/db/schema.rb
|
215
215
|
- examples/rails_example/db/seeds.rb
|
216
216
|
- examples/rails_example/lib/assets/.keep
|