cmor_core_frontend 0.0.8.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +19 -0
  4. data/lib/cmor/core/frontend/configuration.rb +11 -0
  5. data/lib/cmor/core/frontend/engine.rb +9 -0
  6. data/lib/cmor/core/frontend/gemspec.rb +41 -0
  7. data/lib/cmor/core/frontend/version.rb +9 -0
  8. data/lib/cmor/core/frontend.rb +10 -0
  9. data/lib/cmor_core_frontend.rb +5 -0
  10. data/lib/generators/cmor/core/frontend/bootstrap4/bootstrap4_generator.rb +31 -0
  11. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/images/frontend/logos/square.svg +34 -0
  12. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/javascripts/frontend/application/keep.js +0 -0
  13. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/javascripts/frontend/application.js +4 -0
  14. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/javascripts/frontend.js +1 -0
  15. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/stylesheets/frontend/application/fonts.css +3 -0
  16. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/stylesheets/frontend/application/layout.css +3 -0
  17. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/stylesheets/frontend/application.css +6 -0
  18. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/stylesheets/frontend/vendor/modern-business.css +27 -0
  19. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/assets/stylesheets/frontend.css +3 -0
  20. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/controllers/frontend/application_controller.rb +22 -0
  21. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/view_helpers/frontend/application_view_helper.rb +62 -0
  22. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_about_us.html.haml +8 -0
  23. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_call_to_action.html.haml +5 -0
  24. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_inline_gallery.html.haml +6 -0
  25. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_our_team.html.haml +29 -0
  26. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_pricing.html.haml +37 -0
  27. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/frontend/application_view_helper/_target_groups.html.haml +27 -0
  28. data/lib/generators/cmor/core/frontend/bootstrap4/templates/app/views/layouts/frontend/application.html.haml +62 -0
  29. data/lib/generators/cmor/core/frontend/bootstrap4/templates/config/initializers/assets.rb +4 -0
  30. data/lib/generators/cmor/core/frontend/bootstrap4/templates/config/locales/de.yml +9 -0
  31. data/lib/generators/cmor/core/frontend/bootstrap4/templates/config/locales/en.yml +9 -0
  32. data/lib/generators/cmor/core/frontend/bootstrap4/templates/config/routes.rb +3 -0
  33. data/lib/generators/cmor/core/frontend/bootstrap4/templates/frontend.gemspec +18 -0
  34. data/lib/generators/cmor/core/frontend/bootstrap4/templates/lib/frontend/engine.rb +6 -0
  35. data/lib/generators/cmor/core/frontend/bootstrap4/templates/lib/frontend/version.rb +4 -0
  36. data/lib/generators/cmor/core/frontend/bootstrap4/templates/lib/frontend.rb +5 -0
  37. data/lib/generators/cmor/core/frontend/install/install_generator.rb +28 -0
  38. data/lib/generators/cmor/core/frontend/install/templates/frontend_controller.rb +2 -0
  39. data/lib/generators/cmor/core/frontend/install/templates/initializer.rb +2 -0
  40. data/lib/generators/cmor/core/frontend/navigation/navigation_generator.rb +70 -0
  41. data/lib/generators/cmor/core/frontend/new/new_generator.rb +80 -0
  42. data/lib/generators/cmor/core/frontend/new/templates/Gemfile +15 -0
  43. data/lib/generators/cmor/core/frontend/new/templates/Guardfile +82 -0
  44. data/lib/generators/cmor/core/frontend/new/templates/MIT-LICENSE +20 -0
  45. data/lib/generators/cmor/core/frontend/new/templates/README.md +28 -0
  46. data/lib/generators/cmor/core/frontend/new/templates/Rakefile +19 -0
  47. data/lib/generators/cmor/core/frontend/new/templates/app/assets/config/foo_bar_manifest.js +1 -0
  48. data/lib/generators/cmor/core/frontend/new/templates/app/assets/javascripts/foo_bar/application/keep.js +0 -0
  49. data/lib/generators/cmor/core/frontend/new/templates/app/assets/javascripts/foo_bar/application.js +2 -0
  50. data/lib/generators/cmor/core/frontend/new/templates/app/assets/javascripts/foo_bar.js +2 -0
  51. data/lib/generators/cmor/core/frontend/new/templates/app/assets/stylesheets/foo_bar/application/keep.css +0 -0
  52. data/lib/generators/cmor/core/frontend/new/templates/app/assets/stylesheets/foo_bar/application.css +3 -0
  53. data/lib/generators/cmor/core/frontend/new/templates/app/assets/stylesheets/foo_bar.css +3 -0
  54. data/lib/generators/cmor/core/frontend/new/templates/app/controllers/foo_bar/application_controller.rb +5 -0
  55. data/lib/generators/cmor/core/frontend/new/templates/app/view_helpers/foo_bar/application_view_helper.rb +4 -0
  56. data/lib/generators/cmor/core/frontend/new/templates/bin/rails +25 -0
  57. data/lib/generators/cmor/core/frontend/new/templates/config/locales/de.yml +1 -0
  58. data/lib/generators/cmor/core/frontend/new/templates/config/locales/en.yml +1 -0
  59. data/lib/generators/cmor/core/frontend/new/templates/config/routes.rb +2 -0
  60. data/lib/generators/cmor/core/frontend/new/templates/foo_bar.gemspec +50 -0
  61. data/lib/generators/cmor/core/frontend/new/templates/initialize_dummy.sh +31 -0
  62. data/lib/generators/cmor/core/frontend/new/templates/lib/foo_bar/configuration.rb +9 -0
  63. data/lib/generators/cmor/core/frontend/new/templates/lib/foo_bar/engine.rb +5 -0
  64. data/lib/generators/cmor/core/frontend/new/templates/lib/foo_bar/version.rb +1 -0
  65. data/lib/generators/cmor/core/frontend/new/templates/lib/foo_bar.rb +6 -0
  66. data/lib/generators/cmor/core/frontend/new/templates/lib/generators/foo_bar/install/install_generator.rb +25 -0
  67. data/lib/generators/cmor/core/frontend/new/templates/lib/generators/foo_bar/install/templates/initializer.rb +7 -0
  68. data/lib/generators/cmor/core/frontend/new/templates/lib/generators/foo_bar/install/templates/routes.source +3 -0
  69. data/lib/generators/cmor/core/frontend/new/templates/lib/tasks/foo_bar_tasks.rake +4 -0
  70. data/lib/generators/cmor/core/frontend/new/templates/spec/lib/foo_bar/version_spec.rb +5 -0
  71. data/lib/generators/cmor/core/frontend/new/templates/spec/rails_helper.rb +62 -0
  72. data/lib/generators/cmor/core/frontend/new/templates/spec/spec_helper.rb +98 -0
  73. data/lib/generators/cmor/core/frontend/new/templates/spec/support/capybara.rb +1 -0
  74. data/lib/generators/cmor/core/frontend/new/templates/spec/support/factory_bot.rb +9 -0
  75. data/lib/generators/cmor/core/frontend/new/templates/spec/support/rao-shoulda_matchers.rb +5 -0
  76. data/lib/generators/cmor/core/frontend/resource_controller/resource_controller_generator.rb +46 -0
  77. data/lib/generators/cmor/core/frontend/resource_controller/templates/resource_controller.rb +18 -0
  78. data/lib/generators/cmor/core/frontend/resources_controller/resources_controller_generator.rb +54 -0
  79. data/lib/generators/cmor/core/frontend/resources_controller/templates/resources_controller.rb +18 -0
  80. data/lib/generators/cmor/core/frontend/service_controller/service_controller_generator.rb +42 -0
  81. data/lib/generators/cmor/core/frontend/service_controller/templates/service_controller.rb +18 -0
  82. metadata +403 -0
@@ -0,0 +1,98 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ =begin
52
+ # This allows you to limit a spec run to individual examples or groups
53
+ # you care about by tagging them with `:focus` metadata. When nothing
54
+ # is tagged with `:focus`, all examples get run. RSpec also provides
55
+ # aliases for `it`, `describe`, and `context` that include `:focus`
56
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
57
+ config.filter_run_when_matching :focus
58
+
59
+ # Allows RSpec to persist some state between runs in order to support
60
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
61
+ # you configure your source control system to ignore this file.
62
+ config.example_status_persistence_file_path = "spec/examples.txt"
63
+
64
+ # Limits the available syntax to the non-monkey patched syntax that is
65
+ # recommended. For more details, see:
66
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
67
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
68
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
69
+ config.disable_monkey_patching!
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = "doc"
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
@@ -0,0 +1,9 @@
1
+ require 'factory_bot_rails'
2
+
3
+ RSpec.configure do |config|
4
+ config.include FactoryBot::Syntax::Methods
5
+ end
6
+
7
+ FactoryBot.factories.clear
8
+ FactoryBot.definition_file_paths += [Rails.root.join(*%w(spec factories))]
9
+ FactoryBot.find_definitions
@@ -0,0 +1,5 @@
1
+ require 'rao/shoulda/matchers'
2
+
3
+ RSpec.configure do |config|
4
+ config.include Rao::Shoulda::Matchers, type: :feature
5
+ end
@@ -0,0 +1,46 @@
1
+ module Cmor
2
+ module Core
3
+ module Frontend
4
+ module Generators
5
+ # Example:
6
+ #
7
+ # rails g cmor:core:frontend:resource_controller -c CurrentUsersController -m User
8
+ #
9
+ class ResourceControllerGenerator < Rails::Generators::Base
10
+ desc 'Generates a singular resource controller with CRUD actions.'
11
+
12
+ source_root File.expand_path('../templates', __FILE__)
13
+
14
+ class_option :controller_class, type: 'string', aliases: '-c'
15
+ class_option :resource_class, type: 'string', aliases: '-m'
16
+
17
+ def generate_controller
18
+ template 'resource_controller.rb', target_filename
19
+ end
20
+
21
+ private
22
+
23
+ def current_engine
24
+ @current_engine ||= File.open("config/routes.rb", &:readline).split('.').first
25
+ end
26
+
27
+ def target_filename
28
+ "app/controllers/#{controller_class.underscore}.rb"
29
+ end
30
+
31
+ def controller_class
32
+ @controller_class ||= options[:controller_class]
33
+ end
34
+
35
+ def resource_class
36
+ controller_class.chomp('Controller').singularize
37
+ end
38
+
39
+ def params_name
40
+ resource_class.demodulize.underscore
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,18 @@
1
+ module <%= controller_class.deconstantize %>
2
+ class <%= controller_class.demodulize %> < <%= current_engine.chomp('::Engine') %>::Configuration.base_controller.constantize
3
+ include Rao::ResourceController::RestActionsConcern
4
+ include Rao::ResourceController::ResourceConcern
5
+ include Rao::Resourcesontroller::RestResourceUrlsConcern
6
+ include Rao::ResourceController::ResourceInflectionsConcern
7
+
8
+ def self.resource_class
9
+ <%= resource_class %>
10
+ end
11
+
12
+ private
13
+
14
+ def permitted_params
15
+ params.require(:<%= params_name %>).permit()
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,54 @@
1
+ module Cmor
2
+ module Core
3
+ module Frontend
4
+ module Generators
5
+ # Example:
6
+ #
7
+ # rails g cmor:core:frontend:resources_controller -c Cmor::Services::Frontend::ServicesController
8
+ #
9
+ class ResourcesControllerGenerator < Rails::Generators::Base
10
+ desc 'Generates a resources controller with CRUD actions.'
11
+
12
+ source_root File.expand_path('../templates', __FILE__)
13
+
14
+ class_option :controller_class, type: 'string', aliases: '-c'
15
+ class_option :resource_class, type: 'string', aliases: '-m'
16
+
17
+ def generate_controller
18
+ template 'resources_controller.rb', target_filename
19
+ end
20
+
21
+ def generate_routes
22
+ route "resources :#{resources_route_name}"
23
+ end
24
+
25
+ private
26
+
27
+ def resources_route_name
28
+ @resources_route_name ||= controller_class.gsub(current_engine.chomp('Engine'), '').chomp('Controller').underscore
29
+ end
30
+
31
+ def current_engine
32
+ @current_engine ||= File.open("config/routes.rb", &:readline).split('.').first
33
+ end
34
+
35
+ def target_filename
36
+ @target_filename ||= "app/controllers/#{controller_class.underscore}.rb"
37
+ end
38
+
39
+ def controller_class
40
+ @controller_class ||= options[:controller_class]
41
+ end
42
+
43
+ def resource_class
44
+ controller_class.chomp('Controller').singularize
45
+ end
46
+
47
+ def params_name
48
+ resource_class.demodulize.underscore
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,18 @@
1
+ module <%= controller_class.deconstantize %>
2
+ class <%= controller_class.demodulize %> < <%= current_engine.chomp('::Engine') %>::Configuration.base_controller.constantize
3
+ include Rao::ResourcesController::RestActionsConcern
4
+ include Rao::ResourcesController::ResourcesConcern
5
+ include Rao::ResourcesController::RestResourceUrlsConcern
6
+ include Rao::ResourcesController::ResourceInflectionsConcern
7
+
8
+ def self.resource_class
9
+ <%= resource_class %>
10
+ end
11
+
12
+ private
13
+
14
+ def permitted_params
15
+ params.require(:<%= params_name %>).permit()
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ module Cmor
2
+ module Core
3
+ module Frontend
4
+ module Generators
5
+ class ServiceControllerGenerator < Rails::Generators::Base
6
+ desc 'Generates a service controller.'
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ class_option :controller_class, type: 'string', aliases: '-c'
11
+ class_option :service_class, type: 'string', aliases: '-s'
12
+
13
+ def generate_controller
14
+ template 'service_controller.rb', target_filename
15
+ end
16
+
17
+ private
18
+
19
+ def current_engine
20
+ @current_engine ||= File.open("config/routes.rb", &:readline).split('.').first
21
+ end
22
+
23
+ def target_filename
24
+ "app/controllers/#{controller_class.underscore}.rb"
25
+ end
26
+
27
+ def controller_class
28
+ @controller_class ||= options[:controller_class]
29
+ end
30
+
31
+ def service_class
32
+ controller_class.gsub('Controller').singularize.append('Service')
33
+ end
34
+
35
+ def params_name
36
+ service_class.demodulize.underscore
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,18 @@
1
+ module <%= controller_class.deconstantize %>
2
+ class <%= controller_class.demodulize %> < <%= current_engine.chomp('::Engine') %>::Configuration.base_controller.constantize
3
+ include Rao::ServiceController::RestActionsConcern
4
+ include Rao::ServiceController::ServiceConcern
5
+ include Rao::ServiceController::RestServiceUrlsConcern
6
+ include Rao::ServiceController::ServiceInflectionsConcern
7
+
8
+ def self.service_class
9
+ <%= service_class %>
10
+ end
11
+
12
+ private
13
+
14
+ def permitted_params
15
+ params.require(:<%= params_name %>).permit()
16
+ end
17
+ end
18
+ end