class DeviseJiraAuthenticable::InstallGenerator

Public Class Methods

next_migration_number(path) click to toggle source
# File lib/generators/devise_jira_authenticable/install_generator.rb, line 25
def self.next_migration_number(path)
  ActiveRecord::Generators::Base.next_migration_number(path)
end

Public Instance Methods

install() click to toggle source
# File lib/generators/devise_jira_authenticable/install_generator.rb, line 20
def install
  inject_into_file("config/initializers/devise.rb", default_devise_settings,
                   before: /^\s*.*==> Scopes configuration/)
end

Private Instance Methods

default_devise_settings() click to toggle source
# File lib/generators/devise_jira_authenticable/install_generator.rb, line 31
    def default_devise_settings
      <<-CONFIG.gsub(/ {6}/, '')
        # ==> Configuration for jira_authenticable
        # The jira_authenticable strategy can be used in place of the
        # database_authenticatable strategy or alongside it.  The default order of the
        # strategies is the reverse of how they were loaded.  You can control this
        # order by explicitly telling warden the order in which to apply the strategies.
        # See the Warden Configuration section for further details.
        #
        # Configure the URL of the JIRA server to use.
        config.jira_site = '#{jira_site}'
        # Configure the context path for the JIRA server.  Default is blank.
        # config.jira_context_path = '/jira_context_path'
        # Configure the standard timeout period for JIRA server requests for authentication. Default is 60
        # config.jira_read_timeout = 99
        # Configure whether a timeout is handled as an error or simply as a failed validation.  Default is false
        # config.handle_jira_timeout_as_failure = true
      CONFIG
    end
devise_in_model() click to toggle source
# File lib/generators/devise_jira_authenticable/install_generator.rb, line 51
def devise_in_model
  'devise :jira_authenticable, authentication_keys: [ :username ]'
end
migration_version() click to toggle source
# File lib/generators/devise_jira_authenticable/install_generator.rb, line 55
def migration_version
  Rails.version.start_with?('5') ? "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" : ''
end