repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/test/fixtures/padrino_app/app.rb | padrino-mailer/test/fixtures/padrino_app/app.rb | ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = __dir__ unless defined? PADRINO_ROOT
class PadrinoApp < Padrino::Application
register Padrino::Helpers
register Padrino::Mailer
set :delivery_method, :test
mailer :sample do
email :birthday do |name, age|
subject 'Happy Birthday!'
to 'john@fake.com... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/test/fixtures/sinatra_app/app.rb | padrino-mailer/test/fixtures/sinatra_app/app.rb | require 'sinatra/base'
class SinatraApp < Sinatra::Base
register Padrino::Mailer
set :root, __dir__
set :delivery_method, :test
mailer :sample do
email :birthday do |name, age|
subject 'Happy Birthday!'
to 'john@fake.com'
from 'noreply@birthday.com'
locals name: name, age... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/lib/padrino-mailer.rb | padrino-mailer/lib/padrino-mailer.rb | begin
require 'tilt'
rescue LoadError
require 'sinatra/tilt'
end
module Padrino
##
# This component uses the +mail+ library to create a powerful but simple
# mailer within Padrino (and Sinatra).
# There is full support for using plain or html content-types as well as for file attachments.
#
# Using the... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/lib/padrino-mailer/ext.rb | padrino-mailer/lib/padrino-mailer/ext.rb | require 'mail'
module Mail # @private
class Message # @private
include Sinatra::Templates
include Padrino::Rendering if defined?(Padrino::Rendering)
include Padrino::Helpers::RenderHelpers if defined? Padrino::Helpers::RenderHelpers
attr_reader :template_cache
attr_accessor :mailer_name, :message... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/lib/padrino-mailer/mime.rb | padrino-mailer/lib/padrino-mailer/mime.rb | module Padrino
module Mailer
##
# Handles MIME type declarations for mail delivery.
#
module Mime
##
# Returns Symbol with mime type if found, otherwise use +fallback+.
# +mime+ should be the content type like "text/plain"
# +fallback+ may be any symbol.
#
# Also se... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/lib/padrino-mailer/helpers.rb | padrino-mailer/lib/padrino-mailer/helpers.rb | module Padrino
module Mailer
##
# Helpers for defining and delivering email messages.
#
module Helpers
def self.included(base) # @private
base.extend(ClassMethods)
end
##
# Delivers an email with the given mail attributes.
#
# @param [Hash] mail_attributes
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-mailer/lib/padrino-mailer/base.rb | padrino-mailer/lib/padrino-mailer/base.rb | module Padrino
module Mailer
##
# This is the abstract class that other mailers will inherit from in order to send mail.
#
# You can set the default delivery settings from your app through:
#
# set :delivery_method, smtp: {
# address: 'smtp.yourserver.com',
# port: ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/subgems.rb | padrino/subgems.rb | padrino_gemspec = ::Gem::Specification.load(File.expand_path("#{__dir__}/padrino.gemspec"))
performance_gemspec = ::Gem::Specification.load(File.expand_path("#{__dir__}/../padrino-performance/padrino-performance.gemspec"))
PADRINO_SUBGEMS ||= Hash[padrino_gemspec.dependencies.map { |gem| [gem.name, gem.requirement.to_... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/test/test_padrino.rb | padrino/test/test_padrino.rb | require 'minitest/autorun'
require 'minitest/pride'
describe 'Padrino' do
it 'should be a metagem that requires subgems' do
refute defined?(Padrino::Mailer)
refute defined?(Padrino::Helpers)
require File.expand_path('../lib/padrino.rb', __dir__)
assert defined?(Padrino::Mailer)
assert defined?(Pa... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/test/ext/rack-test-methods.rb | padrino/test/ext/rack-test-methods.rb | module Rack::Test::Methods
# Delegate some methods to the last response
alias response last_response
%i[status headers body content_type ok? forbidden?].each do |method_name|
define_method method_name do
last_response.send(method_name)
end
end
end
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/test/ext/minitest-spec.rb | padrino/test/ext/minitest-spec.rb | class Minitest::Spec
# Assert_file_exists('/tmp/app')
def assert_file_exists(file_path)
assert File.file?(file_path), "File at path '#{file_path}' does not exist!"
end
# Assert_no_file_exists('/tmp/app')
def assert_no_file_exists(file_path)
refute File.exist?(file_path), "File should not exist at pat... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/test/padrino/test-methods.rb | padrino/test/padrino/test-methods.rb | require 'oga'
module Padrino
module TestMethods
def assert_html_has_tag(html, tag, attributes = {})
assert html.html_safe?, 'output in not #html_safe?'
assert_has_selector(html, tag, attributes)
end
def assert_html_has_no_tag(html, tag, attributes = {})
assert html.html_safe?, 'output ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino/lib/padrino.rb | padrino/lib/padrino.rb | # Automatically generated from 'padrino.gemspec' by `rake lib/padrino.rb`
require 'padrino-support'
require 'padrino-core'
require 'padrino-helpers'
require 'padrino-cache'
require 'padrino-mailer'
require 'padrino-admin'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/test/test_colorize.rb | padrino-support/test/test_colorize.rb | require_relative 'helper'
describe 'String#colorize' do
it 'should colorize text correctly' do
assert_equal "\e[0;34mHello world\e[0m", 'Hello world'.colorize(:blue)
assert_equal "\e[0;30mHello world\e[0m", 'Hello world'.colorize(:black)
assert_equal "\e[0;31mHello world\e[0m", 'Hello world'.colorize(:re... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/test/test_utils.rb | padrino-support/test/test_utils.rb | require_relative 'helper'
class Minitest::Spec
def assert_query_equal(expected, actual, namespace = nil)
assert_equal expected.split('&').sort, Padrino::Utils.build_uri_query(actual, namespace).split('&').sort
end
end
describe 'Padrino::Utils.build_uri_query' do
it 'should do simple conversion' do
asser... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/test/helper.rb | padrino-support/test/helper.rb | ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = __dir__ unless defined?(PADRINO_ROOT)
require 'minitest/autorun'
require 'minitest/pride'
require 'padrino-support'
require 'padrino-core/logger'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support.rb | padrino-support/lib/padrino-support.rb | ##
# This file loads certain extensions required by Padrino.
#
require 'padrino-support/core_ext/string/colorize'
require 'padrino-support/file_set'
require 'padrino-support/utils'
if ENV['AS_VERSION']
# require ActiveSupport features for tests or legacy projects
require 'active_support/core_ext/string/output_safe... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support/file_set.rb | padrino-support/lib/padrino-support/file_set.rb | ##
# FileSet helper method for iterating and interacting with files inside a directory
#
module FileSet
module_function
##
# Iterates over every file in the glob pattern and yields to a block
# Returns the list of files matching the glob pattern
# FileSet.glob('padrino-core/application/*.rb', __FILE__) { |fi... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support/utils.rb | padrino-support/lib/padrino-support/utils.rb | require 'cgi'
module Padrino
module Utils
module_function
##
# Builds an URI query from a Hash or any Object.
#
# Examples (~ marks here that output is actually escaped by CGI):
#
# Utils.build_uri_query(a: 1, b: 2) # => 'a=1&b=2'
# Utils.build_uri_query(a: [1, 2]) ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support/inflections.rb | padrino-support/lib/padrino-support/inflections.rb | ##
# This module is based on Sequel 4.27.0
# sequel-4.27.0/lib/sequel/model/inflections.rb
#
require 'padrino-support/default_inflections'
module Padrino
# This module acts as a singleton returned/yielded by Sequel.inflections,
# which is used to override or specify additional inflection rules
# for Sequel. Exam... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support/default_inflections.rb | padrino-support/lib/padrino-support/default_inflections.rb | # frozen-string-literal: true
##
# This module is based on Sequel 5.4.0
# sequel-5.4.0/lib/sequel/model/default_inflections.rb
#
module Padrino
# Proc that is instance executed to create the default inflections for both the
# model inflector and the inflector extension.
DEFAULT_INFLECTIONS_PROC = proc do
plu... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-support/lib/padrino-support/core_ext/string/colorize.rb | padrino-support/lib/padrino-support/core_ext/string/colorize.rb | ##
# Add colors
#
class String
# colorize(:red)
def colorize(args)
case args
when Symbol
Colorizer.send(args, self)
when Hash
Colorizer.send(args[:color], self, args[:mode])
end
end
# Used to colorize strings for the shell
class Colorizer
# Returns colors integer mapping
d... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_rendering.rb | padrino-helpers/test/test_rendering.rb | require_relative 'helper'
require 'slim'
require 'liquid'
describe 'Rendering' do
def setup
Padrino::Rendering::DEFAULT_RENDERING_OPTIONS[:strict_format] = false
I18n.enforce_available_locales = true
end
def teardown
I18n.locale = :en
remove_views
end
describe 'for application layout functi... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_form_helpers.rb | padrino-helpers/test/test_form_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'FormHelpers' do
include Padrino::Helpers::FormHelpers
def app
MarkupDemo
end
class UnprotectedApp
def protect_from_csrf; false; end
end
describe 'for #form_tag method' do
it 'should display correct forms in ruby' ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_asset_tag_helpers.rb | padrino-helpers/test/test_asset_tag_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'AssetTagHelpers' do
include Padrino::Helpers::AssetTagHelpers
def app
MarkupDemo
end
def flash
@_flash ||= { notice: 'Demo notice' }
end
describe 'for #flash_tag method' do
it 'should display flash with no given a... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_form_builder.rb | padrino-helpers/test/test_form_builder.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'FormBuilder' do
include Padrino::Helpers::FormHelpers
def app
MarkupDemo
end
# Dummy form builder for testing
module Padrino::Helpers::FormBuilder
class FakeFormBuilder < AbstractFormBuilder
def foo_field; @templat... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_format_helpers.rb | padrino-helpers/test/test_format_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'FormatHelpers' do
include Padrino::Helpers::FormatHelpers
def app
MarkupDemo
end
def setup
Time.stubs(:now).returns(Time.utc(1983, 11, 9, 5))
end
describe 'for #simple_format method' do
it 'should format simple te... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_number_helpers.rb | padrino-helpers/test/test_number_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'NumberHelpers' do
include Padrino::Helpers::NumberHelpers
def app
MarkupDemo
end
def kilobytes(number)
number * 1024
end
def megabytes(number)
kilobytes(number) * 1024
end
def gigabytes(number)
megabytes(... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_rendering_extensions.rb | padrino-helpers/test/test_rendering_extensions.rb | require_relative 'helper'
describe 'Rendering Extensions' do
describe 'for haml' do
it 'should render haml_tag correctly' do
skip unless Padrino::Helpers::OutputHelpers.handlers[:haml].to_s == 'Padrino::Helpers::OutputHelpers::HamlHandler'
mock_app do
get('/') { render :haml, '-haml_tag :div... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_locale.rb | padrino-helpers/test/test_locale.rb | require_relative 'helper'
describe 'Locale Helpers' do
Dir[File.expand_path('../lib/padrino-helpers/locale/*.yml', __dir__)].each do |file|
base_original = YAML.load_file(file)
name = File.basename(file, '.yml')
it "should should have correct locale for #{name}" do
base = base_original[name]['numb... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_render_helpers.rb | padrino-helpers/test/test_render_helpers.rb | require_relative 'helper'
require_relative 'fixtures/render_app/app'
describe 'RenderHelpers' do
def app
RenderDemo
end
describe 'for #partial method and object' do
before { get '/partial/object' }
it 'should render partial html with object' do
assert_response_has_tag 'h1', content: 'User name... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_helpers.rb | padrino-helpers/test/test_helpers.rb | require_relative 'helper'
describe 'Padrino::Helpers' do
it 'should allow including without registering' do
class Foo
include Padrino::Helpers
end
assert_equal '<div>bar</div>', Foo.new.content_tag(:div, 'bar')
end
it 'should not overwrite default_builder setting' do
mock_app do
set ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/helper.rb | padrino-helpers/test/helper.rb | ENV['RACK_ENV'] = 'test'
require 'minitest/autorun'
require 'minitest/pride'
require 'mocha/minitest'
require 'rack/test'
require 'builder'
require 'padrino-helpers'
require 'padrino/rendering'
require 'tilt/liquid'
require 'tilt/builder'
require 'ext/minitest-spec'
require 'ext/rack-test-methods'
require 'padrino/te... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_tag_helpers.rb | padrino-helpers/test/test_tag_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'TagHelpers' do
def app
MarkupDemo
end
describe 'for #tag method' do
it 'should support tags with no content no attributes' do
assert_html_has_tag(tag(:br), :br)
end
it 'should support tags with no content with ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/test_output_helpers.rb | padrino-helpers/test/test_output_helpers.rb | require_relative 'helper'
require_relative 'fixtures/markup_app/app'
describe 'OutputHelpers' do
def app
MarkupDemo
end
describe 'for #content_for method' do
it 'should work for erb templates' do
get '/erb/content_for'
assert_response_has_tag '.demo h1', content: 'This is content yielded fro... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/fixtures/apps/render.rb | padrino-helpers/test/fixtures/apps/render.rb | PADRINO_ROOT = __dir__ unless defined? PADRINO_ROOT
class RenderDemo2 < Padrino::Application
register Padrino::Rendering
set :reload, true
end
RenderDemo2.controllers :blog do
get '/' do
render 'post'
end
get '/override' do
render 'post', layout: RenderDemo2.layout_path('specific')
end
end
Rend... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/fixtures/markup_app/app.rb | padrino-helpers/test/fixtures/markup_app/app.rb | require 'padrino-core'
class MarkupDemo < Sinatra::Base
register Padrino::Helpers
configure do
set :logging, false
set :padrino_logging, false
set :environment, :test
set :root, __dir__
set :sessions, true
set :protect_from_csrf, true
end
get '/:engine/:file' do
show(params[:engin... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/test/fixtures/render_app/app.rb | padrino-helpers/test/fixtures/render_app/app.rb | PADRINO_ROOT = __dir__ unless defined? PADRINO_ROOT
RACK_ENV = 'test' unless defined? RACK_ENV
require 'padrino-core'
class RenderUser
attr_accessor :name
def initialize(name); @name = name; end
end
class RenderDemo < Padrino::Application
register Padrino::Helpers
configure do
set :logging, false
s... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers.rb | padrino-helpers/lib/padrino-helpers.rb | require 'padrino-support'
require 'padrino-support/inflections'
require 'i18n'
# remove at 0.14
require 'padrino/rendering'
FileSet.glob_require('padrino-helpers/**/*.rb', __FILE__)
I18n.load_path += Dir["#{__dir__}/padrino-helpers/locale/*.yml"]
I18n.enforce_available_locales = true
module Padrino
##
# This com... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering.rb | padrino-helpers/lib/padrino/rendering.rb | require 'padrino/core_ext/output_safety'
require 'padrino-support'
require 'pathname'
module Padrino
##
# Padrino enhances the Sinatra 'render' method to have support for
# automatic template engine detection, enhanced layout functionality,
# locale enabled rendering, among other features.
#
module Renderi... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/safe_buffer.rb | padrino-helpers/lib/padrino/safe_buffer.rb | module Padrino
##
# Padrino::SafeBuffer is based on ActiveSupport::SafeBuffer
#
class SafeBuffer < String
UNSAFE_STRING_METHODS = %w[
capitalize chomp chop delete downcase gsub lstrip next reverse rstrip
slice squeeze strip sub succ swapcase tr tr_s upcase
]
alias original_concat concat... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/haml_template.rb | padrino-helpers/lib/padrino/rendering/haml_template.rb | begin
using_modern_haml = false
require 'haml/helpers/xss_mods'
require 'haml/helpers/action_view_extensions'
module Haml
Helpers.include(Helpers::XssMods)
Helpers.include(Helpers::ActionViewExtensions)
def Util.rails_xss_safe?
true
end
end
rescue LoadError
using_modern_haml = true
e... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/slim_template.rb | padrino-helpers/lib/padrino/rendering/slim_template.rb | module Padrino
module Rendering
class SlimOutputBuffer < Temple::Generators::StringBuffer
define_options buffer_class: 'SafeBuffer'
def call(exp)
[preamble, compile(exp), postamble].flatten.compact.join('; '.freeze)
end
def create_buffer
"#{buffer} = #{options[:buffer_cla... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/erubi_template.rb | padrino-helpers/lib/padrino/rendering/erubi_template.rb | module Padrino
module Rendering
module Erubi
module SafeBufferEnhancer
def add_expression_result(code)
@src << " @__in_ruby_literal = true; #{bufvar}.concat((" << code << ').to_s); @__in_ruby_literal = false;'
end
def add_expression_result_escaped(code)
@src << "... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/erubis_template.rb | padrino-helpers/lib/padrino/rendering/erubis_template.rb | module Padrino
module Rendering
##
# SafeBufferEnhancer is an Erubis Enhancer that compiles templates that
# are fit for using SafeBuffer as a Buffer.
#
# @api private
module SafeBufferEnhancer
def add_expr_literal(src, code)
src << " @__in_ruby_literal = true; #{@bufvar}.concat(... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/erb_template.rb | padrino-helpers/lib/padrino/rendering/erb_template.rb | module Padrino
module Rendering
class SafeERB < ::ERB
class Compiler < ::ERB::Compiler
def add_insert_cmd(out, content)
out.push('@__in_ruby_literal = true')
super
out.push('@__in_ruby_literal = false')
end
end
def make_compiler(trim_mode)
C... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/rendering/hamlit_template.rb | padrino-helpers/lib/padrino/rendering/hamlit_template.rb | module Padrino
module Rendering
class HamlitOutputBuffer < Temple::Generators::StringBuffer
define_options buffer_class: 'SafeBuffer'
def call(exp)
[preamble, compile(exp), postamble].flatten.compact.join('; '.freeze)
end
def create_buffer
"#{buffer} = #{options[:buffer_c... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino/core_ext/output_safety.rb | padrino-helpers/lib/padrino/core_ext/output_safety.rb | if defined?(ActiveSupport::SafeBuffer)
SafeBuffer = ActiveSupport::SafeBuffer
else
require 'padrino/safe_buffer'
SafeBuffer = Padrino::SafeBuffer
class String
def html_safe
SafeBuffer.new(self)
end
end
class Object
def html_safe?
false
end
end
class Numeric
def html_s... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/output_helpers.rb | padrino-helpers/lib/padrino-helpers/output_helpers.rb | module Padrino
module Helpers
##
# Helpers related to buffer output for various template engines.
#
module OutputHelpers
def self.included(base)
base.send(:include, SinatraCurrentEngine) unless base.method_defined?(:current_engine)
end
##
# Returns the list of all avai... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_helpers.rb | padrino-helpers/lib/padrino-helpers/form_helpers.rb | require 'padrino-helpers/form_helpers/errors'
require 'padrino-helpers/form_helpers/options'
require 'padrino-helpers/form_helpers/security'
module Padrino
module Helpers
##
# Helpers related to producing form related tags and inputs into templates.
#
module FormHelpers
def self.included(base)
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/translation_helpers.rb | padrino-helpers/lib/padrino-helpers/translation_helpers.rb | module Padrino
module Helpers
##
# Helpers related to locale i18n translation within templates.
#
module TranslationHelpers
##
# Delegates to I18n.translate with no additional functionality.
#
# @param [Symbol] *args
# The keys to retrieve.
#
# @return [Stri... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb | padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb | module Padrino
module Helpers
###
# Helpers related to producing assets (images, stylesheets, js, etc) within templates.
#
module AssetTagHelpers
APPEND_ASSET_EXTENSIONS = %w[js css]
ABSOLUTE_URL_PATTERN = %r{^(https?://)}
ASSET_FOLDERS = {
js: 'javascripts',
css: 'st... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/format_helpers.rb | padrino-helpers/lib/padrino-helpers/format_helpers.rb | module Padrino
module Helpers
###
# Helpers related to formatting or manipulating text within templates.
#
module FormatHelpers
##
# Returns escaped text to protect against malicious content.
#
# @param [String] text
# Unsanitized HTML string that needs to be escaped.
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/render_helpers.rb | padrino-helpers/lib/padrino-helpers/render_helpers.rb | module Padrino
module Helpers
##
# Helpers related to rendering within templates (i.e partials).
#
module RenderHelpers
##
# Render a partials with collections support.
#
# @param [String] template
# Relative path to partial template.
# @param [Hash] options
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/tag_helpers.rb | padrino-helpers/lib/padrino-helpers/tag_helpers.rb | module Padrino
module Helpers
##
# Helpers related to producing html tags within templates.
#
module TagHelpers
##
# Tag values escaped to html entities.
#
ESCAPE_VALUES = {
'&' => '&',
'<' => '<',
'>' => '>',
'"' => '"'
}.fr... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/number_helpers.rb | padrino-helpers/lib/padrino-helpers/number_helpers.rb | module Padrino
module Helpers
##
# Provides methods for converting numbers into formatted strings.
# Methods are provided for phone numbers, currency, percentage,
# precision, positional notation, and file size.
#
# Adapted from Rails Number Helpers.
#
module NumberHelpers
##
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_builder/abstract_form_builder.rb | padrino-helpers/lib/padrino-helpers/form_builder/abstract_form_builder.rb | module Padrino
module Helpers
module FormBuilder
# Base class for Padrino Form Builder
class AbstractFormBuilder
attr_accessor :template, :object, :multipart
attr_reader :namespace, :is_nested, :parent_form, :nested_index, :attributes_name, :model_name
def initialize(template,... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb | padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb | require_relative 'abstract_form_builder' unless defined?(AbstractFormBuilder)
module Padrino
module Helpers
module FormBuilder
class StandardFormBuilder < AbstractFormBuilder
##
# StandardFormBuilder
#
# text_field_block(:username, { class: 'long' }, { class: 'wide-label' ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/output_helpers/haml_handler.rb | padrino-helpers/lib/padrino-helpers/output_helpers/haml_handler.rb | module Padrino
module Helpers
module OutputHelpers
# Haml and Hamlit require different detection code
if defined?(Haml) && Tilt.template_for('.haml').to_s == 'Padrino::Rendering::HamlTemplate'
##
# Handler for Haml templates.
#
class HamlHandler < AbstractHandler
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/output_helpers/slim_handler.rb | padrino-helpers/lib/padrino-helpers/output_helpers/slim_handler.rb | module Padrino
module Helpers
module OutputHelpers
##
# Handler for Slim templates.
#
class SlimHandler < AbstractHandler
##
# Returns true if the block is for Slim.
#
def engine_matches?(block)
block.binding.eval('defined? __in_slim_template')
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/output_helpers/abstract_handler.rb | padrino-helpers/lib/padrino-helpers/output_helpers/abstract_handler.rb | module Padrino
module Helpers
module OutputHelpers
class AbstractHandler
attr_reader :template, :output_buffer
def initialize(template)
@template = template
@output_buffer = template.instance_variable_get(:@_out_buf)
end
##
# Returns true if the ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/output_helpers/erb_handler.rb | padrino-helpers/lib/padrino-helpers/output_helpers/erb_handler.rb | module Padrino
module Helpers
module OutputHelpers
##
# Handler for Erb template.
#
class ErbHandler < AbstractHandler
##
# Outputs the given text to the templates buffer directly.
#
def concat_to_template(text = '', context = nil)
return text if c... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_helpers/security.rb | padrino-helpers/lib/padrino-helpers/form_helpers/security.rb | require 'securerandom'
module Padrino
module Helpers
module FormHelpers
##
# Helpers to generate form security tags for csrf protection.
#
module Security
##
# Constructs a hidden field containing a CSRF token.
#
# @param [String] token
# The toke... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_helpers/errors.rb | padrino-helpers/lib/padrino-helpers/form_helpers/errors.rb | module Padrino
module Helpers
module FormHelpers
##
# Helpers to generate form errors.
#
module Errors
##
# Constructs list HTML for the errors for a given symbol.
#
# @overload error_messages_for(*objects, options = {})
# @param [Array<Object>] o... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-helpers/lib/padrino-helpers/form_helpers/options.rb | padrino-helpers/lib/padrino-helpers/form_helpers/options.rb | module Padrino
module Helpers
module FormHelpers
##
# Helpers to generate options list for select tag.
#
module Options
def extract_option_tags!(options)
state = extract_option_state!(options)
option_tags =
if options[:grouped_options]
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/test/test_padrino_cache.rb | padrino-cache/test/test_padrino_cache.rb | require File.expand_path('helper', __dir__)
describe 'PadrinoCache' do
after do
tmp = File.expand_path('tmp', __dir__)
`rm -rf #{tmp}`
end
it 'should cache a fragment' do
called = false
mock_app do
register Padrino::Cache
enable :caching
get('/foo') { cache(:test) { called ? ha... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/test/test_moneta_store.rb | padrino-cache/test/test_moneta_store.rb | require_relative 'helper'
describe 'Padrino::Cache - Moneta store' do
def setup
@test_key = "val_#{Time.now.to_i}"
end
def teardown
Padrino.cache.clear
end
class Foo
def bar; 'bar'; end
end
it "return nil trying to get a value that doesn't exist" do
Padrino.cache.clear
assert_nil P... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/test/helper.rb | padrino-cache/test/helper.rb | ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = __dir__ unless defined?(PADRINO_ROOT)
require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'padrino-cache'
require 'ext/rack-test-methods'
class Minitest::Spec
include Rack::Test::Methods
# Sets up a Sinatra::Base subclass defined with the block... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/lib/padrino-cache.rb | padrino-cache/lib/padrino-cache.rb | require 'fileutils' unless defined?(FileUtils)
require 'padrino-core'
require 'padrino-helpers'
FileSet.glob_require('padrino-cache/{helpers}/*.rb', __FILE__)
require 'moneta'
module Padrino
class << self
##
# Returns the caching engine.
#
# @example
# # with: Padrino.cache = Padrino::Cache.new... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/lib/padrino-cache/helpers/cache_object.rb | padrino-cache/lib/padrino-cache/helpers/cache_object.rb | module Padrino
module Cache
module Helpers
module ObjectCache
def cache_object(key, opts = {})
if settings.caching?
began_at = Time.now
if settings.cache.key?(key.to_s)
value = settings.cache[key.to_s]
logger.debug 'GET Object', began_at,... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/lib/padrino-cache/helpers/cache_store.rb | padrino-cache/lib/padrino-cache/helpers/cache_store.rb | module Padrino
module Cache
module Helpers
module CacheStore
def expire(*key)
if (key.size == 1) && (key.first.is_a?(String) || key.first.is_a?(Symbol))
settings.cache.delete(key.first)
else
settings.cache.delete(self.class.url(*key))
end
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/lib/padrino-cache/helpers/page.rb | padrino-cache/lib/padrino-cache/helpers/page.rb | module Padrino
module Cache
##
# Helpers supporting page or fragment caching within a request route.
#
module Helpers
##
# Page caching is easy to integrate into your application. To turn it on, simply provide the
# <tt>cache: true</tt> option on either a controller or one of its rou... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-cache/lib/padrino-cache/helpers/fragment.rb | padrino-cache/lib/padrino-cache/helpers/fragment.rb | module Padrino
module Cache
module Helpers
##
# Whereas page-level caching, described in the first section of this document, works by
# grabbing the entire output of a route, fragment caching gives the developer fine-grained
# control of what gets cached. This type of caching occurs at wha... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_sql_helpers.rb | padrino-gen/test/test_sql_helpers.rb | require_relative 'helper'
require_relative '../lib/padrino-gen/padrino-tasks/sql-helpers'
describe 'SqlHelpers' do
def setup
Process.expects(:wait)
end
describe 'create_db' do
describe 'postgres' do
it 'does not set PGPASSWORD when password is nil' do
Process.expects(:spawn).with do |envir... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_component_generator.rb | padrino-gen/test/test_component_generator.rb | require_relative 'helper'
require 'rb-readline'
describe 'ComponentGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
stub_static_files
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the controller generator' do
it 'should fail ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_helper_generator.rb | padrino-gen/test/test_helper_generator.rb | require_relative 'helper'
describe 'HelperGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
@helper_path = "#{@apptmp}/sample_project/app/helpers/demo_items_helper.rb"
@helper_test_path = "#{@apptmp}/sample_project/test/app/helpers/demo_items_he... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_app_generator.rb | padrino-gen/test/test_app_generator.rb | require_relative 'helper'
describe 'AppGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the app generator' do
it 'should fail outside app root' do
out, = capture_io { generate(:... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_controller_generator.rb | padrino-gen/test/test_controller_generator.rb | require_relative 'helper'
describe 'ControllerGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
@controller_path = "#{@apptmp}/sample_project/app/controllers/demo_items.rb"
@controller_test_path = "#{@apptmp}/sample_project/test/app/controllers/... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_task_generator.rb | padrino-gen/test/test_task_generator.rb | require_relative 'helper'
describe 'TaskGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the task generator' do
it 'should fail outside app root' do
out, = capture_io { generate... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_cli.rb | padrino-gen/test/test_cli.rb | require_relative 'helper'
require 'padrino-gen/generators/cli'
describe 'Cli' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the cli' do
it 'should fail without arguments' do
out, = capt... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_migration_generator.rb | padrino-gen/test/test_migration_generator.rb | require_relative 'helper'
describe 'MigrationGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the migration generator' do
it 'should fail outside app root' do
out, = capture_io ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_mailer_generator.rb | padrino-gen/test/test_mailer_generator.rb | require_relative 'helper'
describe 'MailerGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the mailer generator' do
it 'should fail outside app root' do
out, = capture_io { gene... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_model_generator.rb | padrino-gen/test/test_model_generator.rb | require_relative 'helper'
describe 'ModelGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the model generator' do
it 'should fail outside app root' do
out, = capture_io { genera... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_project_generator.rb | padrino-gen/test/test_project_generator.rb | require_relative 'helper'
describe 'ProjectGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
stub_static_files
end
def teardown
`rm -rf #{@apptmp}`
`rm -rf /tmp/project`
end
describe 'the project generator' do
it 'should allow ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/helper.rb | padrino-gen/test/helper.rb | require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'thor/group'
require 'padrino-gen'
require 'padrino-core'
require 'padrino-mailer'
require 'padrino-helpers'
require 'ext/minitest-spec'
require 'mocha/minitest'
require 'webmock/minitest'
Padrino::Generators.load_components!
class Minit... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_generator.rb | padrino-gen/test/test_generator.rb | require_relative 'helper'
describe 'Generator' do
describe 'the generator' do
it 'should have default generators' do
%w[controller mailer migration model app plugin component task helper].each do |gen|
assert Padrino::Generators.mappings.key?(gen.to_sym)
assert_equal "Padrino::Generators::#... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/test_plugin_generator.rb | padrino-gen/test/test_plugin_generator.rb | require_relative 'helper'
describe 'PluginGenerator' do
def setup
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
def teardown
`rm -rf #{@apptmp}`
end
describe 'the plugin generator' do
it 'should respect --root option' do
path = File.expand_path(... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/plugin_template.rb | padrino-gen/test/fixtures/plugin_template.rb | # Template to get Hoptoad on Padrino
# prereqs:
# sudo gem install rack_hoptoad
# http://github.com/atmos/rack_hoptoad
HOPTOAD = <<-HOPTOAD
app.use Rack::Hoptoad, 'API_KEY_HERE' do |notifier|
#notifier.report_under << 'custom'
#notifier.environment_filters << %w(MY_SECRET_KEY MY_SECRET_TOKEN)
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/git_template.rb | padrino-gen/test/fixtures/git_template.rb | project test: :rspec, orm: :activerecord
git :init
git :add, '.'
git :commit, "-m 'hello'"
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/database_template.rb | padrino-gen/test/fixtures/database_template.rb | ##
# You can use other adapters like:
#
# ActiveRecord::Base.configurations = {
# development: {
# adapter: 'mysql2',
# encoding: 'utf8',
# reconnect: true,
# database: 'your_database',
# pool: 5,
# username: 'root',
# password: '',
# host: 'localhos... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/admin_template.rb | padrino-gen/test/fixtures/admin_template.rb | project test: :shoulda, orm: :activerecord
generate :model, 'post title:string body:text'
rake 'ar:create'
generate :admin
rake 'ar:migrate'
generate :admin_page, 'post'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/example_template.rb | padrino-gen/test/fixtures/example_template.rb | project test: :shoulda, orm: :activerecord, template: 'mongochist', dev: true
generate :model, 'post title:string body:text'
generate :controller, 'posts get:index get:new post:new'
generate :migration, 'AddEmailToUser email:string'
generate :fake, 'foo bar'
generate :plugin, 'carrierwave'
require_dependencies 'nokog... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/test/fixtures/rake_template.rb | padrino-gen/test/fixtures/rake_template.rb | project test: :shoulda, orm: :activerecord
# create_file 'lib/tasks/test.rake', <<-RAKE
# task :custom do
# File.open('#{destination_root("/tmp/custom.txt")}', 'w') do |f|
# f.puts('Completed custom rake test')
# end
# end
# RAKE
rake 'custom'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen.rb | padrino-gen/lib/padrino-gen.rb | require 'padrino-core/tasks'
require 'padrino-gen/command'
require 'padrino-gen/core_ext/string'
require 'yaml'
module Padrino
##
# This module it's used for register generators.
#
# Can be useful for 3rd party generators:
#
# # custom_generator.rb
# class CustomGenerator < Thor::Group
# Padrin... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/command.rb | padrino-gen/lib/padrino-gen/command.rb | require 'padrino-core/command'
module Padrino
##
# This method return the correct location of padrino-gen bin or
# exec it using Kernel#system with the given args.
#
# @param [Array<String>] args.
# Splat of arguments to pass to padrino-gen.
#
# @example
# Padrino.bin_gen(:app, name.to_s, "-r=#{d... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/padrino-tasks/activerecord.rb | padrino-gen/lib/padrino-gen/padrino-tasks/activerecord.rb | require 'English'
if PadrinoTasks.load?(:activerecord, defined?(ActiveRecord))
# Fixes for Yardoc YRI Building
begin
require 'active_record'
require 'active_record/schema'
rescue LoadError
module ActiveRecord; end unless defined?(ActiveRecord)
class ActiveRecord::Schema; end unless defined?(Active... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/padrino-tasks/sequel.rb | padrino-gen/lib/padrino-gen/padrino-tasks/sequel.rb | if PadrinoTasks.load?(:sequel, defined?(Sequel))
namespace :sq do
namespace :migrate do
desc 'Perform automigration (reset your db data)'
task auto: :skeleton do
::Sequel.extension :migration
::Sequel::Migrator.run Sequel::Model.db, 'db/migrate', target: 0
::Sequel::Migrator.ru... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/padrino-tasks/mongoid.rb | padrino-gen/lib/padrino-gen/padrino-tasks/mongoid.rb | if PadrinoTasks.load?(:mongoid, defined?(Mongoid))
require 'mongoid'
namespace :mi do
if Mongoid::VERSION =~ /^[012]\./
# Mongoid 2 API
def mongoid_collections
Mongoid.master.collections
end
def mongoid_collection(name)
Mongoid.master.collection(name)
end
d... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/padrino-tasks/sql-helpers.rb | padrino-gen/lib/padrino-gen/padrino-tasks/sql-helpers.rb | require 'fileutils'
module Padrino
module Generators
module SqlHelpers
def self.create_db(adapter, user, password, host, database, charset, collation)
case adapter
when 'postgres'
environment = {}
environment['PGPASSWORD'] = password unless password.nil? || password.empt... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-gen/lib/padrino-gen/padrino-tasks/datamapper.rb | padrino-gen/lib/padrino-gen/padrino-tasks/datamapper.rb | if PadrinoTasks.load?(:datamapper, defined?(DataMapper))
namespace :dm do
namespace :auto do
desc 'Perform auto migration (reset your db data)'
task migrate: :environment do
::DataMapper.repository.auto_migrate!
puts '<= dm:auto:migrate executed'
end
desc 'Perform non dest... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.