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-gen/lib/padrino-gen/padrino-tasks/mongomapper.rb | padrino-gen/lib/padrino-gen/padrino-tasks/mongomapper.rb | if defined?(MongoMapper)
begin
require 'i18n'
rescue LoadError
# Only do this for I18n check later.
end
namespace :mm do
desc 'Drops all the collections for the database for the current Padrino.env'
task drop: :environment do
MongoMapper.database.collections.reject { |c| c.name =~ /system... | 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/minirecord.rb | padrino-gen/lib/padrino-gen/padrino-tasks/minirecord.rb | if PadrinoTasks.load?(:minirecord, defined?(MiniRecord))
namespace :mr do
desc 'Auto migration of database'
task migrate: :environment do
Dir['models/*.rb'].each do |file_path|
basename = File.basename(file_path, File.extname(file_path))
clazz = basename.camelize.constantize
claz... | 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/database.rb | padrino-gen/lib/padrino-gen/padrino-tasks/database.rb | has_seeds = File.file?('db/seeds.rb')
if PadrinoTasks.load?(:database, has_seeds)
namespace :db do
desc 'Load the seed data from db/seeds.rb'
task seed: :environment do
seed_file = Padrino.root('db', 'seeds.rb')
load(seed_file) if File.exist?(seed_file)
end
end
task seed: 'db:seed'
end
| 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/core_ext/string.rb | padrino-gen/lib/padrino-gen/core_ext/string.rb | if defined? ActiveSupport
require 'active_support/core_ext/string/inflections'
else
require 'padrino-support/inflections'
class String
def pluralize
Padrino::Inflections.pluralize(TemporaryString.new(to_str)).to_str
end
def underscore
Padrino::Inflections.underscore(TemporaryString.new(t... | 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/generators/mailer.rb | padrino-gen/lib/padrino-gen/generators/mailer.rb | module Padrino
module Generators
##
# Responsible for the generating mailers and message definitions.
#
class Mailer < Thor::Group
Padrino::Generators.add_generator(:mailer, self)
def self.source_root; __dir__; end
def self.banner; 'padrino-gen mailer [name]'; end
include Tho... | 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/generators/task.rb | padrino-gen/lib/padrino-gen/generators/task.rb | module Padrino
module Generators
##
# Responsible for generating new task file for Padrino application.
#
class Task < Thor::Group
include Thor::Actions
include Padrino::Generators::Actions
include Padrino::Generators::Components::Actions
Padrino::Generators.add_generator(:tas... | 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/generators/component.rb | padrino-gen/lib/padrino-gen/generators/component.rb | module Padrino
module Generators
##
# Responsible for add components within a Padrino project.
#
class Component < Thor::Group
Padrino::Generators.add_generator(:component, self)
def self.source_root; __dir__; end
def self.banner; 'padrino-gen component [options]'; end
includ... | 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/generators/actions.rb | padrino-gen/lib/padrino-gen/generators/actions.rb | require 'pathname'
module Padrino
module Generators
# Raised when an application does not have a resolved root path.
class AppRootNotFound < RuntimeError; end
##
# Default helper name for use in tiny app skeleton generator.
#
DEFAULT_HELPER_NAME = 'Helper'.freeze
##
# Common actions... | 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/generators/project.rb | padrino-gen/lib/padrino-gen/generators/project.rb | require 'padrino-core/version'
require 'securerandom' unless defined?(SecureRandom)
module Padrino
module Generators
##
# Responsible for generating new Padrino projects based on the specified project components.
#
class Project < Thor::Group
Padrino::Generators.add_generator(:project, self)
... | 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/generators/plugin.rb | padrino-gen/lib/padrino-gen/generators/plugin.rb | require 'padrino-core/cli/base' unless defined?(Padrino::Cli::Base)
require 'net/https'
module Padrino
module Generators
##
# Responsible for executing plugins instructions within a Padrino project.
#
class Plugin < Thor::Group
# Defines the default URL for official padrino recipe plugins.
... | 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/generators/app.rb | padrino-gen/lib/padrino-gen/generators/app.rb | module Padrino
module Generators
##
# Responsible for applications within a Padrino project. Creates and mounts
# the application and gives the user related information.
#
class App < Thor::Group
Padrino::Generators.add_generator(:app, self)
def self.source_root; __dir__; end
de... | 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/generators/runner.rb | padrino-gen/lib/padrino-gen/generators/runner.rb | require 'fileutils'
require 'open-uri'
module Padrino
module Generators
##
# Responsible for executing plugin and template instructions including
# common actions for modifying a project or application.
#
module Runner
# Generates project scaffold based on a given template file.
#
... | 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/generators/controller.rb | padrino-gen/lib/padrino-gen/generators/controller.rb | require 'padrino-core/application' unless defined?(Padrino::Application)
module Padrino
module Generators
##
# Responsible for generating route controllers and associated tests within a Padrino application.
#
class Controller < Thor::Group
Padrino::Generators.add_generator(:controller, self)
... | 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/generators/cli.rb | padrino-gen/lib/padrino-gen/generators/cli.rb | require 'thor/group'
module Padrino
module Generators
##
# This class bootstrap +config/boot+ and perform
# +Padrino::Generators.load_components!+ for handle 3rd party generators.
#
class Cli < Thor::Group
include Thor::Actions
class_option :root, desc: 'The root destination', aliase... | 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/generators/helper.rb | padrino-gen/lib/padrino-gen/generators/helper.rb | module Padrino
module Generators
##
# Responsible for generating route helpers and associated tests within a Padrino application.
#
class Helper < Thor::Group
Padrino::Generators.add_generator(:helper, self)
def self.source_root; __dir__; end
def self.banner; 'padrino-gen helper [na... | 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/generators/migration.rb | padrino-gen/lib/padrino-gen/generators/migration.rb | module Padrino
module Generators
##
# Responsible for generating migration files for the appropriate ORM component.
#
class Migration < Thor::Group
Padrino::Generators.add_generator(:migration, self)
def self.source_root; __dir__; end
def self.banner; 'padrino-gen migration [name] [... | 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/generators/model.rb | padrino-gen/lib/padrino-gen/generators/model.rb | module Padrino
module Generators
##
# Responsible for generating new models for the specified ORM component.
#
class Model < Thor::Group
Padrino::Generators.add_generator(:model, self)
def self.source_root; __dir__; end
def self.banner; 'padrino-gen model [name] [fields]'; end
... | 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/generators/components/actions.rb | padrino-gen/lib/padrino-gen/generators/components/actions.rb | module Padrino
module Generators
module Components
module Actions
##
# Generates the model migration file created when generating a new model.
#
# @param [String] filename
# File name of model migration.
# @param [String] name
# Name of model.
... | 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/generators/components/scripts/mootools.rb | padrino-gen/lib/padrino-gen/generators/components/scripts/mootools.rb | def setup_script
begin
get('https://raw.github.com/padrino/padrino-static/master/js/mootools.js', destination_root('/public/javascripts/mootools.js'))
get('https://raw.github.com/padrino/padrino-static/master/ujs/mootools.js', destination_root('/public/javascripts/mootools-ujs.js'))
rescue StandardError
... | 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/generators/components/scripts/dojo.rb | padrino-gen/lib/padrino-gen/generators/components/scripts/dojo.rb | def setup_script
begin
get('https://raw.github.com/padrino/padrino-static/master/js/dojo.js', destination_root('/public/javascripts/dojo.js'))
get('https://raw.github.com/padrino/padrino-static/master/ujs/dojo.js', destination_root('/public/javascripts/dojo-ujs.js'))
rescue StandardError
copy_file('tem... | 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/generators/components/scripts/prototype.rb | padrino-gen/lib/padrino-gen/generators/components/scripts/prototype.rb | def setup_script
begin
get('https://raw.github.com/padrino/padrino-static/master/js/protopak.js', destination_root('/public/javascripts/protopak.js'))
get('https://raw.github.com/padrino/padrino-static/master/js/lowpro.js', destination_root('/public/javascripts/lowpro.js'))
get('https://raw.github.c... | 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/generators/components/scripts/extcore.rb | padrino-gen/lib/padrino-gen/generators/components/scripts/extcore.rb | def setup_script
begin
get('https://raw.github.com/padrino/padrino-static/master/js/ext.js', destination_root('/public/javascripts/ext.js'))
get('https://raw.github.com/padrino/padrino-static/master/ujs/ext.js', destination_root('/public/javascripts/ext-ujs.js'))
rescue StandardError
copy_file('templat... | 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/generators/components/scripts/jquery.rb | padrino-gen/lib/padrino-gen/generators/components/scripts/jquery.rb | def setup_script
begin
get('https://raw.github.com/padrino/padrino-static/master/js/jquery.js', destination_root('/public/javascripts/jquery.js'))
get('https://raw.github.com/padrino/padrino-static/master/ujs/jquery.js', destination_root('/public/javascripts/jquery-ujs.js'))
rescue StandardError
copy_f... | 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/generators/components/mocks/rr.rb | padrino-gen/lib/padrino-gen/generators/components/mocks/rr.rb | def setup_mock
require_dependencies 'rr', require: false, group: 'test'
case options[:test].to_s
when 'rspec'
inject_into_file 'spec/spec_helper.rb', "require 'rr'\n", after: "'../config/boot'\n"
when 'minitest'
insert_mocking_include 'RR::Adapters::MiniTest', path: 'test/test_config.rb'
else
inse... | 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/generators/components/mocks/mocha.rb | padrino-gen/lib/padrino-gen/generators/components/mocks/mocha.rb | def setup_mock
require_dependencies 'mocha', group: 'test', require: false
if options[:test].to_s == 'rspec'
inject_into_file 'spec/spec_helper.rb', " conf.mock_with :mocha\n", after: "RSpec.configure do |conf|\n"
else
inject_into_file 'test/test_config.rb', "require 'mocha/api'\n", after: "require_rela... | 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/generators/components/renderers/liquid.rb | padrino-gen/lib/padrino-gen/generators/components/renderers/liquid.rb | def setup_renderer
require_dependencies 'liquid', version: '= 2.1.2'
require_dependencies 'liquify'
end
| 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/generators/components/renderers/erb.rb | padrino-gen/lib/padrino-gen/generators/components/renderers/erb.rb | def setup_renderer
require_dependencies 'erubi', version: '~> 1.6'
end
| 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/generators/components/renderers/haml.rb | padrino-gen/lib/padrino-gen/generators/components/renderers/haml.rb | def setup_renderer
require_dependencies 'haml'
end
| 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/generators/components/renderers/slim.rb | padrino-gen/lib/padrino-gen/generators/components/renderers/slim.rb | def setup_renderer
require_dependencies 'slim'
end
| 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/generators/components/tests/cucumber.rb | padrino-gen/lib/padrino-gen/generators/components/tests/cucumber.rb | apply_component_for(:rspec, :test)
CUCUMBER_SETUP = <<~TEST unless defined?(CUCUMBER_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
require 'capybara/cucumber'
require 'rspec/expectat... | 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/generators/components/tests/bacon.rb | padrino-gen/lib/padrino-gen/generators/components/tests/bacon.rb | BACON_SETUP = <<~TEST.gsub(/^ {10}/, '') unless defined?(BACON_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
class Bacon::Context
include Rack::Test::Methods
end
# You can use thi... | 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/generators/components/tests/shoulda.rb | padrino-gen/lib/padrino-gen/generators/components/tests/shoulda.rb | SHOULDA_SETUP = <<~TEST.gsub(/^ {10}/, '') unless defined?(SHOULDA_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
require "test/unit"
class Test::Unit::TestCase
include Rack::Test::M... | 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/generators/components/tests/minitest.rb | padrino-gen/lib/padrino-gen/generators/components/tests/minitest.rb | MINITEST_SETUP = <<~TEST.gsub(/^ {10}/, '') unless defined?(MINITEST_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
class Minitest::Spec
include Rack::Test::Methods
# You can use t... | 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/generators/components/tests/testunit.rb | padrino-gen/lib/padrino-gen/generators/components/tests/testunit.rb | TESTUNIT_SETUP = <<~TEST.gsub(/^ {10}/, '') unless defined?(TESTUNIT_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
class Test::Unit::TestCase
include Rack::Test::Methods
# You can... | 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/generators/components/tests/rspec.rb | padrino-gen/lib/padrino-gen/generators/components/tests/rspec.rb | RSPEC_SETUP = <<~TEST.gsub(/^ {12}/, '') unless defined?(RSPEC_SETUP)
RACK_ENV = 'test' unless defined?(RACK_ENV)
require_relative '../config/boot'
Dir[File.expand_path("\#{__dir__}/../app/helpers/**/*.rb")].each(&method(:require))
RSpec.configure do |conf|
conf.include Rack::Test::Methods
end
# You c... | 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/generators/components/stylesheets/compass.rb | padrino-gen/lib/padrino-gen/generators/components/stylesheets/compass.rb | COMPASS_INIT = <<-COMPASS unless defined?(COMPASS_INIT)
# Enables support for Compass, a stylesheet authoring framework based on SASS.
# See http://compass-style.org/ for more details.
# Store Compass/SASS files (by default) within 'app/stylesheets'.
require 'sass/plugin/rack'
Compass.configuration... | 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/generators/components/stylesheets/sass.rb | padrino-gen/lib/padrino-gen/generators/components/stylesheets/sass.rb | SASS_INIT = <<-SASS unless defined?(SASS_INIT)
# Enables support for SASS template reloading in rack applications.
# See http://nex-3.com/posts/88-sass-supports-rack for more details.
# Store SASS files (by default) within 'app/stylesheets'.
require 'sass/plugin/rack'
Sass::Plugin.options[:template_... | 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/generators/components/stylesheets/less.rb | padrino-gen/lib/padrino-gen/generators/components/stylesheets/less.rb | LESS_INIT = <<-LESS unless defined?(LESS_INIT)
# Enables support for Less template reloading for rack.
# Store Less files by default within 'app/stylesheets/'.
# See http://github.com/kelredd/rack-less for more details.
require 'rack/less'
# optional - use as necessary
Rack::Less.configure do |c... | 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/generators/components/stylesheets/scss.rb | padrino-gen/lib/padrino-gen/generators/components/stylesheets/scss.rb | SCSS_INIT = <<-SCSS unless defined?(SCSS_INIT)
# Enables support for SCSS template reloading in rack applications.
# See http://nex-3.com/posts/88-sass-supports-rack for more details.
# Store SCSS files (by default) within 'app/stylesheets'.
require 'sass/plugin/rack'
Sass::Plugin.options[:syntax] =... | 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/generators/components/orms/activerecord.rb | padrino-gen/lib/padrino-gen/generators/components/orms/activerecord.rb | AR = <<~AR unless defined?(AR)
##
# You can use other adapters like:
#
# ActiveRecord::Base.configurations = {
# development: {
# adapter: 'mysql2',
# encoding: 'utf8',
# reconnect: true,
# database: 'your_database',
# pool: 5,
# username: 'root'... | 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/generators/components/orms/dynamoid.rb | padrino-gen/lib/padrino-gen/generators/components/orms/dynamoid.rb | DYNAMOID = <<~DYNAMOID unless defined?(DYNAMOID)
AWS.config(
access_key_id: ENV['AWS_ACCESS_KEY'],
secret_access_key: ENV['AWS_SECRET_KEY'],
dynamo_db_endpoint: 'dynamodb.ap-southeast-1.amazonaws.com'
)
Dynamoid.configure do |config|
config.adapter = 'aws_sdk' # This adapter establishes a connec... | 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/generators/components/orms/sequel.rb | padrino-gen/lib/padrino-gen/generators/components/orms/sequel.rb | SEQUEL = <<~SEQUEL unless defined?(SEQUEL)
Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure
Sequel::Model.db = case Padrino.env
when :development then Sequel.connect(!DB_DEVELOPMENT!, loggers: [logger])
when :production then Sequel.connect(!DB_PRODUCTION!, loggers: [logger]... | 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/generators/components/orms/ohm.rb | padrino-gen/lib/padrino-gen/generators/components/orms/ohm.rb | OHM = <<~OHM unless defined?(OHM)
# Ohm does not have the concept of namespaces.
# This means that you will not be able to have
# a distinct test, development, or production database.
#
# You can, however, run multiple redis servers on the same host
# and point to them based on the environment:
#
# case... | 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/generators/components/orms/mongoid.rb | padrino-gen/lib/padrino-gen/generators/components/orms/mongoid.rb | MONGOID = <<~MONGO unless defined?(MONGOID)
# Connection.new takes host and port.
host = 'localhost'
port = 27017
database_name = case Padrino.env
when :development then '!NAME!_development'
when :production then '!NAME!_production'
when :test then '!NAME!_test'
end
# Use MONGO_URI if... | 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/generators/components/orms/datamapper.rb | padrino-gen/lib/padrino-gen/generators/components/orms/datamapper.rb | DM = <<~DM unless defined?(DM)
##
# A MySQL connection:
# DataMapper.setup(:default, 'mysql://user:password@localhost/the_database_name')
#
# # A Postgres connection:
# DataMapper.setup(:default, 'postgres://user:password@localhost/the_database_name')
#
# # A Sqlite3 connection
# DataMapper.setup(:def... | 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/generators/components/orms/mongomapper.rb | padrino-gen/lib/padrino-gen/generators/components/orms/mongomapper.rb | MONGO = <<~MONGO unless defined?(MONGO)
MongoMapper.connection = Mongo::Connection.new('localhost', nil, logger: logger)
case Padrino.env
when :development then MongoMapper.database = '!NAME!_development'
when :production then MongoMapper.database = '!NAME!_production'
when :test then MongoMapp... | 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/generators/components/orms/couchrest.rb | padrino-gen/lib/padrino-gen/generators/components/orms/couchrest.rb | COUCHREST = <<~COUCHREST unless defined?(COUCHREST)
case Padrino.env
when :development then db_name = '!NAME!_development'
when :production then db_name = '!NAME!_production'
when :test then db_name = '!NAME!_test'
end
CouchRest::Model::Base.configure do |conf|
conf.model_type_key = 'type... | 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/generators/components/orms/minirecord.rb | padrino-gen/lib/padrino-gen/generators/components/orms/minirecord.rb | MR = <<~MR unless defined?(MR)
##
# You can use other adapters like:
#
# ActiveRecord::Base.configurations[:development] = {
# adapter: 'mysql2',
# encoding: 'utf8',
# reconnect: true,
# database: 'your_database',
# pool: 5,
# username: 'root',
# password: ... | 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/generators/components/orms/mongomatic.rb | padrino-gen/lib/padrino-gen/generators/components/orms/mongomatic.rb | MONGOMATIC = <<~MONGO unless defined?(MONGOMATIC)
case Padrino.env
when :development then Mongomatic.db = Mongo::Connection.new.db('!NAME!_development')
when :production then Mongomatic.db = Mongo::Connection.new.db('!NAME!_production')
when :test then Mongomatic.db = Mongo::Connection.new.db('!NAME!_tes... | 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/generators/components/orms/ripple.rb | padrino-gen/lib/padrino-gen/generators/components/orms/ripple.rb | RIPPLE_DB = <<~RIAK unless defined?(RIPPLE_DB)
development:
http_port: 8098
pb_port: 8087
host: localhost
# The test environment has additional keys for configuring the
# Riak::TestServer for your test/spec suite:
#
# * bin_dir specifies the path to the "riak" script that you use to
# ... | 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/generators/project/config/boot.rb | padrino-gen/lib/padrino-gen/generators/project/config/boot.rb | # Defines our constants
RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV)
PADRINO_ROOT = File.expand_path('..', __dir__) unless defined?(PADRINO_ROOT)
# Load our dependencies
require 'bundler/setup'
Bundler.require(:default, RACK_ENV)
##
# ## Enable devel logging
#
# Padrino::Logger::Config[:deve... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/test/mem_core.rb | padrino-performance/test/mem_core.rb | require 'English'
ENV['RACK_ENV'] = 'test'
require 'padrino-core'
require 'minitest/autorun'
require 'minitest/benchmark'
require 'rack/test'
module MockBenchmark
include Rack::Test::Methods
module Settings
def bench_range
[20, 80, 320, 1280, 5120]
end
def run(*)
puts "Running #{self.na... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/test/bench_core.rb | padrino-performance/test/bench_core.rb | ENV['RACK_ENV'] = 'test'
require 'padrino-core'
require 'minitest/autorun'
require 'minitest/benchmark'
require 'rack/test'
module MockBenchmark
include Rack::Test::Methods
module Settings
def bench_range
[20, 80, 320, 1280, 5120]
end
def run(*)
puts "Running #{self.name}"
super
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/test/test_padrino_performance.rb | padrino-performance/test/test_padrino_performance.rb | require_relative 'helper'
describe 'Padrino Performance' do
end
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/test/helper.rb | padrino-performance/test/helper.rb | require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'padrino-performance'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/test/test_os.rb | padrino-performance/test/test_os.rb | require_relative 'helper'
describe 'Padrino Performance OS Module' do
WINDOWS_RELATED_SYSTEMS = %w[cygwin mswin mingw bccwin wince emx]
describe '#windows?' do
it 'should return false if OS is now windows' do
RbConfig::CONFIG['target_os'] = 'linux'
refute(Padrino::Performance::OS.windows?, 'No non... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/lib/padrino-performance.rb | padrino-performance/lib/padrino-performance.rb | require 'padrino-performance/version'
require 'padrino-performance/os'
| ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/lib/suites/json.rb | padrino-performance/lib/suites/json.rb | module Padrino
module Performance
module JSON
module InfectedRequire
def require(*args)
lib = args.first
JSON.loaded_lib!(lib) if JSON.registered_libs.include? lib
super
end
end
def self.registered_libs
@registered_libs ||= []
end
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/lib/suites/mem.rb | padrino-performance/lib/suites/mem.rb | require 'English'
module Padrino
class << self
def before_load(&block)
@_before_load ||= []
@_before_load << block if block_given?
@_before_load
end
def after_load(&block)
@_after_load ||= []
@_after_load << block if block_given?
@_after_load
end
def perf_memu... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-performance/lib/padrino-performance/version.rb | padrino-performance/lib/padrino-performance/version.rb | module Padrino
module Performance
# The version constant for the current version of Padrino.
VERSION = '0.16.0.pre3' unless defined?(Padrino::VERSION)
#
# The current Padrino version.
#
# @return [String]
# The version number.
#
def self.version
VERSION
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-performance/lib/padrino-performance/os.rb | padrino-performance/lib/padrino-performance/os.rb | module Padrino
module Performance
# OS detection useful for targeting CLI commands.
# Source: http://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on
module OS
def self.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RbConfig::CONFIG['... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_day_portion.rb | test/test_repeater_day_portion.rb | require 'helper'
class TestRepeaterDayPortion < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_am_future
day_portion = Chronic::RepeaterDayPortion.new(:am)
day_portion.start = @now
next_time = day_portion.next(:future)
assert_equal Time.local(2006, 8, 17,... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_span.rb | test/test_span.rb | require 'helper'
class TestSpan < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_span_width
span = Chronic::Span.new(Time.local(2006, 8, 16, 0), Time.local(2006, 8, 17, 0))
assert_equal((60 * 60 * 24), span.width)
end
def test_spa... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_token.rb | test/test_token.rb | require 'helper'
class TestToken < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_token
token = Chronic::Token.new('foo')
assert_equal 0, token.tags.size
assert !token.tagged?
token.tag("mytag")
assert_equal 1, token.tags.s... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_mini_date.rb | test/test_mini_date.rb | require 'helper'
class TestMiniDate < TestCase
def test_valid_month
assert_raises(ArgumentError){ Chronic::MiniDate.new(0,12) }
assert_raises(ArgumentError){ Chronic::MiniDate.new(13,1) }
end
def test_is_between
m=Chronic::MiniDate.new(3,2)
assert m.is_between?(Chronic::MiniDate.new(2,4), Chroni... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_quarter_name.rb | test/test_repeater_quarter_name.rb | require 'helper'
class TestRepeaterQuarterName < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_match
%w[q1 q2 q3 q4].each do |string|
token = Chronic::Token.new(string)
repeater = Chronic::Repeater.scan_for_quarter_names(token)
assert_equal Chronic::Repeat... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_time.rb | test/test_repeater_time.rb | require 'helper'
class TestRepeaterTime < TestCase
def setup
# Wed Aug 16 14:00:00 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_generic
assert_raises(ArgumentError) do
Chronic::RepeaterTime.new('00:01:02:03:004')
end
end
def test_next_future
t = Chronic::Repeater... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_month_name.rb | test/test_repeater_month_name.rb | require 'helper'
class TestRepeaterMonthName < TestCase
def setup
# Wed Aug 16 14:00:00 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next
# future
mays = Chronic::RepeaterMonthName.new(:may)
mays.start = @now
next_may = mays.next(:future)
assert_equal Time.local(2... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_chronic.rb | test/test_chronic.rb | require 'helper'
class TestChronic < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_pre_normalize
assert_equal Chronic::Parser.new.pre_normalize('12:55 pm'), Chronic::Parser.new.pre_normalize('12.55 pm')
end
def test_pre_normalize_num... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_month.rb | test/test_repeater_month.rb | require 'helper'
class TestRepeaterMonth < TestCase
def setup
# Wed Aug 16 14:00:00 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_offset_by
# future
time = Chronic::RepeaterMonth.new(:month).offset_by(@now, 1, :future)
assert_equal Time.local(2006, 9, 16, 14), time
tim... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_weekend.rb | test/test_repeater_weekend.rb | require 'helper'
class TestRepeaterWeekend < TestCase
def setup
# Wed Aug 16 14:00:00 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
weekend = Chronic::RepeaterWeekend.new(:weekend)
weekend.start = @now
next_weekend = weekend.next(:future)
assert_equal Time.l... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_daylight_savings.rb | test/test_daylight_savings.rb | require 'helper'
class TestDaylightSavings < TestCase
def setup
@begin_daylight_savings = Time.local(2008, 3, 9, 5, 0, 0, 0)
@end_daylight_savings = Time.local(2008, 11, 2, 5, 0, 0, 0)
end
def test_begin_past
# ambiguous - resolve to last night
t = Chronic::RepeaterTime.new('900')
t.start =... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_year.rb | test/test_repeater_year.rb | require 'helper'
class TestRepeaterYear < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
years = Chronic::RepeaterYear.new(:year)
years.start = @now
next_year = years.next(:future)
assert_equal Time.local(2007, 1, 1), next_year.begin
assert_equa... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_season.rb | test/test_repeater_season.rb | require 'helper'
class TestRepeaterSeason < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
seasons = Chronic::RepeaterSeason.new(:season)
seasons.start = @now
next_season = seasons.next(:future)
assert_equal Time.local(2006, 9, 23), next_season.begi... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_parsing.rb | test/test_parsing.rb | require 'helper'
class TestParsing < TestCase
# Wed Aug 16 14:00:00 UTC 2006
TIME_2006_08_16_14_00_00 = Time.local(2006, 8, 16, 14, 0, 0, 0)
def setup
@time_2006_08_16_14_00_00 = TIME_2006_08_16_14_00_00
end
def test_handle_generic
time = Chronic.parse("2012-08-02T13:00:00")
assert_equal Time.l... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | true |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_quarter.rb | test/test_repeater_quarter.rb | require 'helper'
class TestRepeaterQuarter < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_match
token = Chronic::Token.new('q')
repeater = Chronic::Repeater.scan_for_units(token)
assert_equal Chronic::RepeaterQuarter, repeater.class
assert_equal :quarter, repea... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/helper.rb | test/helper.rb | unless defined? Chronic
$:.unshift File.expand_path('../../lib', __FILE__)
require 'chronic'
end
require 'minitest/autorun'
class TestCase < MiniTest::Test
def self.test(name, &block)
define_method("test_#{name.gsub(/\W/, '_')}", &block) if block
end
end
| ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_hour.rb | test/test_repeater_hour.rb | require 'helper'
class TestRepeaterHour < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
hours = Chronic::RepeaterHour.new(:hour)
hours.start = @now
next_hour = hours.next(:future)
assert_equal Time.local(2006, 8, 16, 15), next_hour.begin
assert... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_minute.rb | test/test_repeater_minute.rb | require 'helper'
class TestRepeaterMinute < TestCase
def setup
@now = Time.local(2008, 6, 25, 7, 15, 30, 0)
end
def test_next_future
minutes = Chronic::RepeaterMinute.new(:minute)
minutes.start = @now
next_minute = minutes.next(:future)
assert_equal Time.local(2008, 6, 25, 7, 16), next_min... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_handler.rb | test/test_handler.rb | require 'helper'
class TestHandler < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def definitions
@definitions ||= Chronic::SpanDictionary.new.definitions
end
def test_handler_class_1
handler = Chronic::Handler.new([:repeater], :handler)... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_day_name.rb | test/test_repeater_day_name.rb | require 'helper'
class TestRepeaterDayName < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_match
token = Chronic::Token.new('saturday')
repeater = Chronic::Repeater.scan_for_day_names(token)
assert_equal Chronic::RepeaterDayName, repeater.class
assert_equal :sa... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_week.rb | test/test_repeater_week.rb | require 'helper'
class TestRepeaterWeek < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
weeks = Chronic::RepeaterWeek.new(:week)
weeks.start = @now
next_week = weeks.next(:future)
assert_equal Time.local(2006, 8, 20), next_week.begin
assert_equ... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_fortnight.rb | test/test_repeater_fortnight.rb | require 'helper'
class TestRepeaterFortnight < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
end
def test_next_future
fortnights = Chronic::RepeaterFortnight.new(:fortnight)
fortnights.start = @now
next_fortnight = fortnights.next(:future)
assert_equal Time.local(2006, 8, ... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/test/test_repeater_weekday.rb | test/test_repeater_weekday.rb | require 'helper'
class TestRepeaterWeekday < TestCase
def setup
@now = Time.local(2007, 6, 11, 14, 0, 0, 0) # Mon
end
def test_next_future
weekdays = Chronic::RepeaterWeekday.new(:weekday)
weekdays.start = @now
next1_weekday = weekdays.next(:future) # Tues
assert_equal Time.local(2007, 6, ... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic.rb | lib/chronic.rb | require 'time'
require 'date'
require 'numerizer'
require 'chronic/version'
require 'chronic/parser'
require 'chronic/date'
require 'chronic/time'
require 'chronic/handler'
require 'chronic/handlers'
require 'chronic/mini_date'
require 'chronic/span'
require 'chronic/token'
require 'chronic/tokenizer'
require 'chron... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tag.rb | lib/chronic/tag.rb | module Chronic
# Tokens are tagged with subclassed instances of this class when
# they match specific criteria.
class Tag
attr_accessor :type
attr_accessor :width
# type - The Symbol type of this tag.
def initialize(type, width = nil, options = {})
@type = type
@width = width
@... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/season.rb | lib/chronic/season.rb | module Chronic
class Season
attr_reader :start
attr_reader :end
def initialize(start_date, end_date)
@start = start_date
@end = end_date
end
def self.find_next_season(season, pointer)
lookup = [:spring, :summer, :autumn, :winter]
next_season_num = (lookup.index(season) +... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/version.rb | lib/chronic/version.rb | module Chronic
VERSION = '0.10.2'
end
| ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tokenizer.rb | lib/chronic/tokenizer.rb | module Chronic
module Tokenizer
def self.char_type(char)
case char
when '.'
:period
when /[[:alpha:]]/
:letter
when /[[:digit:]]/
:digit
when /[[:space:]]/
:space
when /[[:punct:]]/
:punct
else
:other
end
end
... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/time.rb | lib/chronic/time.rb | module Chronic
class Time
HOUR_SECONDS = 3600 # 60 * 60
MINUTE_SECONDS = 60
SECOND_SECONDS = 1 # haha, awesome
SUBSECOND_SECONDS = 0.001
# Checks if given number could be hour
def self.could_be_hour?(hour, width = nil, hours12 = false)
hour >= 0 && hour <= (hours12 ? 12 : 24) && (width.... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/parser.rb | lib/chronic/parser.rb | require 'chronic/dictionary'
require 'chronic/handlers'
module Chronic
class Parser
include Handlers
# Hash of default configuration options.
DEFAULT_OPTIONS = {
:context => :future,
:now => nil,
:hours24 => nil,
:week_start => :sunday,
:guess => true,
:ambiguous_time... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/handler.rb | lib/chronic/handler.rb | module Chronic
class Handler
attr_reader :pattern
attr_reader :handler_method
# pattern - An Array of patterns to match tokens against.
# handler_method - A Symbol representing the method to be invoked
# when a pattern matches.
def initialize(pattern, handler_method)
@pattern... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/dictionary.rb | lib/chronic/dictionary.rb | require 'chronic/definition'
module Chronic
# A collection of definitions
class Dictionary
attr_reader :defined_items, :options
def initialize(options = {})
@options = options
@defined_items = []
end
# returns a hash of each word's Definitions
def definitions
defined_items.e... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/handlers.rb | lib/chronic/handlers.rb | module Chronic
module Handlers
module_function
# Handle month/day
def handle_m_d(month, day, time_tokens, options)
month.start = self.now
span = month.this(options[:context])
year, month = span.begin.year, span.begin.month
day_start = Chronic.time_class.local(year, month, day)
... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/mini_date.rb | lib/chronic/mini_date.rb | module Chronic
class MiniDate
attr_accessor :month, :day
def self.from_time(time)
new(time.month, time.day)
end
def initialize(month, day)
unless (1..12).include?(month)
raise ArgumentError, '1..12 are valid months'
end
@month = month
@day = day
end
de... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/definition.rb | lib/chronic/definition.rb | require 'chronic/handlers'
module Chronic
# SpanDefinitions subclasses return definitions constructed by Handler instances (see handler.rb)
# SpanDefinitions subclasses follow a <Type> + Definitions naming pattern
# Types of Definitions are collected in Dictionaries (see dictionary.rb)
class Definitions
at... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/token.rb | lib/chronic/token.rb | module Chronic
class Token
attr_accessor :word
attr_accessor :tags
attr_reader :text
attr_reader :position
def initialize(word, text = nil, position = 0)
@word = word
@tags = []
@text = text
@position = position
end
def ==(token)
token.word == @word.downca... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/span.rb | lib/chronic/span.rb | module Chronic
# A Span represents a range of time. Since this class extends
# Range, you can use #begin and #end to get the beginning and
# ending times of the span (they will be of class Time)
class Span < Range
# Returns the width of this span in seconds
def width
(self.end - self.begin).to_i
... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/date.rb | lib/chronic/date.rb | module Chronic
class Date
YEAR_MONTHS = 12
MONTH_DAYS = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
MONTH_DAYS_LEAP = [nil, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
YEAR_SECONDS = 31_536_000 # 365 * 24 * 60 * 60
SEASON_SECONDS = 7_862_400 # 91 * 24 * 60 * 60
... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
mojombo/chronic | https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_day_portion.rb | lib/chronic/repeaters/repeater_day_portion.rb | module Chronic
class RepeaterDayPortion < Repeater #:nodoc:
PORTIONS = {
:am => 0..(12 * 60 * 60 - 1),
:pm => (12 * 60 * 60)..(24 * 60 * 60 - 1),
:morning => (6 * 60 * 60)..(12 * 60 * 60), # 6am-12am,
:afternoon => (13 * 60 * 60)..(17 * 60 * 60), # 1pm-5pm,
:evening => (17 * 60 * ... | ruby | MIT | 416d50434204c9929a321af508d4289e11a6cf69 | 2026-01-04T15:51:17.260733Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.