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 | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20191209053357_change_returned_loan_column.rb | Ruby | mit | 19 | master | 267 | class ChangeReturnedLoanColumn < ActiveRecord::Migration[5.2]
def up
remove_column :loans, :returned_at
add_column :loans, :returned_on, :date
end
def down
remove_column :loans, :returned_on
add_column :loans, :returned_at, :timestamp
end
end |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20191103121749_add_first_nameand_last_name_to_users_table.rb | Ruby | mit | 19 | master | 308 | class AddFirstNameandLastNameToUsersTable < ActiveRecord::Migration[5.2]
def change
add_column :users, :first_name, :string
add_column :users, :last_name, :string
remove_column :users, :full_name, :string
User.update_all first_name: "First"
User.update_all last_name: "Last"
end
end |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20200618212111_agreement_columns.rb | Ruby | mit | 19 | master | 226 | class AgreementColumns < ActiveRecord::Migration[6.0]
def change
rename_column :agreements, :title, :name
change_column_null :agreements, :name, null: false
remove_column :agreements, :content, :string
end
end |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20190727135429_add_fields_to_users.rb | Ruby | mit | 19 | master | 476 | class AddFieldsToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :full_name, :string, null: false
add_column :users, :street_address, :string, null: false
add_column :users, :street_address_second, :string
add_column :users, :city, :string, null: false
add_column :users, :s... |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20190726192055_create_membership_types.rb | Ruby | mit | 19 | master | 290 | class CreateMembershipTypes < ActiveRecord::Migration[5.2]
def change
create_table :membership_types do |t|
t.string :name
t.integer :fee_cents
t.integer :duration_days
t.integer :number_of_items
t.text :description
t.timestamps
end
end
end |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20191205220634_add_state_to_carriers.rb | Ruby | mit | 19 | master | 344 | class AddStateToCarriers < ActiveRecord::Migration[5.2]
def up
remove_column :carriers, :status
add_column :carriers, :state, :string, default: 'available', null: false
add_index :carriers, :state
end
def down
remove_column :carriers, :state
add_column :carriers, :status, :integer, default: 0... |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20200328044747_user_email_uniqueness.rb | Ruby | mit | 19 | master | 325 | class UserEmailUniqueness < ActiveRecord::Migration[6.0]
def up
remove_index :users, name: :index_users_on_email
add_index :users, [:organization_id, :email], unique: true
end
def down
remove_index :users, name: :index_users_on_organization_id_and_email
add_index :users, :email, unique: true
end... |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20200326193031_add_organization_id_to_things.rb | Ruby | mit | 19 | master | 413 | class AddOrganizationIdToThings < ActiveRecord::Migration[6.0]
def change
add_column :agreements, :organization_id, :integer
add_column :carriers, :organization_id, :integer
add_column :fee_types, :organization_id, :integer
add_column :locations, :organization_id, :integer
add_column :membership_t... |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20200621184023_create_signatures.rb | Ruby | mit | 19 | master | 347 | class CreateSignatures < ActiveRecord::Migration[6.0]
def change
create_table :signatures do |t|
t.references :user, null: false, foreign_key: true
t.references :agreement_version, null: false, foreign_key: true
t.string :signature, null: false
t.datetime :signed_at, null: false
t.ti... |
github | rubyforgood/babywearing | https://github.com/rubyforgood/babywearing | db/migrate/20200618203550_create_agreement_versions.rb | Ruby | mit | 19 | master | 463 | class CreateAgreementVersions < ActiveRecord::Migration[6.0]
def change
create_table :agreement_versions do |t|
t.string :title, null: false
t.text :content, null: false
t.references :agreement, null: false, foreign_key: true
t.references :last_modified_by, foreign_key: { to_table: :users ... |
github | tenderlove/jit_buffer | https://github.com/tenderlove/jit_buffer | jit_buffer.gemspec | Ruby | apache-2.0 | 19 | main | 910 | # frozen_string_literal: true
version = File.readlines("lib/jit_buffer.rb").grep(/VERSION = /).first[/[\d.]+/]
Gem::Specification.new do |spec|
spec.name = "jit_buffer"
spec.version = version
spec.authors = ["Aaron Patterson"]
spec.email = ["tenderlove@ruby-lang.org"]
spec.summ... |
github | tenderlove/jit_buffer | https://github.com/tenderlove/jit_buffer | lib/jit_buffer.rb | Ruby | apache-2.0 | 19 | main | 3,718 | require "fiddle"
class Fiddle::Function
def to_proc
this = self
lambda { |*args| this.call(*args) }
end
end unless Fiddle::Function.method_defined?(:to_proc)
class JITBuffer
VERSION = '1.0.5'
class Exception < StandardError
end
class OutOfBoundsException < Exception
end
class ReadOnlyExcept... |
github | tenderlove/jit_buffer | https://github.com/tenderlove/jit_buffer | test/jit_buffer_test.rb | Ruby | apache-2.0 | 19 | main | 3,364 | require "helper"
require "jit_buffer"
class JITBufferTest < Minitest::Test
def test_fill_buffer_with_putc
jit = JITBuffer.new 4096
str = [0xCC] * 4096
jit.writeable!
str.each { |c| jit.putc c }
assert_equal 4096, jit.pos
jit.seek 0
bytes = []
4096.times { bytes << (jit.getc & 0xFF) }... |
github | lihanli/cone | https://github.com/lihanli/cone | cone.gemspec | Ruby | mit | 19 | master | 495 | Gem::Specification.new do |gem|
gem.name = 'cone'
gem.version = '0.3.1'
gem.summary = 'Rails client side URL helpers'
gem.author = 'Lihan Li'
gem.email = 'frankieteardrop@gmail.com'
gem.homepage = 'http://github.com/lihanli/cone'
gem.add_dependency('coffee-rails')
gem.add_dependency('railtie... |
github | lihanli/cone | https://github.com/lihanli/cone | test/Gemfile | Ruby | mit | 19 | master | 239 | source 'https://rubygems.org'
gem 'rails', '5.1.4'
gem 'cone', path: '..'
group :development, :test do
gem 'thin'
gem 'pry-rails'
gem 'capybara', '2.7.1'
gem 'selenium-webdriver', '2.53.4'
gem 'minitest-reporters', '1.0.8'
end |
github | lihanli/cone | https://github.com/lihanli/cone | test/Rakefile | Ruby | mit | 19 | master | 273 | #!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
ConeTest::Application.load_tasks |
github | lihanli/cone | https://github.com/lihanli/cone | test/test/test_helper.rb | Ruby | mit | 19 | master | 795 | ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'capybara/rails'
require "minitest/reporters"
Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
class ActiveSupport::TestCase
# Add more helper methods to be used by all tests her... |
github | lihanli/cone | https://github.com/lihanli/cone | test/test/integration/cone_gem_test.rb | Ruby | mit | 19 | master | 985 | require 'test_helper'
class ConeGemTest < ActionDispatch::IntegrationTest
def get_cone_path(name, opt = {})
# alias, params
get_js("cone.#{name}Path(#{ opt[:params] ? opt[:params].to_json : '' })")
end
test 'path without params' do
assert_equal '/', get_cone_path('root')
assert_equal '/users', g... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/routes.rb | Ruby | mit | 19 | master | 1,868 | ConeTest::Application.routes.draw do
resources :users do
resources :posts
end
root :to => 'users#index'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values oth... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/application.rb | Ruby | mit | 19 | master | 1,161 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/initializers/secret_token.rb | Ruby | mit | 19 | master | 676 | # Be sure to restart your server when you modify this file.
# Your secret key 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 dictionary attac... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/initializers/session_store.rb | Ruby | mit | 19 | master | 416 | # Be sure to restart your server when you modify this file.
ConeTest::Application.config.session_store :cookie_store, key: '_ConeTest_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/environments/development.rb | Ruby | mit | 19 | master | 1,102 | ConeTest::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 restart the web s... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/environments/production.rb | Ruby | mit | 19 | master | 2,312 | ConeTest::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.actio... |
github | lihanli/cone | https://github.com/lihanli/cone | test/config/environments/test.rb | Ruby | mit | 19 | master | 1,411 | ConeTest::Application.configure do
config.active_support.test_order = :sorted
# 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 te... |
github | lihanli/cone | https://github.com/lihanli/cone | lib/cone.rb | Ruby | mit | 19 | master | 392 | module Cone
module Rails
class Railtie < ::Rails::Railtie
config.before_initialize do
# clear the assets cache otherwise routes don't get reloaded on server restart
assets_cache = 'tmp/cache/assets'
ActiveSupport::Cache::FileStore.new(assets_cache).clear if File.directory?(assets_cac... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | arcgis.gemspec | Ruby | apache-2.0 | 19 | master | 543 | Gem::Specification.new do |s|
s.name = "arcgis"
s.version = "0.0.15"
s.rubygems_version = %q{0.0.15}
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Andrew Turner"]
s.autorequire = %q{arcgis}
s.date = %q{2013-02-20}
s.email = %q{aturn... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/helper.rb | Ruby | apache-2.0 | 19 | master | 1,047 | require 'arcgis'
require 'rspec'
require 'rspec/expectations'
require 'yaml'
module Helpers
def create_testing_group(options={})
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => A... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/group_spec.rb | Ruby | apache-2.0 | 19 | master | 3,137 | require 'helper'
# GROUP_METHODS = {
# :post => %w{update reassign delete join invite leave removeUsers },
# :get => %w{users applications}
# }
describe Arcgis::Sharing::Group do
context "searching for groups" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/portal_spec.rb | Ruby | apache-2.0 | 19 | master | 661 | describe Arcgis::Portal do
context "accessing portal" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => ArcConfig.config["online"]["password"])
@... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/item_add_spec.rb | Ruby | apache-2.0 | 19 | master | 4,256 | require 'helper'
describe Arcgis::Sharing::Item do
context "adding an item", privileged: true do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => ArcCon... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/base_spec.rb | Ruby | apache-2.0 | 19 | master | 2,089 | require 'helper'
class APIDouble
# Given get and post methods and some expected url parts
%w(get post).each do |method|
define_method(method.to_sym) do |path, options|
@path = path
@options = options
end
end
def community_url
"/community/"
end
def content_url
"/content/"
end
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/online_spec.rb | Ruby | apache-2.0 | 19 | master | 1,069 | require 'helper'
describe Arcgis::Online do
context "working with online" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
end
describe "logging in" do
before :all do
@online.login(:username => ArcConfig.config["online"]["username"],
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/search_spec.rb | Ruby | apache-2.0 | 19 | master | 887 | require 'helper'
describe Arcgis::Sharing::Search do
include ArcConfig
context "performing a search" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
end
describe "by keyword and typekeywords" do
before :all do
@results = @online.search(:... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/comment_spec.rb | Ruby | apache-2.0 | 19 | master | 1,179 | describe Arcgis::Sharing::Comment do
context "adding an comment" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => ArcConfig.config["online"]["password"... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/user_spec.rb | Ruby | apache-2.0 | 19 | master | 3,160 | require 'helper'
describe Arcgis::Sharing::User do
context "search for users" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
end
describe "by username" do
before :all do
@users = @online.community_users(:q => "ajturner")
end
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/folder_spec.rb | Ruby | apache-2.0 | 19 | master | 836 | require 'helper'
describe Arcgis::Sharing::User do
context "As a user" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => ArcConfig.config["online"]["pa... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/item_spec.rb | Ruby | apache-2.0 | 19 | master | 3,625 | require 'helper'
describe Arcgis::Sharing::Item do
context "adding an item" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@username = ArcConfig.config["online"]["username"]
@online.login(:username => @username, :password => ArcConfig.config["online"... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | spec/arcgis/features_spec.rb | Ruby | apache-2.0 | 19 | master | 509 | describe Arcgis::Sharing::Features do
context "analyzing features" do
before :all do
@online = Arcgis::Online.new(:host => ArcConfig.config["online"]["host"])
@analysis = @online.features_analyze(:type => "CSV", :text => %Q{State,Pop\nVA,50\nPA,100})
end
it "should have records" do
expe... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis.rb | Ruby | apache-2.0 | 19 | master | 208 | require File.dirname(__FILE__) + '/arcgis/base'
require File.dirname(__FILE__) + '/arcgis/configurable'
require File.dirname(__FILE__) + '/arcgis/online'
require File.dirname(__FILE__) + '/contrib/multipart' |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/contrib/multipart.rb | Ruby | apache-2.0 | 19 | master | 784 | require 'net/http'
require 'digest/sha1'
require "erb"
include ERB::Util
class Net::HTTP::Post
def set_multipart_form_data(params, boundary=nil)
boundary ||= Digest::SHA1.hexdigest(params.inspect)
chunks = params.map { |k,v|
if(v.is_a?(File))
%Q{Content-Disposition: form-data; name="#{k}"; file... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/base.rb | Ruby | apache-2.0 | 19 | master | 1,144 | module Arcgis
module Base
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
# Factory for building API endpoints from Definitions
def extend_api(api,definition)
definition.each do |parent,ops|
ops.each do |op,methods|
methods.ea... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/configurable.rb | Ruby | apache-2.0 | 19 | master | 381 | module Arcgis
module Configurable
attr_accessor :host, :username, :password, :token, :debug
class << self
# TODO: include defaults? - ajturner
def keys
@keys ||= [
:host,
:username,
:password,
:token,
:debug
]
end
end
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/online.rb | Ruby | apache-2.0 | 19 | master | 3,827 | require File.dirname(__FILE__) + '/../arcgis/base'
require File.dirname(__FILE__) + '/../arcgis/sharing/community'
require File.dirname(__FILE__) + '/../arcgis/sharing/item'
require File.dirname(__FILE__) + '/../arcgis/sharing/search'
require File.dirname(__FILE__) + '/../arcgis/sharing/user'
require File.dirname(... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/comment.rb | Ruby | apache-2.0 | 19 | master | 1,002 | module Arcgis
module Sharing
module Comment
include Arcgis::Base
# API Docs: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Item_Comments/02r300000088000000/
def comment_url
"comments/"
end
# TODO is this better as a const or a method? - ajturner
GROUP... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/user.rb | Ruby | apache-2.0 | 19 | master | 2,524 | module Arcgis
module Sharing
# API Docs: http://www.arcgis.com/apidocs/rest/user.html
module User
include Arcgis::Base
def user_url
"users/"
end
# TODO add SubResource methods for Invitations, Notifications
# TODO is this better as a const or a method? - ajturner
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/features.rb | Ruby | apache-2.0 | 19 | master | 407 | module Arcgis
module Sharing
module Features
include Arcgis::Base
# API Docs: http://arcgis.com/apidocs/rest/features.html
def features_url
"features/"
end
FEATURES_METHODS = {
:content => {
:post => ["analyze", "generate"]
}
}
... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/community.rb | Ruby | apache-2.0 | 19 | master | 495 | module Arcgis
module Sharing
module Community
include Arcgis::Base
# API Docs: http://www.arcgis.com/apidocs/rest/community.html
def community_url
root_url + "community/"
end
def content_url
root_url + "content/"
end
COMMUNITY_METHODS = {
:c... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/search.rb | Ruby | apache-2.0 | 19 | master | 5,588 | require 'uri'
module Arcgis
module Sharing
module Search
include Arcgis
# q Description: The query string to search with.
#
# Example: q=relands+map
# bbox
# Description: The bounding box for a spatial search and is defined as minx, miny, maxx, maxy. Search requires q, bb... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/group.rb | Ruby | apache-2.0 | 19 | master | 733 | module Arcgis
module Sharing
module Group
include Arcgis::Base
# API Docs: http://www.arcgis.com/apidocs/rest/group.html
def group_url
"groups/"
end
# TODO is this better as a const or a method? - ajturner
GROUP_METHODS = {
:content => {
:get =>... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/sharing/item.rb | Ruby | apache-2.0 | 19 | master | 4,339 | module Arcgis
module Sharing
# API Docs: http://www.arcgis.com/apidocs/rest/item.html
module Item
MAX_SERVICENAME_LIMIT = 80
include Arcgis::Base
def item_url
"items/"
end
# Methods:
# <item-url> GET comments rating relatedItems
# <item-url> POST addComment ... |
github | ajturner/arcgis-ruby | https://github.com/ajturner/arcgis-ruby | lib/arcgis/portal/portal.rb | Ruby | apache-2.0 | 19 | master | 370 | module Arcgis
module Portal
# API Docs: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Portal_Self/02r3000001m7000000/
# http://dcdev.maps.arcgis.com/sharing/rest/portals/self
include Arcgis::Base
def portal_url
"portals/"
end
def organization(options = {})
ge... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | Rakefile | Ruby | mit | 19 | master | 226 | require "rspec/core"
require "rspec/core/rake_task"
desc "Run all specs"
RSpec::Core::RakeTask.new(:default) do |t|
t.rspec_opts = ["--color", "--format", "documentation"]
t.verbose = true
t.pattern = ['spec/*.rb']
end |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | rack-asset-compiler.gemspec | Ruby | mit | 19 | master | 905 | Gem::Specification.new do |s|
s.name = 'rack-asset-compiler'
s.version = "0.2.1"
s.author = 'Jonathan Baudanza'
s.email = 'jon@jonb.org'
s.summary = 'Rack Middleware to facilitate the generic compiling static assets.'
s.homepage = 'http://www.github.com/jbaudanza/rack-asset-compiler'
s.add_dependency 'rac... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | examples/jasmine.rb | Ruby | mit | 19 | master | 1,352 | #
# spec/javascripts/support/jasmine.rb
#
require 'rack/coffee_compiler'
module Jasmine
class Configuration
alias_method :old_js_files, :js_files
def js_files(spec_filter = nil)
# Convert all .coffee files into .js files before putting them in a script tag
old_js_files(spec_filter).map do |filen... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | spec/sass_compiler_spec.rb | Ruby | mit | 19 | master | 1,259 | require 'rack/sass_compiler'
require 'rack/lobster'
require 'rack/test'
include Rack::Test::Methods
describe "SassCompiler" do
before do
@source_dir = File.join(File.dirname(__FILE__), 'fixtures/sass')
@options = {
:source_dir => @source_dir
}
end
def app
options = @options
Rack::Bui... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | spec/coffee_compiler_spec.rb | Ruby | mit | 19 | master | 1,717 | require 'rack/coffee_compiler'
require 'rack/lobster'
require "rack/test"
include Rack::Test::Methods
describe "CoffeeCompiler" do
before do
@source_dir = File.join(File.dirname(__FILE__), 'fixtures/coffeescripts')
@options = {
:source_dir => @source_dir
}
end
def app
options = @options
... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | spec/asset_compiler_spec.rb | Ruby | mit | 19 | master | 4,135 | require 'rack/asset_compiler'
require 'rack/lobster'
require "rack/test"
include Rack::Test::Methods
describe "AssetCompiler" do
before do
@compiler = lambda do |source_file|
@source_file = source_file
'chickenscript'
end
@source_dir = File.join(File.dirname(__FILE__), 'fixtures/eggscripts'... |
github | jbaudanza/rack-asset-compiler | https://github.com/jbaudanza/rack-asset-compiler | lib/rack/asset_compiler.rb | Ruby | mit | 19 | master | 2,791 | module Rack
class AssetCompiler
attr_accessor :url, :source_dir, :source_extension
F = ::File
def initialize(app, options={}, &block)
@app = app
options = {
:compiler => block,
:source_dir => Dir.pwd,
:url => '/',
:cache => ENV['RACK_ENV'] == 'production'
... |
github | dyoder/autocode | https://github.com/dyoder/autocode | autocode.gemspec | Ruby | mit | 19 | master | 1,097 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{autocode}
s.version = "1.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dan Yoder", "Matthew King", "Lawrence Pitt"]
s.date = %q{2009-01-08}
s.email = %q{dan@zera... |
github | dyoder/autocode | https://github.com/dyoder/autocode | Rakefile | Ruby | mit | 19 | master | 1,543 | %w{ rubygems date rake/rdoctask rake/testtask fileutils }.each do |dep|
require dep
end
Gem::manage_gems
include FileUtils
require 'rake/gempackagetask'
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 1.8.6'
s.name = "autocode"
s.rubyforge_project = 'auto... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/normalize.rb | Ruby | mit | 19 | master | 906 | require File.join(File.dirname(__FILE__), 'helpers.rb')
describe "AutoCode should normalize const names" do
before do
Object.instance_eval { remove_const(:A) if const_defined?(:A) }
module A
include AutoCode
auto_create_module :foo_bar
auto_create_module :foo_bar_baz
auto_create_modu... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/least_surprise.rb | Ruby | mit | 19 | master | 1,408 | require "#{File.dirname(__FILE__)}/helpers"
describe "An auto_created module" do
before do
Object.instance_eval { remove_const(:A) if const_defined?(:A) }
module A
module Foo; end
include AutoCode
auto_create_class :B do
def kobold
"koboldy"
end
end
end
... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/auto_load.rb | Ruby | mit | 19 | master | 881 | require "#{File.dirname(__FILE__)}/helpers"
require 'extensions/io'
describe "auto_load" do
before do
Object.instance_eval { remove_const(:A) if const_defined?(:A) }
FileUtils.mkdir('tmp') rescue nil
@path = File.join( 'tmp', 'b.rb' )
content =<<-EOF
module A
module B
end
... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/helpers.rb | Ruby | mit | 19 | master | 351 | require 'rubygems'
%w{ bacon }.each { |dep| require dep }
# Bacon.extend Bacon::TestUnitOutput
Bacon.summary_on_exit
module Kernel
private
def specification(name, &block) Bacon::Context.new(name, &block) end
end
Bacon::Context.instance_eval do
alias_method :specify, :it
end
$:.unshift "#{File.dirname(__FILE__... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/auto_create.rb | Ruby | mit | 19 | master | 1,528 | require "#{File.dirname(__FILE__)}/helpers"
describe "auto_create" do
before do
Object.instance_eval { remove_const(:A) if const_defined?(:A) }
module A
include AutoCode
auto_create_module :B do
def self.smurf; "blue" ; end
auto_create_module true do
d... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/introspection.rb | Ruby | mit | 19 | master | 334 | require "#{File.dirname(__FILE__)}/helpers"
describe "A module that has included AutoCode" do
it "can tell you whether a subconstant has an auto-constructor" do
module A
include AutoCode
auto_create_module :B
end
A.auto_const?(:B).should.be.true
A.auto_const?(:C).should.not.be.tru... |
github | dyoder/autocode | https://github.com/dyoder/autocode | test/auto_eval.rb | Ruby | mit | 19 | master | 641 | require "#{File.dirname(__FILE__)}/helpers"
describe "auto_eval" do
before do
Object.instance_eval { remove_const(:A) if const_defined?(:A) }
module A
include AutoCode
auto_create_module :B
end
A.auto_eval :B do
include AutoCode
auto_create_class
end
A.auto_eval :B do... |
github | dyoder/autocode | https://github.com/dyoder/autocode | lib/autocode.rb | Ruby | mit | 19 | master | 4,998 | module AutoCode
def self.monitor
require 'monitor'
@monitor ||= Monitor.new
end
# always make sure we have a camel-cased symbol
def AutoCode.normalize( cname )
return cname unless cname.is_a? Symbol or cname.is_a? String
camel_case( cname ).intern
end
def AutoCode.camel_case( cname... |
github | dyoder/autocode | https://github.com/dyoder/autocode | lib/rack/reload.rb | Ruby | mit | 19 | master | 265 | require 'rubygems'
require 'rack'
module Rack
class Reload
def initialize(app, *reloadable)
@app = app
@reloadable = reloadable
end
def call(env)
@reloadable.each { |mod| mod.reload }
@app.call(env)
end
end
end |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | Rakefile | Ruby | mit | 19 | master | 992 | # encoding: utf-8
require 'rubygems'
require 'rubygems/tasks'
Gem::Tasks.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec:multi_markdown') do |spec|
spec.exclude_pattern = 'spec/libraries/*_spec.rb'
end
task :spec => 'spec:multi_markdown'
namespace :spec do
Dir.glob('spec/libraries/*_spec.rb')... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | multi_markdown.gemspec | Ruby | mit | 19 | master | 3,219 | # encoding: utf-8
require 'yaml'
Gem::Specification.new do |gemspec|
root = File.dirname(__FILE__)
lib_dir = File.join(root,'lib')
files = `git ls-files`.split($/)
filter_files = lambda { |paths|
files & case paths
when Array
paths
when String
Dir[... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | lib/multi_markdown/multi_markdown.rb | Ruby | mit | 19 | master | 3,015 | module MultiMarkdown
# Markdown library names
LIBRARIES = {
:bluecloth => 'bluecloth',
:kramdown => 'kramdown',
:maruku => 'maruku',
:rdiscount => 'rdiscount',
:redcarpet => 'redcarpet',
:rpeg_markdown => 'peg_markdown'
}
# Markdown Constants
CONSTANTS = {
... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/multi_markdown_spec.rb | Ruby | mit | 19 | master | 1,066 | require 'spec_helper'
require 'multi_markdown'
describe MultiMarkdown do
it "should have a VERSION constant" do
expect(subject.const_get('VERSION')).to_not be_empty
end
describe "find" do
context "when the library is unknown" do
it do
expect {
subject.find(:foo)
}.to rais... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/rdiscount_spec.rb | Ruby | mit | 19 | master | 486 | require 'spec_helper'
describe MultiMarkdown do
context "with rdiscount" do
let(:library) { :rdiscount }
let(:constant) { 'RDiscount' }
describe "find" do
before { require 'rdiscount' }
it "should find the RDiscount" do
expect(subject.find(library).name).to be == constant
en... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/maruku_spec.rb | Ruby | mit | 19 | master | 468 | require 'spec_helper'
describe MultiMarkdown do
context "with maruku" do
let(:library) { :maruku }
let(:constant) { 'Maruku' }
describe "find" do
before { require 'maruku' }
it "should find the Maruku" do
expect(subject.find(library).name).to be == constant
end
end
... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/kramdown_spec.rb | Ruby | mit | 19 | master | 520 | require 'spec_helper'
describe MultiMarkdown do
context "with kramdown" do
let(:library) { :kramdown }
let(:constant) { 'Kramdown::Document' }
describe "find" do
before { require 'kramdown' }
it "should find the Kramdown::Document" do
expect(subject.find(library).name).t... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/redcarpet_spec.rb | Ruby | mit | 19 | master | 510 | require 'spec_helper'
describe MultiMarkdown do
context "with redcarpet" do
let(:library) { :redcarpet }
let(:constant) { 'RedcarpetCompat' }
describe "find" do
before { require 'redcarpet' }
it "should find the RedcarpetCompat" do
expect(subject.find(library).name).to be ==... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/rpeg_markdown_spec.rb | Ruby | mit | 19 | master | 503 | require 'spec_helper'
describe MultiMarkdown do
context "with rpeg_markdown" do
let(:library) { :rpeg_markdown }
let(:constant) { 'PEGMarkdown' }
describe "find" do
before { require 'peg_markdown' }
it "should find the PEGMarkdown" do
expect(subject.find(library).name).to be == co... |
github | postmodern/multi_markdown | https://github.com/postmodern/multi_markdown | spec/libraries/bluecloth_spec.rb | Ruby | mit | 19 | master | 486 | require 'spec_helper'
describe MultiMarkdown do
context "with bluecloth" do
let(:library) { :bluecloth }
let(:constant) { 'BlueCloth' }
describe "find" do
before { require 'bluecloth' }
it "should find the BlueCloth" do
expect(subject.find(library).name).to be == constant
en... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | update_specinfra.rb | Ruby | mit | 19 | master | 5,808 | #!/usr/bin/env ruby
require 'erb'
require 'fileutils'
require 'shellwords'
require 'tmpdir'
# Usage:
# 1. Update SPECINFRA_VERSION
# 2. Run ./update_specinfra.rb
SPECINFRA_REPO = 'mizzy/specinfra'
SPECINFRA_VERSION = 'v2.94.0'
module GitHubFetcher
def self.fetch(repo, tag:, path:)
Dir.mktmpdir do |dir|
... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrbgem.rake | Ruby | mit | 19 | master | 468 | MRuby::Gem::Specification.new('mruby-specinfra') do |spec|
spec.license = 'MIT'
spec.authors = [
'Gosuke Miyashita',
'Takashi Kokubun',
]
spec.add_dependency 'mruby-array-ext'
spec.add_dependency 'mruby-class-ext'
spec.add_dependency 'mruby-env'
spec.add_dependency 'mruby-metaprog'
spec.add_depe... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra.rb | Ruby | mit | 19 | master | 1,432 | # require 'specinfra/core'
# include Specinfra
# include Specinfra::Helper::Os
# include Specinfra::Helper::Properties
# include Specinfra::Helper::HostInventory
module Specinfra
class << self
def command
Specinfra::CommandFactory.instance
end
def backend
type = Specinfra.configuration.back... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/helper.rb | Ruby | mit | 19 | master | 228 | # require 'specinfra/helper/os'
# require 'specinfra/helper/docker'
# require 'specinfra/helper/lxc'
# require 'specinfra/helper/configuration'
# require 'specinfra/helper/properties'
# require 'specinfra/helper/host_inventory' |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/properties.rb | Ruby | mit | 19 | master | 237 | # require 'singleton'
module Specinfra
class Properties
include Singleton
def initialize
@prop = {}
end
def properties(prop=nil)
if ! prop.nil?
@prop = prop
end
@prop
end
end
end |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/backend.rb | Ruby | mit | 19 | master | 580 | # require 'specinfra/backend/base'
# require 'specinfra/backend/exec'
# require 'specinfra/backend/ssh'
# require 'specinfra/backend/powershell/script_helper'
# require 'specinfra/backend/powershell/command'
# require 'specinfra/backend/cmd'
# require 'specinfra/backend/docker'
# require 'specinfra/backend/dockercli'
#... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/host_inventory.rb | Ruby | mit | 19 | master | 1,365 | module Specinfra
class HostInventory
KEYS = %w{
memory
ec2
hostname
domain
fqdn
platform
platform_codename
platform_version
filesystem
cpu
virtualization
kernel
block_device
user
group
facter
ohai
mount
... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/ec2_metadata.rb | Ruby | mit | 19 | master | 2,379 | # -*- coding: utf-8 -*-
module Specinfra
class Ec2Metadata
def initialize(host_inventory)
@host_inventory = host_inventory
@base_uri = 'http://169.254.169.254/latest/meta-data/'
@token_uri = 'http://169.254.169.254/latest/api/token'
@token = ''
@metadata = {}
end
def get
... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/configuration.rb | Ruby | mit | 19 | master | 1,790 | module Specinfra
module Configuration
class << self
VALID_OPTIONS_KEYS = [
:backend,
:env,
:path,
:shell,
:interactive_shell,
:login_shell,
:pre_command,
:stdout,
:stderr,
:exit_status,
:sudo_path,
:disable_sudo,... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/core.rb | Ruby | mit | 19 | master | 422 | # require 'specinfra/version'
# require 'specinfra/ext'
# require 'specinfra/helper'
# require 'specinfra/command'
# require 'specinfra/command_factory'
# require 'specinfra/command_result'
# require 'specinfra/backend'
# require 'specinfra/configuration'
# require 'specinfra/runner'
# require 'specinfra/processor'
mo... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/command.rb | Ruby | mit | 19 | master | 15,553 | module Specinfra
module Command
end
end
# Module
# require 'specinfra/command/module'
# require 'specinfra/command/module/service/init'
# require 'specinfra/command/module/service/systemd'
# require 'specinfra/command/module/service/daemontools'
# require 'specinfra/command/module/service/supervisor'
# require 'sp... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/ext/class.rb | Ruby | mit | 19 | master | 3,329 | class Class
def subclasses
case self.to_s
when "Specinfra::Command::Base"
[
Specinfra::Command::Base::Bond,
Specinfra::Command::Base::Bridge,
Specinfra::Command::Base::Cron,
Specinfra::Command::Base::File,
Specinfra::Command::Base::Fstab,
Specinfra::Comman... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/command/1_base.rb | Ruby | mit | 19 | master | 364 | # require 'shellwords'
class Specinfra::Command::Base
class << self
class NotImplementedError < Exception; end
def create
self
end
def escape(target)
str = case target
when Regexp
target.source
else
target.to_s
end
Sh... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/command/2_linux/base/inventory.rb | Ruby | mit | 19 | master | 835 | class Specinfra::Command::Linux::Base::Inventory < Specinfra::Command::Base::Inventory
class << self
def get_memory
'cat /proc/meminfo'
end
def get_cpu
'cat /proc/cpuinfo'
end
def get_hostname
'hostname -s'
end
def get_domain
'dnsdomainname'
end
def get_... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/command/openbsd/base/inventory.rb | Ruby | mit | 19 | master | 533 | class Specinfra::Command::Openbsd::Base::Inventory < Specinfra::Command::Base::Inventory
class << self
def get_memory
'false'
end
def get_cpu
'false'
end
def get_hostname
'hostname -s'
end
def get_domain
'hostname | ' +
'awk -v h=`hostname -s` \'$1 ~ h { su... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/command/1_base/file.rb | Ruby | mit | 19 | master | 5,270 | class Specinfra::Command::Base::File < Specinfra::Command::Base
class << self
def check_is_file(file)
"test -f #{escape(file)}"
end
def check_is_directory(directory)
"test -d #{escape(directory)}"
end
def check_is_pipe(file)
"test -p #{escape(file)}"
end
def check_is_s... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/backend/1_exec.rb | Ruby | mit | 19 | master | 4,709 | # require 'singleton'
# require 'fileutils'
# require 'shellwords'
# require 'sfl' if Specinfra.ruby_is_older_than?(1, 9, 0)
module Specinfra
module Backend
class Exec < Base
def run_command(cmd, opts={})
cmd = build_command(cmd)
cmd = add_pre_command(cmd)
stdout, stderr, exit_statu... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/backend/lxc.rb | Ruby | mit | 19 | master | 1,122 | module Specinfra
module Backend
class Lxc < Exec
def initialize(config = {})
super
begin
# require 'lxc/extra' unless Object.const_defined?("::LXC::Extra")
raise 'mruby-specinfra does not support dynamic require'
rescue StandardError
fail "LXC client li... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/backend/0_base.rb | Ruby | mit | 19 | master | 1,229 | # require 'singleton'
# require 'specinfra/command_result'
module Specinfra
module Backend
class Base
def self.instance
@instance ||= self.new
end
def self.clear
@instance = nil
end
def initialize(config = {})
@config = config
@example = nil
e... |
github | itamae-kitchen/mruby-specinfra | https://github.com/itamae-kitchen/mruby-specinfra | mrblib/specinfra/backend/docker.rb | Ruby | mit | 19 | master | 3,996 | module Specinfra
module Backend
class Docker < Exec
def initialize(config = {})
super
begin
# require 'docker' unless Object.const_defined?("::Docker")
raise 'mruby-specinfra does not support dynamic require'
rescue StandardError
fail "Docker client lib... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.