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 | jfairbank/chroma | https://github.com/jfairbank/chroma | spec/color/custom_palette_spec.rb | Ruby | isc | 234 | master | 410 | describe Chroma::Color, '#custom_palette' do
let(:subject) do
'red'.paint.custom_palette do
spin 60
spin 180
spin(60).brighten(20)
greyscale
end
end
it 'generates the correct colors' do
expect(subject).
to generate_palette %w(#ff0000 #ffff00 #00ffff #ffff33 #808080)
en... |
github | jfairbank/chroma | https://github.com/jfairbank/chroma | spec/color/palette_spec.rb | Ruby | isc | 234 | master | 5,112 | describe Chroma::Color, '#palette' do
let(:red) { 'red'.paint }
def palette(name, *args)
red.palette.send(name, *args)
end
it 'returns an instance of Harmonies' do
expect(red.palette).to be_a Chroma::Harmonies
end
describe '#complement' do
it 'returns the color and its complement' do
ex... |
github | jfairbank/chroma | https://github.com/jfairbank/chroma | spec/chroma/define_palette_spec.rb | Ruby | isc | 234 | master | 817 | describe Chroma, '.define_palette' do
def add_palette
Chroma.define_palette :foo do
spin 60
spin 180
spin(60).brighten(20)
greyscale
end
end
def remove_palette
if Chroma::Harmonies.method_defined? :foo
Chroma::Harmonies.send(:remove_method, :foo)
end
end
after(:... |
github | jfairbank/chroma | https://github.com/jfairbank/chroma | spec/chroma/paint_spec.rb | Ruby | isc | 234 | master | 1,478 | require 'spec_helper'
describe Chroma do
describe '.paint' do
context 'with named color' do
it 'creates a color' do
expect(Chroma.paint('red')).to be_a(Chroma::Color)
end
end
context 'with 6 character hexadecimal' do
it 'creates a color' do
expect(Chroma.paint('#ff0000'... |
github | platanus/potassium | https://github.com/platanus/potassium | potassium.gemspec | Ruby | mit | 233 | master | 1,695 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'potassium/version'
Gem::Specification.new do |spec|
spec.name = "potassium"
spec.version = Potassium::VERSION
spec.authors = ["juliogarciag"]
spec.email = ["j... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/front_end_vite_spec.rb | Ruby | mit | 233 | master | 3,294 | require 'spec_helper'
RSpec.describe 'Front end' do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project('front_end_vite' => true)
end
def read_file(file_path)
IO.read("#{project_path}/#{file_path}")
end
let(:gemfile) { read_file('Gemfile') }
let(:application_f... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/spec_helper.rb | Ruby | mit | 233 | master | 819 | require "bundler/setup"
Bundler.require(:default, :test)
require (Pathname.new(__FILE__).dirname + "../lib/potassium").expand_path
Dir["./spec/support/**/*.rb"].each { |file| require file }
RSpec.configure do |config|
config.include PotassiumTestHelpers
config.expect_with :rspec do |expectations|
expectati... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/vue_admin_spec.rb | Ruby | mit | 233 | master | 1,368 | require "spec_helper"
require "pry"
RSpec.describe "VueAdmin" do
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project(:vue_admin => true, "admin" => true, "devise" => true)
end
it "adds component integration to active admin initializer" do
admin_initializer_path = "#{... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/node_spec.rb | Ruby | mit | 233 | master | 870 | require "spec_helper"
RSpec.describe "Node" do
let(:version) { Potassium::NODE_VERSION }
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "adds engine with node version to package.json" do
package_json_path = "#{project_path}/package.json"
expect(Fi... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/schedule_spec.rb | Ruby | mit | 233 | master | 811 | require "spec_helper"
RSpec.describe "schedule" do
let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project(
"schedule" => true, "background_processor" => true, "email_service" => "sendgrid"
)
en... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/error_reporting_spec.rb | Ruby | mit | 233 | master | 706 | require "spec_helper"
RSpec.describe "Error Reporting" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("sentry" => true)
end
it "adds the Sentry gem to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfile")
expect(gemfile_content).to include("se... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/github_spec.rb | Ruby | mit | 233 | master | 1,936 | require "spec_helper"
RSpec.describe "GitHub" do
let(:org_name) { "platanus" }
let(:repo_name) { PotassiumTestHelpers::APP_NAME.dasherize }
let(:access_token) { "1234" }
let(:pr_template_file) { IO.read("#{project_path}/.github/pull_request_template.md") }
before do
drop_dummy_database
remove_projec... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/background_processor_spec.rb | Ruby | mit | 233 | master | 2,505 | require "spec_helper"
require 'yaml'
RSpec.describe "BackgroundProcessor" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("background_processor" => true, "heroku" => true)
end
it "adds sidekiq gem to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfi... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/data_migrate_spec.rb | Ruby | mit | 233 | master | 399 | require "spec_helper"
RSpec.describe 'DataMigrate' do
let(:gemfile) { IO.read("#{project_path}/Gemfile") }
let(:annotate_task) { IO.read("#{project_path}/lib/tasks/auto_annotate_models.rake") }
before(:all) do
remove_project_directory
create_dummy_project
end
it { expect(gemfile).to include("data_m... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/ci_spec.rb | Ruby | mit | 233 | master | 740 | require "spec_helper"
require "rubocop"
RSpec.describe 'CI' do
let(:ci_config) do
yml_path = "#{project_path}/.circleci/config.yml"
IO.read(yml_path)
end
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "adds brakeman to Gemfile" do
content = ... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/coverage_spec.rb | Ruby | mit | 233 | master | 1,203 | require "spec_helper"
RSpec.describe "Coverage" do
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "adds simplecov related gems to Gemfile" do
content = IO.read("#{project_path}/Gemfile")
expect(content).to include("simplecov")
expect(content).to ... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/pundit_spec.rb | Ruby | mit | 233 | master | 2,966 | require "spec_helper"
RSpec.describe "Pundit" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("pundit" => true, "devise" => true, "admin" => true)
end
it "adds the Pundit gem to Gemfile" do
content = IO.read("#{project_path}/Gemfile")
expect(content).to i... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/database_container_spec.rb | Ruby | mit | 233 | master | 1,149 | require "spec_helper"
require "yaml"
RSpec.describe "DatabaseContainer" do
before(:all) do
drop_dummy_database
end
before do
remove_project_directory
create_dummy_project("database" => database)
end
[:postgresql, :mysql].each do |db_type|
context "when database is #{db_type}" do
let!(... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/mjml_spec.rb | Ruby | mit | 233 | master | 1,918 | require "spec_helper"
RSpec.describe "Mjml" do
let(:gemfile) { IO.read("#{project_path}/Gemfile") }
let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
let(:sidekiq_config) { IO.read("#{project_path}/config/sidek... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/database_spec.rb | Ruby | mit | 233 | master | 333 | require "spec_helper"
RSpec.describe "Database" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "adds the Strong Migrations gem to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfile")
expect(gemfile_content).to include("strong_migrations... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/bullet_spec.rb | Ruby | mit | 233 | master | 1,082 | require "spec_helper"
RSpec.describe "Bullet" do
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
context "with all the bullet config" do
let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
it { expect(dev_config).to includ... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/google_tag_manager_spec.rb | Ruby | mit | 233 | master | 1,119 | require "spec_helper"
RSpec.describe "Google Tag Manager" do
before :all do
remove_project_directory
create_dummy_project('google_tag_manager' => true)
end
let(:gtm_head_file_path) do
"#{project_path}/app/views/shared/_gtm_head.html.erb"
end
let(:gtm_body_file_path) do
"#{project_path}/app/v... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/heroku_spec.rb | Ruby | mit | 233 | master | 2,268 | require "spec_helper"
RSpec.describe "Heroku" do
before(:all) do
drop_dummy_database
remove_project_directory
end
it "creates a project for Heroku" do
create_dummy_project("heroku" => true)
app_name = PotassiumTestHelpers::APP_NAME.dasherize
procfile_path = "#{project_path}/Procfile"
pr... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/redis_spec.rb | Ruby | mit | 233 | master | 1,354 | require "spec_helper"
require 'yaml'
RSpec.describe "RedisProcessor" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("heroku" => true)
end
context "when installed" do
it "adds redis-actionpack gem to Gemfile" do
gemfile_content = IO.read("#{project_path}... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/environment_variables_spec.rb | Ruby | mit | 233 | master | 833 | require 'spec_helper'
RSpec.describe 'EnvironmentVariables' do
let(:environment_variables) { IO.read("#{project_path}/lib/environment_variables.rb") }
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it 'creates a .env.test file' do
expect(File.exists?("#{p... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/draper_spec.rb | Ruby | mit | 233 | master | 608 | require "spec_helper"
RSpec.describe "Draper" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("draper" => true)
end
it "adds the Draper gem to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfile")
expect(gemfile_content).to include("draper")
e... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/mailer_spec.rb | Ruby | mit | 233 | master | 3,091 | require "spec_helper"
RSpec.describe "Mailer" do
let(:gemfile) { IO.read("#{project_path}/Gemfile") }
let(:env) { IO.read("#{project_path}/.env.development") }
let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
let(:prod_config) { IO.read("#{project_path}/config/environments/pro... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/i18n_spec.rb | Ruby | mit | 233 | master | 762 | require "spec_helper"
RSpec.describe "I18n" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("locale" => "es-CL")
end
it "adds the Clockwork gem to Gemfile" do
content = IO.read("#{project_path}/Gemfile")
expect(content).to include("rails-i18n")
end
i... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/testing_spec.rb | Ruby | mit | 233 | master | 2,073 | require "spec_helper"
RSpec.describe "Testing" do
let(:gemfile_content) { IO.read("#{project_path}/Gemfile") }
let(:rails_helper_content) { IO.read("#{project_path}/spec/rails_helper.rb") }
let(:rspec_content) { IO.read("#{project_path}/.rspec") }
let(:guard_content) { IO.read("#{project_path}/Guardfile") }
... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/new_project_spec.rb | Ruby | mit | 233 | master | 1,455 | require "spec_helper"
require "rubocop"
RSpec.describe "A new project" do
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "is correctly bundled" do
expect { on_project { `bundle exec rails -v` } }.not_to output.to_stderr
end
it "configures postgresql... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/file_storage_spec.rb | Ruby | mit | 233 | master | 4,867 | require "spec_helper"
RSpec.describe "File Storage" do
context "when selecting active_storage" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project(storage: :active_storage)
end
it "adds the aws-sdk-s3 gem to Gemfile" do
gemfile_content = IO.read("#... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/power_types_spec.rb | Ruby | mit | 233 | master | 722 | require "spec_helper"
RSpec.describe "PowerTypes" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "adds the PowerTypes gem to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfile")
expect(gemfile_content).to include("power-types")
end
... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/features/api_spec.rb | Ruby | mit | 233 | master | 952 | require "spec_helper"
RSpec.describe "Api" do
before :all do
drop_dummy_database
remove_project_directory
create_dummy_project("api" => true)
end
it "adds power_api related gems to Gemfile" do
gemfile_content = IO.read("#{project_path}/Gemfile")
expect(gemfile_content).to include("power_api"... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/support/fake_heroku.rb | Ruby | mit | 233 | master | 2,155 | require 'active_support/all'
class FakeHeroku
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
def initialize(args)
@args = args
end
def run!
if @args.first == "pipelines:info"
if FakeHeroku.has_created_pipeline?
puts "=== dummy-app\ns... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/support/fake_octokit.rb | Ruby | mit | 233 | master | 935 | class FakeOctokit
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'octokit'), File.dirname(__FILE__))
def initialize(options); end
def create_repository(repo_name, options)
File.open(RECORDER, 'a') do |file|
file.write "#{repo_name}, #{options.map { |key, value| "#{key}: #{value}" }}"
end... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/support/potassium_test_helpers.rb | Ruby | mit | 233 | master | 2,035 | require 'pathname'
require 'bundler'
require 'potassium/cli_options'
module PotassiumTestHelpers
include Potassium::CliOptions
APP_NAME = "dummy_app"
def remove_project_directory
FileUtils.rm_rf(project_path)
end
def create_tmp_directory
FileUtils.mkdir_p(tmp_path)
end
def create_dummy_projec... |
github | platanus/potassium | https://github.com/platanus/potassium | spec/support/fake_github.rb | Ruby | mit | 233 | master | 523 | class FakeGithub
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
def initialize(args)
@args = args
end
def run!
File.open(RECORDER, 'a') do |file|
file.write @args.join(' ')
end
end
def self.clear!
FileUtils.rm_rf RECORDER
end
d... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/cli.rb | Ruby | mit | 233 | master | 279 | require "potassium/version"
require "gli"
module Potassium::CLI
extend GLI::App
program_desc "Platanus Rails application generator"
version Potassium::VERSION
hide_commands_without_desc true
commands_from "potassium/cli/commands"
exit Potassium::CLI.run(ARGV)
end |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/template_finder.rb | Ruby | mit | 233 | master | 232 | module Potassium
class TemplateFinder
TEMPLATES = {
default: Potassium::ApplicationGenerator
}
def default_template
find(:default)
end
def find(name)
TEMPLATES.fetch(name)
end
end
end |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/text_spinner.rb | Ruby | mit | 233 | master | 1,301 | module Potassium
# TODO: I don't know if this is a concern of this gem. Maybe we should move this later
class TextSpinner
attr_accessor :wait_condition, :base_message, :interval, :message_continuations,
:counter, :started
DEFAULT_ATTRIBUTES = {
wait_condition: -> {},
base_message: "",
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/platanus_config.rb | Ruby | mit | 233 | master | 807 | module Potassium
class PlatanusConfig
def initialize(options)
@options = options
@option_key_names = Potassium::CliOptions.option_names
end
def generate!
default_options = {
'db': 'postgresql', 'locale': 'es-CL', 'email_service': 'sendgrid', 'devise': true,
'devise-user-... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/version.rb | Ruby | mit | 233 | master | 484 | module Potassium
VERSION = "7.2.0"
RUBY_VERSION = "2.7.0"
RAILS_VERSION = "~> 7.0.4.2"
RUBOCOP_VERSION = "~> 1.9"
RUBOCOP_RSPEC_VERSION = "~> 2.2"
POSTGRES_VERSION = "11.3"
MYSQL_VERSION = "5.7"
NODE_VERSION = "20"
TAILWINDCSS_VERSION = "^3.2.7"
POSTCSS_VERSION = "^8.4.21"
AUTOPREFIXER_VERSION = "... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/test_cli.rb | Ruby | mit | 233 | master | 906 | require "potassium/version"
require 'potassium/cli_options'
require './spec/support/potassium_test_helpers'
require "term/ansicolor"
require "gli"
module Potassium::TestCLI
extend self
extend GLI::App
extend PotassiumTestHelpers
extend Potassium::CliOptions
extend Term::ANSIColor
program_desc "Platanus Ra... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/node_version_ensurer.rb | Ruby | mit | 233 | master | 984 | module Potassium
class NodeVersionEnsurer
def ensure!
raise VersionError.new(install_message) if installed_node_version.nil?
raise VersionError.new(update_message) if Potassium::NODE_VERSION != installed_node_version
end
private
def installed_node_version
node_version = `node -v 2>... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/cli_options.rb | Ruby | mit | 233 | master | 6,139 | module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
CREATE_OPTIONS = [
{
type: :switch,
name: 'version-check',
desc: 'Performs a version check before running.',
negatable: true,
default_value: true,
default_test_value: true
},
{
type: :switch,
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/newest_version_ensurer.rb | Ruby | mit | 233 | master | 1,191 | require 'gems'
require 'semantic'
require 'potassium/text_spinner'
class VersionError < StandardError
end
module Potassium
class NewestVersionEnsurer
def initialize
self.installed_version = Semantic::Version.new(Potassium::VERSION)
self.text_spinner = Potassium::TextSpinner.new
end
def ensu... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/lib/dotenv_monkeypatch.rb | Ruby | mit | 233 | master | 652 | module Dotenv
module Substitutions
module Command
class << self
INTERPOLATED_SHELL_COMMAND = /
(?<backslash>\\)? # is it escaped with a backslash?
COMMAND_EXPAND # literal $
(?<cmd> # collect command content for eval
\( ... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/lib/tasks/auto_annotate_models.rake | Ruby | mit | 233 | master | 1,429 | if Rails.env.development?
task :set_annotation_options do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults(
'routes' => 'false',
'position_in_routes' => 'after',
'position_in_class' => 'after',
'position_in_test' => 'after... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/seeds/seeds.rb | Ruby | mit | 233 | master | 411 | # This file should contain all the record creation needed to seed the database
# with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
# Write the code in a way that can be executed multiple times without duplicating the information.
#
# For example:
#... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/seeds/fake_data_loader.rake | Ruby | mit | 233 | master | 425 | Rake::Task['db:setup'].enhance do
Rake::Task['db:fake_data:load'].invoke if Rails.env.development?
end
namespace :db do
namespace :fake_data do
desc "Loads development's fake data."
task load: :environment do
require 'fake_data_loader.rb'
if Rails.env.production?
puts "You can't run th... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/seeds/fake_data_loader.rb | Ruby | mit | 233 | master | 703 | # Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
# Whenever you can, use FactoryBot's methods to keep this code "self updated".
#
# For Example:
#
# Having a country factory in /spec/factories/countries.rb
#
# FactoryBot.define do
# factory :country do
# name "Chile"
#... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/seeds/admin_data_loader.rb | Ruby | mit | 233 | master | 871 | # Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
# Whenever you can, use FactoryBot's methods to keep this code "self updated".
#
# For Example:
#
# Having a country factory in /spec/factories/countries.rb
#
# FactoryBot.define do
# factory :country do
# name "Chile"
#... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/config/shrine.rb | Ruby | mit | 233 | master | 1,376 | require 'shrine'
if Rails.env.development?
require 'shrine/storage/file_system'
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/cache'),
store: Shrine::Storage::FileSystem.new('public', prefix: 'uploads')
}
elsif Rails.env.production?
require 'shrine/storage/s3'
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/config/puma.rb | Ruby | mit | 233 | master | 1,288 | # https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
# The environment variable WEB_CONCURRENCY may be set to a default value based
# on dyno size. To manually configure this value use heroku config:set
# WEB_CONCURRENCY.
#
# Increasing the number of workers will increase the a... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/config/initializers/session_store.rb | Ruby | mit | 233 | master | 508 | # https://github.com/redis-store/redis-store/issues/358#issuecomment-1537920008
class RedisClient::Config
alias original_initialize initialize
def initialize(**kwargs)
# remove not supported kwargs
original_initialize(
**kwargs.except(:raw, :serializer, :marshalling, :namespace, :scheme)
)
end
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/config/initializers/shrine/plugins/image_handling_utilities.rb | Ruby | mit | 233 | master | 4,798 | class Shrine
module Plugins
module ImageHandlingUtilities
# rubocop:disable Metrics/ModuleLength
module AttachmentMethods
def included(klass)
super
define_instance_methods
define_class_methods(klass)
end
private
def define_instance_metho... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/app/jobs/shrine_promote_job.rb | Ruby | mit | 233 | master | 549 | class ShrinePromoteJob < ApplicationJob
queue_as :default
def perform(attacher_class, record_class, record_id, name, file_data)
attacher_class = Object.const_get(attacher_class)
record = Object.const_get(record_class).find(record_id)
attacher = attacher_class.retrieve(model: record, name: name... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/app/serializers/concerns/image_handling_attributes.rb | Ruby | mit | 233 | master | 666 | module ImageHandlingAttributes
extend ActiveSupport::Concern
class_methods do
def add_image_handling_attributes(attachment_name:, derivatives:, include_original_image: false)
attributes attachment_name, "#{attachment_name}_blurhash".to_sym
define_method(attachment_name) do
attachment_hash ... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/app/uploaders/cover_image_uploader.rb | Ruby | mit | 233 | master | 1,604 | require "image_processing/vips"
class CoverImageUploader < ImageUploader
plugin :derivation_endpoint, prefix: "derivations/cover_image"
plugin :add_metadata
plugin :image_handling_utilities
DERIVATIVES = {
sm: { size: [426, 240], type: 'jpg' },
md: { size: [960, 540], type: 'jpg' },
lg: { size: [1... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/active_admin/policies/default_policy.rb | Ruby | mit | 233 | master | 571 | class BackOffice::DefaultPolicy
attr_reader :admin_user, :record
def initialize(admin_user, record)
@admin_user = admin_user
@record = record
end
def index?
true
end
def show?
true
end
def create?
true
end
def new?
create?
end
def update?
true
end
def edit?... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/testing/rails_helper.rb | Ruby | mit | 233 | master | 4,058 | ENV['RACK_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require 'rspec/rails'
require 'spec_helper'
=begin
General
=======
1) Place your unit tests inside the "spec" directory.
2) Run unit tests executing `bin/guard`.
3) Use support directories to add helpers and settings.
You can on... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/testing/simplecov_config.rb | Ruby | mit | 233 | master | 2,051 | require 'simplecov'
require 'simplecov_text_formatter'
require 'simplecov_linter_formatter'
require 'simplecov_json_formatter'
SimpleCovLinterFormatter.setup do |config|
config.scope = ENV.fetch(
"SIMPLE_COV_LINTER_SCOPE", :own_changes
)
config.json_filename = ENV.fetch(
"SIMPLE_COV_LINTER_JSON_FILENAME"... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/testing/pundit/comment_policy_spec.rb | Ruby | mit | 233 | master | 221 | RSpec.describe BackOffice::ActiveAdmin::CommentPolicy do
include_context 'with pundit setup'
let(:record) { instance_double('ActiveAdmin::Comment') }
it_behaves_like 'pundit back office - default permissions'
end |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/testing/pundit/page_policy_spec.rb | Ruby | mit | 233 | master | 459 | RSpec.describe BackOffice::ActiveAdmin::PagePolicy do
include_context 'with pundit setup'
let(:name) { 'Dashboard' }
let(:record) { instance_double('ActiveAdmin::Page', name: name) }
permissions :show? do
it_behaves_like 'pundit back office - grant access to admin'
context "with name different than '... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/assets/testing/pundit/shared_examples.rb | Ruby | mit | 233 | master | 2,205 | RSpec.shared_context 'with pundit setup' do
subject(:policy) { described_class }
let(:admin_user) { create(:admin_user) }
end
RSpec.shared_examples 'pundit back office - grant access to admin' do
it { expect(policy).to permit(admin_user, record) }
end
RSpec.shared_examples 'pundit back office - forbid access t... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/templates/application.rb | Ruby | mit | 233 | master | 1,840 | set :app_name, app_name
set :node_version, node_version
set :titleized_app_name, get(:app_name).titleize
set :underscorized_app_name, get(:app_name).underscore
set :dasherized_app_name, get(:app_name).dasherize
run_action(:cleaning) do
clean_gemfile
end
run_action(:asking) do
ask :database
ask :devise
ask :ad... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/templates/recipe.rb | Ruby | mit | 233 | master | 347 | set :app_name, app_name
set :titleized_app_name, get(:app_name).titleize
set :underscorized_app_name, get(:app_name).underscore
set :dasherized_app_name, get(:app_name).dasherize
recipe_name = ARGV.first
run_action(:recipe_loading) do
install recipe_name.to_sym
run_action(:gem_install) do
run "bundle install" ... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/google_tag_manager.rb | Ruby | mit | 233 | master | 2,195 | class Recipes::GoogleTagManager < Rails::AppBuilder
def ask
use_google_tag_manager = answer(:google_tag_manager) do
Ask.confirm 'Do you want to use Google Tag Manager?'
end
set(:google_tag_manager, use_google_tag_manager)
end
def create
install if selected?(:google_tag_manager)
end
de... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/pundit.rb | Ruby | mit | 233 | master | 3,031 | class Recipes::Pundit < Rails::AppBuilder
def ask
if get(:authentication).present?
use_pundit = answer(:pundit) { Ask.confirm("Do you want to use Pundit for authorization?") }
set(:authorization, use_pundit)
end
end
def create
if selected?(:authorization)
run_pundit_installer
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/node.rb | Ruby | mit | 233 | master | 579 | require 'net/http'
require 'semantic'
require 'json'
class Recipes::Node < Rails::AppBuilder
NODE_VERSION = Potassium::NODE_VERSION
def create
info "Using node version LTS #{NODE_VERSION}"
create_file '.node-version', NODE_VERSION, force: true
after(:vite_install) do
json_file = File.read(Pathna... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/script.rb | Ruby | mit | 233 | master | 396 | class Recipes::Script < Rails::AppBuilder
def create
template "../assets/bin/setup.erb", "bin/setup", force: true
run "chmod a+x bin/setup"
after(:database_creation) do
inside('.') { run('bin/setup') }
end
end
def install
heroku = load_recipe(:heroku)
set(:heroku, heroku.installed?... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/puma.rb | Ruby | mit | 233 | master | 208 | class Recipes::Puma < Rails::AppBuilder
def create
gather_gems(:production) do
gather_gem 'rack-timeout'
end
copy_file '../assets/config/puma.rb', 'config/puma.rb', force: true
end
end |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/front_end_vite.rb | Ruby | mit | 233 | master | 4,752 | class Recipes::FrontEndVite < Rails::AppBuilder
VUE_VERSION = Potassium::VUE_VERSION
POSTCSS_VERSION = Potassium::POSTCSS_VERSION
TAILWINDCSS_VERSION = Potassium::TAILWINDCSS_VERSION
AUTOPREFIXER_VERSION = Potassium::AUTOPREFIXER_VERSION
VUE_TEST_UTILS_VERSION = Potassium::VUE_TEST_UTILS_VERSION
JSDOM_VERSI... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/background_processor.rb | Ruby | mit | 233 | master | 2,025 | class Recipes::BackgroundProcessor < Rails::AppBuilder
def ask
response = if enabled_mailer?
info "Note: Emails should be sent on background jobs. We'll install sidekiq"
true
else
answer(:background_processor) do
Ask.confirm("Do ... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/heroku.rb | Ruby | mit | 233 | master | 4,366 | class Recipes::Heroku < Rails::AppBuilder
NAME_PREFIX = 'pl'
ENVIRONMENTS = ['staging', 'production']
HEROKU_NAMES_MAX_CHARS = 30
def ask
heroku = answer(:heroku) do
Ask.confirm("Are you going to deploy to heroku? (#{who_am_i})")
end
if heroku
set(:heroku, heroku)
ENVIRONMENTS.e... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/bullet.rb | Ruby | mit | 233 | master | 843 | class Recipes::Bullet < Rails::AppBuilder
def create
gather_gem 'bullet'
recipe = self
after(:gem_install) do
recipe.bullet_config
end
end
def installed?
gem_exists?(/bullet/)
end
def install
create
end
def bullet_config
application bullet_after_initialize, env: "devel... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/pry.rb | Ruby | mit | 233 | master | 214 | class Recipes::Pry < Rails::AppBuilder
def create
gather_gems(:development, :test) do
gather_gem('pry-rails')
gather_gem('pry-byebug')
end
template '../assets/.pryrc', '.pryrc'
end
end |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/error_reporting.rb | Ruby | mit | 233 | master | 672 | class Recipes::ErrorReporting < Rails::AppBuilder
def ask
response = answer(:sentry) do
Ask.confirm("Do you need to report application errors with Sentry?")
end
set(:report_error, response)
end
def create
if selected?(:report_error)
gather_gem 'sentry-rails'
template '../assets/... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/i18n.rb | Ruby | mit | 233 | master | 650 | class Recipes::I18n < Rails::AppBuilder
def ask
languages = {
"es-CL": "es-CL (Chile)",
en: "en (USA)"
}
lang = answer(:locale) do
languages.keys[Ask.list("What is the main locale of your app?", languages.values)]
end
set(:lang, lang)
end
def create
gather_gem('rails-i... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/admin.rb | Ruby | mit | 233 | master | 3,394 | class Recipes::Admin < Rails::AppBuilder
def ask
if selected?(:authentication)
admin_mode = answer(:admin) { Ask.confirm("Do you want to use ActiveAdmin?") }
set(:admin_mode, admin_mode)
end
end
def create
if selected?(:admin_mode)
if selected?(:authentication)
add_active_ad... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/environment_variables.rb | Ruby | mit | 233 | master | 450 | class Recipes::EnvironmentVariables < Rails::AppBuilder
def create
template '../assets/.env.test.erb', '.env.test'
copy_file '../assets/lib/environment_variables.rb', 'lib/environment_variables.rb'
application(before_configuration_require)
end
private
def before_configuration_require
<<~RUBY
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/draper.rb | Ruby | mit | 233 | master | 491 | class Recipes::Draper < Rails::AppBuilder
def ask
draper = answer(:draper) { Ask.confirm('Do you want to use Draper to decorate models?') }
set(:draper, draper)
end
def create
return unless selected?(:draper)
add_draper
end
def installed?
gem_exists?(/draper/)
end
def install
ad... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/style.rb | Ruby | mit | 233 | master | 985 | class Recipes::Style < Rails::AppBuilder
def create
add_linters
add_config_files
add_readme_header :style_guide
end
def install
create
end
private
def add_linters
gather_gems(:development, :test) do
gather_gem 'rubocop', Potassium::RUBOCOP_VERSION
gather_gem 'rubocop-perfo... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/rack_cors.rb | Ruby | mit | 233 | master | 632 | class Recipes::RackCors < Rails::AppBuilder
def install
create
end
def create
gather_gem('rack-cors', '~> 1.1')
recipe = self
after(:gem_install) do
application recipe.rack_cors_config
end
end
def rack_cors_config
<<~RUBY
config.middleware.insert_before 0, Rack::Cors do
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/database_container.rb | Ruby | mit | 233 | master | 2,614 | class Recipes::DatabaseContainer < Rails::AppBuilder
CONTAINER_VARS = {
postgresql: { port: 5432, user: 'postgres' },
mysql: { port: 3306, user: 'root' }
}
POSTGRESQL_SERVICE =
<<~YAML
image: postgres:#{Potassium::POSTGRES_VERSION}
ports:
- #{CONTAINER_VARS[:postgresql][:port]}
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/ci.rb | Ruby | mit | 233 | master | 493 | class Recipes::Ci < Rails::AppBuilder
def create
template '../assets/.circleci/config.yml.erb', '.circleci/config.yml'
gather_gems(:test) do
gather_gem 'rspec_junit_formatter', '~> 0.4'
end
gather_gems(:development, :test) do
gather_gem('brakeman')
end
add_readme_header :ci
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/annotate.rb | Ruby | mit | 233 | master | 354 | class Recipes::Annotate < Rails::AppBuilder
def create
gather_gems(:development) do
gather_gem('annotate', '~> 3.0')
end
template '../assets/lib/tasks/auto_annotate_models.rake',
'lib/tasks/auto_annotate_models.rake'
end
def install
create
after(:gem_install) do
run "bundle... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/ruby.rb | Ruby | mit | 233 | master | 369 | require 'net/http'
require 'semantic'
class Recipes::Ruby < Rails::AppBuilder
def create
info "Using ruby version #{version_alias}"
create_file '.ruby-version', version_alias, force: true
end
private
def version
Potassium::RUBY_VERSION
end
def version_alias
Semantic::Version.new(version)... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/github.rb | Ruby | mit | 233 | master | 2,914 | require 'octokit'
class Recipes::Github < Rails::AppBuilder
def ask
github_repo_create = answer(:github) do
Ask.confirm('Do you want to create a Github repository?')
end
set(:github_repo, github_repo_create)
setup_repo if github_repo_create
end
def setup_repo
setup_repo_private
set... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/testing.rb | Ruby | mit | 233 | master | 2,541 | class Recipes::Testing < Rails::AppBuilder
def create
add_gems
add_readme_header(:testing)
recipe = self
after(:gem_install) do
recipe.install_rspec
recipe.install_guard
recipe.create_rspec_binary
end
config_raise_delivery_errors_option
end
def install_rspec
remove... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/redis.rb | Ruby | mit | 233 | master | 1,229 | class Recipes::Redis < Rails::AppBuilder
def create
add_redis
add_docker_compose_redis_config
set_redis_dot_env
add_session_store_config
end
def install
create
end
def installed?
gem_exists?(/redis-actionpack/)
end
def add_redis
run_action(:install_redis) do
gather_gem... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/data_migrate.rb | Ruby | mit | 233 | master | 1,116 | class Recipes::DataMigrate < Rails::AppBuilder
def create
gather_gem('data_migrate')
annotate_task = 'lib/tasks/auto_annotate_models.rake'
insert_into_file annotate_task, annotate_config, after: "Annotate.load_tasks\n"
end
def install
create
end
def installed?
gem_exists?(/data_migrate/)... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/vue_admin.rb | Ruby | mit | 233 | master | 4,452 | class Recipes::VueAdmin < Rails::AppBuilder
def ask
if selected?(:admin_mode)
vue_admin = answer(:vue_admin) do
Ask.confirm "Do you want Vue support for ActiveAdmin?"
end
set(:vue_admin, vue_admin)
end
end
def create
recipe = self
if selected?(:vue_admin)
after(:ad... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/env.rb | Ruby | mit | 233 | master | 503 | class Recipes::Env < Rails::AppBuilder
def create
gather_gems(:development, :test) do
gather_gem('dotenv-rails')
end
template '../assets/.env.development.erb', '.env.development'
append_to_file '.gitignore', ".env.local\n"
append_to_file '.gitignore', ".env\n"
env_config =
<<~RUB... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/power_types.rb | Ruby | mit | 233 | master | 455 | class Recipes::PowerTypes < Rails::AppBuilder
def create
add_power_types
generate_folders
end
def install
add_power_types
generate_folders
end
def installed?
gem_exists?(/power-types/)
end
private
def add_power_types
gather_gem 'power-types'
add_readme_section :internal_d... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/mailer.rb | Ruby | mit | 233 | master | 3,545 | class Recipes::Mailer < Rails::AppBuilder
def ask
email_services = {
aws_ses: "Amazon SES",
sendgrid: "Sendgrid (beta)",
none: "None, thanks"
}
email_service = answer(:email_service) do
email_services.keys[Ask.list("Which email service are you using?", email_services.values)]
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/yarn.rb | Ruby | mit | 233 | master | 587 | class Recipes::Yarn < Rails::AppBuilder
def create
template '../assets/package.json', 'package.json'
template '../assets/bin/update.erb', 'bin/update', force: true
application "config.assets.paths << Rails.root.join('node_modules')"
append_to_file ".gitignore", "node_modules/\n"
if get(:heroku)
... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/rails.rb | Ruby | mit | 233 | master | 802 | class Recipes::Rails < Rails::AppBuilder
def create
gather_gem("bootsnap", require: false)
gather_gem("sassc", github: "sass/sassc-ruby", ref: 'refs/pull/233/head')
gather_gem("sassc-embedded")
environment 'config.force_ssl = true', env: 'production'
disable_automatic_nonce_generation
end
def... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/database.rb | Ruby | mit | 233 | master | 1,184 | class Recipes::Database < Rails::AppBuilder
def ask
databases = {
postgresql: "PostgreSQL",
mysql: "MySQL",
none: "None, thanks"
}
database = answer(:db) do
databases.keys[Ask.list("Which database are you using?", databases.values)]
end
set :database, database.to_sym
en... |
github | platanus/potassium | https://github.com/platanus/potassium | lib/potassium/recipes/schedule.rb | Ruby | mit | 233 | master | 919 | class Recipes::Schedule < Rails::AppBuilder
def ask
if selected?(:background_processor)
response = answer(:schedule) { Ask.confirm("Do you need to schedule jobs?") }
end
set(:schedule, response)
end
def create
if selected?(:schedule)
gather_gem 'sidekiq-scheduler', '>= 3.0.1'
ad... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.