source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
Appraisals
Ruby
mit
210
master
253
appraise "rails_5_1_5" do gem "rails", "5.1.5" gem 'sqlite3', '~> 1.3.6' end appraise "rails_5_2_4_3" do gem "rails", "5.2.4.3" gem 'sqlite3', '~> 1.4.2' end appraise "rails_6_0_3_4" do gem "rails", "6.0.3.4" gem 'sqlite3', '~> 1.4.2' end
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lazy_migrate.gemspec
Ruby
mit
210
master
2,023
# frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "lazy_migrate/version" Gem::Specification.new do |spec| spec.name = "lazy_migrate" spec.version = LazyMigrate::VERSION spec.authors = ["Jesse Duffield"] spe...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate.rb
Ruby
mit
210
master
200
# typed: strict # frozen_string_literal: true require "lazy_migrate/version" require "lazy_migrate/client" module LazyMigrate extend T::Sig sig { void } def self.run Client.run end end
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/client.rb
Ruby
mit
210
master
4,015
# typed: false # frozen_string_literal: true require 'tty-prompt' require 'active_record' require 'rails' require 'lazy_migrate/migrator_adapter_factory' module LazyMigrate class Client class << self MIGRATE = 'migrate' ROLLBACK = 'rollback' UP = 'up' DOWN = 'down' REDO = 'redo' ...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/migrator_adapter_factory.rb
Ruby
mit
210
master
681
# typed: true # frozen_string_literal: true require "lazy_migrate/old_migrator_adapter" require "lazy_migrate/new_migrator_adapter" module LazyMigrate class MigratorAdapterFactory class << self # unfortunately the code is a little different from 5.2 onwards compared to previous # versions, and we wa...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/migrator_adapter.rb
Ruby
mit
210
master
4,773
# typed: strict # frozen_string_literal: true require 'lazy_migrate/migration' module LazyMigrate class MigratorAdapter extend T::Sig extend T::Helpers abstract! sig { void } def initialize; end # bring_to_top updates the version of a migration to bring it to the top of the # migratio...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/old_migrator_adapter.rb
Ruby
mit
210
master
2,795
# typed: strict # frozen_string_literal: true require 'lazy_migrate/migrator_adapter' module ActiveRecord class Migrator module Compatibility class V5_1 < ActiveRecord::Migrator end end end end module LazyMigrate class OldMigratorAdapter < MigratorAdapter extend T::Sig sig { overri...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/new_migrator_adapter.rb
Ruby
mit
210
master
2,646
# typed: strict # frozen_string_literal: true require 'lazy_migrate/migrator_adapter' require 'lazy_migrate/migration' module LazyMigrate class NewMigratorAdapter < MigratorAdapter extend T::Sig sig { returns(ActiveRecord::MigrationContext) } attr_accessor :context sig { void } def initialize ...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
lib/lazy_migrate/migration.rb
Ruby
mit
210
master
270
# typed: strict # frozen_string_literal: true require 'sorbet-runtime' module LazyMigrate class Migration < T::Struct prop :status, String const :version, Integer const :name, String prop :has_file, T::Boolean prop :current, T::Boolean end end
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/spec_helper.rb
Ruby
mit
210
master
415
# typed: strict # frozen_string_literal: true require "bundler/setup" require "lazy_migrate" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/rails_helper.rb
Ruby
mit
210
master
642
# typed: strict # frozen_string_literal: true require 'rails/all' # require 'rspec/rails' version_underlined = Rails.version.gsub('.', '_') require "support/rails_app_#{version_underlined}/config/environment" support_folder = File.join(File.dirname(__FILE__), 'support') db_dir = ActiveRecord::Tasks::DatabaseTasks.db_...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/lazy_migrate/migrator_adapter_spec.rb
Ruby
mit
210
master
9,369
# typed: false # frozen_string_literal: true require 'rails_helper' require 'lazy_migrate/migration' RSpec.describe LazyMigrate::MigratorAdapter do let(:rails_root) { Rails.root } let(:create_books_migration_status) { LazyMigrate::Migration.new(status: "up", version: 20200804231712, name: "Create books", has...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/mock_schema.rb
Ruby
mit
210
master
981
# typed: strict # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sourc...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/Gemfile
Ruby
mit
210
master
846
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.4', '>= 5.2.4.3' # Use sqlite3 as the database for Active Record gem 'sqlite3' group :development, :test do # Call 'byebug'...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/boot.rb
Ruby
mit
210
master
225
# typed: strict ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. # require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/application.rb
Ruby
mit
210
master
1,270
# typed: strict require_relative 'boot' require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "active_storage/engine" # require "action_controller/railtie" # require "action_mailer/railtie" # require "action_view/railtie" # r...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/initializers/cors.rb
Ruby
mit
210
master
520
# typed: strict # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. # Read more: https://github.com/cyu/rack-cors # Rails.application.config.middleware.in...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/initializers/filter_parameter_logging.rb
Ruby
mit
210
master
210
# typed: strict # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/initializers/wrap_parameters.rb
Ruby
mit
210
master
501
# typed: strict # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do w...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/environments/test.rb
Ruby
mit
210
master
1,893
# typed: strict Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" f...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/environments/development.rb
Ruby
mit
210
master
1,924
# typed: strict Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to rest...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_2_4_3/config/environments/production.rb
Ruby
mit
210
master
3,625
# typed: strict Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both th...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_6_0_3_4/Gemfile
Ruby
mit
210
master
846
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3', '>= 6.0.3.4' # Use sqlite3 as the database for Active Record gem 'sqlite3' group :development, :test do # Call 'byebug'...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_6_0_3_4/config/application.rb
Ruby
mit
210
master
1,270
# typed: strict require_relative 'boot' require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "active_storage/engine" # require "action_controller/railtie" # require "action_mailer/railtie" # require "action_view/railtie" # r...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/Gemfile
Ruby
mit
210
master
967
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.5' # Use sqlite3 as ...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/test/test_helper.rb
Ruby
mit
210
master
328
# typed: strict ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by all tests here...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/config/application.rb
Ruby
mit
210
master
1,169
# typed: strict require_relative 'boot' require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "action_cable/engine" # require "...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/config/puma.rb
Ruby
mit
210
master
2,321
# typed: false # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximu...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/config/environments/production.rb
Ruby
mit
210
master
3,480
# typed: strict Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both th...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/config/environments/test.rb
Ruby
mit
210
master
1,781
# typed: false Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" fo...
github
jesseduffield/lazy_migrate
https://github.com/jesseduffield/lazy_migrate
spec/support/rails_app_5_1_5/config/environments/development.rb
Ruby
mit
210
master
1,642
# typed: false Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to resta...
github
hanami/hanami-validations
https://github.com/hanami/hanami-validations
Rakefile
Ruby
mit
209
main
297
# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" require "rubocop/rake_task" RSpec::Core::RakeTask.new(:spec) desc "Run all tests" task test: :spec RuboCop::RakeTask.new(:rubocop) desc "Run all linters" task lint: :rubocop task default: %i[lint test]
github
hanami/hanami-validations
https://github.com/hanami/hanami-validations
hanami-validations.gemspec
Ruby
mit
209
main
1,411
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml. lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "hanami/validations/version" Gem::Specification.new do |spec| spec.name = "hanami-validati...
github
hanami/hanami-validations
https://github.com/hanami/hanami-validations
Gemfile
Ruby
mit
209
main
302
# frozen_string_literal: true source "https://rubygems.org" eval_gemfile "Gemfile.devtools" gemspec unless ENV["CI"] gem "yard", require: false end gem "hanami-devtools", require: false, github: "hanami/devtools" gem "i18n", "~> 1.0", require: false group :test do gem "rspec", "~> 3.9" end
github
hanami/hanami-validations
https://github.com/hanami/hanami-validations
lib/hanami/validations.rb
Ruby
mit
209
main
221
# frozen_string_literal: true require "dry/validation" # @see Hanami::Validations # @since 0.1.0 module Hanami # @since 0.1.0 # @api private module Validations require_relative "validations/version" end end
github
hanami/hanami-validations
https://github.com/hanami/hanami-validations
spec/spec_helper.rb
Ruby
mit
209
main
221
# frozen_string_literal: true require "i18n" require "pathname" SPEC_ROOT = Pathname.new(__dir__) require "hanami/validations" require_relative "support/rspec" SPEC_ROOT.glob("support/**/*.rb").each { |f| require(f) }
github
relevance/streamlined
https://github.com/relevance/streamlined
init.rb
Ruby
mit
208
master
710
if defined?(Dependencies) ActiveSupport::Dependencies.load_paths.unshift("#{RAILS_ROOT}/app/streamlined") end require 'extensions/array_conversions' require 'extensions/hash_smart_merge' require 'relevance/symbol_additions' require 'relevance/string_additions' require 'relevance/method_additions' require 'relevance/...
github
relevance/streamlined
https://github.com/relevance/streamlined
install.rb
Ruby
mit
208
master
753
require 'rake' begin puts "======================================================================" puts "Attempting to copy Streamlined required files into your application..." puts "======================================================================" RAKE_FILE = File.join(File.dirname(__FILE__), '/tasks/re...
github
relevance/streamlined
https://github.com/relevance/streamlined
Rakefile
Ruby
mit
208
master
4,162
require 'rake' require 'rake/testtask' require 'rake/rdoctask' # Suppress file lists when running tests Rake::TestTask.class_eval do alias_method :original_define, :define def define @verbose = false original_define end end require 'test/lib/ar_helper' load 'test/lib/multi_rails/tasks/multi_rails.rake' ...
github
relevance/streamlined
https://github.com/relevance/streamlined
tasks/rcov.rake
Ruby
mit
208
master
1,547
begin require 'rcov' require "rcov/rcovtask" namespace :coverage do rcov_output = ENV["CC_BUILD_ARTIFACTS"] || 'tmp/coverage' rcov_exclusions = %w{ tasks/relevance_extensions_tasks.rake lib/streamlined/integration_tests.rb lib/relevance/integration_test_support.rb lib/relevance/co...
github
relevance/streamlined
https://github.com/relevance/streamlined
tasks/relevance_extensions_tasks.rake
Ruby
mit
208
master
2,146
require 'find' # Handle copying over the default assets, views, and layout that Streamlined depends on. # We don't do all this in the rake task to make things easier to test. module Streamlined class Assets @source = File.expand_path(File.join(File.dirname(__FILE__), '..', 'files')) @destination = RAILS_ROOT...
github
relevance/streamlined
https://github.com/relevance/streamlined
autotest/streamlined.rb
Ruby
mit
208
master
533
# TODO - autotest blows up right now, needs work class Autotest::Streamlined < Autotest def initialize super @exceptions = /\/\./ @test_mappings = { /^lib\/(.*)\.rb$/ => proc { |filename, m| file = File.basename(filename).gsub("_", "_?").gsub(".rb", "") files = files_matching %r%^tes...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined.rb
Ruby
mit
208
master
1,554
# The module must be defined before we start adding in functionality module Streamlined; end; require 'streamlined/environment' require 'streamlined/context' require 'streamlined/render_methods' require 'streamlined/breadcrumb' require 'streamlined/column' require 'streamlined/components' require 'streamlined/ui' requ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/extensions/array_conversions.rb
Ruby
mit
208
master
282
module ArrayConversions def to_2d_array if is_a?(Array) && !first.is_a?(Array) collect { |e| [e, e] } elsif is_a?(Hash) collect { |k,v| [k, v] } else self end end end Hash.send(:include, ArrayConversions) Array.send(:include, ArrayConversions)
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/extensions/hash_smart_merge.rb
Ruby
mit
208
master
372
module HashSmartMerge # Merges hashes one level deep without overwriting keys. If the same # key exists in both hashes, the values will be put in an array. def smart_merge!(hash) hash.each_pair do |k, v| if has_key?(k) self[k] = [self[k]] << v else self[k] = v end end ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/reflection.rb
Ruby
mit
208
master
2,484
require 'streamlined/view' module Streamlined; end module Streamlined::Reflection def reflect_on_scalars scalars = model.columns.inject(HashWithIndifferentAccess.new) do |h,v| h[v.name] = Streamlined::Column::ActiveRecord.new(v, model) h end end def reflect_on_additions additions = HashWi...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/permanent_registry.rb
Ruby
mit
208
master
1,176
# Provides a registry hook for global items that should never be reloaded # (e.g., items registered in environment.rb). class Streamlined::PermanentRegistry class <<self SUBREGISTRIES = [:display_formats_by_matcher, :edit_formats_by_matcher] attr_accessor *SUBREGISTRIES def reset SUBREGISTRIES.ea...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/breadcrumb.rb
Ruby
mit
208
master
771
module Streamlined; end module Streamlined::Breadcrumb def node_for(crud_context, instance) class_name = instance.class.to_s case crud_context when :list Proc.new { link_to class_name.titleize.pluralize, :controller => class_name.underscore.pluralize, :action => "list" } when :sh...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/integration_tests.rb
Ruby
mit
208
master
3,053
# Creating a streamlined integration test # 1. Starter File # require "#{File.dirname(__FILE__)}/your_test_base" # # class CampaignsIntegrationTest < YourTestBase # include Relevance::StreamlinedIntegrationTests # fixtures :campaigns # def setup # self.model_class = Campaign # self.form_fields = {:input=...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helper.rb
Ruby
mit
208
master
2,877
# Streamlined # (c) 2005-2008 Relevance, Inc.. (http://thinkrelevance.com) # Streamlined is freely distributable under the terms of an MIT-style license. # For details, see http://streamlinedframework.org/ # # The methods here are available to all Streamlined views. module Streamlined; end module Streamlined; module H...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/column.rb
Ruby
mit
208
master
310
# TODO: arguably columns belong to Streamlined::Context::ControllerContext module Streamlined; end module Streamlined; module Column; end; end require 'streamlined/column/base' require 'streamlined/column/addition' require 'streamlined/column/active_record' require 'streamlined/column/association'
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/view.rb
Ruby
mit
208
master
205
module Streamlined; end module Streamlined::View; end require 'streamlined/view/base' require 'streamlined/view/edit_views' require 'streamlined/view/render_methods' require 'streamlined/view/show_views'
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/reloadable_registry.rb
Ruby
mit
208
master
819
class Streamlined::ReloadableRegistry # unloadable is needed so that we do not lose validation_reflection when # reloading in development mode unloadable @ui_by_name = {} @context_hashes_by_name = {} class <<self attr_accessor :ui_by_name # Returns the UI class for a given model class or name ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/functional_tests.rb
Ruby
mit
208
master
3,537
gem 'flexmock', '~> 0.6' require 'relevance/controller_test_support' module Streamlined; end module Streamlined::FunctionalTests include Relevance::ControllerTestSupport def url_for(*args) assert(@controller, "You must hit a controller first before calling url_for") @controller.url_for(*args) end def po...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/render_methods.rb
Ruby
mit
208
master
2,968
# render overrides shared by controllers and views module Streamlined::GenericView protected def generic_view(template) test = Proc.new do |*args| file = File.join(*args) File.exist?(file) && file end test[STREAMLINED_GENERIC_OVERRIDE_ROOT, "#{template}.rhtml"] || test[STREAMLINED_GEN...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/ui.rb
Ruby
mit
208
master
11,246
# Streamlined # (c) 2005-2008 Relevance, Inc.. (http://thinkrelevance.com) # Streamlined is freely distributable under the terms of an MIT-style license. # For details, see http://streamlinedframework.org/ # TODO: Arguably belongs to Streamlined::Controller::Context module Streamlined; end require 'streamlined/reflect...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/environment.rb
Ruby
mit
208
master
1,877
# Bootstrap the Streamlined Environment module Streamlined::Environment class << self # Helper method to require plugins Streamlined depends on def require_streamlined_plugin(plugin) plugin_path = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/plugins", plugin.to_s)) $LOAD_P...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller.rb
Ruby
mit
208
master
5,173
# Streamlined # (c) 2005-2008 Relevance, Inc.. (http://thinkrelevance.com) # Streamlined is freely distributable under the terms of an MIT-style license. # For details, see http://streamlinedframework.org/ module Streamlined::Controller; end require 'streamlined/controller/crud_methods' require 'streamlined/controller...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/view/base.rb
Ruby
mit
208
master
1,082
class Streamlined::View::Base attr_reader :fields attr_reader :association attr_reader :separator class <<self attr_accessor :empty_list_content end @empty_list_content = "No records found" # When creating a relationship manager, specify the list of fields that will be # rendered at runtime. ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/view/render_methods.rb
Ruby
mit
208
master
1,116
module Streamlined::View::RenderMethods include Streamlined::RenderMethods def controller_name controller.controller_name # needed by Streamlined::RenderMethods end def controller_path controller.controller_path # needed by Streamlined::RenderMethods end def convert_partial_options(options) p...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/view/show_views.rb
Ruby
mit
208
master
2,297
module Streamlined::View::ShowViews # Factory method for creating a relationship Summary given the name of a summary. def self.create_summary(sym, options = {}) raise ArgumentError unless Symbol === sym Class.class_eval(ActiveSupport::Inflector.camelize(sym.to_s)).new options end # TODO: this is not...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/view/edit_views.rb
Ruby
mit
208
master
1,656
module Streamlined::View::EditViews def self.create_relationship(sym, options = {}) raise ArgumentError unless Symbol === sym Class.class_eval(ActiveSupport::Inflector.camelize(sym.to_s)).new options end # Factory method for creating a relationship View given the name of a view. # Renders an Ajax-ena...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/ui/deprecated.rb
Ruby
mit
208
master
1,368
module Streamlined::DeprecatedUIClassMethods def deprecated_class_methods # TODO: This list may be incomplete. It's designed to catalog methods that can # be called in a block on the UI class. If a method was missed, tests may fail. # Add the method to this list and things should be groovy again. @dep...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/column/association.rb
Ruby
mit
208
master
6,613
# Currently available Views: # * :membership => simple scrollable list of checkboxes. DEFAULT for n_to_many # * :inset_table => full table view inserted into current table # * :window => same table from :inset_table but displayed in a window # * :filter_select => like :membership, but with an auto-filter text box and ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/column/base.rb
Ruby
mit
208
master
6,722
require 'streamlined/view' require 'streamlined/helper' class Streamlined::Column::Base include Streamlined::Helpers::FormHelper include ERB::Util attr_accessor :human_name, :link_to, :popup, :parent_model, :wrapper, :additional_column_pairs, :additional_includes, :filter_column, :help at...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/column/active_record.rb
Ruby
mit
208
master
4,200
class Streamlined::Column::ActiveRecord < Streamlined::Column::Base attr_accessor :ar_column, :enumeration, :check_box, :default_edit_value attr_with_default :filterable, 'true' delegates :name, :to => :ar_column delegates :table_name, :to => :parent_model def initialize(ar_column, parent_model) @ar_co...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/column/addition.rb
Ruby
mit
208
master
596
class Streamlined::Column::Addition < Streamlined::Column::Base attr_accessor :name, :sort_column def initialize(sym, parent_model) @name = sym.to_s @human_name = sym.to_s.humanize @read_only = true @parent_model = parent_model end def addition? true end # Array#== calls this def ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/components/select.rb
Ruby
mit
208
master
1,563
module Streamlined::Components # Create a html select component with args corresponding to the Rails # select method, plus the ActionView::Base instance # # Example: # # html_fragment = Streamlined::Components::Select.render do |s| # s.view = view # s.object = model_underscore # s.method = n...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/filter_helper.rb
Ruby
mit
208
master
1,804
module Streamlined::Helpers::FilterHelper attr_with_default(:advanced_filtering) {false} # return the columns to be used for Advanced Filter def advanced_filter_columns filter_columns = Hash.new model_ui.list_columns.each do |column| if column.is_a?(Streamlined::Column::ActiveRecord) fil...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/link_helper.rb
Ruby
mit
208
master
4,561
# Helpers for creating links. Many of these links have additional functionality, implied by # CSS classes. Streamlined.js picks up these CSS classes and adds capabilities. # TODO: This class is almost identical to WindowLinkHelper. The duplication should be refactored out. module Streamlined::Helpers::LinkHelper def...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/header_helper.rb
Ruby
mit
208
master
1,134
# By default, headers are based on the class name (e.g. 'Edit Person') # If your model class implements a name method, # you will get that instead (e.g. 'Edit John Doe') module Streamlined::Helpers::HeaderHelper def render_show_header render_header end def render_edit_header render_header("Ed...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/breadcrumb_helper.rb
Ruby
mit
208
master
832
module Streamlined::Helpers::BreadcrumbHelper include Streamlined::Breadcrumb DELIMITER = "<" attr_with_default(:streamlined_breadcrumb) {false} def render_breadcrumb html = Builder::XmlMarkup.new html.div(:i...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/layout_helper.rb
Ruby
mit
208
master
1,663
# These helpers are needed by the layout # You might need to include them in non-streamlined controllers that want to share layout module Streamlined::Helpers::LayoutHelper # Returns an array of arrays which define the side menus for the corresponding view. # Override all side menus in all Streamlined controllers ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/table_helper.rb
Ruby
mit
208
master
1,037
module Streamlined::Helpers::TableHelper def streamlined_table_row_button_header model_ui.table_row_buttons ? "<th>&nbsp;</th>" : "" end def streamlined_table_row_buttons(item) if model_ui.table_row_buttons "<td>#{quick_show_button(item)}#{quick_edit_button(item)}#{quick_delete_button(item)}&nbsp...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/window_link_helper.rb
Ruby
mit
208
master
3,673
# This helper provides support for using Prototype Windows to render the edit/show instead of the # default, which is to render them as separate HTML pages. To add it, pass it as an option to the # +acts_as_streamlined+ method: # # class PeopleController < ApplicationController # acts_as_streamlined :helpe...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/helpers/form_helper.rb
Ruby
mit
208
master
1,331
module Streamlined::Helpers::FormHelper # If the validation_reflection plugin is available and working properly, check to see if the given # column allows for a nil assignment. If so, return the unassigned choice. Otherwise, return nothing. def unassigned_if_allowed(model_class, column, items) choice = "<o...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/enumeration_methods.rb
Ruby
mit
208
master
1,312
module Streamlined::Controller::EnumerationMethods # Shows the enumeration's configured +Edit+ view, as defined in streamlined_ui # and Streamlined::Column. def edit_enumeration self.instance = model.find(params[:id]) @enumeration_name = params[:enumeration] rel_type = model_ui.scalars[@enumeration_n...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/filter_methods.rb
Ruby
mit
208
master
7,958
module Streamlined::Controller::FilterMethods def add_filter @expired = filter_session_expired @column = params[:filter_column] @value = params[:filter_value] @conditions = build_filter(:add, nil, @column, @value) render_streamlined_file '/shared/add_filter.rjs' # ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/quick_add_methods.rb
Ruby
mit
208
master
2,870
module Streamlined::Controller::QuickAddMethods # TODO: needs refactoring def quick_add self.crud_context = :new return unless set_instance_vars @model.class.delegate_target_associations.each do |assoc| target_class = assoc.class_name.constantize instance_variable_set("@#{target_class.na...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/render_methods.rb
Ruby
mit
208
master
2,818
module Streamlined::Controller::RenderMethods include Streamlined::RenderMethods private def current_render_filter self.class.render_filters[current_action] end def render_filter_exists?(name) current_render_filter && current_render_filter[name] end def render_or_redirect(status, action, re...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/relationship_methods.rb
Ruby
mit
208
master
3,713
module Streamlined::Controller::RelationshipMethods # Shows the relationship's configured +Edit+ view, as defined in streamlined_ui # and Streamlined::Column. def edit_relationship self.instance = @root = model.find(params[:id]) @rel_name = params[:relationship] relationship = context_column(@rel_name) ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/options_methods.rb
Ruby
mit
208
master
320
module Streamlined::Controller::OptionsMethods private def merge_count_or_find_options(target) target.merge!(count_or_find_options) end def count_or_find_options result = self.class.count_or_find_options result.each_pair { |k, v| result[k] = self.send(v) if v.is_a?(Symbol) } result end end
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/crud_methods.rb
Ruby
mit
208
master
8,197
module Streamlined::Controller::CrudMethods # Creates the list of items of the managed model class. Default behavior # creates an Ajax-enabled table view that paginates in groups of 10. The # resulting view will use Prototype and XHR to allow the user to page # through the model instances. # # If the re...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/controller/callbacks.rb
Ruby
mit
208
master
650
module Streamlined::Controller::Callbacks private def current_before_callback(action) self.class.callbacks["before_#{action}".to_sym] end def execute_before_callback(action) callback = current_before_callback(action) return self.send(callback) if callback.is_a?(Symbol) self.instance_eval(&...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/context/request_context.rb
Ruby
mit
208
master
1,059
class Streamlined::Context::RequestContext attr_accessor :filter, :page, :sort_order, :sort_column, :counter, :per_page, :advanced_filter include HashInit DELEGATES = [:sort_order, :sort_column, :filter, :filter?, :advanced_filter, :ad...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/streamlined/context/controller_context.rb
Ruby
mit
208
master
1,138
# per controller context, kept for the lifetime of the controller class # and made available via delegation to controllers and views class Streamlined::Context::ControllerContext attr_accessor :ui_model_name, :ui_context def initialize(ui_model_name) streamlined_ui(ui_model_name) end ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/module_additions.rb
Ruby
mit
208
master
2,397
module Relevance; end module Relevance::ModuleAdditions # Provides an alternative to Rails' delegate method. We needed two things # that Rails did not do: delegate from one method name to another, and # provide a default value if the delegate object is nil. :to is required # :method is optional (default is the...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/string_additions.rb
Ruby
mit
208
master
488
module Relevance; end module Relevance::StringAdditions # preferred over constantize where failure should be unexceptional def to_const(failval=false) components = sub(/^::/,'').split('::') components.inject(Object) do |c,n| return failval unless c.const_defined?(n) c.const_get(n) end end...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/integration_test_support.rb
Ruby
mit
208
master
633
module Relevance; end module Relevance::IntegrationTestSupport include Relevance::ControllerTestSupport def url_for(*args) assert(@controller, "You must hit a controller first before calling url_for") super(*args) end def post_create_form assert_not_nil(form_model_name) post url_for_create...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/macro_reflection.rb
Ruby
mit
208
master
454
module Relevance; end module Relevance; module ActiveRecord; end; end module Relevance::ActiveRecord::MacroReflection module InstanceMethods [:has_many, :belongs_to, :has_one, :has_and_belongs_to_many].each do |macro_name| define_method("#{macro_name}?") do self.macro == macro_name end en...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/controller_test_support.rb
Ruby
mit
208
master
3,324
module Relevance; end module Relevance::ControllerTestSupport include FlexMock::TestCase include Relevance::RailsAssertions # Many attributes will derive by inference from :model_class if you do not set them attr_accessor :model_class, :controller_name attr_writer :object_for_create, :url_base, :object_for...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/csv.rb
Ruby
mit
208
master
406
require 'csv' module Enumerable def to_csv(keys, options = {:header=>true, :separator => ','}) str = '' header = options.delete(:header) header = keys if header == true ::CSV::Writer.generate(str, options[:separator]) do |csv| csv << header if header each do |item| csv << keys.inj...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/module.rb
Ruby
mit
208
master
2,261
module Relevance module ModuleHelper class << self def reader_from_options(sym, opts={}) default = if opts[:default] "#{opts[:default].inspect}" elsif opts[:default_method] "#{opts[:default_method]}" end if default "defined?(@#{sym}) ? @#{sym} ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/active_record_extensions.rb
Ruby
mit
208
master
3,067
# Streamlined # (c) 2005-2008 Relevance, Inc.. (http://thinkrelevance.com) # Streamlined is freely distributable under the terms of an MIT-style license. # For details, see http://streamlinedframework.org/ # # Adds several utility methods to ActiveRecord::Base for supporting view columns/ module Relevance; module Activ...
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/hash_init.rb
Ruby
mit
208
master
301
module HashInit # Initalize an object with a hash of key values to be set on self, # and optionally yield self to set things in a block if desired. def initialize(hash={}) hash.each do |k,v| sym = "#{k}=" self.send sym, v end if hash yield(self) if block_given? end end
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/method_additions.rb
Ruby
mit
208
master
225
module Relevance; end module Relevance::MethodAdditions def name # convert '#<Method: String#to_s>' to 'to_s' self.inspect.match(/.*?([a-z_]*)>$/)[1] end end Method.class_eval {include Relevance::MethodAdditions}
github
relevance/streamlined
https://github.com/relevance/streamlined
lib/relevance/rails_assertions.rb
Ruby
mit
208
master
1,903
module Relevance; end module Relevance::RailsAssertions # TODO: make this true for every CRUD method # TODO: also assert that various handlers like onclick do not exist def assert_unobtrusive_javascript assert_select("script", :count=>0, :text=>/./) end def assert_true(expr, *args) assert_equal(tru...
github
relevance/streamlined
https://github.com/relevance/streamlined
test/test_helper.rb
Ruby
mit
208
master
3,096
RAILS_ENV = "test" unless Object.const_defined?("RAILS_ENV") $:.unshift(File.dirname(__FILE__) + '/../lib') require 'rubygems' require 'test/unit' require 'test/spec' require 'mocha' require 'flexmock/test_unit' require 'ostruct' require File.expand_path(File.join(File.dirname(__FILE__), "/lib/multi_rails/lib/multi_rai...
github
relevance/streamlined
https://github.com/relevance/streamlined
test/test_functional_helper.rb
Ruby
mit
208
master
4,198
base = File.dirname(__FILE__) require File.join(base, 'test_helper') require File.join(base, "lib", 'ar_helper') require 'active_record/fixtures' $: << File.join(base,"fixtures") # getting messy: Poet needed by Poem require "poet" # Require sample fixtures, models, and UI classes # .sort.each added to ensure that th...
github
relevance/streamlined
https://github.com/relevance/streamlined
test/edge_rails_test_helper.rb
Ruby
mit
208
master
735
module EdgeRailsTestHelper # prepare our test environment by doing stuff that normally happens via the plugin init process def self.bootstrap_test_environment_for_edge ActionView::Base.send(:include, Streamlined::Helper) ActionController::Base.view_paths = [File.join(RAILS_ROOT, 'app', 'views')] %W(#{S...