ditty 0.8.0 → 0.10.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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/.env.test +2 -0
  3. data/.gitignore +3 -0
  4. data/.pryrc +2 -0
  5. data/.rubocop.yml +23 -4
  6. data/.travis.yml +4 -8
  7. data/CNAME +1 -0
  8. data/Dockerfile +18 -0
  9. data/Gemfile.ci +0 -17
  10. data/Rakefile +2 -2
  11. data/_config.yml +1 -0
  12. data/config.ru +4 -4
  13. data/ditty.gemspec +28 -18
  14. data/docs/CNAME +1 -0
  15. data/docs/_config.yml +1 -0
  16. data/docs/index.md +34 -0
  17. data/exe/ditty +2 -0
  18. data/lib/ditty/cli.rb +41 -5
  19. data/lib/ditty/components/{app.rb → ditty.rb} +18 -16
  20. data/lib/ditty/controllers/{application.rb → application_controller.rb} +63 -34
  21. data/lib/ditty/controllers/{audit_logs.rb → audit_logs_controller.rb} +4 -2
  22. data/lib/ditty/controllers/{auth.rb → auth_controller.rb} +22 -18
  23. data/lib/ditty/controllers/{component.rb → component_controller.rb} +23 -20
  24. data/lib/ditty/controllers/{main.rb → main_controller.rb} +6 -2
  25. data/lib/ditty/controllers/roles_controller.rb +23 -0
  26. data/lib/ditty/controllers/user_login_traits_controller.rb +46 -0
  27. data/lib/ditty/controllers/{users.rb → users_controller.rb} +13 -11
  28. data/lib/ditty/db.rb +7 -5
  29. data/lib/ditty/emails/base.rb +37 -32
  30. data/lib/ditty/generators/crud_generator.rb +114 -0
  31. data/lib/ditty/generators/migration_generator.rb +26 -0
  32. data/lib/ditty/generators/project_generator.rb +52 -0
  33. data/lib/ditty/helpers/component.rb +2 -1
  34. data/lib/ditty/helpers/pundit.rb +24 -8
  35. data/lib/ditty/helpers/response.rb +15 -13
  36. data/lib/ditty/helpers/views.rb +28 -6
  37. data/lib/ditty/listener.rb +6 -4
  38. data/lib/ditty/memcached.rb +8 -0
  39. data/lib/ditty/middleware/accept_extension.rb +2 -2
  40. data/lib/ditty/middleware/error_catchall.rb +2 -2
  41. data/lib/ditty/models/base.rb +9 -0
  42. data/lib/ditty/models/identity.rb +11 -7
  43. data/lib/ditty/models/role.rb +1 -0
  44. data/lib/ditty/models/user.rb +23 -2
  45. data/lib/ditty/policies/role_policy.rb +1 -1
  46. data/lib/ditty/policies/user_login_trait_policy.rb +1 -1
  47. data/lib/ditty/policies/user_policy.rb +1 -1
  48. data/lib/ditty/services/authentication.rb +27 -16
  49. data/lib/ditty/services/email.rb +19 -15
  50. data/lib/ditty/services/logger.rb +26 -20
  51. data/lib/ditty/services/pagination_wrapper.rb +7 -5
  52. data/lib/ditty/services/settings.rb +7 -6
  53. data/lib/ditty/tasks/ditty.rake +19 -1
  54. data/lib/ditty/tasks/omniauth-ldap.rake +2 -2
  55. data/lib/ditty/templates/.gitignore +5 -0
  56. data/lib/ditty/templates/.rspec +2 -0
  57. data/lib/ditty/templates/.rubocop.yml +7 -0
  58. data/lib/ditty/templates/Rakefile +12 -0
  59. data/lib/ditty/templates/application.rb +12 -0
  60. data/lib/ditty/templates/config.ru +37 -0
  61. data/lib/ditty/templates/controller.rb.erb +64 -0
  62. data/lib/ditty/templates/env.example +4 -0
  63. data/lib/ditty/templates/lib/project.rb.erb +5 -0
  64. data/lib/ditty/templates/logs/.empty_directory +0 -0
  65. data/lib/ditty/templates/migration.rb.erb +7 -0
  66. data/lib/ditty/templates/model.rb.erb +26 -0
  67. data/lib/ditty/templates/pids/.empty_directory +0 -0
  68. data/lib/ditty/templates/policy.rb.erb +48 -0
  69. data/{public → lib/ditty/templates/public}/browserconfig.xml +0 -0
  70. data/lib/ditty/templates/public/css/sb-admin-2.min.css +10 -0
  71. data/lib/ditty/templates/public/css/styles.css +13 -0
  72. data/lib/ditty/templates/public/favicon.ico +0 -0
  73. data/{public → lib/ditty/templates/public}/images/apple-icon.png +0 -0
  74. data/{public → lib/ditty/templates/public}/images/favicon-16x16.png +0 -0
  75. data/{public → lib/ditty/templates/public}/images/favicon-32x32.png +0 -0
  76. data/{public → lib/ditty/templates/public}/images/launcher-icon-1x.png +0 -0
  77. data/{public → lib/ditty/templates/public}/images/launcher-icon-2x.png +0 -0
  78. data/{public → lib/ditty/templates/public}/images/launcher-icon-4x.png +0 -0
  79. data/{public → lib/ditty/templates/public}/images/mstile-150x150.png +0 -0
  80. data/{public → lib/ditty/templates/public}/images/safari-pinned-tab.svg +0 -0
  81. data/lib/ditty/templates/public/js/sb-admin-2.min.js +7 -0
  82. data/lib/ditty/templates/public/js/scripts.js +1 -0
  83. data/{public/manifest.json → lib/ditty/templates/public/manifest.json.erb} +2 -2
  84. data/lib/ditty/templates/settings.yml.erb +29 -0
  85. data/lib/ditty/templates/sidekiq.rb +18 -0
  86. data/lib/ditty/templates/sidekiq.yml +9 -0
  87. data/lib/ditty/templates/spec_helper.rb +43 -0
  88. data/lib/ditty/templates/type.rb.erb +21 -0
  89. data/lib/ditty/templates/views/display.haml.tt +20 -0
  90. data/lib/ditty/templates/views/edit.haml.tt +10 -0
  91. data/lib/ditty/templates/views/form.haml.tt +11 -0
  92. data/lib/ditty/templates/views/index.haml.tt +29 -0
  93. data/lib/ditty/templates/views/new.haml.tt +10 -0
  94. data/lib/ditty/version.rb +1 -1
  95. data/lib/ditty.rb +6 -4
  96. data/lib/rubocop/cop/ditty/call_services_directly.rb +2 -2
  97. data/migrate/20181209_add_user_login_traits.rb +4 -4
  98. data/migrate/20190220_add_parent_id_to_roles.rb +9 -0
  99. data/spec/ditty/api_spec.rb +51 -0
  100. data/spec/ditty/controllers/roles_spec.rb +67 -0
  101. data/spec/ditty/controllers/user_login_traits_spec.rb +72 -0
  102. data/spec/ditty/controllers/users_spec.rb +72 -0
  103. data/spec/ditty/emails/base_spec.rb +76 -0
  104. data/spec/ditty/emails/forgot_password_spec.rb +20 -0
  105. data/spec/ditty/helpers/component_spec.rb +85 -0
  106. data/spec/ditty/models/user_spec.rb +36 -0
  107. data/spec/ditty/services/email_spec.rb +36 -0
  108. data/spec/ditty/services/logger_spec.rb +68 -0
  109. data/spec/ditty/services/settings_spec.rb +63 -0
  110. data/spec/ditty_spec.rb +9 -0
  111. data/spec/factories.rb +46 -0
  112. data/spec/fixtures/logger.yml +17 -0
  113. data/spec/fixtures/section.yml +3 -0
  114. data/spec/fixtures/settings.yml +8 -0
  115. data/spec/spec_helper.rb +51 -0
  116. data/spec/support/api_shared_examples.rb +250 -0
  117. data/spec/support/crud_shared_examples.rb +145 -0
  118. data/views/403.haml +1 -1
  119. data/views/404.haml +2 -4
  120. data/views/500.haml +11 -0
  121. data/views/audit_logs/index.haml +32 -33
  122. data/views/auth/forgot_password.haml +32 -16
  123. data/views/auth/identity.haml +14 -13
  124. data/views/auth/ldap.haml +2 -2
  125. data/views/auth/login.haml +23 -17
  126. data/views/auth/register.haml +20 -18
  127. data/views/auth/register_identity.haml +27 -12
  128. data/views/auth/reset_password.haml +36 -19
  129. data/views/blank.haml +43 -0
  130. data/views/embedded.haml +17 -11
  131. data/views/index.haml +1 -1
  132. data/views/layout.haml +45 -30
  133. data/views/partials/actions.haml +15 -14
  134. data/views/partials/content_tag.haml +0 -0
  135. data/views/partials/delete_form.haml +1 -1
  136. data/views/partials/filter_control.haml +2 -2
  137. data/views/partials/footer.haml +6 -5
  138. data/views/partials/form_control.haml +19 -12
  139. data/views/partials/form_tag.haml +1 -1
  140. data/views/partials/navitems.haml +42 -0
  141. data/views/partials/notifications.haml +12 -8
  142. data/views/partials/pager.haml +44 -25
  143. data/views/partials/search.haml +15 -11
  144. data/views/partials/sidebar.haml +15 -37
  145. data/views/partials/sort_ui.haml +2 -0
  146. data/views/partials/topbar.haml +53 -0
  147. data/views/partials/user_associations.haml +32 -0
  148. data/views/quick_start.haml +23 -0
  149. data/views/roles/display.haml +27 -6
  150. data/views/roles/edit.haml +3 -3
  151. data/views/roles/form.haml +1 -0
  152. data/views/roles/index.haml +23 -16
  153. data/views/roles/new.haml +2 -2
  154. data/views/user_login_traits/display.haml +4 -4
  155. data/views/user_login_traits/edit.haml +3 -3
  156. data/views/user_login_traits/index.haml +23 -25
  157. data/views/user_login_traits/new.haml +2 -2
  158. data/views/users/display.haml +14 -15
  159. data/views/users/edit.haml +3 -3
  160. data/views/users/form.haml +0 -0
  161. data/views/users/index.haml +31 -24
  162. data/views/users/login_traits.haml +6 -8
  163. data/views/users/new.haml +2 -2
  164. data/views/users/profile.haml +15 -15
  165. data/views/users/user.haml +1 -1
  166. metadata +271 -63
  167. data/lib/ditty/controllers/roles.rb +0 -13
  168. data/lib/ditty/controllers/user_login_traits.rb +0 -18
  169. data/views/partials/navbar.haml +0 -22
@@ -17,11 +17,20 @@ module Ditty
17
17
 
18
18
  def role?(check)
19
19
  @roles ||= Hash.new do |h, k|
20
- h[k] = !roles_dataset.first(name: k).nil?
20
+ role_or_descendant = roles.find do |role|
21
+ role.name == k || role.descendants.map(&:name).include?(k)
22
+ end
23
+ h[k] = !role_or_descendant.nil?
21
24
  end
22
25
  @roles[check]
23
26
  end
24
27
 
28
+ def all_roles
29
+ roles.inject([]) do |memo, role|
30
+ memo + [role] + role.descendants
31
+ end.uniq
32
+ end
33
+
25
34
  def method_missing(method_sym, *arguments, &block)
26
35
  if respond_to_missing?(method_sym)
27
36
  role?(method_sym[0..-2])
@@ -31,7 +40,9 @@ module Ditty
31
40
  end
32
41
 
33
42
  def respond_to_missing?(name, _include_private = false)
34
- name[-1] == '?'
43
+ return true if name[-1] == '?'
44
+
45
+ super
35
46
  end
36
47
 
37
48
  def gravatar
@@ -48,6 +59,12 @@ module Ditty
48
59
  validates_format(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :email)
49
60
  end
50
61
 
62
+ def before_save
63
+ super
64
+ self.name = nil if name.blank?
65
+ self.surname = nil if surname.blank?
66
+ end
67
+
51
68
  # Add the basic roles and identity
52
69
  def after_create
53
70
  super
@@ -68,6 +85,10 @@ module Ditty
68
85
  email
69
86
  end
70
87
 
88
+ def display_name
89
+ name || username
90
+ end
91
+
71
92
  class << self
72
93
  def anonymous_user
73
94
  role = ::Ditty::Role.find_or_create(name: 'anonymous')
@@ -25,7 +25,7 @@ module Ditty
25
25
  end
26
26
 
27
27
  def permitted_attributes
28
- [:name]
28
+ %i[parent_id name]
29
29
  end
30
30
 
31
31
  class Scope < ApplicationPolicy::Scope
@@ -13,7 +13,7 @@ module Ditty
13
13
  end
14
14
 
15
15
  def read?
16
- user && (record.user_id || user.super_admin?)
16
+ user && (record.user_id == user.id || user.super_admin?)
17
17
  end
18
18
 
19
19
  def update?
@@ -26,7 +26,7 @@ module Ditty
26
26
  end
27
27
 
28
28
  def delete?
29
- create?
29
+ create? && record&.super_admin? == false
30
30
  end
31
31
 
32
32
  def permitted_attributes
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ditty/controllers/application'
3
+ require 'ditty/controllers/application_controller'
4
4
  require 'ditty/services/settings'
5
5
  require 'ditty/services/logger'
6
- require 'backports/2.4.0/hash/compact'
7
6
 
8
7
  require 'omniauth'
9
- OmniAuth.config.logger = Ditty::Services::Logger.instance
10
- OmniAuth.config.path_prefix = "#{Ditty::Application.map_path}/auth"
8
+ OmniAuth.config.logger = ::Ditty::Services::Logger
9
+ OmniAuth.config.path_prefix = "#{::Ditty::ApplicationController.map_path}/auth"
11
10
  OmniAuth.config.on_failure = proc { |env|
12
11
  next [400, {}, []] if env['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
13
12
 
@@ -23,38 +22,50 @@ module Ditty
23
22
  end
24
23
 
25
24
  def providers
26
- config.compact.keys
25
+ config.compact.keys.select { |e| config[e][:available] && config[e][:enabled] != false }
27
26
  end
28
27
 
29
28
  def setup
30
- providers.each do |provider|
31
- begin
32
- require "omniauth/#{provider}"
29
+ config.compact.each_key do |provider|
30
+ ::Ditty::Services::Logger.debug "Loading authentication provider #{provider}"
31
+ req = if config.dig(provider, :require)
32
+ [config[provider][:require]]
33
+ else
34
+ ["omniauth/#{provider}", "omniauth-#{provider}"]
35
+ end
36
+ req.find do |e|
37
+ require e
38
+ config[provider][:available] = true
39
+ true
33
40
  rescue LoadError
34
- require "omniauth-#{provider}"
41
+ ::Ditty::Services::Logger.warn "Could not load authentication provider #{provider} using #{e}"
42
+ config[provider][:available] = false
43
+ false
35
44
  end
36
45
  end
37
46
  end
38
47
 
39
48
  def config
40
- default.merge Ditty::Services::Settings.values(:authentication) || {}
49
+ @config ||= default.merge(::Ditty::Services::Settings.values(:authentication) || {})
41
50
  end
42
51
 
43
52
  def provides?(provider)
44
- providers.include? provider.to_sym
53
+ provider = provider.to_sym
54
+ providers.include?(provider) && config[provider][:available] && config.dig(provider, :enabled) != false
45
55
  end
46
56
 
47
57
  def default
48
58
  require 'ditty/models/identity'
49
- require 'ditty/controllers/auth'
59
+ require 'ditty/controllers/auth_controller'
50
60
  {
51
61
  identity: {
62
+ available: true,
52
63
  arguments: [
53
64
  {
54
65
  fields: [:username],
55
- model: Ditty::Identity,
56
- on_login: Ditty::Auth,
57
- on_registration: Ditty::Auth,
66
+ model: ::Ditty::Identity,
67
+ on_login: ::Ditty::AuthController,
68
+ on_registration: ::Ditty::AuthController,
58
69
  locate_conditions: ->(req) { { username: req['username'] } }
59
70
  }
60
71
  ]
@@ -66,4 +77,4 @@ module Ditty
66
77
  end
67
78
  end
68
79
 
69
- Ditty::Services::Authentication.setup
80
+ ::Ditty::Services::Authentication.setup
@@ -20,31 +20,35 @@ module Ditty
20
20
  end
21
21
  end
22
22
 
23
- def deliver(email, to = nil, options = {})
23
+ def generate(email, to = nil, options = {})
24
24
  config!
25
25
  options[:to] ||= to unless to.nil?
26
26
  options[:from] ||= config[:from] unless config[:from].nil?
27
27
  email = from_symbol(email, options) if email.is_a? Symbol
28
- email.deliver!
28
+ email
29
+ end
30
+
31
+ def deliver(email, to = nil, options = {})
32
+ generate(email, to, options).deliver!
29
33
  end
30
34
 
31
35
  private
32
36
 
33
- def config
34
- @config ||= default.merge Ditty::Services::Settings.values(:email) || {}
35
- end
37
+ def config
38
+ @config ||= default.merge ::Ditty::Services::Settings.values(:email) || {}
39
+ end
36
40
 
37
- def default
38
- {
39
- delivery_method: :logger,
40
- logger: Ditty::Services::Logger.instance
41
- }
42
- end
41
+ def default
42
+ {
43
+ delivery_method: :logger,
44
+ logger: ::Ditty::Services::Logger
45
+ }
46
+ end
43
47
 
44
- def from_symbol(email, options)
45
- require "ditty/emails/#{email}"
46
- constantize("Ditty::Emails::#{classify(email)}").new(options)
47
- end
48
+ def from_symbol(email, options)
49
+ require "ditty/emails/#{email}"
50
+ constantize("Ditty::Emails::#{classify(email)}").new(options)
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -30,40 +30,46 @@ module Ditty
30
30
  end
31
31
  end
32
32
 
33
+ # TODO: REfac this so that you can log something like ES to a separate logger
34
+
33
35
  def method_missing(method, *args, &block)
34
36
  loggers.each { |logger| logger.send(method, *args, &block) }
35
37
  end
36
38
 
37
39
  def respond_to_missing?(method, _include_private = false)
38
- loggers.any? { |logger| logger.respond_to?(method) }
40
+ return true if loggers.any? { |logger| logger.respond_to?(method) }
41
+
42
+ super
39
43
  end
40
44
 
41
45
  private
42
46
 
43
- def config
44
- default.merge Ditty::Services::Settings.values(:logger) || {}
45
- end
46
-
47
- def tr(val)
48
- {
49
- '$stdout' => $stdout,
50
- '$stderr' => $stderr
51
- }[val] || val
52
- end
47
+ def config
48
+ default.merge ::Ditty::Services::Settings.values(:logger) || {}
49
+ end
53
50
 
54
- def default
55
- { loggers: [{ name: 'default', class: 'Logger' }] }
56
- end
51
+ def tr(val)
52
+ {
53
+ '$stdout' => $stdout,
54
+ '$stderr' => $stderr
55
+ }[val] || val
56
+ end
57
57
 
58
- class << self
59
- def method_missing(method, *args, &block)
60
- instance.send(method, *args, &block)
58
+ def default
59
+ { loggers: [{ name: 'default', class: 'Logger' }] }
61
60
  end
62
61
 
63
- def respond_to_missing?(method, _include_private)
64
- instance.respond_to? method
62
+ class << self
63
+ def method_missing(method, *args, &block)
64
+ instance.send(method, *args, &block)
65
+ end
66
+
67
+ def respond_to_missing?(method, _include_private)
68
+ return true if instance.respond_to?(method)
69
+
70
+ super
71
+ end
65
72
  end
66
- end
67
73
  end
68
74
  end
69
75
  end
@@ -10,18 +10,18 @@ module Ditty
10
10
  end
11
11
 
12
12
  def last_page?
13
- if list.respond_to? :'last_page?'
13
+ if list.respond_to? :last_page?
14
14
  list.last_page?
15
15
  else
16
- list.current_page == list.total_pages
16
+ list.next_page.nil?
17
17
  end
18
18
  end
19
19
 
20
20
  def first_page?
21
- if list.respond_to? :'first_page?'
21
+ if list.respond_to? :first_page?
22
22
  list.first_page?
23
23
  else
24
- list.current_page == 0
24
+ list.previous_page.nil?
25
25
  end
26
26
  end
27
27
 
@@ -64,7 +64,9 @@ module Ditty
64
64
  end
65
65
 
66
66
  def respond_to_missing?(method, _include_private = false)
67
- list.respond_to? method
67
+ return true if list.respond_to?(method)
68
+
69
+ super
68
70
  end
69
71
 
70
72
  def current_page_record_range
@@ -25,20 +25,21 @@ module Ditty
25
25
  from = values
26
26
  if keys.count > 1 && scope?(keys.first)
27
27
  from = values(keys.first)
28
- keys = keys[1..-1]
28
+ keys = keys[1..]
29
29
  key = keys.join('.')
30
30
  end
31
- from[key.to_sym] || from.dig(*keys)
31
+ key = key.to_sym if key.respond_to?(:to_sym)
32
+ from[key] || from.dig(*keys)
32
33
  end
33
34
 
34
35
  def values(scope = :settings)
35
36
  @values ||= begin
36
37
  v = Hash.new do |h, k|
37
38
  h[k] = if File.file?("#{CONFIG_FOLDER}/#{k}.yml")
38
- read("#{CONFIG_FOLDER}/#{k}.yml")
39
- elsif k != :settings && h[:settings].key?(k)
40
- h[:settings][k]
41
- end
39
+ read("#{CONFIG_FOLDER}/#{k}.yml")
40
+ elsif k != :settings && h[:settings].key?(k)
41
+ h[:settings][k]
42
+ end
42
43
  h[k]
43
44
  end
44
45
  v[:settings] = File.file?(CONFIG_FILE) ? read(CONFIG_FILE) : {}
@@ -1,6 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :ditty do
4
+ desc 'Run the ditty console'
5
+ task :console do
6
+ require 'irb'
7
+ ARGV.clear
8
+ IRB.start
9
+ end
10
+
4
11
  desc 'Prepare Ditty'
5
12
  task prep: ['generate_tokens', 'prep:folders', 'prep:public', 'prep:migrations']
6
13
 
@@ -31,6 +38,7 @@ namespace :ditty do
31
38
  task :folders do
32
39
  puts 'Prepare the Ditty folders'
33
40
  Dir.mkdir 'pids' unless File.exist?('pids')
41
+ Dir.mkdir 'logs' unless File.exist?('logs')
34
42
  end
35
43
 
36
44
  desc 'Check that the public folder is present and populated'
@@ -53,7 +61,7 @@ namespace :ditty do
53
61
  FileUtils.cp_r path, 'migrations' unless File.expand_path(path).eql? File.expand_path('migrations')
54
62
  end
55
63
  puts 'Migrations added:'
56
- Dir.foreach('migrations').sort.each { |x| puts x if File.file?("migrations/#{x}") && x[-3..-1] == '.rb' }
64
+ Dir.foreach('migrations').sort.each { |x| puts x if File.file?("migrations/#{x}") && x[-3..] == '.rb' }
57
65
  end
58
66
  end
59
67
 
@@ -81,6 +89,16 @@ namespace :ditty do
81
89
  end
82
90
  end
83
91
 
92
+ desc 'Migrate Ditty database to the specified version'
93
+ task :run, [:version] do |_t, args|
94
+ ::DB.loggers << Logger.new($stdout) if ::DB.loggers.count.zero?
95
+ raise 'No version specified' unless args[:version]
96
+
97
+ puts "** [ditty] Running Ditty Migrations to #{args[:version]}"
98
+ ::Sequel.extension :migration
99
+ ::Sequel::Migrator.run(::DB, folder, target: args[:version].to_i)
100
+ end
101
+
84
102
  desc 'Migrate Ditty database to latest version'
85
103
  task :up do
86
104
  ::DB.loggers << Logger.new($stdout) if ::DB.loggers.count.zero?
@@ -4,7 +4,7 @@ namespace :ditty do
4
4
  namespace :ldap do
5
5
  desc 'Check the LDAP settings'
6
6
  task :check do
7
- settings = Ditty::Services::Settings[:authentication][:ldap][:arguments].first
7
+ settings = ::Ditty::Services::Settings[:authentication][:ldap][:arguments].first
8
8
  ldap = Net::LDAP.new host: settings[:host], port: settings[:port]
9
9
  ldap.authenticate settings[:bind_dn], settings[:password] if settings[:bind_dn]
10
10
  raise 'Could not bind to LDAP server' unless ldap.bind
@@ -18,7 +18,7 @@ namespace :ditty do
18
18
  require 'ditty/services/settings'
19
19
  require 'ditty/models/role'
20
20
 
21
- settings = Ditty::Services::Settings[:authentication][:ldap][:arguments].first
21
+ settings = ::Ditty::Services::Settings[:authentication][:ldap][:arguments].first
22
22
  ldap = Net::LDAP.new host: settings[:host], port: settings[:port]
23
23
  ldap.authenticate settings[:bind_dn], settings[:password] if settings[:bind_dn]
24
24
  if ldap.bind
@@ -0,0 +1,5 @@
1
+ .token_secret
2
+ .session_secret
3
+ gems
4
+ logs/*
5
+ migrations
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,7 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+ - rubocop-thread_safety
5
+ - rubocop-sequel
6
+ - ditty/rubocop
7
+
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dotenv/load'
4
+
5
+ require 'rake'
6
+ require 'ditty'
7
+ require 'ditty/db' if ENV['DATABASE_URL']
8
+ require 'ditty/memcached' if ENV['MEMCACHED_URL']
9
+
10
+ require './application'
11
+
12
+ Ditty::Components.tasks