smartkiosk-server 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/.gitignore +32 -0
  2. data/.rspec +1 -0
  3. data/Capfile +4 -0
  4. data/Gemfile +71 -0
  5. data/Gemfile.lock +439 -0
  6. data/Guardfile +25 -0
  7. data/LICENSE +287 -0
  8. data/README.md +13 -0
  9. data/Rakefile +5 -0
  10. data/app/acquirers/cards_mkb_acquirer.rb +87 -0
  11. data/app/acquirers/cash_acquirer.rb +22 -0
  12. data/app/admin/agents.rb +108 -0
  13. data/app/admin/collections.rb +62 -0
  14. data/app/admin/commissions.rb +87 -0
  15. data/app/admin/gateways.rb +183 -0
  16. data/app/admin/limits.rb +82 -0
  17. data/app/admin/payments.rb +246 -0
  18. data/app/admin/provider_groups.rb +60 -0
  19. data/app/admin/provider_profiles.rb +11 -0
  20. data/app/admin/provider_receipt_templates.rb +82 -0
  21. data/app/admin/providers.rb +201 -0
  22. data/app/admin/rebates.rb +83 -0
  23. data/app/admin/report_results.rb +66 -0
  24. data/app/admin/report_templates.rb +209 -0
  25. data/app/admin/reports.rb +158 -0
  26. data/app/admin/revisions.rb +120 -0
  27. data/app/admin/system_receipt_templates.rb +76 -0
  28. data/app/admin/terminal_builds.rb +39 -0
  29. data/app/admin/terminal_profiles.rb +123 -0
  30. data/app/admin/terminals.rb +388 -0
  31. data/app/admin/users.rb +117 -0
  32. data/app/admin/versions.rb +131 -0
  33. data/app/admin/welcome.rb +64 -0
  34. data/app/assets/fonts/PT_Sans-Web-Bold.eot +0 -0
  35. data/app/assets/fonts/PT_Sans-Web-Bold.svg +6386 -0
  36. data/app/assets/fonts/PT_Sans-Web-Bold.ttf +0 -0
  37. data/app/assets/fonts/PT_Sans-Web-Bold.woff +0 -0
  38. data/app/assets/fonts/PT_Sans-Web-Regular.eot +0 -0
  39. data/app/assets/fonts/PT_Sans-Web-Regular.svg +5650 -0
  40. data/app/assets/fonts/PT_Sans-Web-Regular.ttf +0 -0
  41. data/app/assets/fonts/PT_Sans-Web-Regular.woff +0 -0
  42. data/app/assets/images/chosen-sprite.png +0 -0
  43. data/app/assets/javascripts/active_admin/chosen.js.erb.coffee +12 -0
  44. data/app/assets/javascripts/active_admin/qtip.js.coffee +22 -0
  45. data/app/assets/javascripts/active_admin/sortable_forms.js.coffee +14 -0
  46. data/app/assets/javascripts/active_admin.js.coffee +9 -0
  47. data/app/assets/javascripts/application.js +15 -0
  48. data/app/assets/javascripts/report_templates.js.coffee +10 -0
  49. data/app/assets/javascripts/terminals.js.coffee +12 -0
  50. data/app/assets/stylesheets/active_admin/PIE.css.scss +18 -0
  51. data/app/assets/stylesheets/active_admin/filter_numeric_range.css.scss +14 -0
  52. data/app/assets/stylesheets/active_admin/selectable_check_boxes.css.scss +12 -0
  53. data/app/assets/stylesheets/active_admin/sortable_forms.css.scss +11 -0
  54. data/app/assets/stylesheets/active_admin.css.scss +705 -0
  55. data/app/assets/stylesheets/fonts.css.scss +14 -0
  56. data/app/assets/stylesheets/provider_groups.css.scss +12 -0
  57. data/app/assets/stylesheets/provider_receipt_templates.css.scss +12 -0
  58. data/app/assets/stylesheets/terminals.css.scss +9 -0
  59. data/app/controllers/application_controller.rb +12 -0
  60. data/app/controllers/collections_controller.rb +10 -0
  61. data/app/controllers/payments_controller.rb +73 -0
  62. data/app/controllers/system_receipt_templates_controller.rb +10 -0
  63. data/app/controllers/terminal_builds_controller.rb +5 -0
  64. data/app/controllers/terminal_orders_controller.rb +25 -0
  65. data/app/controllers/terminal_pings_controller.rb +45 -0
  66. data/app/controllers/welcome_controller.rb +5 -0
  67. data/app/helpers/active_admin/report_templates_helper.rb +56 -0
  68. data/app/helpers/active_admin/views_helper.rb +20 -0
  69. data/app/helpers/application_helper.rb +2 -0
  70. data/app/mailers/.gitkeep +0 -0
  71. data/app/models/.gitkeep +0 -0
  72. data/app/models/ability.rb +30 -0
  73. data/app/models/agent.rb +24 -0
  74. data/app/models/collection.rb +65 -0
  75. data/app/models/commission.rb +77 -0
  76. data/app/models/commission_section.rb +75 -0
  77. data/app/models/gateway.rb +99 -0
  78. data/app/models/gateway_attachment.rb +9 -0
  79. data/app/models/gateway_setting.rb +7 -0
  80. data/app/models/gateway_switch.rb +7 -0
  81. data/app/models/limit.rb +77 -0
  82. data/app/models/limit_section.rb +58 -0
  83. data/app/models/payment.rb +322 -0
  84. data/app/models/provider.rb +59 -0
  85. data/app/models/provider_field.rb +7 -0
  86. data/app/models/provider_gateway.rb +47 -0
  87. data/app/models/provider_group.rb +45 -0
  88. data/app/models/provider_profile.rb +9 -0
  89. data/app/models/provider_rebate.rb +69 -0
  90. data/app/models/provider_receipt_template.rb +85 -0
  91. data/app/models/rebate.rb +84 -0
  92. data/app/models/report.rb +71 -0
  93. data/app/models/report_result.rb +11 -0
  94. data/app/models/report_template.rb +56 -0
  95. data/app/models/revision.rb +104 -0
  96. data/app/models/role.rb +48 -0
  97. data/app/models/system_receipt_template.rb +13 -0
  98. data/app/models/terminal.rb +126 -0
  99. data/app/models/terminal_build.rb +62 -0
  100. data/app/models/terminal_order.rb +42 -0
  101. data/app/models/terminal_ping.rb +120 -0
  102. data/app/models/terminal_profile.rb +51 -0
  103. data/app/models/terminal_profile_promotion.rb +18 -0
  104. data/app/models/terminal_profile_provider.rb +11 -0
  105. data/app/models/terminal_profile_provider_group.rb +19 -0
  106. data/app/models/user.rb +38 -0
  107. data/app/models/user_role.rb +45 -0
  108. data/app/reports/agents_report.rb +81 -0
  109. data/app/reports/collections_report.rb +151 -0
  110. data/app/reports/payments_report.rb +189 -0
  111. data/app/reports/terminals_report.rb +123 -0
  112. data/app/uploaders/file_uploader.rb +53 -0
  113. data/app/uploaders/icon_uploader.rb +15 -0
  114. data/app/uploaders/zip_uploader.rb +53 -0
  115. data/app/views/admin/gateways/providers.html.arb +10 -0
  116. data/app/views/admin/revisions/payments.html.arb +28 -0
  117. data/app/views/admin/terminal_profiles/_tree.html.haml +35 -0
  118. data/app/views/admin/terminal_profiles/sort.html.haml +21 -0
  119. data/app/views/admin/terminals/pings.html.arb +55 -0
  120. data/app/views/admin/terminals/upgrade_build.html.arb +30 -0
  121. data/app/views/layouts/application.html.erb +1 -0
  122. data/app/views/welcome/index.html.erb +25 -0
  123. data/app/workers/pay_worker.rb +11 -0
  124. data/app/workers/report_worker.rb +7 -0
  125. data/app/workers/revise_worker.rb +7 -0
  126. data/config/acquiring.yml +13 -0
  127. data/config/application.rb +75 -0
  128. data/config/boot.rb +6 -0
  129. data/config/database.yml +17 -0
  130. data/config/deploy/roundlake-passenger.rb +3 -0
  131. data/config/deploy/roundlake-trinidad.rb +3 -0
  132. data/config/deploy.rb +37 -0
  133. data/config/environment.rb +5 -0
  134. data/config/environments/development.rb +39 -0
  135. data/config/environments/production.rb +67 -0
  136. data/config/environments/test.rb +37 -0
  137. data/config/initializers/active_admin.rb +31 -0
  138. data/config/initializers/backtrace_silencers.rb +7 -0
  139. data/config/initializers/devise.rb +232 -0
  140. data/config/initializers/inflections.rb +15 -0
  141. data/config/initializers/mime_types.rb +5 -0
  142. data/config/initializers/money.rb +6 -0
  143. data/config/initializers/redis.rb +4 -0
  144. data/config/initializers/secret_token.rb +7 -0
  145. data/config/initializers/session_store.rb +8 -0
  146. data/config/initializers/setup_rack.rb +1 -0
  147. data/config/initializers/wrap_parameters.rb +14 -0
  148. data/config/locales/active_admin.ru.yml +71 -0
  149. data/config/locales/activerecord.ru.yml +645 -0
  150. data/config/locales/devise.ru.yml +57 -0
  151. data/config/locales/ru.yml +33 -0
  152. data/config/locales/smartkiosk.gateways.ru.yml +241 -0
  153. data/config/locales/smartkiosk.hardware.ru.yml +38 -0
  154. data/config/locales/smartkiosk.reports.ru.yml +56 -0
  155. data/config/locales/smartkiosk.ru.yml +163 -0
  156. data/config/nginx.conf +9 -0
  157. data/config/redis.yml +9 -0
  158. data/config/routes.rb +48 -0
  159. data/config/schedule.rb +13 -0
  160. data/config/sidekiq.yml +5 -0
  161. data/config/trinidad.yml +6 -0
  162. data/config.ru +4 -0
  163. data/db/migrate/20120825083035_create_terminals.rb +47 -0
  164. data/db/migrate/20120825083305_create_payments.rb +51 -0
  165. data/db/migrate/20120827062618_devise_create_users.rb +50 -0
  166. data/db/migrate/20120827132621_create_admin_notes.rb +17 -0
  167. data/db/migrate/20120827132622_move_admin_notes_to_comments.rb +25 -0
  168. data/db/migrate/20120903193346_create_providers.rb +24 -0
  169. data/db/migrate/20120922075345_create_collections.rb +26 -0
  170. data/db/migrate/20120922080440_create_agents.rb +29 -0
  171. data/db/migrate/20120922081104_create_commissions.rb +10 -0
  172. data/db/migrate/20120927035841_create_gateways.rb +13 -0
  173. data/db/migrate/20120927040626_create_provider_gateways.rb +13 -0
  174. data/db/migrate/20120927091849_create_limits.rb +10 -0
  175. data/db/migrate/20120927164647_create_roles.rb +14 -0
  176. data/db/migrate/20121003131522_create_report_templates.rb +18 -0
  177. data/db/migrate/20121007135652_create_reports.rb +13 -0
  178. data/db/migrate/20121008073905_create_report_results.rb +10 -0
  179. data/db/migrate/20121017114538_create_gateway_settings.rb +12 -0
  180. data/db/migrate/20121017114556_create_gateway_attachments.rb +10 -0
  181. data/db/migrate/20121019132606_create_revisions.rb +19 -0
  182. data/db/migrate/20121023073501_create_gateway_switches.rb +10 -0
  183. data/db/migrate/20121112142743_create_terminal_orders.rb +13 -0
  184. data/db/migrate/20121118191553_create_versions.rb +19 -0
  185. data/db/migrate/20121125093414_create_system_receipt_templates.rb +9 -0
  186. data/db/migrate/20121127192257_create_terminal_builds.rb +10 -0
  187. data/db/migrate/20121212053441_create_rebates.rb +15 -0
  188. data/db/migrate/20121216143855_create_provider_receipt_templates.rb +9 -0
  189. data/db/migrate/20130101091100_create_terminal_profiles.rb +13 -0
  190. data/db/migrate/20130101091734_create_provider_rebates.rb +21 -0
  191. data/db/migrate/20130102164447_create_limit_sections.rb +14 -0
  192. data/db/migrate/20130102164503_create_commission_sections.rb +17 -0
  193. data/db/migrate/20130102171743_create_provider_profiles.rb +10 -0
  194. data/db/migrate/20130103152507_create_provider_fields.rb +17 -0
  195. data/db/migrate/20130103154526_create_provider_groups.rb +10 -0
  196. data/db/migrate/20130104063628_create_terminal_profile_providers.rb +11 -0
  197. data/db/migrate/20130104090957_create_terminal_profile_provider_groups.rb +11 -0
  198. data/db/migrate/20130108091644_create_terminal_profile_promotions.rb +10 -0
  199. data/db/schema.rb +489 -0
  200. data/db/seeds/receipt_templates/payment.txt +19 -0
  201. data/db/seeds/receipt_templates/system/balance.txt +13 -0
  202. data/db/seeds/receipt_templates/system/collection.txt +17 -0
  203. data/db/seeds/receipt_templates/system/touchtest.txt +15 -0
  204. data/db/seeds.rb +18 -0
  205. data/doc/README_FOR_APP +2 -0
  206. data/init.rb +1 -0
  207. data/lib/active_admin/cancan_integration.rb +81 -0
  208. data/lib/active_admin/form_builder_fix.rb +76 -0
  209. data/lib/active_admin/inputs/filter_date_range_input_fix.rb +24 -0
  210. data/lib/active_admin/inputs/filter_multiple_select_input.rb +18 -0
  211. data/lib/active_admin/inputs/filter_numeric_range_input.rb +31 -0
  212. data/lib/active_admin/resource_controller_fix.rb +23 -0
  213. data/lib/active_admin/views/pages/base_fix.rb +13 -0
  214. data/lib/assets/.gitkeep +0 -0
  215. data/lib/blueprints.rb +79 -0
  216. data/lib/date_expander.rb +38 -0
  217. data/lib/dav4rack/build_resource.rb +59 -0
  218. data/lib/formtastic/inputs/selectable_check_boxes.rb +39 -0
  219. data/lib/paper_trail/version_fix.rb +3 -0
  220. data/lib/report_builder.rb +88 -0
  221. data/lib/seeder.rb +103 -0
  222. data/lib/smartkiosk/server/version.rb +5 -0
  223. data/lib/smartkiosk/server.rb +35 -0
  224. data/lib/string_file.rb +12 -0
  225. data/lib/tasks/.gitkeep +0 -0
  226. data/lib/tasks/db.rake +27 -0
  227. data/lib/tasks/dump.rake +53 -0
  228. data/lib/tasks/matrioshka.rake +16 -0
  229. data/log/.gitkeep +0 -0
  230. data/log/gateways/.gitkeep +0 -0
  231. data/public/404.html +26 -0
  232. data/public/422.html +26 -0
  233. data/public/500.html +25 -0
  234. data/public/robots.txt +5 -0
  235. data/script/rails +6 -0
  236. data/smartkiosk-server.gemspec +23 -0
  237. data/spec/controllers/collections_controller_spec.rb +32 -0
  238. data/spec/controllers/payments_controller_spec.rb +123 -0
  239. data/spec/controllers/system_receipt_templates_controller_spec.rb +5 -0
  240. data/spec/controllers/terminal_builds_controller_spec.rb +5 -0
  241. data/spec/controllers/terminal_orders_controller_spec.rb +32 -0
  242. data/spec/controllers/terminal_pings_controller_spec.rb +31 -0
  243. data/spec/spec_helper.rb +66 -0
  244. data/vendor/assets/javascripts/.gitkeep +0 -0
  245. data/vendor/assets/javascripts/chosen.jquery.js +1026 -0
  246. data/vendor/assets/javascripts/datepicker-ru.jquery.js +21 -0
  247. data/vendor/assets/javascripts/nestedSortable.jquery.js +429 -0
  248. data/vendor/assets/javascripts/qtip.jquery.js +3403 -0
  249. data/vendor/assets/stylesheets/.gitkeep +0 -0
  250. data/vendor/assets/stylesheets/chosen.jquery.css +397 -0
  251. data/vendor/assets/stylesheets/modules/PIE.htc +96 -0
  252. data/vendor/assets/stylesheets/qtip.jquery.css.scss +604 -0
  253. data/vendor/plugins/.gitkeep +0 -0
  254. metadata +333 -0
@@ -0,0 +1,55 @@
1
+ table_for(terminal.pings, :class => 'index_table index', :i18n => TerminalPing) do |t|
2
+ t.column :created_at
3
+ t.column :condition do |x|
4
+ status_tag I18n.t("smartkiosk.terminal_conditions.#{x.condition}"), x.condition.to_sym
5
+ end
6
+ t.column :state do |x|
7
+ I18n.t "smartkiosk.terminal_states.#{x.state}"
8
+ end
9
+ t.column :version
10
+ t.column :ip
11
+ t.column :queues do |x|
12
+ ul do
13
+ x.queues.each do |queue, count|
14
+ li :style => 'white-space: nowrap' do
15
+ b queue+':'
16
+ span count
17
+ end
18
+ end
19
+ end
20
+ end
21
+ t.column :banknotes do |x|
22
+ ul do
23
+ x.banknotes.each do |banknote, count|
24
+ li :style => 'white-space: nowrap' do
25
+ b banknote+':'
26
+ span count
27
+ end
28
+ end
29
+ end
30
+ end
31
+ Terminal::HARDWARE.each do |hardware|
32
+ t.column :"#{hardware}_error" do |x|
33
+ div :style => 'white-space: nowrap' do
34
+ if x.error(hardware).blank?
35
+ status_tag I18n.t('formtastic.no'), :ok
36
+ else
37
+ status_tag(
38
+ (
39
+ I18n.t("smartkiosk.hardware.#{hardware}.errors")[x.error(hardware)] ||
40
+ I18n.t('smartkiosk.unlocalized') + " (#{x.error(hardware)})"
41
+ ),
42
+ :error
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
48
+ t.column :cash_sum
49
+ t.column :cash_count
50
+ t.column :cash_acceptor_version
51
+ t.column :printer_version
52
+ t.column :modem_balance
53
+ t.column :modem_signal_level
54
+ t.column :modem_version
55
+ end
@@ -0,0 +1,30 @@
1
+ table :style => 'width: 80%', :align => 'center' do
2
+ tr do
3
+ td :style => 'width: 40%;' do
4
+ div :style => 'padding-right: 20px;' do
5
+ h3 I18n.t('smartkiosk.admin.messages.terminals.terminals_to_upgrade'), :style => 'font-weight: bold;'
6
+ assigns[:terminals].each_with_index do |t, i|
7
+ div t.keyword, :style => 'width: 33%; float: left'
8
+ end
9
+ end
10
+ end
11
+ td :style => 'width: 1px;' do
12
+ div :style => 'padding: 40px; background-color: #FFADAD' do
13
+ h2 I18n.t('smartkiosk.admin.messages.terminals.build_to_upgrade'), :style => 'white-space: nowrap'
14
+ form :action => upgrade_admin_terminal_path(assigns[:ids]), :method => :post do
15
+ input :type => 'hidden', :name => 'authenticity_token', :value => form_authenticity_token
16
+ select :name => 'build_id', :class => 'chosen', :style => 'width: 400px' do
17
+ TerminalBuild.all.each do |tb|
18
+ option tb.version, :value => tb.id
19
+ end
20
+ end
21
+ div :style => 'margin-top: 15px' do
22
+ input :value => I18n.t('smartkiosk.admin.actions.terminals.upgrade'), :type => 'submit'
23
+ end
24
+ end
25
+ end
26
+ end
27
+ td do
28
+ end
29
+ end
30
+ end
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Access rejected (403)</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
+ <div class="dialog">
21
+ <h1>You are not supposed to be here.</h1>
22
+ <p>You might be unauthorized or just mistyped the url.</p>
23
+ </div>
24
+ </body>
25
+ </html>
@@ -0,0 +1,11 @@
1
+ class PayWorker
2
+ include Sidekiq::Worker
3
+
4
+ def perform(payment_id)
5
+ payment = Payment.find(payment_id)
6
+
7
+ payment.plog :info, :queue, "Paid" do
8
+ payment.pay!
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class ReportWorker
2
+ include Sidekiq::Worker
3
+
4
+ def perform(report_id)
5
+ Report.find(report_id).build!
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class ReviseWorker
2
+ include Sidekiq::Worker
3
+
4
+ def perform(revision_id)
5
+ Revision.find(revision_id).perform!
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ - type: cash
2
+ class: CashAcquirer
3
+ - type: inner_card, foreign_card
4
+ class: CardsMkbAcquirer
5
+ dhi: 'tcp://195.191.76.150:4007'
6
+ processing_code: "00000000"
7
+ merchant_type: "4814"
8
+ acquirer_country: "643"
9
+ entry_mode: "9010"
10
+ condition_code: "00"
11
+ acquirer: "443222"
12
+ terminal_id: "49990001"
13
+ acceptor_id: "510000000000016"
@@ -0,0 +1,75 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ require_relative '../lib/smartkiosk/server/version'
13
+
14
+ module Smartkiosk
15
+ module Server
16
+ def self.revision
17
+ file = File.expand_path '../../REVISION', __FILE__
18
+ File.exist?(file) ? File.read(file).strip : nil
19
+ end
20
+
21
+ class Application < Rails::Application
22
+ # Settings in config/environments/* take precedence over those specified here.
23
+ # Application configuration should go into files in config/initializers
24
+ # -- all .rb files in that directory are automatically loaded.
25
+
26
+ # Custom directories with classes and modules you want to be autoloadable.
27
+ config.autoload_paths += %W(#{config.root}/acquirers #{config.root}/reports #{config.root}/lib)
28
+
29
+ # Only load the plugins named here, in the order given (default is alphabetical).
30
+ # :all can be used as a placeholder for all plugins not explicitly named.
31
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
32
+
33
+ # Activate observers that should always be running.
34
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
35
+
36
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
37
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
38
+ # config.time_zone = 'Central Time (US & Canada)'
39
+
40
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
41
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
42
+ config.i18n.default_locale = :ru
43
+ config.i18n.locale = :ru
44
+
45
+ # Configure the default encoding used in templates for Ruby 1.9.
46
+ config.encoding = "utf-8"
47
+
48
+ # Configure sensitive parameters which will be filtered from the log file.
49
+ config.filter_parameters += [:password]
50
+
51
+ # Enable escaping HTML in JSON.
52
+ config.active_support.escape_html_entities_in_json = true
53
+
54
+ # Use SQL instead of Active Record's schema dumper when creating the database.
55
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
56
+ # like if you have constraints or database-specific column types
57
+ # config.active_record.schema_format = :sql
58
+
59
+ # Enforce whitelist mode for mass assignment.
60
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
61
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
62
+ # parameters by using an attr_accessible or attr_protected declaration.
63
+ config.active_record.whitelist_attributes = false
64
+
65
+ config.active_record.default_timezone = :local
66
+ config.active_record.time_zone_aware_attributes = false
67
+
68
+ # Enable the asset pipeline
69
+ config.assets.enabled = true
70
+
71
+ # Version of your assets, change this if you want to expire all your assets
72
+ config.assets.version = '1.0'
73
+ end
74
+ end
75
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,17 @@
1
+ development:
2
+ adapter: sqlite3
3
+ database: db/development.sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+
7
+ test:
8
+ adapter: sqlite3
9
+ database: db/test.sqlite3
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ production:
14
+ adapter: sqlite3
15
+ database: db/production.sqlite3
16
+ pool: 5
17
+ timeout: 5000
@@ -0,0 +1,3 @@
1
+ role :web, "smartkiosk-dev1.rdlk.net"
2
+ role :app, "smartkiosk-dev1.rdlk.net"
3
+ role :db, "smartkiosk-dev1.rdlk.net", :primary => true
@@ -0,0 +1,3 @@
1
+ role :web, "smartkiosk-dev4.rdlk.net"
2
+ role :app, "smartkiosk-dev4.rdlk.net"
3
+ role :db, "smartkiosk-dev4.rdlk.net", :primary => true
data/config/deploy.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'bundler/capistrano'
2
+ require 'sidekiq/capistrano'
3
+ require 'capistrano/ext/multistage'
4
+
5
+ set :stages, %w(roundlake-passenger roundlake-trinidad mkb mkb-test)
6
+ set :default_stage, 'roundlake-passenger'
7
+ set :application, 'smartkiosk'
8
+
9
+ on :start do
10
+ set :rails_env, 'production'
11
+ end
12
+
13
+ set :repository, 'git@github.com:smartkiosk/smartkiosk-server.git'
14
+
15
+ set :keep_releases, 1
16
+
17
+ set :use_sudo, false
18
+ set :user, "deployer"
19
+
20
+ set :deploy_to, "/home/deployer/www/#{application}"
21
+
22
+ after 'deploy:update_code', 'deploy:configure'
23
+ before 'deploy:create_symlink', 'deploy:install'
24
+
25
+ namespace :deploy do
26
+ task :configure do
27
+ run "ln -f #{shared_path}/config/database.yml #{release_path}/config/database.yml"
28
+ end
29
+
30
+ task :install do
31
+ run "cd #{release_path}; bundle exec rake db:install RAILS_ENV=#{rails_env} SEED_TEST=true"
32
+ end
33
+
34
+ task :restart do
35
+ run "touch #{current_path}/tmp/restart.txt"
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Rails.application.class.initialize!
@@ -0,0 +1,39 @@
1
+ Rails.application.class.configure do
2
+ config.enabled = true
3
+
4
+ # Settings specified here will take precedence over those in config/application.rb
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Log error messages when you accidentally call methods on nil.
12
+ config.whiny_nils = true
13
+
14
+ # Show full error reports and disable caching
15
+ config.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
17
+
18
+ # Don't care if the mailer can't send
19
+ config.action_mailer.raise_delivery_errors = false
20
+
21
+ # Print deprecation notices to the Rails logger
22
+ config.active_support.deprecation = :log
23
+
24
+ # Only use best-standards-support built into browsers
25
+ config.action_dispatch.best_standards_support = :builtin
26
+
27
+ # Raise exception on mass assignment protection for Active Record models
28
+ config.active_record.mass_assignment_sanitizer = :strict
29
+
30
+ # Log the query plan for queries taking more than this (works
31
+ # with SQLite, MySQL, and PostgreSQL)
32
+ #config.active_record.auto_explain_threshold_in_seconds = 0.5
33
+
34
+ # Do not compress assets
35
+ config.assets.compress = false
36
+
37
+ # Expands the lines which load the assets
38
+ config.assets.debug = true
39
+ end
@@ -0,0 +1,67 @@
1
+ Rails.application.class.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = true
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ config.assets.precompile += %w( modules/PIE.htc )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Rails.application.class.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = false
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,31 @@
1
+ require 'active_admin/cancan_integration'
2
+ require 'active_admin/views/pages/base_fix'
3
+ require 'active_admin/form_builder_fix'
4
+ require 'active_admin/resource_controller_fix'
5
+ require 'active_admin/inputs/filter_numeric_range_input'
6
+ require 'active_admin/inputs/filter_multiple_select_input'
7
+ require 'active_admin/inputs/filter_date_range_input_fix'
8
+ require 'paper_trail/version_fix'
9
+ require 'formtastic/inputs/selectable_check_boxes'
10
+ require 'dav4rack/build_resource'
11
+
12
+ ActiveAdmin.setup do |config|
13
+ # TODO: Remove this as soon as AA fixed
14
+ I18n.locale = :ru
15
+ I18n.load_path += Dir[File.expand_path("../../locales/**/*.yml", __FILE__)]
16
+ I18n.reload!
17
+
18
+ config.site_title = proc { I18n.t "smartkiosk.admin.title" }
19
+
20
+ config.batch_actions = true
21
+
22
+ config.namespace :admin do |admin_namespace|
23
+ admin_namespace.root_to = "dashboard#index"
24
+ end
25
+
26
+ config.authentication_method = :authenticate_user!
27
+ config.current_user_method = :current_user
28
+ config.logout_link_path = :destroy_user_session_path
29
+
30
+ config.register_javascript 'http://api-maps.yandex.ru/2.0-stable/?load=package.full&lang=ru-RU'
31
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!