Module: Kiqr

Defined in:
lib/kiqr.rb,
lib/kiqr/cli.rb,
lib/kiqr/config.rb,
lib/kiqr/engine.rb,
lib/kiqr/errors.rb,
lib/kiqr/models.rb,
lib/kiqr/version.rb,
lib/kiqr/commands.rb,
lib/kiqr/frontend.rb,
lib/kiqr/models/user.rb,
lib/kiqr/translations.rb,
lib/kiqr/models/member.rb,
lib/kiqr/themes/irelia.rb,
lib/kiqr/cli/extensions.rb,
lib/kiqr/models/account.rb,
lib/kiqr/cli/application.rb,
lib/kiqr/frontend/helpers.rb,
lib/kiqr/current_attributes.rb,
lib/kiqr/controllers/helpers.rb,
lib/kiqr/themes/irelia/config.rb,
lib/kiqr/translations/helpers.rb,
lib/kiqr/frontend/form_helpers.rb,
lib/kiqr/frontend/theme_config.rb,
lib/kiqr/frontend/view_helpers.rb,
lib/kiqr/controllers/url_helpers.rb,
lib/kiqr/models/omniauth_identity.rb,
lib/kiqr/cli/generators/app/app_generator.rb,
lib/generators/kiqr/update/update_generator.rb,
lib/generators/kiqr/install/install_generator.rb,
lib/kiqr/cli/generators/dummy/dummy_generator.rb,
lib/kiqr/frontend/controllers/renders_submenu.rb,
lib/kiqr/controllers/two_factor_authentication.rb,
lib/kiqr/controllers/set_current_request_details.rb,
lib/generators/kiqr/themes/irelia/install_generator.rb

Defined Under Namespace

Modules: Cli, Config, Controllers, Errors, Frontend, Models, Themes, Translations Classes: Commands, CurrentAttributes, Engine, InstallGenerator, OmniauthCallbacksController, OnboardingController, RegistrationsController, SessionsController, UpdateGenerator

Constant Summary collapse

VERSION =
"0.1.0.alpha1"

Class Method Summary collapse

Class Method Details

.configObject

Load Kiqr configuration



53
54
55
# File 'lib/kiqr.rb', line 53

def self.config
  @config ||= Kiqr::Config
end

.default_url_optionsObject

> Base URL

Load default_url_options automatically with KIQR. To set a custom URL in production, set the ‘BASE_URL` environment variable to your apps domain. It defaults to `localhost:3000` in the development and test environments.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/kiqr.rb', line 80

def self.default_url_options
  ENV["BASE_URL"] ||= (Rails.env.development? || Rails.env.test?) ? "http://localhost:3000" : (return {})

  parsed_base_url = URI.parse(ENV["BASE_URL"])
  default_url_options = %i[user password host port].index_with { |key| parsed_base_url.public_send(key) }.compact
  default_url_options[:protocol] = parsed_base_url.scheme

  # Remove port 80 or port 443 from default_url_options
  default_url_options.delete(:port) if default_url_options[:port] == 80 || default_url_options[:port] == 443

  raise "ENV['BASE_URL'] has not been configured correctly." if default_url_options.empty?

  default_url_options
end

.include_helpers(scope) ⇒ Object

Include helpers to the applications controllers and views.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/kiqr.rb', line 63

def self.include_helpers(scope)
  ActiveSupport.on_load(:action_controller) do
    include scope::Helpers if defined?(scope::Helpers)
    include scope::UrlHelpers if defined?(scope::UrlHelpers)
  end

  ActiveSupport.on_load(:action_view) do
    include scope::UrlHelpers if defined?(scope::UrlHelpers)
    include scope::FormHelpers if defined?(scope::FormHelpers)
    include scope::ViewHelpers if defined?(scope::ViewHelpers)
  end
end

.versionObject

Return the Kiqr version



58
59
60
# File 'lib/kiqr.rb', line 58

def self.version
  Kiqr::VERSION
end