sandboxy 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +5 -5
  2. data/.github/pull_request_template.md +2 -2
  3. data/CHANGELOG.md +6 -0
  4. data/CODE_OF_CONDUCT.md +1 -1
  5. data/DEPRECATIONS.md +3 -1
  6. data/Gemfile +1 -1
  7. data/INSTALL.md +1 -1
  8. data/LICENSE +1 -1
  9. data/README.md +68 -38
  10. data/Rakefile +0 -1
  11. data/examples/rails_example/Gemfile +1 -0
  12. data/examples/rails_example/app/api/books/api.rb +33 -0
  13. data/examples/rails_example/app/assets/javascripts/{bars.coffee → applications.coffee} +0 -0
  14. data/examples/rails_example/app/assets/javascripts/{foos.coffee → authors.coffee} +0 -0
  15. data/examples/rails_example/app/assets/javascripts/books.coffee +3 -0
  16. data/examples/rails_example/app/assets/javascripts/libraries.coffee +3 -0
  17. data/examples/rails_example/app/assets/javascripts/sandbox.coffee +3 -0
  18. data/examples/rails_example/app/assets/stylesheets/applications.scss +3 -0
  19. data/examples/rails_example/app/assets/stylesheets/{foos.scss → authors.scss} +1 -1
  20. data/examples/rails_example/app/assets/stylesheets/{bars.scss → books.scss} +1 -1
  21. data/examples/rails_example/app/assets/stylesheets/libraries.scss +3 -0
  22. data/examples/rails_example/app/assets/stylesheets/sandbox.scss +3 -0
  23. data/examples/rails_example/app/controllers/application_controller.rb +5 -1
  24. data/examples/rails_example/app/controllers/applications_controller.rb +74 -0
  25. data/examples/rails_example/app/controllers/authors_controller.rb +77 -0
  26. data/examples/rails_example/app/controllers/books_controller.rb +77 -0
  27. data/examples/rails_example/app/controllers/libraries_controller.rb +77 -0
  28. data/examples/rails_example/app/controllers/sandbox_controller.rb +6 -0
  29. data/examples/rails_example/app/helpers/applications_helper.rb +2 -0
  30. data/examples/rails_example/app/helpers/authors_helper.rb +2 -0
  31. data/examples/rails_example/app/helpers/books_helper.rb +2 -0
  32. data/examples/rails_example/app/helpers/libraries_helper.rb +2 -0
  33. data/examples/rails_example/app/helpers/sandbox_helper.rb +2 -0
  34. data/examples/rails_example/app/models/application.rb +14 -0
  35. data/examples/rails_example/app/models/author.rb +2 -0
  36. data/examples/rails_example/app/models/book.rb +2 -0
  37. data/examples/rails_example/app/models/library.rb +2 -0
  38. data/examples/rails_example/app/views/applications/_application.json.jbuilder +2 -0
  39. data/examples/rails_example/app/views/applications/_form.html.erb +19 -0
  40. data/examples/rails_example/app/views/applications/edit.html.erb +6 -0
  41. data/examples/rails_example/app/views/applications/index.html.erb +25 -0
  42. data/examples/rails_example/app/views/applications/index.json.jbuilder +1 -0
  43. data/examples/rails_example/app/views/applications/new.html.erb +5 -0
  44. data/examples/rails_example/app/views/applications/show.html.erb +7 -0
  45. data/examples/rails_example/app/views/applications/show.json.jbuilder +1 -0
  46. data/examples/rails_example/app/views/authors/_author.json.jbuilder +2 -0
  47. data/examples/rails_example/app/views/authors/_form.html.erb +19 -0
  48. data/examples/rails_example/app/views/authors/edit.html.erb +6 -0
  49. data/examples/rails_example/app/views/authors/index.html.erb +25 -0
  50. data/examples/rails_example/app/views/authors/index.json.jbuilder +1 -0
  51. data/examples/rails_example/app/views/authors/new.html.erb +5 -0
  52. data/examples/rails_example/app/views/authors/show.html.erb +4 -0
  53. data/examples/rails_example/app/views/authors/show.json.jbuilder +1 -0
  54. data/examples/rails_example/app/views/books/_book.json.jbuilder +2 -0
  55. data/examples/rails_example/app/views/books/_form.html.erb +19 -0
  56. data/examples/rails_example/app/views/books/edit.html.erb +6 -0
  57. data/examples/rails_example/app/views/books/index.html.erb +25 -0
  58. data/examples/rails_example/app/views/books/index.json.jbuilder +1 -0
  59. data/examples/rails_example/app/views/books/new.html.erb +5 -0
  60. data/examples/rails_example/app/views/books/show.html.erb +4 -0
  61. data/examples/rails_example/app/views/books/show.json.jbuilder +1 -0
  62. data/examples/rails_example/app/views/libraries/_form.html.erb +19 -0
  63. data/examples/rails_example/app/views/libraries/_library.json.jbuilder +2 -0
  64. data/examples/rails_example/app/views/libraries/edit.html.erb +6 -0
  65. data/examples/rails_example/app/views/libraries/index.html.erb +25 -0
  66. data/examples/rails_example/app/views/libraries/index.json.jbuilder +1 -0
  67. data/examples/rails_example/app/views/libraries/new.html.erb +5 -0
  68. data/examples/rails_example/app/views/libraries/show.html.erb +4 -0
  69. data/examples/rails_example/app/views/libraries/show.json.jbuilder +1 -0
  70. data/examples/rails_example/config/initializers/grape.rb +2 -0
  71. data/examples/rails_example/config/initializers/sandboxy.rb +13 -0
  72. data/examples/rails_example/config/routes.rb +9 -3
  73. data/examples/rails_example/config/secrets.yml +2 -2
  74. data/examples/rails_example/db/migrate/20170827184048_create_books.rb +9 -0
  75. data/examples/rails_example/db/migrate/20170827184054_create_authors.rb +9 -0
  76. data/examples/rails_example/db/migrate/20170827184106_create_libraries.rb +9 -0
  77. data/examples/rails_example/db/migrate/20170827184304_create_applications.rb +11 -0
  78. data/examples/rails_example/db/migrate/{20170827105828_sandboxy_migration.rb → 20170827190815_sandboxy_migration.rb} +0 -0
  79. data/examples/rails_example/db/schema.rb +19 -3
  80. data/examples/rails_example/test/controllers/applications_controller_test.rb +48 -0
  81. data/examples/rails_example/test/controllers/authors_controller_test.rb +48 -0
  82. data/examples/rails_example/test/controllers/books_controller_test.rb +48 -0
  83. data/examples/rails_example/test/controllers/libraries_controller_test.rb +48 -0
  84. data/examples/rails_example/test/controllers/sandbox_controller_test.rb +7 -0
  85. data/examples/rails_example/test/fixtures/{bars.yml → applications.yml} +0 -0
  86. data/examples/rails_example/test/fixtures/{foos.yml → authors.yml} +0 -0
  87. data/examples/rails_example/test/fixtures/books.yml +11 -0
  88. data/examples/rails_example/test/fixtures/libraries.yml +11 -0
  89. data/examples/rails_example/test/models/application_test.rb +7 -0
  90. data/examples/rails_example/test/models/{bar_test.rb → author_test.rb} +1 -1
  91. data/examples/rails_example/test/models/{foo_test.rb → book_test.rb} +1 -1
  92. data/examples/rails_example/test/models/library_test.rb +7 -0
  93. data/examples/rails_example/test/system/applications_test.rb +9 -0
  94. data/examples/rails_example/test/system/authors_test.rb +9 -0
  95. data/examples/rails_example/test/system/books_test.rb +9 -0
  96. data/examples/rails_example/test/system/libraries_test.rb +9 -0
  97. data/lib/generators/sandboxy_generator.rb +4 -6
  98. data/lib/generators/templates/initializer.rb +13 -0
  99. data/lib/sandboxy/configuration.rb +11 -34
  100. data/lib/sandboxy/middleware.rb +3 -3
  101. data/lib/sandboxy/railtie.rb +3 -3
  102. data/lib/sandboxy/version.rb +1 -1
  103. data/lib/sandboxy.rb +12 -3
  104. data/sandboxy.gemspec +4 -6
  105. data/test/dummy30/config/initializers/sandboxy.rb +13 -0
  106. data/test/test_helper.rb +0 -2
  107. metadata +93 -78
  108. data/examples/rails_example/app/controllers/bars_controller.rb +0 -74
  109. data/examples/rails_example/app/controllers/foos_controller.rb +0 -74
  110. data/examples/rails_example/app/helpers/bars_helper.rb +0 -2
  111. data/examples/rails_example/app/helpers/foos_helper.rb +0 -2
  112. data/examples/rails_example/app/models/bar.rb +0 -2
  113. data/examples/rails_example/app/models/foo.rb +0 -2
  114. data/examples/rails_example/app/models/shared_sandbox.rb +0 -3
  115. data/examples/rails_example/app/views/bars/_bar.json.jbuilder +0 -2
  116. data/examples/rails_example/app/views/bars/_form.html.erb +0 -17
  117. data/examples/rails_example/app/views/bars/edit.html.erb +0 -6
  118. data/examples/rails_example/app/views/bars/index.html.erb +0 -25
  119. data/examples/rails_example/app/views/bars/index.json.jbuilder +0 -1
  120. data/examples/rails_example/app/views/bars/new.html.erb +0 -5
  121. data/examples/rails_example/app/views/bars/show.html.erb +0 -4
  122. data/examples/rails_example/app/views/bars/show.json.jbuilder +0 -1
  123. data/examples/rails_example/app/views/foos/_foo.json.jbuilder +0 -2
  124. data/examples/rails_example/app/views/foos/_form.html.erb +0 -17
  125. data/examples/rails_example/app/views/foos/edit.html.erb +0 -6
  126. data/examples/rails_example/app/views/foos/index.html.erb +0 -25
  127. data/examples/rails_example/app/views/foos/index.json.jbuilder +0 -1
  128. data/examples/rails_example/app/views/foos/new.html.erb +0 -5
  129. data/examples/rails_example/app/views/foos/show.html.erb +0 -4
  130. data/examples/rails_example/app/views/foos/show.json.jbuilder +0 -1
  131. data/examples/rails_example/config/sandboxy.yml +0 -13
  132. data/examples/rails_example/db/migrate/20170826223227_create_foos.rb +0 -8
  133. data/examples/rails_example/db/migrate/20170826223243_create_bars.rb +0 -8
  134. data/examples/rails_example/test/controllers/bars_controller_test.rb +0 -48
  135. data/examples/rails_example/test/controllers/foos_controller_test.rb +0 -48
  136. data/examples/rails_example/test/system/bars_test.rb +0 -9
  137. data/examples/rails_example/test/system/foos_test.rb +0 -9
  138. data/lib/generators/templates/configuration.yml.erb +0 -13
@@ -1,8 +0,0 @@
1
- class CreateBars < ActiveRecord::Migration[5.1]
2
- def change
3
- create_table :bars do |t|
4
-
5
- t.timestamps
6
- end
7
- end
8
- end
@@ -1,48 +0,0 @@
1
- require 'test_helper'
2
-
3
- class BarsControllerTest < ActionDispatch::IntegrationTest
4
- setup do
5
- @bar = bars(:one)
6
- end
7
-
8
- test "should get index" do
9
- get bars_url
10
- assert_response :success
11
- end
12
-
13
- test "should get new" do
14
- get new_bar_url
15
- assert_response :success
16
- end
17
-
18
- test "should create bar" do
19
- assert_difference('Bar.count') do
20
- post bars_url, params: { bar: { } }
21
- end
22
-
23
- assert_redirected_to bar_url(Bar.last)
24
- end
25
-
26
- test "should show bar" do
27
- get bar_url(@bar)
28
- assert_response :success
29
- end
30
-
31
- test "should get edit" do
32
- get edit_bar_url(@bar)
33
- assert_response :success
34
- end
35
-
36
- test "should update bar" do
37
- patch bar_url(@bar), params: { bar: { } }
38
- assert_redirected_to bar_url(@bar)
39
- end
40
-
41
- test "should destroy bar" do
42
- assert_difference('Bar.count', -1) do
43
- delete bar_url(@bar)
44
- end
45
-
46
- assert_redirected_to bars_url
47
- end
48
- end
@@ -1,48 +0,0 @@
1
- require 'test_helper'
2
-
3
- class FoosControllerTest < ActionDispatch::IntegrationTest
4
- setup do
5
- @foo = foos(:one)
6
- end
7
-
8
- test "should get index" do
9
- get foos_url
10
- assert_response :success
11
- end
12
-
13
- test "should get new" do
14
- get new_foo_url
15
- assert_response :success
16
- end
17
-
18
- test "should create foo" do
19
- assert_difference('Foo.count') do
20
- post foos_url, params: { foo: { } }
21
- end
22
-
23
- assert_redirected_to foo_url(Foo.last)
24
- end
25
-
26
- test "should show foo" do
27
- get foo_url(@foo)
28
- assert_response :success
29
- end
30
-
31
- test "should get edit" do
32
- get edit_foo_url(@foo)
33
- assert_response :success
34
- end
35
-
36
- test "should update foo" do
37
- patch foo_url(@foo), params: { foo: { } }
38
- assert_redirected_to foo_url(@foo)
39
- end
40
-
41
- test "should destroy foo" do
42
- assert_difference('Foo.count', -1) do
43
- delete foo_url(@foo)
44
- end
45
-
46
- assert_redirected_to foos_url
47
- end
48
- end
@@ -1,9 +0,0 @@
1
- require "application_system_test_case"
2
-
3
- class BarsTest < ApplicationSystemTestCase
4
- # test "visiting the index" do
5
- # visit bars_url
6
- #
7
- # assert_selector "h1", text: "Bar"
8
- # end
9
- end
@@ -1,9 +0,0 @@
1
- require "application_system_test_case"
2
-
3
- class FoosTest < ApplicationSystemTestCase
4
- # test "visiting the index" do
5
- # visit foos_url
6
- #
7
- # assert_selector "h1", text: "Foo"
8
- # end
9
- end
@@ -1,13 +0,0 @@
1
- # ----------
2
- # Sandboxy
3
- # ----------
4
-
5
- # Set your environment default: Must be either `live` or `sandbox`.
6
- # This is the environment that your app boots with.
7
- # By default it gets refreshed with every new request to your server.
8
- <% if options[:default] %>environment: <%= options[:default] %><% else %># environment: 'live'<% end %>
9
-
10
- # Specify whether to retain your current app environment on new requests.
11
- # If set to true, your app will only load your environment default when starting.
12
- # Every additional switch of your environment at runtime will then not be automatically resolved to your environment default on a new request.
13
- <% if options[:retain_environment] %>retain_environment: <%= options[:retain_environment] %><% else %># retain_environment: false<% end %>