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 | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/dummy/db/schema.rb | Ruby | mit | 18 | master | 10,903 | # 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 source for your
# dat... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/dummy/config/application.rb | Ruby | mit | 18 | master | 559 | require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
require 'shopr'
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over t... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 18 | master | 659 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/dummy/config/initializers/new_framework_defaults.rb | Ruby | mit | 18 | master | 1,027 | # Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versi... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/orders.rb | Ruby | mit | 18 | master | 496 | FactoryBot.define do
factory :order, class: Shopr::Order do
first_name 'Joe'
last_name 'Bloggs'
billing_address1 'Unit 9 Winchester Place'
billing_address2 'North Street'
billing_address3 'Poole'
billing_address4 'Dorset'
billing_postcode 'BH15 1NX'
as... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/users.rb | Ruby | mit | 18 | master | 203 | FactoryBot.define do
factory :user, class: Shopr::User do
email "user@example.com"
password "password"
password_confirmation "password"
first_name "Test"
last_name "User"
end
end |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/product_categories.rb | Ruby | mit | 18 | master | 584 | FactoryBot.define do
factory :product_category, class: Shopr::ProductCategory do
name 'Product Category'
end
factory :phones_category, class: Shopr::ProductCategory do
name 'Phones'
end
factory :accessories_category, class: Shopr::ProductCategory do
name 'Accessories'
end
factory :software_... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/products.rb | Ruby | mit | 18 | master | 3,019 | FactoryBot.define do
factory :stock_product, class: Shopr::Product do
description 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo c... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/delivery_services.rb | Ruby | mit | 18 | master | 2,352 | FactoryBot.define do
factory :delivery_price, class: Shopr::DeliveryServicePrice do
price 5.0
cost_price 2.50
code 'PACK'
min_weight 0
max_weight 1
association :tax_rate, factory: :standard_tax
association :delivery_service, factory: :d... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/countries.rb | Ruby | mit | 18 | master | 678 | FactoryBot.define do
factory :united_kingdom, class: Shopr::Country do
name 'United Kingdom'
code2 'GB'
code3 'GBR'
continent 'EU'
tld 'uk'
currency 'GBP'
eu_member true
end
factory :united_states, class: Shopr::Country do
name 'United Stat... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/factories/tax_rates.rb | Ruby | mit | 18 | master | 245 | FactoryBot.define do
factory :standard_tax, class: Shopr::TaxRate do
name 'Standard Tax'
rate 20.0
end
factory :exempt_tax, class: Shopr::TaxRate do
name 'Exempt Tax'
rate 0.0
end
end |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/models/country_spec.rb | Ruby | mit | 18 | master | 288 | RSpec.describe Shopr::Country, type: :model do
it "has a valid factory" do
expect(build(:united_kingdom)).to be_valid
end
describe "ActiveModel validations" do
let(:country) { create(:united_kingdom) }
it { expect(country).to validate_presence_of(:name) }
end
end |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/models/product_spec.rb | Ruby | mit | 18 | master | 536 | RSpec.describe Shopr::Product, type: :model do
it "has a valid factory" do
expect(build(:yealink_t22p)).to be_valid
end
describe "ActiveModel validations" do
let(:product) { create(:yealink_t22p) }
it { expect(product).to validate_presence_of(:name) }
it { expect(product).to validate_presence_o... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | spec/models/user_spec.rb | Ruby | mit | 18 | master | 325 | RSpec.describe Shopr::User, type: :model do
it "has a valid factory" do
expect(build(:user)).to be_valid
end
describe "ActiveModel validations" do
let(:user) { create(:user) }
it { expect(user).to validate_presence_of(:first_name) }
it { expect(user).to validate_presence_of(:last_name) }
end
... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | db/seeds.rb | Ruby | mit | 18 | master | 9,569 | # encoding: UTF-8
# tax rates
tax_rate = Shopr::TaxRate.where(name: 'Standard VAT', rate: 20.0).first_or_create
# delivery services
ds = Shopr::DeliveryService.new(name: 'Next Day Delivery', code: 'ND16', courier: 'AnyCourier', tracking_url: 'http://trackingurl.com/track/{{consignment_number}}')
if ds.save
ds.deliv... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | db/migrate/20160608183749_create_initial_shopr_tables.rb | Ruby | mit | 18 | master | 9,866 | class CreateInitialShoprTables < ActiveRecord::Migration[4.2]
create_table 'nifty_key_value_store' do |t|
t.integer :parent_id
t.string :parent_type
t.string :group
t.string :name
t.string :value
t.timestamps
end
create_table 'shopr_addresses' do |t|
t.integer :customer_id
t.... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | config/routes.rb | Ruby | mit | 18 | master | 1,047 | Shopr::Engine.routes.draw do
devise_for :users, class_name: 'Shopr::User', module: :devise
get 'attachment/:id/:filename.:extension' => 'attachments#show'
resources :customers do
post :search, on: :collection
resources :addresses
end
resources :product_categories
resources :products do
resour... |
github | tryshopr/shopr | https://github.com/tryshopr/shopr | config/initializers/devise.rb | Ruby | mit | 18 | master | 13,219 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | phoenx.gemspec | Ruby | mit | 18 | master | 1,049 | # coding: utf-8
require File.expand_path('../lib/phoenx/gem_version', __FILE__)
require 'date'
Gem::Specification.new do |spec|
spec.name = "phoenx"
spec.version = Phoenx::VERSION
spec.date = Date.today
spec.authors = ["Jens Meder"]
spec.email = ["gems@jensmeder.de"]
spe... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx.rb | Ruby | mit | 18 | master | 858 | require 'colored'
require 'xcodeproj'
require 'phoenx/gem_version'
require 'phoenx/constants'
require 'phoenx/cli/option'
require 'phoenx/cli/command'
require 'phoenx/cli/cli_factory'
require 'phoenx/entities/project'
require 'phoenx/entities/target'
require 'phoenx/entities/configuration'
require 'phoenx/entities/s... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/constants.rb | Ruby | mit | 18 | master | 765 | module Phoenx
WORKSPACE_EXTENSION = "pxworkspace"
PROJECT_EXTENSION = "pxproject"
XCODE_PROJECT_EXTENSION = "xcodeproj"
XCODE_WORKSPACE_EXTENSION = "xcworkspace"
SOURCE_EXTENSIONS = [".swift", ".m", ".c", ".xcdatamodeld"]
RESOURCES_ROOT = "Resources"
TESTS_ROOT = "Tests... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/validators/workspace_validator.rb | Ruby | mit | 18 | master | 412 | module Phoenx
class WorkspaceValidator
ERROR_NONE = 0
ERROR_INVALID_NAME = 1
ERROR_INVALID_MAIN_PROJECT = 2
def validate(workspace)
if workspace.name == nil || workspace.name == ""
return ERROR_INVALID_NAME
end
if workspace.main_project == nil || workspace.main_project ... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/validators/configuration_validator.rb | Ruby | mit | 18 | master | 283 | module Phoenx
class ConfigurationValidator
ERROR_NONE = 0
ERROR_INVALID_NAME = 1
def validate(configuration)
if configuration.name == nil || configuration.name == ""
return ERROR_INVALID_NAME
end
return ERROR_NONE
end
end
end |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/validators/project_validator.rb | Ruby | mit | 18 | master | 242 | module Phoenx
class ProjectValidator
ERROR_NONE = 0
ERROR_INVALID_NAME = 1
def validate(project)
if project.name == nil || project.name == ""
return ERROR_INVALID_NAME
end
return ERROR_NONE
end
end
end |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/entities/project.rb | Ruby | mit | 18 | master | 917 | module Phoenx
class Project
attr_reader :configurations
attr_reader :config_files
attr_accessor :pre_install_scripts
attr_accessor :post_install_scripts
attr_accessor :project_name
attr_accessor :support_files
attr_accessor :excluded_support_files
attr_reader :targets
attr_accessor :deterministic... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/entities/workspace.rb | Ruby | mit | 18 | master | 553 | module Phoenx
class Workspace
attr_accessor :name
attr_reader :main_project_name
attr_reader :main_project_path
attr_reader :projects
attr_reader :generated_projects
def initialize
@main_project = {}
@projects = {}
@generated_projects = {}
yield(self)
end
def project(name, pa... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/entities/scheme.rb | Ruby | mit | 18 | master | 302 | module Phoenx
class Scheme
attr_accessor :name
attr_accessor :archive_configuration
attr_accessor :launch_configuration
attr_accessor :analyze_configuration
attr_accessor :profile_configuration
def initialize(name, block)
@name = name
self.instance_eval(&block)
end
end
end |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/entities/target.rb | Ruby | mit | 18 | master | 2,998 | module Phoenx
class AbstractTarget
attr_accessor :name
attr_accessor :resources
attr_accessor :excluded_resources
attr_accessor :frameworks
attr_accessor :libraries
attr_accessor :sources
attr_accessor :excluded_sources
attr_accessor :system_frameworks
attr_accessor :system_libraries
attr_accessor... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/entities/dependency.rb | Ruby | mit | 18 | master | 246 | module Phoenx
class Dependency
attr_accessor :target_name
attr_accessor :path
attr_accessor :embed
def initialize(target_name, embed = true, path = nil)
@target_name = target_name
@path = path
@embed = embed
end
end
end |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/use_cases/generate_project.rb | Ruby | mit | 18 | master | 2,337 | module Phoenx
class GenerateProject
:project_spec
:project
def initialize(project_spec)
@project_spec = project_spec
end
def build
@project_spec.pre_install_scripts.each do |pre_script|
abort "Missing pre install script ".red + pre_script.bold unless File.exists?(pre_script)
puts `./#{p... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/use_cases/generate_target.rb | Ruby | mit | 18 | master | 18,225 | module Phoenx
class TargetBuilder
attr_reader :project
attr_reader :target_spec
attr_reader :project_spec
attr_reader :framework_files
def initialize(project, target_spec, project_spec)
@project = project
@target_spec = target_spec
@project_spec = project_spec
@framework_files = []
end... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/use_cases/generate_workspace.rb | Ruby | mit | 18 | master | 1,366 | require 'colored'
module Phoenx
class GenerateWorkspace
:project_files
:workspace
def initialize(workspace)
@workspace = workspace
@project_files = []
end
def generate_workspace
workspace = Xcodeproj::Workspace.new(@workspace.main_project_path + @workspace.main_project_name + "." + XCODE_PROJ... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/use_cases/extract_build_settings.rb | Ruby | mit | 18 | master | 1,017 | module Phoenx
class ExtractBuildSettings
:project
def initialize(project)
@project = project
end
def extract_target_settings
@project.targets.each do |target|
FileUtils::mkdir_p 'xcconfig/' + target.name
target.build_configuration_list.build_configurations.each do |config|
extract_set... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/use_cases/target/add_header.rb | Ruby | mit | 18 | master | 2,146 | module Phoenx
module Target
class HeaderBuilder
attr_reader :project
attr_reader :target
attr_reader :target_spec
attr_reader :umbrella_headers
def initialize(project, target, target_spec)
@project = project
@target = target
@target_spec = target_spec
@umbrella_headers = []
end
... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/cli/command.rb | Ruby | mit | 18 | master | 2,170 | module Phoenx
module Cli
class Command
attr_accessor :name
attr_accessor :description
attr_accessor :base_command
attr_accessor :usage
@block
@options
@commands
@@indent = 20
def initialize(name, description, &block)
@name = name
@description = description
@block ... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/cli/cli_factory.rb | Ruby | mit | 18 | master | 3,968 | require 'fileutils'
module Phoenx
module Cli
class Factory
def workspace_command
command = Phoenx::Cli::Command.new "workspace", "Builds the workspace and projects" do
command.print
exit
end
command.base_command = "phoenx workspace"
command.usage = "Initializes the workspace by gen... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/cli/option.rb | Ruby | mit | 18 | master | 439 | module Phoenx
module Cli
class Option
attr_accessor :name
attr_accessor :short_cut
attr_accessor :description
attr_accessor :has_argument
@block
def initialize(name, short_cut, description, has_argument, &block)
@name = name
@short_cut = short_cut
@description = description
... |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/utilities/files_utils.rb | Ruby | mit | 18 | master | 308 | module Phoenx
def Phoenx.merge_files_array(files, excluded_files = nil)
if files == nil
return nil
end
resources = []
files.each do |source|
resources.concat Dir[source]
end
unless excluded_files == nil
resources -= merge_files_array(excluded_files)
end
return resources
end
end |
github | jensmeder/Phoenx | https://github.com/jensmeder/Phoenx | lib/phoenx/utilities/xcodeproj_utils.rb | Ruby | mit | 18 | master | 1,753 | require 'xcodeproj'
module Phoenx
def Phoenx.is_bundle?(file)
return file.include?('xcassets') || file.include?('bundle') || file.include?('playground')
end
def Phoenx.is_translation_folder?(file)
return file.include?('lproj')
end
def Phoenx.add_groups_for_files(project,files)
files.each do |path|
abo... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | codequest_pipes.gemspec | Ruby | mit | 18 | master | 676 | # encoding: utf-8
Gem::Specification.new do |spec|
spec.name = 'codequest_pipes'
spec.version = '0.3.1.1'
spec.author = 'codequest'
spec.email = 'hello@codequest.com'
spec.description = 'Pipes provides a Unix-like way to chain business objects'
spec.summary = 'Unix-like way to chain busi... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | spec/matcher_spec.rb | Ruby | mit | 18 | master | 1,578 | require 'spec_helper'
require 'rspec/matchers/fail_matchers'
require 'codequest_pipes/rspec'
RSpec.configure do |config|
config.include RSpec::Matchers::FailMatchers
end
describe 'expect(...).to match(pipe_context(expected))' do
let(:ctx) { Pipes::Context.new(foo: 'foo', bar: {}, baz: 1) }
let(:expected) { nil ... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | spec/pipe_spec.rb | Ruby | mit | 18 | master | 3,455 | require 'spec_helper'
# Parent is a dummy test class.
class Parent < Pipes::Pipe
require_context :flow
def call
flow.push(self.class.name)
end
end # class Parent
class Child < Parent; end
class Grandchild < Parent; end
class GrandGrandchild < Parent; end
# BadApple will break.
class BadApple < Pipes::Pipe... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | spec/context_spec.rb | Ruby | mit | 18 | master | 869 | require 'spec_helper'
describe Pipes::Context do
describe '#add' do
it 'allows adding new fields' do
subject.add(key: 'val')
expect(subject.key).to eq('val')
end
it 'does not allow rewriting existing fields' do
subject.add(key: 'val')
expect { subject.add(key: 'other_val') }
... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | lib/codequest_pipes.rb | Ruby | mit | 18 | master | 219 | require 'codequest_pipes/closure'
require 'codequest_pipes/context'
require 'codequest_pipes/pipe'
module Pipes
class MissingCallMethod < ::Exception; end
class MissingContext < ::Exception; end
end # module Pipes |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | lib/codequest_pipes/pipe.rb | Ruby | mit | 18 | master | 1,876 | module Pipes
# Pipe is a mix-in which turns a class into a Pipes building block (Pipe).
# A Pipe can only have class methods since it can't be instantiated.
class Pipe
attr_reader :context
def initialize(ctx)
@context = ctx
end
def call
fail MissingCallMethod
end
def self.|(... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | lib/codequest_pipes/closure.rb | Ruby | mit | 18 | master | 258 | module Pipes
# Closure provides a quick and dirty way of turning a block into an example of
# Pipes::Pipe.
class Closure
def self.define(&block)
Class.new(Pipe) { define_method(:call, block) }
end
end # class Closure
end # module Pipes |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | lib/codequest_pipes/rspec.rb | Ruby | mit | 18 | master | 432 | RSpec::Matchers.define :pipe_context do |expected_hash|
def matches_or_equals?(actual, expected)
return expected.matches?(actual) if expected.respond_to?(:matches?)
expected == actual
end
match do |ctx|
return false unless ctx.is_a?(Pipes::Context)
expected_hash.all? do |key, val|
next fals... |
github | codequest-eu/codequest_pipes | https://github.com/codequest-eu/codequest_pipes | lib/codequest_pipes/context.rb | Ruby | mit | 18 | master | 2,400 | module Pipes
# Context is an object used to pass data between Pipes. It behaves like an
# OpenStruct except you can write a value only once - this way we prevent
# context keys from being overwritten.
class Context
attr_reader :error
# Override is an exception raised when an attempt is made to override... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | simple_service.gemspec | Ruby | mit | 18 | master | 1,331 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'simple_service/version'
Gem::Specification.new do |spec|
spec.name = 'simple_service'
spec.version = SimpleService::VERSION
spec.authors = ['Jarrod Spillers']
spec.em... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | lib/simple_service.rb | Ruby | mit | 18 | master | 2,283 | require 'simple_service/result'
require 'simple_service/configuration'
require 'simple_service/version'
module SimpleService
def self.included(klass)
klass.extend ClassMethods
klass.include InstanceMethods
self.configure
end
class << self
attr_accessor :configuration
end
def self.configure
... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | lib/simple_service/result.rb | Ruby | mit | 18 | master | 1,356 | module SimpleService
class Result
attr_accessor :value, :recorded_commands
def initialize()
@recorded_commands = Set.new
@verbose_tracking = SimpleService.configuration.verbose_tracking
end
def success!(klass, command_name, result_value)
record_command(klass, command_name, result_v... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/spec_helper.rb | Ruby | mit | 18 | master | 281 | $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib', 'simple_service')
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH << File.join(File.dirname(__FILE__))
require 'simplecov'
SimpleCov.start
require 'pry'
require 'rspec'
require 'simple_service' |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/simple_service_spec.rb | Ruby | mit | 18 | master | 5,445 | require 'spec_helper'
require_relative 'support/basic_service'
require_relative 'support/looping_service'
require_relative 'support/empty_service'
require_relative 'support/multiple_outcome_calls'
RSpec.describe SimpleService do
let(:params) do
{
foo: 'foo',
bar: 'bar',
command_one_success: tr... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/support/looping_service.rb | Ruby | mit | 18 | master | 242 | class LoopingService
include SimpleService
commands :add_one
def self.call(kwargs)
count = kwargs
3.times do
count = super(count)
end
count
end
def add_one(count:)
success(count: count + 1)
end
end |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/support/modify_foo_bar.rb | Ruby | mit | 18 | master | 446 | class ModifyFooBar
include SimpleService
def call(foo:, bar:, command_one_success:, command_two_success:)
modified_foo = "modified #{foo}"
modified_bar = "modified #{bar}"
if command_one_success
success(
modified_foo: modified_foo,
modified_bar: modified_bar,
command_two_... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/support/combine_foo_bar.rb | Ruby | mit | 18 | master | 339 | class CombineFooBar
include SimpleService
def call(modified_foo:, modified_bar:, command_two_success:)
combined_foo_bar = "combined #{modified_foo} #{modified_bar}"
if command_two_success
success(combined_foo_bar: combined_foo_bar)
else
failure(message: 'stuff went wrong with command two')... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/support/basic_service.rb | Ruby | mit | 18 | master | 389 | require_relative 'modify_foo_bar'
require_relative 'combine_foo_bar'
class BasicService
include SimpleService
commands :upcase_foo,
:upcase_bar,
ModifyFooBar,
CombineFooBar
def upcase_foo(**kwargs)
success(kwargs.merge(foo: kwargs[:foo].upcase))
end
def upcase_bar(**kw... |
github | jspillers/simple_service | https://github.com/jspillers/simple_service | spec/support/multiple_outcome_calls.rb | Ruby | mit | 18 | master | 389 | class MultipleOutcomeCalls
include SimpleService
commands :command_one,
:command_two,
def command_one(**kwargs)
success(kwargs.merge(foo: kwargs[:foo].capitalize))
success(kwargs.merge(foo: kwargs[:foo].upcase))
end
def command_two(**kwargs)
success(bar: kwargs[:bar].capitalize)
... |
github | nextrevision/rancher-vagrant | https://github.com/nextrevision/rancher-vagrant | config_sample.rb | Ruby | apache-2.0 | 18 | master | 914 | # Box configuration details
# $box = "rancherio/rancheros"
# $box_version = '>=0.4.1'
# Official CoreOS channel. Either alpha, beta or stable
# $update_channel = "alpha"
# URL to pull CoreOS image from
# $box_url = "https://storage.googleapis.com/%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"... |
github | nextrevision/rancher-vagrant | https://github.com/nextrevision/rancher-vagrant | Vagrantfile | Ruby | apache-2.0 | 18 | master | 5,288 | # -*- mode: ruby -*-
# vi: set ft=ruby :
# set vagrant defaults
$boxes = []
$box = 'rancherio/rancheros'
$box_url = nil
$box_version = nil
$rancher_version = 'latest'
$ip_prefix = '192.168.33'
$disable_folder_sync = true
# install the vagrant-rancher provisioner plugin if
# it is not already installed
unless Vagrant.... |
github | nextrevision/rancher-vagrant | https://github.com/nextrevision/rancher-vagrant | lib/vagrant_rancheros_guest_plugin.rb | Ruby | apache-2.0 | 18 | master | 2,796 | require 'ipaddr'
## Hacking this until we get a real plugin
# Borrowing from http://stackoverflow.com/questions/1825928/netmask-to-cidr-in-ruby
IPAddr.class_eval do
def to_cidr
self.to_i.to_s(2).count("1")
end
end
module VagrantPlugins
module GuestLinux
class Plugin < Vagrant.plugin("2")
guest_ca... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | sdoc-site.rb | Ruby | mit | 18 | master | 3,531 | require 'sinatra'
require "sdoc_site"
require "sdoc_site/builds"
get '/doc/:something' do
redirect "/doc/#{params[:something]}/"
end
get %r{/doc/([^/]+)/([^/]*)} do
path = params["captures"][0]
remainder = params["captures"][1]
list = SDocSite::Builds::List.new(File.join('public', 'doc'))
locks = SDocSite::... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | Rakefile | Ruby | mit | 18 | master | 2,641 | $KCODE = 'UTF-8' unless RUBY_VERSION >= '1.9'
$:.unshift "#{File.dirname(__FILE__)}/lib"
require 'rubygems'
require 'rake/testtask'
require "sdoc_site/automation"
task :default => :test
desc "Run tests"
Rake::TestTask.new("test") do |t|
t.libs << 'tests'
t.pattern = 'tests/**/*_test.rb'
# t.warning = true
# ... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | config.ru | Ruby | mit | 18 | master | 425 | $:.unshift ::File.expand_path(::File.join(::File.dirname(__FILE__), 'lib/'))
require 'rubygems'
require 'sinatra'
set :run => false
set :environment => ENV['environment'] || :development
set :app_file => 'sdoc-site.rb'
configure :production do
require app_file
end
configure :development do
set :reload => true
en... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/builds.rb | Ruby | mit | 18 | master | 259 | require "sdoc_site"
module SDocSite::Builds
SIMPLE_BUILD_REGEXP = /^([^_-]+)-([^_-]+)$/
MERGED_BUILD_REGEXP = /^([^_-]+-[^_-]+_)+[^_-]+-[^_-]+$/
end
require "sdoc_site/builds/build"
require "sdoc_site/builds/merged_build"
require "sdoc_site/builds/list" |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/rails_git.rb | Ruby | mit | 18 | master | 1,897 | require "sdoc_site/version"
require "yaml"
module SDocSite
class RailsGit
attr_reader :rails_dir
def initialize(rails_dir)
@rails_dir = File.expand_path(rails_dir)
update
end
def update
if File.exists? rails_dir
in_rails_dir do
# `git pull origin`
... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation.rb | Ruby | mit | 18 | master | 9,142 | require "fileutils"
require "pathname"
require "rubygems"
require "sdoc"
require "haml"
require 'tmpdir'
require "sdoc_site/builds"
class SDocSite::Automation
include SDocSite
def initialize public_dir, options = {}
@public_dir = public_dir
@options = options
name = 'sdoc_' + rand.to_s.gsub(/\D... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/version.rb | Ruby | mit | 18 | master | 1,007 | require "sdoc_site"
class SDocSite::Version
include Comparable
attr_accessor :major, :minor, :tiny, :other, :beta
def initialize(tagname = '')
@tag = tagname
@major = @minor = '0'
@tiny = @other = ''
m = tagname.match(/\D*(\d+)\.(\d+)(?:\.(\d+)(.*)?)?/)
if m
@major = m[1]
@... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/sinatra.rb | Ruby | mit | 18 | master | 622 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Sinatra < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/sinatra/sinatra.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/github.rb | Ruby | mit | 18 | master | 1,734 | require "sdoc_site/version"
require "sdoc"
class SDocSite::Automation::Github
def initialize automation, url, options = {}
@automation = automation
@url = url
@tmp_path = @automation.temp_dir
@options = options
end
def name
@options[:name] || short_name[0,1].upcase + short_name[1..-1]
en... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/rails.rb | Ruby | mit | 18 | master | 1,613 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Rails < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/rails/rails.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line-numbe... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/eventmachine.rb | Ruby | mit | 18 | master | 1,391 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Eventmachine < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/eventmachine/eventmachine.git', :name => 'EventMachine', :short_name => 'eventmachine'
end
def build_doc version
do... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/rspecrails.rb | Ruby | mit | 18 | master | 268 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::RSpecRails < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/dchelimsky/rspec-rails.git'
end
def name
'RSpec::Rails'
end
end |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/hpricot.rb | Ruby | mit | 18 | master | 724 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Hpricot < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/why/hpricot.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line-num... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/rspec.rb | Ruby | mit | 18 | master | 846 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::RSpec < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/dchelimsky/rspec.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line-... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/rack.rb | Ruby | mit | 18 | master | 681 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Rack < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/rack/rack.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line-numbers'... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/haml.rb | Ruby | mit | 18 | master | 971 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Haml < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/nex3/haml.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '--line-numbers'... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/awss3.rb | Ruby | mit | 18 | master | 248 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Awss3 < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/marcel/aws-s3.git'
end
def name
'AWS-S3'
end
end |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/nokogiri.rb | Ruby | mit | 18 | master | 663 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Nokogiri < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/tenderlove/nokogiri.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options << '-... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/ruby.rb | Ruby | mit | 18 | master | 2,893 | require "sdoc_site/version"
require "sdoc"
require "rake"
class SDocSite::Automation::Ruby
def initialize automation
@automation = automation
end
def name
'Ruby'
end
def description
''
end
def short_name
'ruby'
end
def versions_to_build
2
end
def available_versi... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/automation/authlogic.rb | Ruby | mit | 18 | master | 715 | require "rake"
require "sdoc_site/automation/github"
class SDocSite::Automation::Authlogic < SDocSite::Automation::Github
def initialize automation
super automation, 'git://github.com/binarylogic/authlogic.git'
end
protected
def run_sdoc target
options = []
options << "-o" << target
options <<... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/builds/build.rb | Ruby | mit | 18 | master | 1,122 | require "sdoc_site/version"
class SDocSite::Builds::Build
include Comparable
include SDocSite::Builds
attr_accessor :name
attr_accessor :versions
attr_accessor :original
def initialize(name, versions = [])
@name = name
@versions = versions
@original = nil
end
def version
@versi... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/builds/merged_build.rb | Ruby | mit | 18 | master | 1,034 | class SDocSite::Builds::MergedBuild
attr_accessor :builds, :original
include SDocSite::Builds
def initialize
@builds = []
@original = nil
end
def ==(other)
builds.sort == other.builds.sort
end
def self.from_str str
parts = str.split('_')
merged = self.new
parts.each do |pa... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | lib/sdoc_site/builds/list.rb | Ruby | mit | 18 | master | 1,501 | class SDocSite::Builds::List
include SDocSite::Builds
attr_accessor :root
def initialize(root)
@root = root
reset
end
def reset
@simple_builds = nil
@merged_builds = nil
end
def simple_builds
@simple_builds ||= fetch_simple_builds
end
def simple_build build
simpl... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | tests/sdoc-site_test.rb | Ruby | mit | 18 | master | 3,821 | require "test_helper"
require "rack/test"
require "#{File.dirname(__FILE__)}/../sdoc-site.rb"
require "sdoc_site/builds"
require "sdoc_site/automation"
set :environment, :test
class SDocSiteTest < Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application
end
def test_should_redir... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | tests/builds_build_test.rb | Ruby | mit | 18 | master | 1,370 | require "test_helper"
require "sdoc_site/builds"
class BuildsBuildTest < Test::Unit::TestCase
include SDocSite
include SDocSite::Builds
def test_should_equal_same_builds
first = Build.from_str('a-v1.1')
first.versions << Version.new('v1.2')
second = Build.from_str('a-v1.1')
second.versions <<... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | tests/builds_merged_build_test.rb | Ruby | mit | 18 | master | 1,305 | require "test_helper"
require "sdoc_site/builds"
class BuildsMergedBuildTest < Test::Unit::TestCase
include SDocSite::Builds
def test_should_equal_merged_builds_in_any_order
first = MergedBuild.from_str('a-v1.1_b-v2.1')
second = MergedBuild.from_str('b-v2.1_a-v1.1')
assert_equal(first, second)
... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | tests/builds_list_test.rb | Ruby | mit | 18 | master | 955 | require "test_helper"
require "sdoc_site/builds"
class BuildsTest < Test::Unit::TestCase
include SDocSite
def test_should_return_all_simple_builds
builds = Builds::List.new(fixtures_path 'builds')
assert_equal(2, builds.simple_builds.size, 'Should find rails and ruby ')
end
def test_should_return... |
github | voloko/railsapi.com | https://github.com/voloko/railsapi.com | tests/version_test.rb | Ruby | mit | 18 | master | 697 | require "test_helper"
require "sdoc_site/version"
class VersionTest < Test::Unit::TestCase
include SDocSite
def test_should_compare
a = Version.new('v1.3.2')
b = Version.new('v1.3.3')
assert(a < b, "A should be less than b")
end
def test_should_find_same_minor
a = Version.new('v1.2.2')
... |
github | danielw/opinion | https://github.com/danielw/opinion | Rakefile | Ruby | mit | 18 | master | 307 | # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails' |
github | danielw/opinion | https://github.com/danielw/opinion | test/test_helper.rb | Ruby | mit | 18 | master | 1,277 | ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../config/environment')
require 'test_help'
class ActiveSupport::TestCase
fixtures :all
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures th... |
github | danielw/opinion | https://github.com/danielw/opinion | test/unit/user_mailer_test.rb | Ruby | mit | 18 | master | 711 | require File.dirname(__FILE__) + '/../test_helper'
require 'user_mailer'
class UserMailerTest < ActiveSupport::TestCase
FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
CHARSET = "utf-8"
include ActionMailer::Quoting
def setup
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perfo... |
github | danielw/opinion | https://github.com/danielw/opinion | test/unit/post_test.rb | Ruby | mit | 18 | master | 1,337 | require File.dirname(__FILE__) + '/../test_helper'
class PostTest < ActiveSupport::TestCase
def test_create
assert_difference 'Post.count' do
Post.create(:body => "lorem ipsum")
end
end
def test_script_tags
assert_difference 'Post.count' do
@post = Post.new(:title => "Tag Test", :body ... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/images_controller_test.rb | Ruby | mit | 18 | master | 488 | require File.dirname(__FILE__) + '/../test_helper'
require 'images_controller'
# Re-raise errors caught by the controller.
class ImagesController; def rescue_action(e) raise e end; end
class ImagesControllerTest < ActionController::TestCase
def setup
@controller = ImagesController.new
@request = ActionCo... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/users_controller_test.rb | Ruby | mit | 18 | master | 691 | require File.dirname(__FILE__) + '/../test_helper'
require 'users_controller'
# Re-raise errors caught by the controller.
class UsersController; def rescue_action(e) raise e end; end
class UsersControllerTest < ActionController::TestCase
def setup
@controller = UsersController.new
@request = ActionContro... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/accounts_controller_test.rb | Ruby | mit | 18 | master | 2,467 | require 'test_helper'
# Re-raise errors caught by the controller.
class AccountsController; def rescue_action(e) raise e end; end
module ReCaptcha
module Controller
def verify_recaptcha(model = nil)
true
end
end
end
class AccountsControllerTest < ActionController::TestCase
def setup
@controll... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/forums_controller_test.rb | Ruby | mit | 18 | master | 2,022 | require File.dirname(__FILE__) + '/../test_helper'
require 'forums_controller'
# Re-raise errors caught by the controller.
class ForumsController; def rescue_action(e) raise e end; end
class ForumsControllerTest < ActionController::TestCase
def setup
@controller = ForumsController.new
@request = ActionCo... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/categories_controller_test.rb | Ruby | mit | 18 | master | 2,096 | require File.dirname(__FILE__) + '/../test_helper'
require 'categories_controller'
# Re-raise errors caught by the controller.
class CategoriesController; def rescue_action(e) raise e end; end
class CategoriesControllerTest < ActionController::TestCase
def setup
@controller = CategoriesController.new
@reque... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/admin_controller_test.rb | Ruby | mit | 18 | master | 467 | require File.dirname(__FILE__) + '/../test_helper'
require 'admin_controller'
# Re-raise errors caught by the controller.
class AdminController; def rescue_action(e) raise e end; end
class AdminControllerTest < ActionController::TestCase
def setup
@controller = AdminController.new
@request = ActionContro... |
github | danielw/opinion | https://github.com/danielw/opinion | test/functional/posts_controller_test.rb | Ruby | mit | 18 | master | 5,162 | require File.dirname(__FILE__) + '/../test_helper'
require 'posts_controller'
# Re-raise errors caught by the controller.
class PostsController; def rescue_action(e) raise e end; end
class PostsControllerTest < ActionController::TestCase
def setup
@controller = PostsController.new
@request = ActionContro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.