ditty 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.pryrc +0 -0
  4. data/.rspec +0 -0
  5. data/.rubocop.yml +0 -0
  6. data/.travis.yml +4 -1
  7. data/Gemfile.ci +0 -0
  8. data/License.txt +0 -0
  9. data/Rakefile +3 -0
  10. data/Readme.md +0 -0
  11. data/config.ru +0 -0
  12. data/ditty.gemspec +1 -1
  13. data/lib/ditty.rb +18 -30
  14. data/lib/ditty/components/app.rb +7 -5
  15. data/lib/ditty/controllers/application.rb +0 -0
  16. data/lib/ditty/controllers/audit_logs.rb +0 -0
  17. data/lib/ditty/controllers/component.rb +0 -0
  18. data/lib/ditty/controllers/main.rb +0 -0
  19. data/lib/ditty/controllers/roles.rb +0 -0
  20. data/lib/ditty/controllers/users.rb +0 -0
  21. data/lib/ditty/db.rb +0 -0
  22. data/lib/ditty/helpers/authentication.rb +0 -0
  23. data/lib/ditty/helpers/component.rb +0 -0
  24. data/lib/ditty/helpers/pundit.rb +0 -0
  25. data/lib/ditty/helpers/views.rb +0 -0
  26. data/lib/ditty/helpers/wisper.rb +0 -0
  27. data/lib/ditty/listener.rb +0 -0
  28. data/lib/ditty/models/audit_log.rb +1 -1
  29. data/lib/ditty/models/base.rb +2 -0
  30. data/lib/ditty/models/identity.rb +1 -1
  31. data/lib/ditty/models/role.rb +1 -1
  32. data/lib/ditty/models/user.rb +1 -1
  33. data/lib/ditty/policies/application_policy.rb +0 -0
  34. data/lib/ditty/policies/audit_log_policy.rb +0 -0
  35. data/lib/ditty/policies/identity_policy.rb +0 -0
  36. data/lib/ditty/policies/role_policy.rb +0 -0
  37. data/lib/ditty/policies/user_policy.rb +0 -0
  38. data/lib/ditty/rake_tasks.rb +0 -0
  39. data/lib/ditty/seed.rb +0 -0
  40. data/lib/ditty/services/logger.rb +0 -0
  41. data/lib/ditty/version.rb +1 -1
  42. data/migrate/20170207_base_tables.rb +0 -0
  43. data/migrate/20170208_audit_log.rb +0 -0
  44. data/migrate/20170416_audit_log_details.rb +0 -0
  45. data/public/browserconfig.xml +0 -0
  46. data/public/images/apple-icon.png +0 -0
  47. data/public/images/favicon-16x16.png +0 -0
  48. data/public/images/favicon-32x32.png +0 -0
  49. data/public/images/launcher-icon-1x.png +0 -0
  50. data/public/images/launcher-icon-2x.png +0 -0
  51. data/public/images/launcher-icon-4x.png +0 -0
  52. data/public/images/mstile-150x150.png +0 -0
  53. data/public/images/safari-pinned-tab.svg +0 -0
  54. data/public/manifest.json +0 -0
  55. data/views/404.haml +0 -0
  56. data/views/audit_logs/index.haml +0 -0
  57. data/views/error.haml +0 -0
  58. data/views/identity/login.haml +0 -0
  59. data/views/identity/register.haml +0 -0
  60. data/views/index.haml +0 -0
  61. data/views/layout.haml +0 -0
  62. data/views/partials/delete_form.haml +0 -0
  63. data/views/partials/footer.haml +0 -0
  64. data/views/partials/form_control.haml +0 -0
  65. data/views/partials/navbar.haml +0 -0
  66. data/views/partials/notifications.haml +0 -0
  67. data/views/partials/pager.haml +0 -0
  68. data/views/partials/sidebar.haml +0 -0
  69. data/views/roles/display.haml +0 -0
  70. data/views/roles/edit.haml +0 -0
  71. data/views/roles/form.haml +0 -0
  72. data/views/roles/index.haml +0 -0
  73. data/views/roles/new.haml +0 -0
  74. data/views/users/display.haml +0 -0
  75. data/views/users/edit.haml +0 -0
  76. data/views/users/identity.haml +0 -0
  77. data/views/users/index.haml +0 -0
  78. data/views/users/new.haml +0 -0
  79. data/views/users/profile.haml +0 -0
  80. data/views/users/user.haml +0 -0
  81. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5927a508f91c400cfa56e92e918bc39e528e9239
4
- data.tar.gz: cd6c64af45510a51eeb1a809db67b89879064d17
3
+ metadata.gz: 4e117d869f435ccaf97c5e0ed465a2464695d0e1
4
+ data.tar.gz: 0eaa19a3ed0647b95abf5593ca4a89a98f043e5e
5
5
  SHA512:
6
- metadata.gz: a224e0050344d3f2e1f8f7b2c0706de89f49aa642dfaeb999218ee871d70f11f73f4013207d71a3dcaf1561f3f13a525003c742b092abb037679a0d1cdd75729
7
- data.tar.gz: f470a2c66fda01a16c2b67b7e058efbd858cf387f69846e8ac7ba03a6ff6ed98b115e2548b07198793ad8d56823a136aea6076a6e7539a12a4da2c6514507ba0
6
+ metadata.gz: dfe1b8c443b4ae745c8e45c9e660c6819f49d9af0062f486f3c5d24d4f9f2383a52cde548c3dfc6c6f4a2406d21b680af6abba5d85e35120ff9675c8eb087215
7
+ data.tar.gz: 076b68ddde52ccdede169bdf493aa63adb1ea28ffcec0f764791e460e4e3e744e382af61d950b0d6b624ef55e9b425a13d9817af3b5b292472dd98f8bc9afd6b
data/.gitignore CHANGED
File without changes
data/.pryrc CHANGED
File without changes
data/.rspec CHANGED
File without changes
File without changes
@@ -7,7 +7,10 @@ rvm:
7
7
  gemfile: Gemfile.ci
8
8
  env:
9
9
  - DATABASE_URL="sqlite::memory:" RACK_ENV=test
10
- before_install: gem install bundler -v 1.12.5
10
+ before_install:
11
+ - gem install bundler -v 1.12.5
12
+ before_script:
13
+ - bundle exec rake ditty:prep
11
14
  addons:
12
15
  code_climate:
13
16
  repo_token: 289860573c6284a8e277de86848caba84d840be49e35f3601bcd672ab40d1e35
data/Gemfile.ci CHANGED
File without changes
File without changes
data/Rakefile CHANGED
@@ -5,6 +5,9 @@ require 'bundler/gem_tasks'
5
5
  require 'rspec/core/rake_task'
6
6
  require 'ditty/rake_tasks'
7
7
 
8
+ require 'ditty'
9
+ require 'ditty/components/app'
10
+
8
11
  RSpec::Core::RakeTask.new(:spec)
9
12
 
10
13
  task default: :spec
data/Readme.md CHANGED
File without changes
data/config.ru CHANGED
File without changes
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Sinatra Based Application Framework'
14
14
  spec.description = 'Sinatra Based Application Framework'
15
15
  spec.homepage = 'https://github.com/eagerelk/ditty'
16
- spec.license = 'LGPLv3'
16
+ spec.license = 'MIT'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
  spec.bindir = 'exe'
@@ -67,45 +67,38 @@ module Ditty
67
67
 
68
68
  # Return a hash of controllers with their routes as keys: `{ '/users' => Ditty::Controllers::Users }`
69
69
  def self.routes
70
- @routes ||= {}
71
- end
72
-
73
- def self.routes=(routes)
74
- @routes = routes
70
+ components.inject({}) do |memo, comp|
71
+ memo.merge! comp[1].routes if comp[1].respond_to?(:routes)
72
+ memo
73
+ end.compact
75
74
  end
76
75
 
77
76
  # Return an ordered list of navigation items:
78
77
  # `[{order:0, link:'/users/', text:'Users'}, {order:1, link:'/roles/', text:'Roles'}]
79
78
  def self.navigation
80
- @navigation ||= []
81
- end
82
-
83
- def self.navigation=(navigation)
84
- @navigation = navigation
79
+ components.inject([]) do |memo, comp|
80
+ memo.concat comp[1].navigation if comp[1].respond_to?(:navigation)
81
+ memo
82
+ end
85
83
  end
86
84
 
87
85
  def self.migrations
88
- @migrations ||= []
89
- end
90
-
91
- def self.migrations=(migrations)
92
- @migrations = migrations
86
+ components.map do |_name, comp|
87
+ comp.migrations if comp.respond_to?(:migrations)
88
+ end.compact
93
89
  end
94
90
 
95
91
  def self.seeders
96
- @seeders ||= []
97
- end
98
-
99
- def self.seeders=(seeders)
100
- @seeders = seeders
92
+ components.map do |_name, comp|
93
+ comp.seeder if comp.respond_to?(:seeder)
94
+ end.compact
101
95
  end
102
96
 
103
97
  def self.workers
104
- @workers ||= []
105
- end
106
-
107
- def self.workers=(workers)
108
- @workers = workers
98
+ components.inject([]) do |memo, comp|
99
+ memo.concat comp.workers if comp.respond_to?(:workers)
100
+ memo
101
+ end
109
102
  end
110
103
 
111
104
  module Base
@@ -123,11 +116,6 @@ module Ditty
123
116
  extend(component::ClassMethods) if defined?(component::ClassMethods)
124
117
 
125
118
  component.configure(self, *args, &block) if component.respond_to?(:configure)
126
- Components.navigation.concat component.navigation if component.respond_to?(:navigation)
127
- Components.routes.merge! component.routes if component.respond_to?(:routes)
128
- Components.migrations << component.migrations if component.respond_to?(:migrations)
129
- Components.seeders << component.seeder if component.respond_to?(:seeder)
130
- Components.workers.concat component.workers if component.respond_to?(:workers)
131
119
  nil
132
120
  end
133
121
  end
@@ -4,7 +4,10 @@ require 'ditty'
4
4
 
5
5
  module Ditty
6
6
  class App
7
- def self.load_models
7
+ def self.load
8
+ controllers = File.expand_path('../../controllers', __FILE__)
9
+ Dir.glob("#{controllers}/*.rb").each { |f| require f }
10
+
8
11
  require 'ditty/models/user'
9
12
  require 'ditty/models/role'
10
13
  require 'ditty/models/identity'
@@ -25,8 +28,7 @@ module Ditty
25
28
  end
26
29
 
27
30
  def self.routes
28
- controllers = File.expand_path('../../controllers', __FILE__)
29
- Dir.glob("#{controllers}/*.rb").each { |f| require f }
31
+ load
30
32
  {
31
33
  '/' => ::Ditty::Main,
32
34
  '/users' => ::Ditty::Users,
@@ -36,7 +38,7 @@ module Ditty
36
38
  end
37
39
 
38
40
  def self.navigation
39
- load_models
41
+ load
40
42
 
41
43
  [
42
44
  {
@@ -54,7 +56,7 @@ module Ditty
54
56
 
55
57
  def self.seeder
56
58
  proc do
57
- load_models
59
+ load
58
60
 
59
61
  ::Ditty::Role.find_or_create(name: 'super_admin')
60
62
  ::Ditty::Role.find_or_create(name: 'admin')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,7 +3,7 @@
3
3
  require 'ditty/models/base'
4
4
 
5
5
  module Ditty
6
- class AuditLog < Sequel::Model
6
+ class AuditLog < ::Sequel::Model
7
7
  include ::Ditty::Base
8
8
  many_to_one :user
9
9
 
@@ -1,3 +1,5 @@
1
+ require 'sequel'
2
+
1
3
  module Ditty
2
4
  module Base
3
5
  def for_json
@@ -7,7 +7,7 @@ require 'active_support'
7
7
  require 'active_support/core_ext/object/blank'
8
8
 
9
9
  module Ditty
10
- class Identity < Sequel::Model
10
+ class Identity < ::Sequel::Model
11
11
  include ::Ditty::Base
12
12
  many_to_one :user
13
13
 
@@ -3,7 +3,7 @@
3
3
  require 'ditty/models/base'
4
4
 
5
5
  module Ditty
6
- class Role < Sequel::Model
6
+ class Role < ::Sequel::Model
7
7
  include ::Ditty::Base
8
8
 
9
9
  many_to_many :users
@@ -7,7 +7,7 @@ require 'active_support/core_ext/object/blank'
7
7
 
8
8
  # Why not store this in Elasticsearch?
9
9
  module Ditty
10
- class User < Sequel::Model
10
+ class User < ::Sequel::Model
11
11
  include ::Ditty::Base
12
12
 
13
13
  one_to_many :identity
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ditty
4
- VERSION = '0.2.1'.freeze
4
+ VERSION = '0.2.2'.freeze
5
5
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ditty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgens du Toit
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -406,7 +406,7 @@ files:
406
406
  - views/users/user.haml
407
407
  homepage: https://github.com/eagerelk/ditty
408
408
  licenses:
409
- - LGPLv3
409
+ - MIT
410
410
  metadata: {}
411
411
  post_install_message:
412
412
  rdoc_options: []
@@ -424,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
424
424
  version: '0'
425
425
  requirements: []
426
426
  rubyforge_project:
427
- rubygems_version: 2.6.11
427
+ rubygems_version: 2.6.13
428
428
  signing_key:
429
429
  specification_version: 4
430
430
  summary: Sinatra Based Application Framework