source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/screenshot.rb | Ruby | mit | 41,450 | master | 4,748 | require_relative 'editor'
require_relative 'mac_editor'
require_relative 'device_types'
require_relative 'module'
require_relative 'device'
module Frameit
# Represents one screenshot
class Screenshot
attr_accessor :path # path to the screenshot
attr_accessor :size # size in px array of 2 elements: height a... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/config_parser.rb | Ruby | mit | 41,450 | master | 4,983 | require_relative 'device_types'
module Frameit
class ConfigParser
attr_reader :data
def load(path)
return nil unless File.exist?(path) # we are okay with no config at all
UI.verbose("Parsing config file '#{path}'")
@path = path
self.parse(File.read(path))
end
# @param data (... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/device.rb | Ruby | mit | 41,450 | master | 3,522 | require 'fastimage'
require_relative 'module'
module Frameit
class Device
REQUIRED_PRIORITY = 999
attr_reader :id
attr_reader :deliver_screen_id
attr_reader :formatted_name
attr_reader :resolutions
attr_reader :density_ppi
attr_reader :default_color
attr_reader :platform
attr_rea... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/mac_editor.rb | Ruby | mit | 41,450 | master | 851 | require 'mini_magick'
require_relative 'editor'
module Frameit
# Responsible for framing Mac Screenshots
class MacEditor < Editor
def prepare_image
image = super
image.resize("#{offset['width']}x") if offset['width']
end
def put_device_into_background(background)
self.top_space_above... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/commands_generator.rb | Ruby | mit | 41,450 | master | 4,348 | require 'commander'
require 'fastlane/version'
require 'fastlane_core/ui/help_formatter'
require 'fastlane_core/globals'
require 'fastlane_core/configuration/configuration'
require_relative 'device_types'
require_relative 'runner'
require_relative 'options'
require_relative 'dependency_checker'
require_relative 'devic... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/trim_box.rb | Ruby | mit | 41,450 | master | 1,960 | require_relative 'module'
module Frameit
# Represents the MiniMagick trim bounding box for cropping a text image
class Trimbox
attr_accessor :width # width of the trim box
attr_accessor :height # height of the trim box
attr_accessor :offset_x # horizontal offset from the canvas to the trim box
attr... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/strings_parser.rb | Ruby | mit | 41,450 | master | 1,515 | require_relative 'module'
module Frameit
# This class will parse the .string files
class StringsParser
def self.parse(path)
UI.user_error!("Couldn't find strings file at path '#{path}'") unless File.exist?(path)
UI.user_error!("Must be .strings file, only got '#{path}'") unless path.end_with?(".str... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/lib/frameit/frame_downloader.rb | Ruby | mit | 41,450 | master | 3,336 | require 'fastlane_core/module'
require_relative 'module'
module Frameit
class FrameDownloader
HOST_URL = "https://fastlane.github.io/frameit-frames"
def download_frames
print_disclaimer
require 'json'
require 'fileutils'
UI.message("Downloading device frames to '#{templates_path}'... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/frames_generator/Rakefile | Ruby | mit | 41,450 | master | 11,445 | require 'colored'
require 'mini_magick'
require 'json'
DEVICES_TO_SKIP = [
"Apple iMac", # we don't currently support iMac
# some super old Android devices:
"Nokia 220",
"Nokia 230",
"Nokia C3-00",
"Nokia Asha 230",
"Samsung Galaxy Y",
# unsupported platforms:
"Microsoft Lumia 950",
"Microsoft Surf... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/commands_generator_spec.rb | Ruby | mit | 41,450 | master | 1,699 | require 'frameit/commands_generator'
describe Frameit::CommandsGenerator do
def expect_runner_run
fake_runner = "runner"
expect(Frameit::Runner).to receive(:new).and_return(fake_runner)
expect(fake_runner).to receive(:run)
end
describe ":run options handling" do
it "can use the use_legacy_iphone... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/strings_parser_spec.rb | Ruby | mit | 41,450 | master | 3,428 | describe Frameit do
describe Frameit::StringsParser do
describe "parse" do
it "raise error when file can't be found" do
expect do
Frameit::StringsParser.parse("./nothere")
end.to raise_exception("Couldn't find strings file at path './nothere'")
end
it "raise error when... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/template_finder_spec.rb | Ruby | mit | 41,450 | master | 4,506 | require 'ostruct'
describe Frameit do
describe Frameit::TemplateFinder do
DEVICE_SCREEN_IDS = Frameit::DEVICE_SCREEN_IDS
DisplayType = Frameit::DisplayType
describe 'it can find some screenshots' do
# Prevent the tests from looking in the real home
# directory.
before(:all) do
... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/device_spec.rb | Ruby | mit | 41,450 | master | 5,382 | require 'frameit/device'
describe Frameit::Device do
def screen_size_from(path)
path.match(/{([0-9]+)x([0-9]+)}/).captures.map(&:to_i)
end
before do
allow(FastImage).to receive(:size) do |path|
screen_size_from(path)
end
Frameit.config = instance_double("FastlaneCore::Configuration")
... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/editor_spec.rb | Ruby | mit | 41,450 | master | 5,415 | require 'frameit/config_parser'
describe Frameit do
describe Frameit::Editor do
describe "frame!" do
before do
allow_any_instance_of(MiniMagick::Tool::Mogrify).to receive(:call) { '' }
allow(MiniMagick::Image).to receive(:open) { |path| MiniMagick::Image.new(path) }
allow_any_instan... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | frameit/spec/config_parser_spec.rb | Ruby | mit | 41,450 | master | 1,624 | describe Frameit do
describe Frameit::ConfigParser do
it "doesn't mind if there is no config file" do
result = Frameit::ConfigParser.new.load("./invalid")
expect(result).to eq(nil)
end
describe "Invalid JSON file" do
it "raises an exception" do
expect do
Frameit::Confi... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce.rb | Ruby | mit | 41,450 | master | 245 | require_relative 'produce/manager'
require_relative 'produce/options'
require_relative 'produce/developer_center'
require_relative 'produce/itunes_connect'
require_relative 'produce/available_default_languages'
require_relative 'produce/module' |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/group.rb | Ruby | mit | 41,450 | master | 3,042 | require 'spaceship'
require_relative 'module'
module Produce
class Group
def create(options, _args)
login
ENV["CREATED_NEW_GROUP_ID"] = Time.now.to_i.to_s
group_identifier = options.group_identifier || UI.input("Group identifier: ")
if app_group_exists?(group_identifier)
UI.suc... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/merchant.rb | Ruby | mit | 41,450 | master | 4,180 | require 'spaceship'
require_relative 'module'
module Produce
class Merchant
def create(_options, _args)
login
merchant_identifier = detect_merchant_identifier
merchant = find_merchant(merchant_identifier)
if merchant
UI.success("[DevCenter] Merchant '#{merchant.bundle_id})' alre... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/manager.rb | Ruby | mit | 41,450 | master | 531 | require 'fastlane_core/print_table'
require_relative 'developer_center'
require_relative 'itunes_connect'
module Produce
class Manager
# Produces app at DeveloperCenter and ItunesConnect
def self.start_producing
FastlaneCore::PrintTable.print_values(config: Produce.config, hide_keys: [], title: "Summar... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/commands_generator.rb | Ruby | mit | 41,450 | master | 18,798 | require 'commander'
require 'fastlane/version'
require 'fastlane_core/ui/help_formatter'
require 'fastlane_core/configuration/config_item'
require 'fastlane_core/print_table'
require_relative 'module'
require_relative 'manager'
require_relative 'options'
HighLine.track_eof = false
module Produce
class CommandsGene... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/cloud_container.rb | Ruby | mit | 41,450 | master | 3,041 | require 'spaceship'
require_relative 'module'
module Produce
class CloudContainer
def create(options, _args)
login
container_identifier = options.container_identifier || UI.input("iCloud Container identifier: ")
if container_exists?(container_identifier)
UI.success("[DevCenter] iCloud... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/developer_center.rb | Ruby | mit | 41,450 | master | 7,737 | require 'spaceship'
require_relative 'module'
module Produce
class DeveloperCenter
SERVICE_ON = "on"
SERVICE_OFF = "off"
SERVICE_COMPLETE = "complete"
SERVICE_UNLESS_OPEN = "unlessopen"
SERVICE_UNTIL_FIRST_LAUNCH = "untilfirstauth"
SERVICE_LEGACY = "legacy"
SERVICE_CLOUDKIT = "cloudkit"
... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/service.rb | Ruby | mit | 41,450 | master | 15,169 | require 'spaceship'
require_relative 'module'
# rubocop:disable Metrics/ClassLength
module Produce
class Service
include Spaceship::ConnectAPI::BundleIdCapability::Type
include Spaceship::ConnectAPI::BundleIdCapability::Settings
include Spaceship::ConnectAPI::BundleIdCapability::Options
def self.ena... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/itunes_connect.rb | Ruby | mit | 41,450 | master | 4,951 | require 'spaceship'
require 'spaceship/tunes/tunes'
require 'fastlane_core/languages'
require_relative 'module'
module Produce
class ItunesConnect
def run
@full_bundle_identifier = app_identifier
@full_bundle_identifier.gsub!('*', Produce.config[:bundle_identifier_suffix].to_s) if wildcard_bundle?
... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/available_default_languages.rb | Ruby | mit | 41,450 | master | 1,174 | module Produce
class AvailableDefaultLanguages
# If you update this list, you probably also have to update these files:
# - fastlane_core/lib/fastlane_core/languages.rb
# - spaceship/lib/assets/languageMapping.json
# See this pull request for example: https://github.com/fastlane/fastlane/pull/14110
... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/module.rb | Ruby | mit | 41,450 | master | 408 | require 'fastlane_core/helper'
module Produce
class << self
attr_accessor :config
end
Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
UI = FastlaneCore::UI
ROOT = Pathname.new(File.expand_path('../../..', __FILE__))
ENV['FASTLANE_TEA... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/lib/produce/options.rb | Ruby | mit | 41,450 | master | 12,520 | require 'fastlane_core/configuration/config_item'
require 'credentials_manager/appfile_config'
require_relative 'module'
require_relative 'developer_center'
module Produce
class Options
def self.available_options
user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)
user ||= ... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/spec/merchant_spec.rb | Ruby | mit | 41,450 | master | 4,325 | require "produce/merchant"
describe Produce::Merchant do
describe ".detect_merchant_identifier" do
it "accesses merchant identifier from produce config" do
config = { merchant_identifier: "merchant.com.example.app" }
result = Produce::Merchant.detect_merchant_identifier(config)
expect(result)... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/spec/commands_generator_spec.rb | Ruby | mit | 41,450 | master | 11,444 | require 'produce/commands_generator'
require 'produce/service'
require 'produce/group'
require 'produce/merchant'
require 'produce/cloud_container'
describe Produce::CommandsGenerator do
let(:available_options) { Produce::Options.available_options }
describe ":create option handling" do
it "can use the skip_i... |
github | fastlane/fastlane | https://github.com/fastlane/fastlane | produce/spec/manager_spec.rb | Ruby | mit | 41,450 | master | 943 | describe Produce do
describe "Manager" do
it "should auto convert string hash keys to symbol keys" do
Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, {
username: "helmut@januschka.com",
enable_services: { "data_protection" => "complete" },
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | devise.gemspec | Ruby | mit | 24,345 | main | 1,425 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
$:.push File.expand_path("../lib", __FILE__)
require "devise/version"
Gem::Specification.new do |s|
s.name = "devise"
s.version = Devise::VERSION.dup
s.platform = Gem::Platform::RUBY
s.licenses = ["MIT"]
s.summary = "Flexible authe... |
github | heartcombo/devise | https://github.com/heartcombo/devise | Rakefile | Ruby | mit | 24,345 | main | 1,026 | # encoding: UTF-8
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rdoc/task'
desc 'Default: run tests for all ORMs.'
task default: :test
desc 'Run Devise tests for all ORMs.'
task :pre_commit do
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | Gemfile | Ruby | mit | 24,345 | main | 536 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "omniauth"
gem "omniauth-oauth2"
gem "rails", "~> 8.1.0"
gem "rdoc"
gem "rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "minitest", "< 6"
gem "mocha", "~> 2.1", require: false
gem "omniauth-facebook"
gem "omni... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise.rb | Ruby | mit | 24,345 | main | 17,661 | # frozen_string_literal: true
require 'rails'
require 'active_support/core_ext/numeric/time'
require 'active_support/dependencies'
require 'orm_adapter'
require 'set'
require 'securerandom'
require 'responders'
module Devise
autoload :Delegator, 'devise/delegator'
autoload :Encryptor, 'devise/en... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/devise.rb | Ruby | mit | 24,345 | main | 15,538 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/registrations_controller.rb | Ruby | mit | 24,345 | main | 1,450 | # frozen_string_literal: true
class <%= @scope_prefix %>RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]
# GET /resource/sign_up
# def new
# super
# end
# POST /resour... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/confirmations_controller.rb | Ruby | mit | 24,345 | main | 676 | # frozen_string_literal: true
class <%= @scope_prefix %>ConfirmationsController < Devise::ConfirmationsController
# GET /resource/confirmation/new
# def new
# super
# end
# POST /resource/confirmation
# def create
# super
# end
# GET /resource/confirmation?confirmation_token=abcdef
# def show... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/unlocks_controller.rb | Ruby | mit | 24,345 | main | 595 | # frozen_string_literal: true
class <%= @scope_prefix %>UnlocksController < Devise::UnlocksController
# GET /resource/unlock/new
# def new
# super
# end
# POST /resource/unlock
# def create
# super
# end
# GET /resource/unlock?unlock_token=abcdef
# def show
# super
# end
# protected
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/passwords_controller.rb | Ruby | mit | 24,345 | main | 663 | # frozen_string_literal: true
class <%= @scope_prefix %>PasswordsController < Devise::PasswordsController
# GET /resource/password/new
# def new
# super
# end
# POST /resource/password
# def create
# super
# end
# GET /resource/password/edit?reset_password_token=abcdef
# def edit
# super
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/omniauth_callbacks_controller.rb | Ruby | mit | 24,345 | main | 680 | # frozen_string_literal: true
class <%= @scope_prefix %>OmniauthCallbacksController < Devise::OmniauthCallbacksController
# You should configure your model like this:
# devise :omniauthable, omniauth_providers: [:twitter]
# You should also create an action method in this controller like this:
# def twitter
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/templates/controllers/sessions_controller.rb | Ruby | mit | 24,345 | main | 556 | # frozen_string_literal: true
class <%= @scope_prefix %>SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
# POST /resource/sign_in
# def create
# super
# end
# DELETE /resource/sign_out
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/active_record/devise_generator.rb | Ruby | mit | 24,345 | main | 3,726 | # frozen_string_literal: true
require 'rails/generators/active_record'
require 'generators/devise/orm_helpers'
module ActiveRecord
module Generators
class DeviseGenerator < Base
argument :attributes, type: :array, default: [], banner: "field:type field:type"
class_option :primary_key_type, type: :s... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/active_record/templates/migration_existing.rb | Ruby | mit | 24,345 | main | 998 | # frozen_string_literal: true
class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
def self.up
change_table :<%= table_name %> do |t|
<%= migration_data -%>
<% attributes.each do |attribute| -%>
t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>
# Unc... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/active_record/templates/migration.rb | Ruby | mit | 24,345 | main | 666 | # frozen_string_literal: true
class DeviseCreate<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
def change
create_table :<%= table_name %><%= primary_key_type %> do |t|
<%= migration_data -%>
<% attributes.each do |attribute| -%>
t.<%= attribute.type %> :<%= attribute.name %>
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/devise/views_generator.rb | Ruby | mit | 24,345 | main | 4,491 | # frozen_string_literal: true
require 'rails/generators/base'
module Devise
module Generators
# Include this module in your generator to generate Devise views.
# `copy_views` is the main method and by default copies all views
# with forms.
module ViewPathTemplates #:nodoc:
extend ActiveSupport... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/devise/devise_generator.rb | Ruby | mit | 24,345 | main | 869 | # frozen_string_literal: true
require 'rails/generators/named_base'
module Devise
module Generators
class DeviseGenerator < Rails::Generators::NamedBase
include Rails::Generators::ResourceHelpers
namespace "devise"
source_root File.expand_path("../templates", __FILE__)
desc "Generates ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/devise/orm_helpers.rb | Ruby | mit | 24,345 | main | 877 | # frozen_string_literal: true
module Devise
module Generators
module OrmHelpers
def model_contents
buffer = <<-CONTENT
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/devise/controllers_generator.rb | Ruby | mit | 24,345 | main | 1,579 | # frozen_string_literal: true
require 'rails/generators/base'
module Devise
module Generators
class ControllersGenerator < Rails::Generators::Base
CONTROLLERS = %w(confirmations passwords registrations sessions unlocks omniauth_callbacks).freeze
desc <<-DESC.strip_heredoc
Create inherited D... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/devise/install_generator.rb | Ruby | mit | 24,345 | main | 1,137 | # frozen_string_literal: true
require 'rails/generators/base'
require 'securerandom'
module Devise
module Generators
MissingORMError = Class.new(Thor::Error)
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../../templates", __FILE__)
desc "Creates a Devise initia... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/generators/mongoid/devise_generator.rb | Ruby | mit | 24,345 | main | 1,748 | # frozen_string_literal: true
require 'rails/generators/named_base'
require 'generators/devise/orm_helpers'
module Mongoid
module Generators
class DeviseGenerator < Rails::Generators::NamedBase
include Devise::Generators::OrmHelpers
def generate_model
invoke "mongoid:model", [name] unless m... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/time_inflector.rb | Ruby | mit | 24,345 | main | 299 | # frozen_string_literal: true
require "active_support/core_ext/module/delegation"
module Devise
class TimeInflector
include ActionView::Helpers::DateHelper
class << self
attr_reader :instance
delegate :time_ago_in_words, to: :instance
end
@instance = new
end
end |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/rails.rb | Ruby | mit | 24,345 | main | 1,698 | # frozen_string_literal: true
require 'devise/rails/routes'
require 'devise/rails/warden_compat'
module Devise
class Engine < ::Rails::Engine
config.devise = Devise
# Initialize Warden and copy its configurations.
config.app_middleware.use Warden::Manager do |config|
Devise.warden_config = config... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/delegator.rb | Ruby | mit | 24,345 | main | 423 | # frozen_string_literal: true
module Devise
# Checks the scope in the given environment and returns the associated failure app.
class Delegator
def call(env)
failure_app(env).call(env)
end
def failure_app(env)
app = env["warden.options"] &&
(scope = env["warden.options"][:scope]) &... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models.rb | Ruby | mit | 24,345 | main | 3,579 | # frozen_string_literal: true
module Devise
module Models
class MissingAttribute < StandardError
def initialize(attributes)
@attributes = attributes
end
def message
"The following attribute(s) is (are) missing on your model: #{@attributes.join(", ")}"
end
end
# C... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/orm.rb | Ruby | mit | 24,345 | main | 2,286 | # frozen_string_literal: true
module Devise
module Orm # :nodoc:
def self.active_record?(model)
defined?(ActiveRecord) && model < ActiveRecord::Base
end
def self.included(model)
if Devise::Orm.active_record?(model)
model.include DirtyTrackingActiveRecordMethods
else
mod... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/failure_app.rb | Ruby | mit | 24,345 | main | 8,619 | # frozen_string_literal: true
require "action_controller/metal"
module Devise
# Failure application that will be called every time :warden is thrown from
# any strategy or hook. It is responsible for redirecting the user to the sign
# in page based on current scope and mapping. If no scope is given, it
# redi... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/modules.rb | Ruby | mit | 24,345 | main | 1,107 | # frozen_string_literal: true
require 'active_support/core_ext/object/with_options'
Devise.with_options model: true do |d|
# Strategies first
d.with_options strategy: true do |s|
routes = [nil, :new, :destroy]
s.add_module :database_authenticatable, controller: :sessions, route: { session: routes }
s.... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/omniauth.rb | Ruby | mit | 24,345 | main | 883 | # frozen_string_literal: true
begin
gem "omniauth", ">= 1.0.0"
require "omniauth"
rescue LoadError
warn "Could not load 'omniauth'. Please ensure you have the omniauth gem >= 1.0.0 installed and listed in your Gemfile."
raise
end
# Clean up the default path_prefix. It will be automatically set by Devise.
Omn... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/parameter_filter.rb | Ruby | mit | 24,345 | main | 1,272 | # frozen_string_literal: true
module Devise
class ParameterFilter
def initialize(case_insensitive_keys, strip_whitespace_keys)
@case_insensitive_keys = case_insensitive_keys || []
@strip_whitespace_keys = strip_whitespace_keys || []
end
def filter(conditions)
conditions = stringify_par... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/encryptor.rb | Ruby | mit | 24,345 | main | 675 | # frozen_string_literal: true
require 'bcrypt'
module Devise
module Encryptor
def self.digest(klass, password)
if klass.pepper.present?
password = "#{password}#{klass.pepper}"
end
::BCrypt::Password.create(password, cost: klass.stretches).to_s
end
def self.compare(klass, hashe... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/parameter_sanitizer.rb | Ruby | mit | 24,345 | main | 5,606 | # frozen_string_literal: true
module Devise
# The +ParameterSanitizer+ deals with permitting specific parameters values
# for each +Devise+ scope in the application.
#
# The sanitizer knows about Devise default parameters (like +password+ and
# +password_confirmation+ for the `RegistrationsController`), and ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/token_generator.rb | Ruby | mit | 24,345 | main | 716 | # frozen_string_literal: true
require 'openssl'
module Devise
class TokenGenerator
def initialize(key_generator, digest = "SHA256")
@key_generator = key_generator
@digest = digest
end
def digest(klass, column, value)
value.present? && OpenSSL::HMAC.hexdigest(@digest, key_for(column), ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/mapping.rb | Ruby | mit | 24,345 | main | 5,519 | # frozen_string_literal: true
module Devise
# Responsible for handling devise mappings and routes configuration. Each
# resource configured by devise_for in routes is actually creating a mapping
# object. You can refer to devise_for in routes for usage options.
#
# The required value in devise_for is actuall... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/rails/routes.rb | Ruby | mit | 24,345 | main | 20,127 | # frozen_string_literal: true
require "active_support/core_ext/object/try"
require "active_support/core_ext/hash/slice"
module Devise
module RouteSet
def finalize!
result = super
@devise_finalized ||= begin
if Devise.router_name.nil? && defined?(@devise_finalized) && self != Rails.applicatio... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/rails/warden_compat.rb | Ruby | mit | 24,345 | main | 233 | # frozen_string_literal: true
module Warden::Mixins::Common
def request
@request ||= ActionDispatch::Request.new(env)
end
def reset_session!
request.reset_session
end
def cookies
request.cookie_jar
end
end |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/omniauth/config.rb | Ruby | mit | 24,345 | main | 1,413 | # frozen_string_literal: true
module Devise
module OmniAuth
class StrategyNotFound < NameError
def initialize(strategy)
@strategy = strategy
super("Could not find a strategy with name `#{strategy}'. " \
"Please ensure it is required or explicitly set it using the :strategy_class o... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/omniauth/url_helpers.rb | Ruby | mit | 24,345 | main | 1,030 | # frozen_string_literal: true
module Devise
module OmniAuth
module UrlHelpers
def omniauth_authorize_path(resource_or_scope, provider, *args)
scope = Devise::Mapping.find_scope!(resource_or_scope)
_devise_route_context.send("#{scope}_#{provider}_omniauth_authorize_path", *args)
end
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/trackable.rb | Ruby | mit | 24,345 | main | 541 | # frozen_string_literal: true
# After each sign in, update sign in time, sign in count and sign in IP.
# This is only triggered when the user is explicitly set (with set_user)
# and on authentication. Retrieving the user from session (:fetch) does
# not trigger it.
Warden::Manager.after_set_user except: :fetch do |rec... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/forgetable.rb | Ruby | mit | 24,345 | main | 464 | # frozen_string_literal: true
# Before logout hook to forget the user in the given scope, if it responds
# to forget_me! Also clear remember token to ensure the user won't be
# remembered again. Notice that we forget the user unless the record is not persisted.
# This avoids forgetting deleted users.
Warden::Manager.b... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/csrf_cleaner.rb | Ruby | mit | 24,345 | main | 507 | # frozen_string_literal: true
Warden::Manager.after_authentication do |record, warden, options|
clean_up_for_winning_strategy = !warden.winning_strategy.respond_to?(:clean_up_csrf?) ||
warden.winning_strategy.clean_up_csrf?
if Devise.clean_up_csrf_token_on_authentication && clean_up_for_winning_strategy
if... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/proxy.rb | Ruby | mit | 24,345 | main | 486 | # frozen_string_literal: true
module Devise
module Hooks
# A small warden proxy so we can remember, forget and
# sign out users from hooks.
class Proxy #:nodoc:
include Devise::Controllers::Rememberable
include Devise::Controllers::SignInOut
attr_reader :warden
delegate :cookies,... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/activatable.rb | Ruby | mit | 24,345 | main | 565 | # frozen_string_literal: true
# Deny user access whenever their account is not active yet.
# We need this as hook to validate the user activity on each request
# and in case the user is using other strategies beside Devise ones.
Warden::Manager.after_set_user do |record, warden, options|
if record && record.respond_... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/rememberable.rb | Ruby | mit | 24,345 | main | 324 | # frozen_string_literal: true
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
scope = options[:scope]
if record.respond_to?(:remember_me) && options[:store] != false &&
record.remember_me && warden.authenticated?(scope)
Devise::Hooks::Proxy.new(warden).remember_me(record)
end
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/lockable.rb | Ruby | mit | 24,345 | main | 390 | # frozen_string_literal: true
# After each sign in, if resource responds to failed_attempts, sets it to 0
# This is only triggered when the user is explicitly set (with set_user)
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
if record.respond_to?(:reset_failed_attempts!) && warden.authen... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/hooks/timeoutable.rb | Ruby | mit | 24,345 | main | 1,375 | # frozen_string_literal: true
# Each time a record is set we check whether its session has already timed out
# or not, based on last request time. If so, the record is logged out and
# redirected to the sign in page. Also, each time the request comes and the
# record is set, we set the last request time inside its sco... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/mailers/helpers.rb | Ruby | mit | 24,345 | main | 2,376 | # frozen_string_literal: true
module Devise
module Mailers
module Helpers
extend ActiveSupport::Concern
included do
include Devise::Controllers::ScopedViews
end
protected
attr_reader :scope_name, :resource
# Configure default email options
def devise_mail(rec... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/test/integration_helpers.rb | Ruby | mit | 24,345 | main | 1,733 | # frozen_string_literal: true
module Devise
# Devise::Test::IntegrationHelpers is a helper module for facilitating
# authentication on Rails integration tests to bypass the required steps for
# signin in or signin out a record.
#
# Examples
#
# class PostsTest < ActionDispatch::IntegrationTest
# in... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/test/controller_helpers.rb | Ruby | mit | 24,345 | main | 5,312 | # frozen_string_literal: true
module Devise
module Test
# `Devise::Test::ControllerHelpers` provides a facility to test controllers
# in isolation when using `ActionController::TestCase` allowing you to
# quickly sign_in or sign_out a user. Do not use
# `Devise::Test::ControllerHelpers` in integratio... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/strategies/base.rb | Ruby | mit | 24,345 | main | 638 | # frozen_string_literal: true
module Devise
module Strategies
# Base strategy for Devise. Responsible for verifying correct scope and mapping.
class Base < ::Warden::Strategies::Base
# Whenever CSRF cannot be verified, we turn off any kind of storage
def store?
!env["devise.skip_storage"]... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/strategies/database_authenticatable.rb | Ruby | mit | 24,345 | main | 1,234 | # frozen_string_literal: true
require 'devise/strategies/authenticatable'
module Devise
module Strategies
# Default strategy for signing in a user, based on their email and password in the database.
class DatabaseAuthenticatable < Authenticatable
def authenticate!
resource = password.present?... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/strategies/authenticatable.rb | Ruby | mit | 24,345 | main | 6,241 | # frozen_string_literal: true
require 'devise/strategies/base'
module Devise
module Strategies
# This strategy should be used as basis for authentication strategies. It retrieves
# parameters both from params or from http authorization headers. See database_authenticatable
# for an example.
class Au... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/strategies/rememberable.rb | Ruby | mit | 24,345 | main | 1,973 | # frozen_string_literal: true
require 'devise/strategies/authenticatable'
module Devise
module Strategies
# Remember the user through the remember token. This strategy is responsible
# to verify whether there is a cookie with the remember token, and to
# recreate the user from this cookie if it exists. ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/scoped_views.rb | Ruby | mit | 24,345 | main | 368 | # frozen_string_literal: true
module Devise
module Controllers
module ScopedViews
extend ActiveSupport::Concern
module ClassMethods
def scoped_views?
defined?(@scoped_views) ? @scoped_views : Devise.scoped_views
end
def scoped_views=(value)
@scoped_views ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/sign_in_out.rb | Ruby | mit | 24,345 | main | 4,251 | # frozen_string_literal: true
module Devise
module Controllers
# Provide sign in and sign out functionality.
# Included by default in all controllers.
module SignInOut
# Return true if the given scope is signed in session. If no scope given, return
# true if any scope is signed in. This will ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/url_helpers.rb | Ruby | mit | 24,345 | main | 2,493 | # frozen_string_literal: true
module Devise
module Controllers
# Create url helpers to be used with resource/scope configuration. Acts as
# proxies to the generated routes created by devise.
# Resource param can be a string or symbol, a class, or an instance object.
# Example using a :user resource:
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/rememberable.rb | Ruby | mit | 24,345 | main | 1,956 | # frozen_string_literal: true
module Devise
module Controllers
# A module that may be optionally included in a controller in order
# to provide remember me behavior. Useful when signing in is done
# through a callback, like in OmniAuth.
module Rememberable
# Return default cookie values retriev... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/responder.rb | Ruby | mit | 24,345 | main | 1,375 | # frozen_string_literal: true
module Devise
module Controllers
# Custom Responder to configure default statuses that only apply to Devise,
# and allow to integrate more easily with Hotwire/Turbo.
class Responder < ActionController::Responder
if respond_to?(:error_status=) && respond_to?(:redirect_s... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/store_location.rb | Ruby | mit | 24,345 | main | 2,090 | # frozen_string_literal: true
require "uri"
module Devise
module Controllers
# Provide the ability to store a location.
# Used to redirect back to a desired path after sign in.
# Included by default in all controllers.
module StoreLocation
# Returns and delete (if it's navigational format) the... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/controllers/helpers.rb | Ruby | mit | 24,345 | main | 11,705 | # frozen_string_literal: true
module Devise
module Controllers
# Those helpers are convenience methods added to ApplicationController.
module Helpers
extend ActiveSupport::Concern
include Devise::Controllers::SignInOut
include Devise::Controllers::StoreLocation
included do
if... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/lockable.rb | Ruby | mit | 24,345 | main | 7,800 | # frozen_string_literal: true
require "devise/hooks/lockable"
module Devise
module Models
# Handles blocking a user access after a certain number of attempts.
# Lockable accepts two different strategies to unlock a user after it's
# blocked: email and time. The former will send an email to the user when... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/rememberable.rb | Ruby | mit | 24,345 | main | 5,632 | # frozen_string_literal: true
require 'devise/strategies/rememberable'
require 'devise/hooks/rememberable'
require 'devise/hooks/forgetable'
module Devise
module Models
# Rememberable manages generating and clearing token for remembering the user
# from a saved cookie. Rememberable also has utility methods ... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/omniauthable.rb | Ruby | mit | 24,345 | main | 656 | # frozen_string_literal: true
require 'devise/omniauth'
module Devise
module Models
# Adds OmniAuth support to your model.
#
# == Options
#
# Oauthable adds the following options to +devise+:
#
# * +omniauth_providers+: Which providers are available to this model. It expects an array:
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/timeoutable.rb | Ruby | mit | 24,345 | main | 1,105 | # frozen_string_literal: true
require 'devise/hooks/timeoutable'
module Devise
module Models
# Timeoutable takes care of verifying whether a user session has already
# expired or not. When a session expires after the configured time, the user
# will be asked for credentials again, it means, they will be... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/confirmable.rb | Ruby | mit | 24,345 | main | 16,029 | # frozen_string_literal: true
module Devise
module Models
# Confirmable is responsible to verify if an account is already confirmed to
# sign in, and to send emails with confirmation instructions.
# Confirmation instructions are sent to the user email after creating a
# record and when manually reque... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/database_authenticatable.rb | Ruby | mit | 24,345 | main | 7,039 | # frozen_string_literal: true
require 'devise/strategies/database_authenticatable'
module Devise
module Models
# Authenticatable Module, responsible for hashing the password and
# validating the authenticity of a user while signing in.
#
# This module defines a `password=` method. This method will h... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/registerable.rb | Ruby | mit | 24,345 | main | 825 | # frozen_string_literal: true
module Devise
module Models
# Registerable is responsible for everything related to registering a new
# resource (ie user sign up).
module Registerable
extend ActiveSupport::Concern
def self.required_fields(klass)
[]
end
module ClassMethods
... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/trackable.rb | Ruby | mit | 24,345 | main | 1,727 | # frozen_string_literal: true
require 'devise/hooks/trackable'
module Devise
module Models
# Track information about your user sign in. It tracks the following columns:
#
# * sign_in_count - Increased every time a sign in is made (by form, openid, oauth)
# * current_sign_in_at - A timestamp upd... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/validatable.rb | Ruby | mit | 24,345 | main | 2,666 | # frozen_string_literal: true
module Devise
module Models
# Validatable creates all needed validations for a user email and password.
# It's optional, given you may want to create the validations by yourself.
# Automatically validate if the email is present, unique and its format is
# valid. Also tes... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/authenticatable.rb | Ruby | mit | 24,345 | main | 12,220 | # frozen_string_literal: true
require 'devise/hooks/activatable'
require 'devise/hooks/csrf_cleaner'
module Devise
module Models
# Authenticatable module. Holds common settings for authentication.
#
# == Options
#
# Authenticatable adds the following options to +devise+:
#
# * +authent... |
github | heartcombo/devise | https://github.com/heartcombo/devise | lib/devise/models/recoverable.rb | Ruby | mit | 24,345 | main | 6,400 | # frozen_string_literal: true
module Devise
module Models
# Recoverable takes care of resetting the user password and send reset instructions.
#
# ==Options
#
# Recoverable adds the following options to +devise+:
#
# * +reset_password_keys+: the keys you want to use when recovering the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.