odania 0.1.0 → 0.2.0

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSE.txt → MIT-LICENSE} +1 -3
  3. data/README.md +3 -3
  4. data/Rakefile +33 -3
  5. data/app/assets/config/odania_manifest.js +0 -0
  6. data/app/assets/javascripts/application.js +13 -0
  7. data/app/assets/javascripts/textAngular.js +15 -0
  8. data/app/assets/javascripts/textAngular/textAngular-rangy.min.js +478 -0
  9. data/app/assets/javascripts/textAngular/textAngular-sanitize.min.js +322 -0
  10. data/app/assets/javascripts/textAngular/textAngular.min.js +1481 -0
  11. data/app/assets/stylesheets/scaffold.css +80 -0
  12. data/app/assets/stylesheets/textAngular/application.css +15 -0
  13. data/app/assets/stylesheets/textAngular/textAngular.css +204 -0
  14. data/app/controllers/admin/home_controller.rb +2 -0
  15. data/app/controllers/admin/languages_controller.rb +74 -0
  16. data/app/controllers/admin_controller.rb +4 -0
  17. data/app/controllers/application_controller.rb +3 -0
  18. data/app/controllers/categories_controller.rb +34 -0
  19. data/app/controllers/home_controller.rb +11 -0
  20. data/app/controllers/protected/home_controller.rb +2 -0
  21. data/app/controllers/protected_controller.rb +22 -0
  22. data/app/controllers/registration_controller.rb +12 -0
  23. data/app/helpers/standard_form_builder.rb +71 -0
  24. data/app/helpers/standard_form_helper.rb +13 -0
  25. data/app/models/admin.rb +37 -0
  26. data/app/models/language.rb +5 -0
  27. data/app/models/user.rb +47 -0
  28. data/app/views/admin/home/index.html.erb +1 -0
  29. data/app/views/admin/languages/_form.html.erb +16 -0
  30. data/app/views/admin/languages/_language.json.jbuilder +2 -0
  31. data/app/views/admin/languages/edit.html.erb +6 -0
  32. data/app/views/admin/languages/index.html.erb +27 -0
  33. data/app/views/admin/languages/index.json.jbuilder +1 -0
  34. data/app/views/admin/languages/new.html.erb +5 -0
  35. data/app/views/admin/languages/show.html.erb +9 -0
  36. data/app/views/admin/languages/show.json.jbuilder +1 -0
  37. data/app/views/categories/index.html.erb +9 -0
  38. data/app/views/categories/show.html.erb +16 -0
  39. data/app/views/devise/confirmations/new.html.erb +11 -0
  40. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  41. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  42. data/app/views/devise/mailer/password_change.html.erb +4 -0
  43. data/app/views/devise/mailer/reset_password_instructions.html.erb +9 -0
  44. data/app/views/devise/mailer/unlock_instructions.html.erb +8 -0
  45. data/app/views/devise/passwords/edit.html.erb +13 -0
  46. data/app/views/devise/passwords/new.html.erb +11 -0
  47. data/app/views/devise/registrations/edit.html.erb +39 -0
  48. data/app/views/devise/registrations/new.html.erb +15 -0
  49. data/app/views/devise/sessions/new.html.erb +14 -0
  50. data/app/views/devise/shared/_links.html.erb +25 -0
  51. data/app/views/devise/unlocks/new.html.erb +11 -0
  52. data/app/views/home/index.html.erb +11 -0
  53. data/app/views/languages/_form.html.erb +20 -0
  54. data/app/views/languages/edit.html.erb +6 -0
  55. data/app/views/languages/index.html.erb +27 -0
  56. data/app/views/languages/new.html.erb +5 -0
  57. data/app/views/languages/show.html.erb +9 -0
  58. data/app/views/protected/home/index.html.erb +1 -0
  59. data/config/initializers/elasticsearch.rb +5 -0
  60. data/config/locales/devise.en.yml +64 -0
  61. data/config/routes.rb +23 -0
  62. data/db/seeds.rb +5 -0
  63. data/lib/odania.rb +7 -56
  64. data/lib/odania/engine.rb +14 -0
  65. data/lib/odania/version.rb +1 -1
  66. data/lib/tasks/odania_tasks.rake +4 -0
  67. data/lib/templates/erb/scaffold/_form.html.erb +27 -0
  68. data/lib/templates/erb/scaffold/edit.html.erb +6 -0
  69. data/lib/templates/erb/scaffold/index.html.erb +31 -0
  70. data/lib/templates/erb/scaffold/new.html.erb +5 -0
  71. data/lib/templates/erb/scaffold/show.html.erb +11 -0
  72. metadata +129 -84
  73. data/.codeclimate.yml +0 -30
  74. data/.gitignore +0 -17
  75. data/.rspec +0 -2
  76. data/.rubocop.yml +0 -1156
  77. data/.travis.yml +0 -20
  78. data/Gemfile +0 -4
  79. data/Gemfile.lock +0 -113
  80. data/Guardfile +0 -31
  81. data/features/plugin.feature +0 -35
  82. data/features/step_definitions/plugin_steps.rb +0 -75
  83. data/features/support/env.rb +0 -1
  84. data/lib/odania/config.rb +0 -17
  85. data/lib/odania/config/backend.rb +0 -31
  86. data/lib/odania/config/backend_group.rb +0 -43
  87. data/lib/odania/config/domain.rb +0 -59
  88. data/lib/odania/config/duplicates.rb +0 -28
  89. data/lib/odania/config/global_config.rb +0 -210
  90. data/lib/odania/config/layout.rb +0 -30
  91. data/lib/odania/config/page.rb +0 -29
  92. data/lib/odania/config/page_base.rb +0 -47
  93. data/lib/odania/config/plugin_config.rb +0 -58
  94. data/lib/odania/config/style.rb +0 -36
  95. data/lib/odania/config/sub_domain.rb +0 -113
  96. data/lib/odania/config/subdomain_config.rb +0 -124
  97. data/lib/odania/consul.rb +0 -138
  98. data/lib/odania/plugin.rb +0 -103
  99. data/odania.gemspec +0 -34
  100. data/spec/fixtures/global_config.json +0 -135
  101. data/spec/fixtures/plugin_config_1.json +0 -102
  102. data/spec/lib/odania/config/global_config_spec.rb +0 -69
  103. data/spec/lib/odania/config/plugin_config_spec.rb +0 -31
  104. data/spec/lib/odania/plugin_spec.rb +0 -25
  105. data/spec/lib/odania_spec.rb +0 -10
  106. data/spec/spec_helper.rb +0 -19
  107. data/spec/support/consul_mock.rb +0 -123
  108. data/tasks/odania.rake +0 -8
  109. data/tasks/rspec.rake +0 -7
@@ -1,20 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - jruby-19mode
5
- - jruby-head
6
- - ruby-head
7
- - ree
8
- matrix:
9
- allow_failures:
10
- - rvm: jruby-19mode
11
- - rvm: ree
12
- - rvm: ruby-head
13
- - rvm: jruby-head
14
- notifications:
15
- email: true
16
- script:
17
- - bundle exec rake
18
- addons:
19
- code_climate:
20
- repo_token: 5c5ba859225f328f35c67cf8e9d4940272e8304ee980317bd80440ba064621a5
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in odania.gemspec
4
- gemspec
@@ -1,113 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- odania (0.1.0)
5
- deep_merge
6
- diplomat
7
- erubis
8
- public_suffix
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- builder (3.2.2)
14
- codeclimate-test-reporter (0.5.0)
15
- simplecov (>= 0.7.1, < 1.0.0)
16
- coderay (1.1.1)
17
- cucumber (2.3.3)
18
- builder (>= 2.1.2)
19
- cucumber-core (~> 1.4.0)
20
- cucumber-wire (~> 0.0.1)
21
- diff-lcs (>= 1.1.3)
22
- gherkin (~> 3.2.0)
23
- multi_json (>= 1.7.5, < 2.0)
24
- multi_test (>= 0.1.2)
25
- cucumber-core (1.4.0)
26
- gherkin (~> 3.2.0)
27
- cucumber-wire (0.0.1)
28
- deep_merge (1.0.1)
29
- diff-lcs (1.2.5)
30
- diplomat (0.18.0)
31
- faraday (~> 0.9)
32
- json
33
- docile (1.1.5)
34
- erubis (2.7.0)
35
- faraday (0.9.2)
36
- multipart-post (>= 1.2, < 3)
37
- ffi (1.9.10)
38
- formatador (0.2.5)
39
- gherkin (3.2.0)
40
- guard (2.14.0)
41
- formatador (>= 0.2.4)
42
- listen (>= 2.7, < 4.0)
43
- lumberjack (~> 1.0)
44
- nenv (~> 0.1)
45
- notiffany (~> 0.0)
46
- pry (>= 0.9.12)
47
- shellany (~> 0.0)
48
- thor (>= 0.18.1)
49
- guard-compat (1.2.1)
50
- guard-rspec (4.7.2)
51
- guard (~> 2.1)
52
- guard-compat (~> 1.1)
53
- rspec (>= 2.99.0, < 4.0)
54
- hashdiff (0.3.0)
55
- json (1.8.3)
56
- listen (3.1.5)
57
- rb-fsevent (~> 0.9, >= 0.9.4)
58
- rb-inotify (~> 0.9, >= 0.9.7)
59
- ruby_dep (~> 1.2)
60
- lumberjack (1.0.10)
61
- method_source (0.8.2)
62
- multi_json (1.12.1)
63
- multi_test (0.1.2)
64
- multipart-post (2.0.0)
65
- nenv (0.3.0)
66
- notiffany (0.1.0)
67
- nenv (~> 0.1)
68
- shellany (~> 0.0)
69
- pry (0.10.3)
70
- coderay (~> 1.1.0)
71
- method_source (~> 0.8.1)
72
- slop (~> 3.4)
73
- public_suffix (2.0.2)
74
- rake (10.5.0)
75
- rb-fsevent (0.9.7)
76
- rb-inotify (0.9.7)
77
- ffi (>= 0.5.0)
78
- rspec (3.4.0)
79
- rspec-core (~> 3.4.0)
80
- rspec-expectations (~> 3.4.0)
81
- rspec-mocks (~> 3.4.0)
82
- rspec-core (3.4.4)
83
- rspec-support (~> 3.4.0)
84
- rspec-expectations (3.4.0)
85
- diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.4.0)
87
- rspec-mocks (3.4.1)
88
- diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.4.0)
90
- rspec-support (3.4.1)
91
- ruby_dep (1.3.1)
92
- shellany (0.0.1)
93
- simplecov (0.11.2)
94
- docile (~> 1.1.0)
95
- json (~> 1.8)
96
- simplecov-html (~> 0.10.0)
97
- simplecov-html (0.10.0)
98
- slop (3.6.0)
99
- thor (0.19.1)
100
-
101
- PLATFORMS
102
- ruby
103
-
104
- DEPENDENCIES
105
- bundler (~> 1.5)
106
- codeclimate-test-reporter
107
- cucumber
108
- guard
109
- guard-rspec
110
- hashdiff
111
- odania!
112
- rake (< 11.0)
113
- rspec
data/Guardfile DELETED
@@ -1,31 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- ## Uncomment and set this to only include directories you want to watch
5
- # directories %w(app lib config test spec features)
6
-
7
- ## Uncomment to clear the screen before every task
8
- # clearing :on
9
-
10
- ## Guard internally checks for changes in the Guardfile and exits.
11
- ## If you want Guard to automatically start up again, run guard in a
12
- ## shell loop, e.g.:
13
- ##
14
- ## $ while bundle exec guard; do echo "Restarting Guard..."; done
15
- ##
16
- ## Note: if you are using the `directories` clause above and you are not
17
- ## watching the project directory ('.'), then you will want to move
18
- ## the Guardfile to a watched dir and symlink it back, e.g.
19
- #
20
- # $ mkdir config
21
- # $ mv Guardfile config/
22
- # $ ln -s config/Guardfile .
23
- #
24
- # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
-
26
- guard :rspec, cmd: 'rspec' do
27
- watch(%r{^spec/.+_spec\.rb$})
28
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
29
- watch(%r{^lib/odania/config/(.+)\.rb$}) { |m| 'spec/lib/odania/config/plugin_config_spec.rb' }
30
- watch('spec/spec_helper.rb') { 'spec' }
31
- end
@@ -1,35 +0,0 @@
1
- Feature: Plugins
2
- I can register and query all available plugins for the odania portal.
3
-
4
- Scenario: Registering a new plugin
5
- Given I initialize the gem
6
- When I registered the plugin "test-plugin"
7
- Then I should see "1" instances of the plugin "test-plugin"
8
-
9
- Scenario: Registering multiple instances of one plugin
10
- Given I initialize the gem
11
- When I registered the plugin "test-plugin"
12
- And I registered the plugin "test-plugin"
13
- And I registered the plugin "test-plugin"
14
- Then I should see "3" instances of the plugin "test-plugin"
15
-
16
- Scenario: Registering multiple plugins
17
- Given I initialize the gem
18
- When I registered the plugin "test-plugin"
19
- And I registered the plugin "test-plugin"
20
- And I registered the plugin "test-plugin-2"
21
- Then I should see "2" instances of the plugin "test-plugin"
22
- And I should see "1" instances of the plugin "test-plugin-2"
23
-
24
- Scenario: Retrieving plugin instance name
25
- Given I initialize the gem
26
- When I retrieve plugin instance name for "test-plugin"
27
- And I retrieve plugin instance name for "test-plugin"
28
- Then I should retrieve "test-plugin_1"
29
-
30
- Scenario: Build new joined plugin config
31
- Given I initialize the gem
32
- When I registered the plugin "test-plugin"
33
- And I generate the joined plugin config
34
- Then I have a joined plugin config
35
- And The joined plugin config contains the plugin "test-plugin"
@@ -1,75 +0,0 @@
1
- $instances = Hash.new(0)
2
-
3
- Given(/^I initialize the gem$/) do
4
- $instances = Hash.new(0)
5
- `rm -f #{Odania::Plugin::INSTANCE_FILES_PATH}*`
6
-
7
- Odania.plugin.get_all.each_pair do |name, instances|
8
- instances.each do |instance|
9
- if instance.ServiceName.start_with? 'test-plugin'
10
- $logger.info "Deregister: #{instance}" if $debug
11
- Odania.plugin.deregister instance.ServiceID
12
- end
13
- end
14
- end
15
- end
16
-
17
- Given(/^I registered the plugin "([^"]*)"$/) do |plugin_name|
18
- plugin_cfg = {
19
- 'name' => plugin_name,
20
- 'ip' => '127.0.0.1',
21
- 'port' => 80,
22
- 'tags' => ["plugin-#{plugin_name}"],
23
- 'domains' => {
24
- 'odania.com' => {
25
- 'contents' => {
26
- },
27
- 'assets' => {
28
- },
29
- 'config' => {
30
- 'asset_url' => 'assets.odania.com',
31
- 'languages' => %w(de en),
32
- 'layout' => 'simple',
33
- 'language_selector' => 'prefix',
34
- 'redirects' => {
35
- '^/test' => '/games'
36
- }
37
- },
38
- 'public_pages' => {
39
- }
40
- }
41
- },
42
- 'layouts' => {
43
- }
44
- }
45
-
46
- $instances[plugin_name] += 1
47
- plugin_instance_name = "#{plugin_name}_#{$instances[plugin_name]}"
48
- Odania.plugin.register plugin_instance_name, plugin_cfg
49
- end
50
-
51
- Then(/^I should see "([^"]*)" instances of the plugin "([^"]*)"$/) do |amount, plugin_name|
52
- plugins = Odania.plugin.get_all
53
- expect(plugins[plugin_name].count).to eq(amount.to_i)
54
- end
55
-
56
- When(/^I retrieve plugin instance name for "([^"]*)"$/) do |plugin_name|
57
- @plugin_instance_name = Odania.plugin.get_plugin_instance_name plugin_name
58
- end
59
-
60
- Then(/^I should retrieve "([^"]*)"$/) do |plugin_instance_name|
61
- expect(plugin_instance_name).to eq(@plugin_instance_name)
62
- end
63
-
64
- When(/^I generate the joined plugin config$/) do
65
- Odania.plugin.plugin_config.load_from_consul
66
- Odania.plugin.plugin_config.generate
67
- end
68
-
69
- Then(/^I have a joined plugin config$/) do
70
- pending # Write code here that turns the phrase above into concrete actions
71
- end
72
-
73
- Then(/^The joined plugin config contains the plugin "([^"]*)"$/) do |arg1|
74
- pending # Write code here that turns the phrase above into concrete actions
75
- end
@@ -1 +0,0 @@
1
- require 'odania'
@@ -1,17 +0,0 @@
1
- require_relative 'config/domain'
2
- require_relative 'config/duplicates'
3
- require_relative 'config/page'
4
- require_relative 'config/plugin_config'
5
- require_relative 'config/global_config'
6
- require_relative 'config/page_base'
7
- require_relative 'config/layout'
8
- require_relative 'config/sub_domain'
9
- require_relative 'config/style'
10
- require_relative 'config/backend'
11
- require_relative 'config/backend_group'
12
- require_relative 'config/subdomain_config'
13
-
14
- module Odania
15
- module Config
16
- end
17
- end
@@ -1,31 +0,0 @@
1
- module Odania
2
- module Config
3
- class Backend
4
- attr_accessor :service_name, :instance_name, :host, :port
5
-
6
- def initialize(service_name, instance_name, host, port)
7
- self.service_name = service_name
8
- self.instance_name = instance_name
9
- self.host = host
10
- self.port = port
11
- end
12
-
13
- def dump
14
- {
15
- 'service_name' => service_name,
16
- 'instance_name' => instance_name,
17
- 'host' => host,
18
- 'port' => port
19
- }
20
- end
21
-
22
- def load(data)
23
- self.service_name = data['service_name']
24
- self.instance_name = data['instance_name']
25
- self.host = data['host']
26
- self.port = data['port']
27
- self
28
- end
29
- end
30
- end
31
- end
@@ -1,43 +0,0 @@
1
- module Odania
2
- module Config
3
- class BackendGroup
4
- attr_accessor :name, :backends, :core_backend
5
-
6
- def initialize(name, backends=[])
7
- self.name = name
8
- self.core_backend = false
9
- self.backends = backends
10
- end
11
-
12
- def add_backend(backend)
13
- self.backends << backend
14
- end
15
-
16
- def check_core_backend(tags)
17
- self.core_backend = tags.include?('core-backend')
18
- end
19
-
20
- def dump
21
- backend_data = []
22
- backends.each do |backend|
23
- backend_data << backend.dump
24
- end
25
-
26
- {
27
- 'name' => name,
28
- 'backends' => backend_data
29
- }
30
- end
31
-
32
- def load(data)
33
- self.name = data['name']
34
-
35
- unless data['backends'].nil?
36
- data['backends'].each do |backend_data|
37
- self.backends << Backend.new.load(backend_data)
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,59 +0,0 @@
1
- module Odania
2
- module Config
3
- class Domain
4
- attr_accessor :name, :subdomains, :config, :redirects
5
-
6
- def initialize(name)
7
- self.name = name
8
- reset
9
- end
10
-
11
- def add_subdomain(subdomain_name)
12
- self.subdomains[subdomain_name]
13
- end
14
-
15
- def subdomain(name)
16
- self.subdomains[name]
17
- end
18
-
19
- def dump
20
- subdomain_data = {}
21
- subdomains.each_pair do |name, subdomain|
22
- subdomain_data[name] = subdomain.dump
23
- end
24
- subdomain_data
25
- end
26
-
27
- def load(data)
28
- self.name = data['name'] unless data['name'].nil?
29
- self.add(data)
30
- end
31
-
32
- def add(sub_domain_data, group_name=nil)
33
- duplicates = Hash.new { |hash, key| hash[key] = [] }
34
- unless sub_domain_data.nil?
35
- sub_domain_data.each_pair do |name, data|
36
- subdomain_duplicates = self.subdomains[name].add(data, group_name)
37
- duplicates.deep_merge! subdomain_duplicates
38
- end
39
- end
40
-
41
- duplicates
42
- end
43
-
44
- def get_redirects
45
- self.subdomains['_general'].get_redirects
46
- end
47
-
48
- def [](key)
49
- self.subdomains[key]
50
- end
51
-
52
- private
53
-
54
- def reset
55
- self.subdomains = Hash.new { |hash, key| hash[key] = SubDomain.new(key) }
56
- end
57
- end
58
- end
59
- end
@@ -1,28 +0,0 @@
1
- module Odania
2
- module Config
3
- class Duplicates
4
- def initialize
5
- @duplicates = Hash.new { |hash, key| hash[key] = Duplicate.new }
6
- end
7
-
8
- def add(type, key, group_name)
9
- @duplicates[type].add(key, group_name)
10
- end
11
-
12
- def duplicates
13
- @duplicates
14
- end
15
-
16
- class Duplicate
17
- def initialize
18
- @duplicate = {}
19
- end
20
-
21
- def add(key, group_name)
22
- @duplicate[key] = [] if @duplicate[key].nil?
23
- @duplicate[key] << group_name
24
- end
25
- end
26
- end
27
- end
28
- end