panda-core 0.6.0 → 0.7.1

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/builders/panda/core/form_builder.rb +163 -11
  3. data/app/components/panda/core/admin/button_component.rb +27 -12
  4. data/app/components/panda/core/admin/container_component.rb +13 -1
  5. data/app/components/panda/core/admin/heading_component.rb +22 -14
  6. data/app/components/panda/core/admin/slideover_component.rb +52 -22
  7. data/app/controllers/panda/core/admin/my_profile_controller.rb +8 -1
  8. data/app/helpers/panda/core/asset_helper.rb +2 -0
  9. data/app/javascript/panda/core/controllers/image_cropper_controller.js +158 -0
  10. data/app/javascript/panda/core/controllers/index.js +6 -0
  11. data/app/javascript/panda/core/controllers/navigation_toggle_controller.js +66 -0
  12. data/app/models/panda/core/user.rb +13 -2
  13. data/app/services/panda/core/attach_avatar_service.rb +4 -0
  14. data/app/views/layouts/panda/core/admin.html.erb +39 -14
  15. data/app/views/panda/core/admin/dashboard/_default_content.html.erb +1 -1
  16. data/app/views/panda/core/admin/dashboard/show.html.erb +3 -3
  17. data/app/views/panda/core/admin/sessions/new.html.erb +1 -1
  18. data/app/views/panda/core/admin/shared/_breadcrumbs.html.erb +14 -24
  19. data/app/views/panda/core/admin/shared/_sidebar.html.erb +62 -11
  20. data/app/views/panda/core/admin/shared/_slideover.html.erb +1 -1
  21. data/config/importmap.rb +5 -0
  22. data/config/routes.rb +1 -1
  23. data/lib/panda/core/asset_loader.rb +5 -2
  24. data/lib/panda/core/engine.rb +26 -25
  25. data/lib/panda/core/oauth_providers.rb +3 -3
  26. data/lib/panda/core/testing/rails_helper.rb +175 -0
  27. data/lib/panda/core/version.rb +1 -1
  28. metadata +4 -69
  29. data/lib/generators/panda/core/authentication/templates/reek_spec.rb +0 -43
  30. data/lib/generators/panda/core/dev_tools/USAGE +0 -24
  31. data/lib/generators/panda/core/dev_tools/templates/lefthook.yml +0 -13
  32. data/lib/generators/panda/core/dev_tools/templates/spec_support_panda_core_helpers.rb +0 -18
  33. data/lib/generators/panda/core/dev_tools_generator.rb +0 -143
  34. data/lib/generators/panda/core/install_generator.rb +0 -41
  35. data/lib/generators/panda/core/templates/README +0 -25
  36. data/lib/generators/panda/core/templates/initializer.rb +0 -44
  37. data/lib/generators/panda/core/templates_generator.rb +0 -27
  38. data/lib/panda/core/testing/capybara_config.rb +0 -70
  39. data/lib/panda/core/testing/omniauth_helpers.rb +0 -52
  40. data/lib/panda/core/testing/rspec_config.rb +0 -72
@@ -5,21 +5,21 @@ module Panda
5
5
  providers = []
6
6
 
7
7
  begin
8
- require "omniauth-github"
8
+ require "omniauth/strategies/github"
9
9
  providers << :github
10
10
  rescue LoadError
11
11
  # GitHub OAuth functionality not available
12
12
  end
13
13
 
14
14
  begin
15
- require "omniauth-google-oauth2"
15
+ require "omniauth/strategies/google_oauth2"
16
16
  providers << :google_oauth2
17
17
  rescue LoadError
18
18
  # Google OAuth functionality not available
19
19
  end
20
20
 
21
21
  begin
22
- require "omniauth-microsoft_graph"
22
+ require "omniauth/strategies/microsoft_graph"
23
23
  providers << :microsoft_graph
24
24
  rescue LoadError
25
25
  # Microsoft OAuth functionality not available
@@ -0,0 +1,175 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Shared RSpec configuration for all Panda gems
4
+ # This file provides common test infrastructure that can be extended by individual gems
5
+ #
6
+ # IMPORTANT: This file should be required AFTER the dummy app is loaded
7
+ # Individual gem rails_helper files should:
8
+ # 1. Set up SimpleCov
9
+ # 2. Require panda/core and the dummy app
10
+ # 3. Require this file
11
+ # 4. Load gem-specific support files
12
+
13
+ # Require common test gems (assumes Rails and RSpec/Rails are already loaded by gem's rails_helper)
14
+ require "database_cleaner/active_record"
15
+ require "shoulda/matchers"
16
+ require "capybara"
17
+ require "capybara/rspec"
18
+ require "puma"
19
+
20
+ # Configure fixtures
21
+ ActiveRecord::FixtureSet.context_class.send :include, ActiveSupport::Testing::TimeHelpers
22
+
23
+ # Shoulda Matchers configuration
24
+ Shoulda::Matchers.configure do |config|
25
+ config.integrate do |with|
26
+ with.test_framework :rspec
27
+ with.library :rails
28
+ end
29
+ end
30
+
31
+ # Load all support files from panda-core
32
+ panda_core_support_path = Gem.loaded_specs["panda-core"]&.full_gem_path
33
+ if panda_core_support_path
34
+ Dir[File.join(panda_core_support_path, "spec/support/**/*.rb")].sort.each { |f| require f }
35
+ end
36
+
37
+ RSpec.configure do |config|
38
+ # Include panda-core route helpers by default
39
+ config.include Panda::Core::Engine.routes.url_helpers if defined?(Panda::Core::Engine)
40
+ config.include Rails.application.routes.url_helpers
41
+
42
+ # Standard RSpec configuration
43
+ config.use_transactional_fixtures = true
44
+ config.infer_spec_type_from_file_location!
45
+ config.filter_rails_from_backtrace!
46
+ config.example_status_persistence_file_path = "spec/examples.txt"
47
+ config.disable_monkey_patching!
48
+
49
+ # Print total example count before running
50
+ config.before(:suite) do
51
+ puts "Total examples to run: #{RSpec.world.example_count}\n"
52
+ end
53
+
54
+ # Use specific formatter for GitHub Actions
55
+ if ENV["GITHUB_ACTIONS"] == "true"
56
+ require "rspec/github"
57
+ config.add_formatter RSpec::Github::Formatter
58
+ end
59
+
60
+ # Controller testing support (if rails-controller-testing is available)
61
+ if defined?(Rails::Controller::Testing)
62
+ config.include Rails::Controller::Testing::TestProcess, type: :controller
63
+ config.include Rails::Controller::Testing::TemplateAssertions, type: :controller
64
+ config.include Rails::Controller::Testing::Integration, type: :controller
65
+ end
66
+
67
+ # Reset column information before suite
68
+ config.before(:suite) do
69
+ if defined?(Panda::Core::User)
70
+ Panda::Core::User.connection.schema_cache.clear!
71
+ Panda::Core::User.reset_column_information
72
+ end
73
+ end
74
+
75
+ # Disable prepared statements for PostgreSQL tests to avoid caching issues
76
+ config.before(:suite) do
77
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
78
+ ActiveRecord::Base.connection.unprepared_statement do
79
+ # This block intentionally left empty
80
+ end
81
+ # Disable prepared statements globally for test environment
82
+ ActiveRecord::Base.establish_connection(
83
+ ActiveRecord::Base.connection_db_config.configuration_hash.merge(prepared_statements: false)
84
+ )
85
+ end
86
+ end
87
+
88
+ # Disable logging during tests
89
+ config.before(:suite) do
90
+ Rails.logger.level = Logger::ERROR
91
+ ActiveRecord::Base.logger = nil if defined?(ActiveRecord)
92
+ ActionController::Base.logger = nil if defined?(ActionController)
93
+ ActionMailer::Base.logger = nil if defined?(ActionMailer)
94
+ end
95
+
96
+ # Suppress Rails command output during generator tests
97
+ config.before(:each, type: :generator) do
98
+ allow(Rails::Command).to receive(:invoke).and_return(true)
99
+ end
100
+
101
+ # Force all examples to run
102
+ config.filter_run_including({})
103
+ config.run_all_when_everything_filtered = true
104
+
105
+ # Allow using focus keywords "f... before a specific test"
106
+ config.filter_run_when_matching :focus
107
+
108
+ # Retry flaky tests automatically
109
+ # This is especially useful for system tests that may have timing issues
110
+ config.around(:each, :flaky) do |example|
111
+ retry_count = example.metadata[:retry] || 3
112
+ retry_count.times do |i|
113
+ example.run
114
+ break unless example.exception
115
+
116
+ if i < retry_count - 1
117
+ puts "\n[RETRY] Test failed, retrying... (attempt #{i + 2}/#{retry_count})"
118
+ puts "[RETRY] Exception: #{example.exception.class.name}: #{example.exception.message[0..100]}"
119
+ example.instance_variable_set(:@exception, nil)
120
+ sleep 1 # Brief pause between retries
121
+ end
122
+ end
123
+ end
124
+
125
+ # Exclude EditorJS tests by default unless specifically requested
126
+ config.filter_run_excluding :editorjs unless ENV["INCLUDE_EDITORJS"] == "true"
127
+
128
+ # Use verbose output if only running one spec file
129
+ config.default_formatter = "doc" if config.files_to_run.one?
130
+
131
+ # Print the 10 slowest examples and example groups at the
132
+ # end of the spec run, to help surface which specs are running
133
+ # particularly slow.
134
+ config.profile_examples = 10
135
+
136
+ # Run specs in random order to surface order dependencies. If you find an
137
+ # order dependency and want to debug it, you can fix the order by providing
138
+ # the seed, which is printed after each run: --seed 1234
139
+ Kernel.srand config.seed
140
+ config.order = :random
141
+
142
+ # Note: Fixture configuration is gem-specific and should be done in each gem's rails_helper.rb
143
+ # This includes config.fixture_paths and config.global_fixtures
144
+
145
+ # Bullet configuration (if available)
146
+ if defined?(Bullet) && Bullet.enable?
147
+ config.before(:each) do
148
+ Bullet.start_request
149
+ end
150
+
151
+ config.after(:each) do
152
+ Bullet.perform_out_of_channel_notifications if Bullet.notification?
153
+ Bullet.end_request
154
+ end
155
+ end
156
+
157
+ # OmniAuth test mode
158
+ OmniAuth.config.test_mode = true if defined?(OmniAuth)
159
+
160
+ # DatabaseCleaner configuration
161
+ config.before(:suite) do
162
+ # Allow DATABASE_URL in CI environment
163
+ if ENV["DATABASE_URL"]
164
+ DatabaseCleaner.allow_remote_database_url = true
165
+ end
166
+
167
+ DatabaseCleaner.clean_with :truncation
168
+
169
+ # Hook for gems to add custom suite setup
170
+ # Gems can define Panda::Testing.before_suite_hook and it will be called here
171
+ if defined?(Panda::Testing) && Panda::Testing.respond_to?(:before_suite_hook)
172
+ Panda::Testing.before_suite_hook
173
+ end
174
+ end
175
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Panda
4
4
  module Core
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Otaina Limited
@@ -52,48 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: omniauth-google-oauth2
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: omniauth-github
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: omniauth-microsoft_graph
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
55
  - !ruby/object:Gem::Dependency
98
56
  name: propshaft
99
57
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +108,6 @@ dependencies:
150
108
  - - ">="
151
109
  - !ruby/object:Gem::Version
152
110
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: view_component
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
111
  - !ruby/object:Gem::Dependency
168
112
  name: phlex
169
113
  requirement: !ruby/object:Gem::Requirement
@@ -477,7 +421,9 @@ files:
477
421
  - app/helpers/panda/core/sessions_helper.rb
478
422
  - app/javascript/panda/core/application.js
479
423
  - app/javascript/panda/core/controllers/alert_controller.js
424
+ - app/javascript/panda/core/controllers/image_cropper_controller.js
480
425
  - app/javascript/panda/core/controllers/index.js
426
+ - app/javascript/panda/core/controllers/navigation_toggle_controller.js
481
427
  - app/javascript/panda/core/controllers/theme_form_controller.js
482
428
  - app/javascript/panda/core/controllers/toggle_controller.js
483
429
  - app/javascript/panda/core/tailwindcss-stimulus-components.js
@@ -508,15 +454,6 @@ files:
508
454
  - db/migrate/20250809000001_create_panda_core_users.rb
509
455
  - db/migrate/20250810120000_add_current_theme_to_panda_core_users.rb
510
456
  - db/migrate/20250811120000_add_oauth_avatar_url_to_panda_core_users.rb
511
- - lib/generators/panda/core/authentication/templates/reek_spec.rb
512
- - lib/generators/panda/core/dev_tools/USAGE
513
- - lib/generators/panda/core/dev_tools/templates/lefthook.yml
514
- - lib/generators/panda/core/dev_tools/templates/spec_support_panda_core_helpers.rb
515
- - lib/generators/panda/core/dev_tools_generator.rb
516
- - lib/generators/panda/core/install_generator.rb
517
- - lib/generators/panda/core/templates/README
518
- - lib/generators/panda/core/templates/initializer.rb
519
- - lib/generators/panda/core/templates_generator.rb
520
457
  - lib/panda/core.rb
521
458
  - lib/panda/core/asset_loader.rb
522
459
  - lib/panda/core/authentication.rb
@@ -533,9 +470,7 @@ files:
533
470
  - lib/panda/core/services/base_service.rb
534
471
  - lib/panda/core/sluggable.rb
535
472
  - lib/panda/core/subscribers/authentication_subscriber.rb
536
- - lib/panda/core/testing/capybara_config.rb
537
- - lib/panda/core/testing/omniauth_helpers.rb
538
- - lib/panda/core/testing/rspec_config.rb
473
+ - lib/panda/core/testing/rails_helper.rb
539
474
  - lib/panda/core/version.rb
540
475
  - lib/tasks/assets.rake
541
476
  - lib/tasks/panda/core/migrations.rake
@@ -1,43 +0,0 @@
1
- require "spec_helper"
2
-
3
- RUBY_FILE_PATTERN = File.expand_path("../../**/*.rb", __dir__)
4
- EXCLUDED_PATHS = [
5
- "db/schema.rb",
6
- "bin/",
7
- "script/",
8
- "log/",
9
- "public/",
10
- "tmp/",
11
- "doc/",
12
- "vendor/",
13
- "storage/",
14
- "node_modules/",
15
- ".git/",
16
- "spec/dummy/"
17
- ].freeze
18
-
19
- RSpec.describe "Reek" do
20
- it "contains no code smells" do
21
- failures = []
22
-
23
- Dir.glob(RUBY_FILE_PATTERN).each do |file|
24
- next if EXCLUDED_PATHS.any? { |path| file.include?(path) }
25
-
26
- IO.popen(["bundle", "exec", "reek", file], err: [:child, :out]) do |io|
27
- output = io.read
28
- next if output.empty?
29
-
30
- failures << {file: file, output: output}
31
- end
32
- end
33
-
34
- failures.each do |failure|
35
- puts "\nCode smells found in #{failure[:file]}:"
36
- puts failure[:output]
37
- end
38
-
39
- failures.each do |failure|
40
- expect(failure).to be_nil, "Found code smells in #{failure[:file]}"
41
- end
42
- end
43
- end
@@ -1,24 +0,0 @@
1
- Description:
2
- Sets up or updates Panda Core development tools in your gem or Rails application.
3
- This includes linting configurations, testing helpers, and CI/CD workflows.
4
-
5
- Example:
6
- # Initial setup
7
- rails generate panda:core:dev_tools
8
-
9
- # Force update (overwrites existing files)
10
- rails generate panda:core:dev_tools --force
11
-
12
- # Skip adding dependencies to Gemfile
13
- rails generate panda:core:dev_tools --skip-dependencies
14
-
15
- This will:
16
- - Copy .standard.yml, .yamllint, and .rspec configurations
17
- - Set up GitHub Actions workflows for CI and releases
18
- - Add development dependencies to your Gemfile
19
- - Create testing helper configuration
20
- - Add rake tasks for linting and security checks
21
- - Track version for future updates
22
-
23
- To check for updates later:
24
- bundle exec rake panda:check_updates
@@ -1,13 +0,0 @@
1
- ---
2
- assert_lefthook_installed: true
3
- colors: true
4
- pre-commit:
5
- parallel: true
6
- jobs:
7
- - name: bundle-audit
8
- run: bundle exec bundle-audit --update
9
- - name: bundle-outdated
10
- run: bundle outdated --strict
11
- - name: standardrb
12
- run: bundle exec standardrb --fix {all_files}
13
- glob: "**/*.rb"
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "panda/core/testing/rspec_config"
4
- require "panda/core/testing/omniauth_helpers"
5
- require "panda/core/testing/capybara_config"
6
-
7
- RSpec.configure do |config|
8
- # Apply Panda Core RSpec configuration
9
- Panda::Core::Testing::RSpecConfig.configure(config)
10
- Panda::Core::Testing::RSpecConfig.setup_matchers
11
-
12
- # Configure Capybara
13
- Panda::Core::Testing::CapybaraConfig.configure
14
-
15
- # Include helpers
16
- config.include Panda::Core::Testing::OmniAuthHelpers, type: :system
17
- config.include Panda::Core::Testing::CapybaraConfig::Helpers, type: :system
18
- end
@@ -1,143 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rails/generators"
4
-
5
- module Panda
6
- module Core
7
- module Generators
8
- class DevToolsGenerator < Rails::Generators::Base
9
- source_root File.expand_path("dev_tools/templates", __dir__)
10
-
11
- desc "Set up or update Panda Core development tools in your gem/application"
12
-
13
- class_option :force, type: :boolean, default: false,
14
- desc: "Overwrite existing files"
15
- class_option :skip_dependencies, type: :boolean, default: false,
16
- desc: "Skip adding dependencies to Gemfile"
17
-
18
- VERSION_FILE = ".panda-dev-tools-version"
19
- CURRENT_VERSION = "1.0.0"
20
-
21
- def check_for_updates
22
- if File.exist?(VERSION_FILE)
23
- installed_version = File.read(VERSION_FILE).strip
24
- if installed_version != CURRENT_VERSION
25
- say "Updating Panda Core dev tools from #{installed_version} to #{CURRENT_VERSION}", :yellow
26
- @updating = true
27
- else
28
- say "Panda Core dev tools are up to date (#{CURRENT_VERSION})", :green
29
- unless options[:force]
30
- say "Use --force to reinstall anyway"
31
- nil
32
- end
33
- end
34
- else
35
- say "Installing Panda Core dev tools #{CURRENT_VERSION}", :green
36
- @updating = false
37
- end
38
- end
39
-
40
- def copy_linting_configs
41
- say "Copying linting configurations..."
42
- copy_file ".standard.yml", force: options[:force] || @updating
43
- copy_file ".yamllint", force: options[:force] || @updating
44
- copy_file ".rspec", force: options[:force] || @updating
45
- copy_file "lefthook.yml", force: options[:force] || @updating
46
- end
47
-
48
- def copy_github_workflows
49
- say "Copying GitHub Actions workflows..."
50
- directory ".github", ".github", force: options[:force] || @updating
51
- end
52
-
53
- def create_version_file
54
- create_file VERSION_FILE, CURRENT_VERSION, force: true
55
- end
56
-
57
- def add_development_dependencies
58
- say "Adding development dependencies to gemspec..."
59
-
60
- if File.exist?("Gemfile")
61
- append_to_file "Gemfile" do
62
- <<~RUBY
63
-
64
- group :development, :test do
65
- # Panda Core development tools
66
- gem "standard"
67
- gem "brakeman"
68
- gem "bundler-audit"
69
- gem "yamllint"
70
- end
71
- RUBY
72
- end
73
- end
74
- end
75
-
76
- def create_spec_helper
77
- say "Creating spec helper with Panda Core testing configuration..."
78
-
79
- create_file "spec/support/panda_core_helpers.rb" do
80
- <<~RUBY
81
- # frozen_string_literal: true
82
-
83
- require 'panda/core/testing/rspec_config'
84
- require 'panda/core/testing/omniauth_helpers'
85
- require 'panda/core/testing/capybara_config'
86
-
87
- RSpec.configure do |config|
88
- # Apply Panda Core RSpec configuration
89
- Panda::Core::Testing::RSpecConfig.configure(config)
90
- Panda::Core::Testing::RSpecConfig.setup_matchers
91
-
92
- # Configure Capybara
93
- Panda::Core::Testing::CapybaraConfig.configure
94
-
95
- # Include helpers
96
- config.include Panda::Core::Testing::OmniAuthHelpers, type: :system
97
- config.include Panda::Core::Testing::CapybaraConfig::Helpers, type: :system
98
- end
99
- RUBY
100
- end
101
- end
102
-
103
- def add_rake_tasks
104
- say "Adding Panda Core rake tasks..."
105
-
106
- append_to_file "Rakefile" do
107
- <<~RUBY
108
-
109
- # Panda Core development tasks
110
- namespace :panda do
111
- desc "Run all linters"
112
- task :lint do
113
- sh "bundle exec standardrb"
114
- sh "yamllint -c .yamllint ."
115
- end
116
-
117
- desc "Run security checks"
118
- task :security do
119
- sh "bundle exec brakeman --quiet"
120
- sh "bundle exec bundle-audit --update"
121
- end
122
-
123
- desc "Run all quality checks"
124
- task quality: [:lint, :security]
125
- end
126
- RUBY
127
- end
128
- end
129
-
130
- def display_instructions
131
- say "\n✅ Panda Core development tools have been set up!", :green
132
- say "\nNext steps:"
133
- say " 1. Run 'bundle install' to install new dependencies"
134
- say " 2. Run 'bundle exec rake panda:quality' to check code quality"
135
- say " 3. Customize .github/workflows for your gem's needs"
136
- say " 4. Add 'require' statements to your spec_helper.rb or rails_helper.rb:"
137
- say " require 'support/panda_core_helpers'"
138
- say "\nFor more information, see: docs/development_tools.md"
139
- end
140
- end
141
- end
142
- end
143
- end
@@ -1,41 +0,0 @@
1
- module Panda
2
- module Core
3
- class InstallGenerator < Rails::Generators::Base
4
- include Rails::Generators::Migration
5
-
6
- source_root File.expand_path("templates", __dir__)
7
-
8
- namespace "panda:core:install"
9
-
10
- # Allow incompatible default types for Thor options
11
- def self.allow_incompatible_default_type!
12
- true
13
- end
14
-
15
- class_option :skip_migrations, type: :boolean, default: false,
16
- desc: "Skip migrations installation"
17
- class_option :orm, type: :string, default: "active_record",
18
- desc: "ORM to be used for migrations"
19
-
20
- def self.next_migration_number(dirname)
21
- next_migration_number = current_migration_number(dirname) + 1
22
- ActiveRecord::Migration.next_migration_number(next_migration_number)
23
- end
24
-
25
- def create_initializer
26
- template "initializer.rb", "config/initializers/panda.rb"
27
- end
28
-
29
- def mount_engine
30
- routes_file = File.join(destination_root, "config/routes.rb")
31
- return unless File.exist?(routes_file)
32
-
33
- route 'mount Panda::Core::Engine => "/"'
34
- end
35
-
36
- def show_readme
37
- readme "README" if behavior == :invoke
38
- end
39
- end
40
- end
41
- end
@@ -1,25 +0,0 @@
1
- ===============================================================================
2
-
3
- Panda Core has been installed!
4
-
5
- Next steps:
6
-
7
- 1. Install and run migrations:
8
-
9
- rails panda:core:install:migrations
10
- rails db:migrate
11
-
12
- 2. Configure authentication providers in config/initializers/panda.rb
13
- (Uncomment and configure the providers you want to use)
14
-
15
- 3. Add the required OAuth gems to your Gemfile:
16
-
17
- gem 'omniauth-google-oauth2' # For Google authentication
18
- gem 'omniauth-microsoft_graph' # For Microsoft authentication
19
- gem 'omniauth-github' # For GitHub authentication
20
-
21
- 4. Configure your OAuth credentials in Rails credentials:
22
-
23
- rails credentials:edit
24
-
25
- ===============================================================================
@@ -1,44 +0,0 @@
1
- Panda::Core.configure do |config|
2
- config.admin_path = "/admin"
3
-
4
- config.login_page_title = "Panda Admin"
5
- config.admin_title = "Panda Admin"
6
-
7
- # Configure authentication providers
8
- # Uncomment and configure the providers you want to use
9
- # Don't forget to add the corresponding gems (e.g., omniauth-google-oauth2)
10
- #
11
- # config.authentication_providers = {
12
- # google_oauth2: {
13
- # enabled: true,
14
- # name: "Google", # Display name for the button
15
- # icon: "google", # FontAwesome icon name (optional, auto-detected if not specified)
16
- # client_id: Rails.application.credentials.dig(:google, :client_id),
17
- # client_secret: Rails.application.credentials.dig(:google, :client_secret),
18
- # options: {
19
- # scope: "email,profile",
20
- # prompt: "select_account",
21
- # hd: "yourdomain.com" # Specify your domain here if you want to restrict admin logins
22
- # }
23
- # }
24
- # }
25
-
26
- # Configure the session token cookie name
27
- config.session_token_cookie = :panda_session
28
-
29
- # Configure the user class for the application
30
- config.user_class = "Panda::Core::User"
31
-
32
- # Configure the user identity class for the application
33
- config.user_identity_class = "Panda::Core::UserIdentity"
34
-
35
- # Configure the storage provider (default: :active_storage)
36
- # config.storage_provider = :active_storage
37
-
38
- # Configure the cache store (default: :memory_store)
39
- # config.cache_store = :memory_store
40
-
41
- # Configure EditorJS tools (optional)
42
- # config.editor_js_tools = []
43
- # config.editor_js_tool_config = {}
44
- end