flexite 0.0.2

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.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +12 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  6. data/app/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  7. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  8. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  9. data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  10. data/app/assets/images/flexite/glyphicons-halflings-white.png +0 -0
  11. data/app/assets/images/flexite/glyphicons-halflings.png +0 -0
  12. data/app/assets/javascripts/flexite/application.js +18 -0
  13. data/app/assets/javascripts/flexite/bootstrap.min.js +7 -0
  14. data/app/assets/javascripts/flexite/common.js.erb +2 -0
  15. data/app/assets/javascripts/flexite/jquery.min.js +2 -0
  16. data/app/assets/javascripts/flexite/tree.js.erb +83 -0
  17. data/app/assets/javascripts/flexite/treeview.js +1335 -0
  18. data/app/assets/stylesheets/flexite/application.css +29 -0
  19. data/app/assets/stylesheets/flexite/bootstrap-treeview.min.css +1 -0
  20. data/app/assets/stylesheets/flexite/bootstrap.min.css +5 -0
  21. data/app/assets/stylesheets/flexite/configs.css +8 -0
  22. data/app/assets/stylesheets/flexite/entries.css +4 -0
  23. data/app/assets/stylesheets/flexite/tree.css +21 -0
  24. data/app/assets/stylesheets/scaffold.css +56 -0
  25. data/app/controllers/flexite/application_controller.rb +25 -0
  26. data/app/controllers/flexite/configs_controller.rb +61 -0
  27. data/app/controllers/flexite/entries_controller.rb +82 -0
  28. data/app/factories/flexite/base_factory.rb +7 -0
  29. data/app/factories/flexite/service_factory.rb +19 -0
  30. data/app/forms/flexite/base_form.rb +24 -0
  31. data/app/forms/flexite/config/form.rb +12 -0
  32. data/app/forms/flexite/entry/array_form.rb +11 -0
  33. data/app/forms/flexite/entry/form.rb +16 -0
  34. data/app/helpers/flexite/application_helper.rb +15 -0
  35. data/app/helpers/flexite/configs_helper.rb +4 -0
  36. data/app/helpers/flexite/entries_helper.rb +46 -0
  37. data/app/models/flexite/arr_entry.rb +35 -0
  38. data/app/models/flexite/bool_entry.rb +19 -0
  39. data/app/models/flexite/config.rb +64 -0
  40. data/app/models/flexite/entry.rb +30 -0
  41. data/app/models/flexite/int_entry.rb +13 -0
  42. data/app/models/flexite/str_entry.rb +2 -0
  43. data/app/models/flexite/sym_entry.rb +17 -0
  44. data/app/services/flexite/action_service/result.rb +44 -0
  45. data/app/services/flexite/action_service.rb +30 -0
  46. data/app/services/flexite/config/create_service.rb +25 -0
  47. data/app/services/flexite/config/update_service.rb +28 -0
  48. data/app/services/flexite/data/hash.rb +17 -0
  49. data/app/services/flexite/data/migrators/yaml.rb +62 -0
  50. data/app/services/flexite/data/new.rb +87 -0
  51. data/app/services/flexite/entry/array_create_service.rb +69 -0
  52. data/app/services/flexite/entry/array_update_service.rb +69 -0
  53. data/app/services/flexite/entry/create_service.rb +31 -0
  54. data/app/services/flexite/entry/destroy_array_entry_service.rb +25 -0
  55. data/app/services/flexite/entry/destroy_service.rb +22 -0
  56. data/app/services/flexite/entry/update_service.rb +26 -0
  57. data/app/simple_form/array_input.rb +13 -0
  58. data/app/views/flexite/application/index.html.haml +14 -0
  59. data/app/views/flexite/configs/_form.html.haml +7 -0
  60. data/app/views/flexite/configs/create.js.haml +3 -0
  61. data/app/views/flexite/configs/edit.js.haml +1 -0
  62. data/app/views/flexite/configs/index.json.erb +10 -0
  63. data/app/views/flexite/configs/new.js.haml +1 -0
  64. data/app/views/flexite/configs/update.js.haml +2 -0
  65. data/app/views/flexite/entries/_form.html.haml +11 -0
  66. data/app/views/flexite/entries/_new_array_entry_form.html.haml +7 -0
  67. data/app/views/flexite/entries/_popup.html.haml +18 -0
  68. data/app/views/flexite/entries/_types_dropdown.html.haml +8 -0
  69. data/app/views/flexite/entries/create.js.haml +4 -0
  70. data/app/views/flexite/entries/destroy.js.haml +4 -0
  71. data/app/views/flexite/entries/destroy_array_entry.js.haml +6 -0
  72. data/app/views/flexite/entries/edit.js.haml +1 -0
  73. data/app/views/flexite/entries/new.js.haml +1 -0
  74. data/app/views/flexite/entries/new_array_entry.js.haml +1 -0
  75. data/app/views/flexite/entries/select_type.js.haml +1 -0
  76. data/app/views/flexite/entries/types/_arr_entry.html.haml +19 -0
  77. data/app/views/flexite/entries/types/_bool_entry.html.haml +4 -0
  78. data/app/views/flexite/entries/types/_int_entry.html.haml +4 -0
  79. data/app/views/flexite/entries/types/_str_entry.html.haml +4 -0
  80. data/app/views/flexite/entries/types/_sym_entry.html.haml +1 -0
  81. data/app/views/flexite/entries/update.js.haml +1 -0
  82. data/app/views/flexite/shared/_messages.html.haml +5 -0
  83. data/app/views/flexite/shared/_show_flash.js.haml +5 -0
  84. data/app/views/layouts/flexite/application.html.haml +11 -0
  85. data/config/initializers/simple_form.rb +143 -0
  86. data/config/initializers/simple_form_bootstrap.rb +43 -0
  87. data/config/locales/simple_form.en.yml +26 -0
  88. data/config/routes.rb +17 -0
  89. data/db/migrate/20180503102555_create_flexite_configs.rb +14 -0
  90. data/db/migrate/20180503103109_create_flexite_entries.rb +14 -0
  91. data/lib/flexite/cached_node.rb +19 -0
  92. data/lib/flexite/configuration.rb +24 -0
  93. data/lib/flexite/engine.rb +18 -0
  94. data/lib/flexite/flexy.rb +13 -0
  95. data/lib/flexite/nodes_hash.rb +5 -0
  96. data/lib/flexite/version.rb +3 -0
  97. data/lib/flexite.rb +44 -0
  98. data/lib/tasks/flexite_tasks.rake +20 -0
  99. data/test/dummy/README.rdoc +261 -0
  100. data/test/dummy/Rakefile +7 -0
  101. data/test/dummy/app/assets/javascripts/application.js +15 -0
  102. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  103. data/test/dummy/app/controllers/application_controller.rb +3 -0
  104. data/test/dummy/app/helpers/application_helper.rb +2 -0
  105. data/test/dummy/config/application.rb +59 -0
  106. data/test/dummy/config/application.yml +599 -0
  107. data/test/dummy/config/boot.rb +10 -0
  108. data/test/dummy/config/database.yml +25 -0
  109. data/test/dummy/config/environment.rb +5 -0
  110. data/test/dummy/config/environments/development.rb +40 -0
  111. data/test/dummy/config/environments/production.rb +67 -0
  112. data/test/dummy/config/environments/test.rb +37 -0
  113. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  114. data/test/dummy/config/initializers/flexite.rb +5 -0
  115. data/test/dummy/config/initializers/inflections.rb +15 -0
  116. data/test/dummy/config/initializers/mime_types.rb +5 -0
  117. data/test/dummy/config/initializers/secret_token.rb +7 -0
  118. data/test/dummy/config/initializers/session_store.rb +8 -0
  119. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  120. data/test/dummy/config/locales/en.yml +5 -0
  121. data/test/dummy/config/routes.rb +3 -0
  122. data/test/dummy/config.ru +4 -0
  123. data/test/dummy/db/development.sqlite3 +0 -0
  124. data/test/dummy/db/schema.rb +39 -0
  125. data/test/dummy/db/seeds.rb +3 -0
  126. data/test/dummy/db/test.sqlite3 +0 -0
  127. data/test/dummy/log/development.log +86588 -0
  128. data/test/dummy/public/404.html +26 -0
  129. data/test/dummy/public/422.html +26 -0
  130. data/test/dummy/public/500.html +25 -0
  131. data/test/dummy/public/favicon.ico +0 -0
  132. data/test/dummy/script/rails +6 -0
  133. data/test/dummy/tmp/cache/assets/C67/060/sprockets%2Ffaf176441f0544dd2b51901280044b40 +0 -0
  134. data/test/dummy/tmp/cache/assets/C9D/530/sprockets%2Fdcd49c063327c12052812f41c20a8e74 +0 -0
  135. data/test/dummy/tmp/cache/assets/CA3/270/sprockets%2F502b740063f8ec15e7e12811da71c772 +0 -0
  136. data/test/dummy/tmp/cache/assets/CDC/060/sprockets%2F8ff1d307d1b36810549d0829722b7aea +0 -0
  137. data/test/dummy/tmp/cache/assets/CDE/120/sprockets%2F5fd8b3fa3724451579552aed373410ce +0 -0
  138. data/test/dummy/tmp/cache/assets/CF8/980/sprockets%2F4e5077b95460dc34d7c9d7d9880e7b47 +0 -0
  139. data/test/dummy/tmp/cache/assets/D00/4C0/sprockets%2F603c6d7b825c2f4a6422b3d4af4e6203 +0 -0
  140. data/test/dummy/tmp/cache/assets/D00/C40/sprockets%2F999847c008fb4ce26fff5607c39d8358 +0 -0
  141. data/test/dummy/tmp/cache/assets/D09/A30/sprockets%2F2a71e20a2f3544acb51956504cd8d8e9 +0 -0
  142. data/test/dummy/tmp/cache/assets/D0D/E60/sprockets%2F90ea9eaa4671ec2d76703bae31972634 +0 -0
  143. data/test/dummy/tmp/cache/assets/D2A/160/sprockets%2Fbe17d4d0be4b381500e2824bbe273d70 +0 -0
  144. data/test/dummy/tmp/cache/assets/D2E/700/sprockets%2Fb21f85e0940bbcb3a8914c9cb0b07218 +0 -0
  145. data/test/dummy/tmp/cache/assets/D39/CD0/sprockets%2F0e8f6981475e49ea9fe14698fa57e4e9 +0 -0
  146. data/test/dummy/tmp/cache/assets/D40/590/sprockets%2F181dd5673b58f1ec4c89e50028bfad60 +0 -0
  147. data/test/dummy/tmp/cache/assets/D46/870/sprockets%2Fd880bdf72c5d0009b88fda8521439dc8 +0 -0
  148. data/test/dummy/tmp/cache/assets/D48/5F0/sprockets%2Fe6a83afb2d92f4692ffb391b5285a518 +0 -0
  149. data/test/dummy/tmp/cache/assets/D4B/A20/sprockets%2Febde89014596e655c35df9c4a01ee636 +0 -0
  150. data/test/dummy/tmp/cache/assets/D54/A50/sprockets%2Ff49839d906f69fd92904ebac07a3a38e +0 -0
  151. data/test/dummy/tmp/cache/assets/D69/B50/sprockets%2F4186e2787004e19ceb0c4afed46cf04b +0 -0
  152. data/test/dummy/tmp/cache/assets/D6D/C20/sprockets%2F112e96fea93f5f1e31d2077f1cdaf283 +0 -0
  153. data/test/dummy/tmp/cache/assets/D7A/8F0/sprockets%2F8eefc5f9824d950317a5c4a2e68b3c4e +0 -0
  154. data/test/dummy/tmp/cache/assets/DB3/360/sprockets%2F24b1f98ad736884b91d6ebeb2fc68ed8 +0 -0
  155. data/test/dummy/tmp/cache/assets/DD2/E90/sprockets%2Ff01f48c96ba588d15b20dd57ed3ccb7f +0 -0
  156. data/test/dummy/tmp/cache/assets/DEE/0C0/sprockets%2Feedcd74856542eedb5ea3ab1b1502ca4 +0 -0
  157. data/test/dummy/tmp/cache/assets/DF1/210/sprockets%2Ff4fe7dba1445ba1b668aaa1bd34ca984 +0 -0
  158. data/test/dummy/tmp/cache/assets/E44/790/sprockets%2Fefb8d8ea9e97da9d675a8bfa1d5de343 +0 -0
  159. data/test/fixtures/flexite/configs.yml +7 -0
  160. data/test/fixtures/flexite/entries.yml +13 -0
  161. data/test/flexite_test.rb +7 -0
  162. data/test/functional/flexite/configs_controller_test.rb +51 -0
  163. data/test/functional/flexite/entries_controller_test.rb +51 -0
  164. data/test/integration/navigation_test.rb +10 -0
  165. data/test/test_helper.rb +15 -0
  166. data/test/unit/flexite/config_test.rb +9 -0
  167. data/test/unit/flexite/entry_test.rb +9 -0
  168. data/test/unit/helpers/flexite/configs_helper_test.rb +6 -0
  169. data/test/unit/helpers/flexite/entries_helper_test.rb +6 -0
  170. metadata +366 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ value: MyString
5
+ type:
6
+ entry:
7
+ config:
8
+
9
+ two:
10
+ value: MyString
11
+ type:
12
+ entry:
13
+ config:
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class FlexiteTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Flexite
6
+ end
7
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class ConfigsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @config = configs(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:configs)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create config" do
21
+ assert_difference('Config.count') do
22
+ post :create, config: { name: @config.name }
23
+ end
24
+
25
+ assert_redirected_to config_path(assigns(:config))
26
+ end
27
+
28
+ test "should show config" do
29
+ get :show, id: @config
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @config
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update config" do
39
+ put :update, id: @config, config: { name: @config.name }
40
+ assert_redirected_to config_path(assigns(:config))
41
+ end
42
+
43
+ test "should destroy config" do
44
+ assert_difference('Config.count', -1) do
45
+ delete :destroy, id: @config
46
+ end
47
+
48
+ assert_redirected_to configs_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class EntriesControllerTest < ActionController::TestCase
5
+ setup do
6
+ @entry = entries(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:entries)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create entry" do
21
+ assert_difference('Entry.count') do
22
+ post :create, entry: { type: @entry.type, value: @entry.value }
23
+ end
24
+
25
+ assert_redirected_to entry_path(assigns(:entry))
26
+ end
27
+
28
+ test "should show entry" do
29
+ get :show, id: @entry
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @entry
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update entry" do
39
+ put :update, id: @entry, entry: { type: @entry.type, value: @entry.value }
40
+ assert_redirected_to entry_path(assigns(:entry))
41
+ end
42
+
43
+ test "should destroy entry" do
44
+ assert_difference('Entry.count', -1) do
45
+ delete :destroy, id: @entry
46
+ end
47
+
48
+ assert_redirected_to entries_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class ConfigTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class EntryTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class ConfigsHelperTest < ActionView::TestCase
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module Flexite
4
+ class EntriesHelperTest < ActionView::TestCase
5
+ end
6
+ end