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 | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/test_dbslayer_connection.rb | Ruby | mit | 19 | master | 3,087 | require File.dirname(__FILE__) + '/helper.rb'
class TestDbslayerConnection < Test::Unit::TestCase
def setup
@slayer = ActiveRecord::ConnectionAdapters::DbslayerConnection.new
end
def test_query_string
query = {"foo" => "bar"}
assert_equal URI.encode(query.to_json), @slayer.send('query_string', qu... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/test_dbslayer_column.rb | Ruby | mit | 19 | master | 475 | require File.dirname(__FILE__) + '/helper.rb'
class Test_ActiveRecord_ConnectionAdapters_DbslayerColumn < Test::Unit::TestCase
def setup
@column = ActiveRecord::ConnectionAdapters::DbslayerColumn.new('foo', false, 'tinyint(1)')
end
# the only thing changed from the MySQL one
def test_boolean_coerce
... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/test_dbslayer_adapter.rb | Ruby | mit | 19 | master | 2,985 | require File.dirname(__FILE__) + '/helper.rb'
class Test_ActiveRecord_ConnectionAdapters_DbslayerAdapter < Test::Unit::TestCase
def setup
@config = { :host => 'localhost', :port => 9090 }
@adapter = ActiveRecord::Base.dbslayer_connection(@config)
end
def test_adapter_name
assert_equal 'DBSlayer ... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/test_dbslayer_results.rb | Ruby | mit | 19 | master | 2,719 | require File.dirname(__FILE__) + '/helper.rb'
CITY_HASH_ROWS = [{'id' => 123, 'city_name' => "Mumbai (Bombay)", "country_name" => "India" , 'population' => 10500000},
{'id' => 4112, 'city_name' => "Seoul" , "country_name" =>"South Korea" , 'population' => 9981619} ,
{'id' => 2433, 'city_name' => "São Paulo... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/localtest.rb | Ruby | mit | 19 | master | 500 | require 'rubygems'
require 'activerecord-dbslayer-adapter'
ActiveRecord::Base.establish_connection({
:adapter => 'dbslayer',
:host => 'localhost',
:port => 9090
})
class Restaurant < ActiveRecord::Base
has_many :reviews
end
class Review < ActiveRecord::Base
belongs_to :restaurant
end
rests = Restaurant.fi... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | test/helper.rb | Ruby | mit | 19 | master | 5,680 | require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_record'
require 'mocha'
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
require 'active_record/connection_adapters/dbslayer_adapter'
STAT_REPLY = {"STAT" => "STAT"}
CLIENT_INFO_REPLY = {"CLIENT_INFO" => "5.2.27"}
VERSION_NUM_... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | tasks/rcov.rake | Ruby | mit | 19 | master | 263 | desc 'Measures test coverage'
task :test_coverage do
rm_f "coverage"
rm_f "coverage.data"
rcov = "rcov --aggregate coverage.data --text-summary -Ilib"
system("#{rcov} --html test/test_*.rb")
system("open coverage/index.html") if PLATFORM['darwin']
end |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | lib/activerecord-dbslayer-adapter.rb | Ruby | mit | 19 | master | 752 | # Stole this code from Nick Sieger
begin
tried_gem ||= false
require 'active_record/version'
rescue LoadError
raise if tried_gem
require 'rubygems'
gem 'activerecord'
tried_gem = true
retry
end
if ActiveRecord::VERSION::MAJOR < 2
if defined?(RAILS_CONNECTION_ADAPTERS)
RAILS_CONNECTION_ADAPTERS << %... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | lib/active_record/connection_adapters/dbslayer_connection.rb | Ruby | mit | 19 | master | 4,190 | require 'rubygems'
require 'net/http'
require 'open-uri'
require 'json'
module ActiveRecord
module ConnectionAdapters
class DbslayerException < RuntimeError
end
class DbslayerResult
def initialize(results_hash)
@hash = results_hash
end
def rows
@hash['ROWS']
... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | lib/active_record/connection_adapters/dbslayer_adapter.rb | Ruby | mit | 19 | master | 11,839 | require 'active_record/connection_adapters/abstract_adapter'
require 'active_record/connection_adapters/dbslayer_connection'
require 'active_record/connection_adapters/mysql_adapter'
module ActiveRecord
class Base
# Establishes a connection to the database that's used by all Active Record objects.
def self.d... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | config/requirements.rb | Ruby | mit | 19 | master | 375 | require 'fileutils'
include FileUtils
require 'rubygems'
%w[rake hoe newgem rubigen mocha active_support active_record].each do |req_gem|
begin
require req_gem
rescue LoadError
puts "This Rakefile requires the '#{req_gem}' RubyGem."
puts "Installation: gem install #{req_gem} -y"
exit
end
end
$:.... |
github | harrisj/activerecord-dbslayer-adapter | https://github.com/harrisj/activerecord-dbslayer-adapter | config/hoe.rb | Ruby | mit | 19 | master | 2,481 | require 'activerecord-dbslayer-adapter'
AUTHOR = 'Jacob Harris' # can also be an array of Authors
EMAIL = "jharris@nytimes.com"
DESCRIPTION = "An ActiveRecord adapter to DBSlayer"
GEM_NAME = 'activerecord-dbslayer-adapter' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'ar-dbslayer' # The unix name for ... |
github | afair/postgresql-cursor | https://github.com/afair/postgresql-cursor | Rakefile | Ruby | mit | 19 | master | 591 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the postgre_sql_cursor plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation ... |
github | afair/postgresql-cursor | https://github.com/afair/postgresql-cursor | lib/postgresql_cursor.rb | Ruby | mit | 19 | master | 4,988 | # PostgreSQLCursor
# An extenstion for PostgreSQL adapter to select large result sets, buffered, and "fetched"
# from the buffer. Hashes are returned for each row instead of an ActiveRecord subcless.
# Warning: This file must be laoded after ActiveRecord. Probably as a merb dependency gem/plugin.
class ActiveRecord::Co... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | Rakefile | Ruby | mit | 19 | master | 1,255 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "gemstalker"
gem.summary = "GemStalker is a small library to determine if GitHub has built a gem yet."
gem.email = "josh@technicalpickles.com"
gem.homepage = "http://github.... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | gemstalker.gemspec | Ruby | mit | 19 | master | 1,773 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{gemstalker}
s.version = "0.5.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Josh Nichols"]
s.date = %q{2009-07-22}
s.default_executable = %q{gemstalk}
s.descripti... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | test/test_helper.rb | Ruby | mit | 19 | master | 1,662 | require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'ruby-debug'
require 'fake_web'
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.dirname(__FILE__), '..', 'lib')
require 'gem_stalker'
FakeWeb.allow_net_connect = false
FakeWeb.register_uri 'http://gems.github.com:80/gems/technicalpick... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | test/gemstalker_test.rb | Ruby | mit | 19 | master | 1,963 | require File.dirname(__FILE__) + '/test_helper'
class GemstalkerTest < Test::Unit::TestCase
context "a stalker for a specific version of a gem that has not been built" do
setup do
@stalker = GemStalker.new(:username => 'technicalpickles', :repository => 'jeweler', :version => '0.9.3')
end
should ... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | test/responses/bostonrb.gemspec | Ruby | mit | 19 | master | 655 | HTTP/1.1 301 Moved Permanently
Server: nginx/0.6.31
Date: Fri, 13 Feb 2009 20:41:25 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f; path=/; expire... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | test/responses/jeweler.gemspec | Ruby | mit | 19 | master | 3,410 | HTTP/1.1 200 OK
Server: nginx/0.6.31
Date: Fri, 13 Feb 2009 20:36:19 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Set-Cookie: _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f; path=/; expires=Wed, 01 Jan ... |
github | technicalpickles/gemstalker | https://github.com/technicalpickles/gemstalker | lib/gem_stalker.rb | Ruby | mit | 19 | master | 2,748 | require 'net/http'
require 'rubygems/spec_fetcher'
require 'git'
# Small class for determining if a gem has been built on GitHub and if it's installable.
class GemStalker
attr_accessor :username, :name, :repository, :version
# Accepts the following options:
#
# username:: GitHub username
# repository:: re... |
github | metacollin/homebrew-kicad | https://github.com/metacollin/homebrew-kicad | kicad.rb | Ruby | mit | 19 | master | 8,993 | class Kicad < Formula
desc "Electronic Design Automation Suite"
homepage "http://www.kicad-pcb.org"
url "https://launchpad.net/kicad/4.0/4.0.7/+download/kicad-4.0.7.tar.xz"
sha256 "09074c77c6097d0f2ae49711c6d6f6c4490f0c068bba69b17f5f07319255fdc1"
head "https://git.launchpad.net/kicad", :using => :git
# opti... |
github | metacollin/homebrew-kicad | https://github.com/metacollin/homebrew-kicad | kicad-wxwidgets.rb | Ruby | mit | 19 | master | 1,882 | class KicadWxwidgets < Formula
desc "Custom patched version of wxwidgets, only for use by KiCad."
homepage "https://kicad-pcb.org"
url "https://github.com/KiCad/wxWidgets/archive/kicad/macos-wx-3.0.zip"
sha256 "71dfa7128c871a50d44432117e75144cf0218819a7efb1ecf7f24ee8b8f3bd5f"
head "https://github.com/KiCad/wx... |
github | metacollin/homebrew-kicad | https://github.com/metacollin/homebrew-kicad | kicad-wxpython.rb | Ruby | mit | 19 | master | 1,718 | class KicadWxpython < Formula
desc "Custom patched version of wxPython, only for use by KiCad."
homepage "https://kicad-pcb.org"
url "https://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2"
sha256 "d54129e5fbea4fb8091c87b2980760b72c22a386cb3b9dd2eebc928ef5e8df61"
bot... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | thundersvm.gemspec | Ruby | apache-2.0 | 19 | master | 573 | require_relative "lib/thundersvm/version"
Gem::Specification.new do |spec|
spec.name = "thundersvm"
spec.version = ThunderSVM::VERSION
spec.summary = "High performance parallel SVMs for Ruby"
spec.homepage = "https://github.com/ankane/thundersvm-ruby"
spec.license = "Apache-2.... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | Rakefile | Ruby | apache-2.0 | 19 | master | 836 | require "bundler/gem_tasks"
require "rake/testtask"
require "ruby_memcheck"
test_config = lambda do |t|
t.pattern = "test/**/*_test.rb"
end
Rake::TestTask.new(&test_config)
namespace :test do
RubyMemcheck::TestTask.new(:valgrind, &test_config)
end
task default: :test
def download_file(file)
require "open-uri"... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | lib/thundersvm.rb | Ruby | apache-2.0 | 19 | master | 897 | # stdlib
require "fiddle/import"
require "fileutils"
require "tempfile"
# modules
require_relative "thundersvm/model"
require_relative "thundersvm/classifier"
require_relative "thundersvm/regressor"
require_relative "thundersvm/version"
module ThunderSVM
class Error < StandardError; end
class << self
attr_ac... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | lib/thundersvm/model.rb | Ruby | apache-2.0 | 19 | master | 5,122 | module ThunderSVM
class Model
def initialize(
svm_type: :c_svc,
kernel: :rbf,
degree: 3,
gamma: nil,
coef0: 0,
c: 1,
nu: 0.5,
epsilon: 0.1,
max_memory: 8192,
tolerance: 0.001,
probability: false,
gpu: 0,
cores: nil,
verbose: nil
... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | lib/thundersvm/ffi.rb | Ruby | apache-2.0 | 19 | master | 806 | module ThunderSVM
module FFI
extend Fiddle::Importer
libs = Array(ThunderSVM.ffi_lib).dup
begin
dlload Fiddle.dlopen(libs.shift)
rescue Fiddle::DLError => e
retry if libs.any?
if e.message.include?("Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib") && e.message.include?(... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | test/test_helper.rb | Ruby | apache-2.0 | 19 | master | 521 | require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
class Minitest::Test
def setup
# autoload before GC.stress
ThunderSVM::FFI if stress?
GC.stress = true if stress?
end
def teardown
GC.stress = false if stress?
end
def stress?
ENV["STRESS"]
end
def assert... |
github | ankane/thundersvm-ruby | https://github.com/ankane/thundersvm-ruby | test/thundersvm_test.rb | Ruby | apache-2.0 | 19 | master | 2,186 | require_relative "test_helper"
class ThunderSVMTest < Minitest::Test
def test_classifier
x = [[1, 2], [3, 4], [5, 6], [7, 8]]
y = [1, 1, 2, 2]
model = ThunderSVM::Classifier.new
model.fit(x, y)
predictions = model.predict(x)
expected = [1, 1, 2, 2]
assert_equal expected, predictions
... |
github | pusewicz/ultimate-minitest-rails | https://github.com/pusewicz/ultimate-minitest-rails | ultimate-minitest-rails.gemspec | Ruby | mit | 19 | master | 811 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "ultimate-minitest-rails/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "ultimate-minitest-rails"
s.version = UltimateMinitestRails::VERSION
s.authors = ["Piotr U... |
github | pusewicz/ultimate-minitest-rails | https://github.com/pusewicz/ultimate-minitest-rails | Rakefile | Ruby | mit | 19 | master | 278 | # 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 'bundler/gem_tasks'
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks |
github | pusewicz/ultimate-minitest-rails | https://github.com/pusewicz/ultimate-minitest-rails | config/application.rb | Ruby | mit | 19 | master | 1,128 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module UltimateMinitestRails
class Application < Rails::Application
# Settings in config/environment... |
github | pusewicz/ultimate-minitest-rails | https://github.com/pusewicz/ultimate-minitest-rails | test/test_helper.rb | Ruby | mit | 19 | master | 347 | require 'ultimate-minitest-rails/support/mocha' # Mocha is a mocking and stubbing library for Ruby
require 'ultimate-minitest-rails/support/minitest_reporters' # Create customizable MiniTest output formats
require 'ultimate-minitest-rails/support/database_rewinder' # Minimalist's tiny and u... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | ruby_git_hooks.gemspec | Ruby | mit | 19 | master | 1,482 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ruby_git_hooks/version'
Gem::Specification.new do |spec|
spec.name = "ruby_git_hooks"
spec.version = RubyGitHooks::VERSION
spec.authors = ["Noah Gibbs", "Ruth Helfinste... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/jira_add_comment_test.rb | Ruby | mit | 19 | master | 10,110 | # encoding: UTF-8
# Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "ruby_git_hooks/jira_add_comment"
require "minitest/autorun"
require "rest-client"
class JiraCommentAddHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/jira_ref_check_test.rb | Ruby | mit | 19 | master | 927 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "ruby_git_hooks/jira_ref_check"
require "minitest/autorun"
class JiraReferenceCheckHookTest < HookTestCase
def setup
@hook = JiraReferenceCheckHook.new
end
def test_no_reference_to_jira
mock(@hook).commit_message... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/basic_hook_test.rb | Ruby | mit | 19 | master | 10,104 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
class BasicHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
TEST_PATH = File.join(REPOS_DIR, "hook_test_file")
TEST_HOOK_BODY = <<HOOK
#{RubyGitHooks.... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/max_file_size_hook_test.rb | Ruby | mit | 19 | master | 1,335 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
class MaxFileSizeHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
MAX_SIZE = 100000
TEST_HOOK_BODY = <<TEST
#{RubyGitHooks.shebang}
require "ruby_git_... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/multi_hook_test.rb | Ruby | mit | 19 | master | 2,163 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
class CopyrightCheckHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
CURRENT_YEAR = Time.now.strftime("%Y")
TEST_HOOK_MULTI_REG = <<TEST
#{RubyGitHook... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/non_ascii_hook_test.rb | Ruby | mit | 19 | master | 1,298 | # -*- coding: utf-8 -*-
# Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
class NonAsciiHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
FAKE_CURL = File.expand_path File.join(File.dirname(__FILE__), "fake_c... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/copyright_check_test.rb | Ruby | mit | 19 | master | 5,109 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
require "pony"
class RealCopyrightCheckHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
FAKE_MAILER = File.join(File.dirname(__FILE__), "fake_mailer")
... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/watermark_test.rb | Ruby | mit | 19 | master | 971 | # coding: utf-8
require "test_helper"
require "minitest/autorun"
class AddWatermarkHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
FAKE_CURL = File.expand_path File.join(File.dirname(__FILE__), "fake_curl")
TEST_HOOK_BODY = <<TEST
#{RubyGitHooks.shebang}
require "... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/test_helper.rb | Ruby | mit | 19 | master | 388 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
# Test local copy first
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
require "minitest/pride"
require "rr"
require "ruby_git_hooks"
require "ruby_git_hooks/git_ops"
class HookTestCase < MiniTest::Test
Hook = RubyGitHooks::Hook
... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | test/case_clash_hook_test.rb | Ruby | mit | 19 | master | 1,468 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "test_helper"
require "minitest/autorun"
class CaseClashHookTest < HookTestCase
REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
TEST_HOOK_BODY = <<TEST
#{RubyGitHooks.shebang}
require "ruby_git_hooks/case_clash"
RubyGitH... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks.rb | Ruby | mit | 19 | master | 13,622 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks/version"
# This module is the core of the ruby_git_hooks code. It includes the
# Git commands, the hook types and in general most of the interface.
# README.md is the best overall documentation for this package, but
# this is wh... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/git_ops.rb | Ruby | mit | 19 | master | 4,445 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
# This is a set of Git operations, run via shell. It permits much
# cleaner unit tests. Initially it was written in this way because it
# was very small and simple. Now it should be converted to Grit or a
# similar tool or library.
module RubyGitHook... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/max_file_size.rb | Ruby | mit | 19 | master | 893 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook checks the size of each individual file against a
# configurable maximum size. Once a huge file is in your git history
# it can't be fully removed without rewriting history, so you're
# usually better off preventing them... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/non_ascii.rb | Ruby | mit | 19 | master | 882 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook checks that commit message contains only ASCII characters.
class NonAsciiCharactersCheckHook < RubyGitHooks::Hook
Hook = RubyGitHooks::Hook
def initialize(options = {})
end
def check
if !commit_message || c... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/case_clash.rb | Ruby | mit | 19 | master | 846 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook checks whether a similar file exists with the same name
# except for uppercase/lowercase. It's useful when Mac OS and Unix
# people need to coexist in a single Git repository. You can be sure
# that the Linux people can... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/jira_add_comment.rb | Ruby | mit | 19 | master | 13,193 | # Copyright (C) 2013-2014 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
require "ruby_git_hooks/jira_ref_check"
require "rest-client"
require "json"
# This hook adds Jira "commit" comments for your commits. It is
# called as a post-receive hook with a list of commits - ideally the
# ruby_git_hooks... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/email_notify.rb | Ruby | mit | 19 | master | 1,476 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook sends out email notification of commits to a configurable
# list of recipients via the Pony gem, which uses the Ruby Mail gem.
class EmailNotifyHook < RubyGitHooks::Hook
LEGAL_OPTIONS = [ "no_send", "via", "via_options... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/ruby_debug.rb | Ruby | mit | 19 | master | 609 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook looks for source files that include ruby-debug and fails
# if any do. It exists primarily for testing. It's functional, but
# not necessarily useful.
class RubyDebugHook < RubyGitHooks::Hook
def check
bad_files =... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/jira_ref_check.rb | Ruby | mit | 19 | master | 823 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook checks that the commit message has one or more correctly-formatted
# Jira ticket references.
class JiraReferenceCheckHook < RubyGitHooks::Hook
Hook = RubyGitHooks::Hook
JIRA_TICKET_REGEXP = /(?<=\W|^)[A-Z]{2,10}-\d{... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/all.rb | Ruby | mit | 19 | master | 243 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
require "ruby_git_hooks/case_clash"
require "ruby_git_hooks/max_file_size"
require "ruby_git_hooks/copyright_check"
require "ruby_git_hooks/ruby_debug_hook" |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/copyright_check.rb | Ruby | mit | 19 | master | 5,676 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook checks whether a proper copyright notice exists at the top
# of each of your files. Right now it hardcodes most of the Copyright
# notice format, though you can customize the company name. If you'd
# prefer a more flexi... |
github | onlive/ruby_git_hooks | https://github.com/onlive/ruby_git_hooks | lib/ruby_git_hooks/watermark.rb | Ruby | mit | 19 | master | 757 | # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
require "ruby_git_hooks"
# This hook adds a watermark to the end of commit message so that we
# know the hooks have been run. It should be run as the last
# commit-msg hook so it changes the message immediately before the
# commit is accepted and other hook... |
github | esurharun/kyle | https://github.com/esurharun/kyle | kyle.gemspec | Ruby | mit | 19 | master | 687 | Gem::Specification.new do |gem|
gem.name = 'kyle'
gem.version = '0.0.5'
gem.date = '2014-09-17'
gem.summary = 'Kyle'
gem.description = 'A password manager for paranoids.'
gem.authors = ['Harun Esur', 'Isaac Seymour']
gem.email = 'harun.esur@sceptive.com'
gem.homepage ... |
github | esurharun/kyle | https://github.com/esurharun/kyle | spec/kyle_commands_spec.rb | Ruby | mit | 19 | master | 757 | require 'spec_helper'
describe KyleCommands do
subject(:cmds) { described_class.new(args) }
context 'in batch mode' do
let(:args) { %w(-b filename.txt whale) }
it 'is in batch mode' do
expect(cmds.batch?).to eq(true)
end
it 'runs #batch_generate' do
expect(cmds).to receive(:batch_gen... |
github | esurharun/kyle | https://github.com/esurharun/kyle | spec/kyle_spec.rb | Ruby | mit | 19 | master | 2,280 | require 'spec_helper'
describe Kyle do
let!(:passwords) { Kyle.new(hostname, account, port, key).passwords }
context "Bill Gates' passwords" do
let(:hostname) { 'microsoft.com' }
let(:account) { 'bill.gates' }
let(:port) { '666' }
let(:key) { 'iKnowWhatYouDidToIBMLastSummer' }
it 'has the cor... |
github | esurharun/kyle | https://github.com/esurharun/kyle | lib/constants.rb | Ruby | mit | 19 | master | 677 | # Algorithms, password characters, animals
module Constants
ENC_ALGS = %w(des3 desx des cast bf aes128 aes192 aes256 rc4).freeze
HASH_ALGS = %w(sha512 sha384 sha256 sha224 sha1 sha md5 md4 ripemd160).freeze
LETTERS = %w(q w e r t y u i o p a s d f g h j k l z x c v b n m).freeze
BIG_LETTERS = %w(Q W E R T Y U ... |
github | esurharun/kyle | https://github.com/esurharun/kyle | lib/kyle_commands.rb | Ruby | mit | 19 | master | 2,906 | require 'kyle'
# Command line access to Kyle
class KyleCommands
attr_accessor :args
def initialize(args = [])
@args = args
end
def run
puts 'Kyle - A password manager for paranoids. ( 0.0.5 )'
puts ''
batch_generate if batch?
single_generate_choose if single_by_choose?
single_generat... |
github | esurharun/kyle | https://github.com/esurharun/kyle | lib/kyle.rb | Ruby | mit | 19 | master | 2,291 | #!/usr/bin/ruby
require 'openssl'
require 'highline/import'
require 'constants'
# Password generation from 4 inputs
class Kyle
attr_accessor :hostname, :account, :port, :key
def initialize(hostname, account, port, key)
@hostname = hostname
@account = account
@port = port
@key = key
end
def pa... |
github | patrixr/jsonapi-serializer-formats | https://github.com/patrixr/jsonapi-serializer-formats | jsonapi-serializer-formats.gemspec | Ruby | mit | 19 | main | 837 | Gem::Specification.new do |s|
s.name = 'jsonapi-serializer-formats'
s.version = '0.0.6'
s.summary = "Adds 'formats' to JSON::API Serializers"
s.description = <<-EOF
A module to enrich JSON:API Serializers (https://github.com/jsonapi-serializer) with configurable formats
EOF
s.authors ... |
github | patrixr/jsonapi-serializer-formats | https://github.com/patrixr/jsonapi-serializer-formats | spec/spec_helper.rb | Ruby | mit | 19 | main | 227 | require 'ffaker'
require 'rspec'
require 'byebug'
require 'jsonapi/serializer'
require 'jsonapi-serializer-formats'
Dir[
File.expand_path('spec/fixtures/*.rb')
].sort.each { |f| require f }
RSpec.configure do |config|
end |
github | patrixr/jsonapi-serializer-formats | https://github.com/patrixr/jsonapi-serializer-formats | spec/formats_spec.rb | Ruby | mit | 19 | main | 4,214 | require 'spec_helper'
RSpec.describe JSONAPI::Formats do
let(:movie) { Movie.fake }
let(:serializer) { serializer_klass.new(movie, { params: { format: selected_formats }}) }
let(:json) { serializer.serializable_hash }
let(:data) { json[:data] }
context 'Rendering custom formats' do
let(:serializer_klass... |
github | patrixr/jsonapi-serializer-formats | https://github.com/patrixr/jsonapi-serializer-formats | lib/jsonapi-serializer-formats.rb | Ruby | mit | 19 | main | 2,339 | module JSONAPI
module Formats
extend ActiveSupport::Concern
included do
class << self
def scoped_formats
@scoped_formats ||= []
end
def formats_per_attr
@formats_per_attr ||= {}
end
# --- Override the attribute and relationship methods t... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | Rakefile | Ruby | mit | 19 | master | 2,769 | require 'rake'
require 'rake/testtask'
require 'rubygems'
require 'diff/lcs'
require 'yaml'
task :default => [:test]
desc "Run tests"
task :test do |test|
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['git_commit_notifier/test/*.rb']
t.verbose = true
end
end
desc "Install Git Com... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/test/commit_hook_test.rb | Ruby | mit | 19 | master | 870 | require 'rubygems'
require 'mocha'
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/commit_hook'
require File.dirname(__FILE__) + '/../lib/git'
class CommitHookTest < Test::Unit::TestCase
def test_hook
path = File.dirname(__FILE__) + '/fixtures/'
Git.expects(:log).with(REVISIONS.first, REVISIO... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/test/result_processor_test.rb | Ruby | mit | 19 | master | 3,110 | require 'test/unit'
require 'jcode'
require File.dirname(__FILE__) + '/../lib/result_processor'
require File.dirname(__FILE__) + '/../lib/diff_to_html'
class ResultProcessorTest < Test::Unit::TestCase
# button_to_remote 'create_btn'
# submit_to_remote 'create_btn'
def setup
create_test_input
end
def te... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/test/test_helper.rb | Ruby | mit | 19 | master | 494 | require 'test/unit'
unless defined? REVISIONS
REVISIONS = ['e28ad77bba0574241e6eb64dfd0c1291b221effe', # 2 files updated
'a4629e707d80a5769f7a71ca6ed9471015e14dc9', # 1 file updated
'dce6ade4cdc2833b53bd600ef10f9bce83c7102d', # 6 files updated
'51b986619d88f7ba98be7d271188785cb... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/test/diff_to_html_test.rb | Ruby | mit | 19 | master | 4,145 | require 'rubygems'
require 'mocha'
require 'cgi'
require 'test/unit'
require 'hpricot'
require File.dirname(__FILE__) + '/test_helper'
require File.dirname(__FILE__) + '/../lib/diff_to_html'
require File.dirname(__FILE__) + '/../lib/git'
class DiffToHtmlTest < Test::Unit::TestCase
def test_multiple_commits
pat... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/lib/diff_to_html.rb | Ruby | mit | 19 | master | 8,849 | require 'rubygems'
require 'diff/lcs'
require File.dirname(__FILE__) + '/result_processor'
def escape_content(s)
CGI.escapeHTML(s).gsub(" ", " ")
end
class DiffToHtml
attr_accessor :file_prefix
attr_reader :result
def range_info(range)
range.match(/^@@ \-(\d+),\d+ \+(\d+),\d+ @@/)
left_ln = Inte... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/lib/commit_hook.rb | Ruby | mit | 19 | master | 1,640 | require 'rubygems'
require 'cgi'
require 'net/smtp'
require 'sha1'
require File.dirname(__FILE__) + '/diff_to_html'
require File.dirname(__FILE__) + '/emailer'
require File.dirname(__FILE__) + '/git'
class CommitHook
def self.run(rev1, rev2, ref_name, config_file = nil)
config = YAML.load_file(config_file || '... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/lib/emailer.rb | Ruby | mit | 19 | master | 2,860 | require 'yaml'
class Emailer
def initialize(config, project_path, recipient, from_address, from_alias, subject, text_message, html_message, old_rev, new_rev, ref_name)
@config = config
@project_path = project_path
@recipient = recipient
@from_address = from_address
@from_alias = from_alias
@... |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/lib/git.rb | Ruby | mit | 19 | master | 289 | class Git
def self.show(rev)
`git show #{rev.strip} -w`
end
def self.log(rev1, rev2)
`git log #{rev1}..#{rev2}`.strip
end
def self.prefix
`git config hooks.emailprefix`.strip
end
def self.mailing_list_address
`git config hooks.mailinglist`.strip
end
end |
github | ilozka/git-commit-notifier | https://github.com/ilozka/git-commit-notifier | git_commit_notifier/lib/result_processor.rb | Ruby | mit | 19 | master | 3,208 | require 'cgi'
class ResultProcessor
# input (loaded in @diff) is an array having Hash elements:
# { :action => action, :token => string }
# action can be :discard_a, :discard_b or :match
# output: two formatted html strings, one for the removals and one for the additions
def results
close_tags # close ... |
github | andrewhavens/moticons | https://github.com/andrewhavens/moticons | moticons.gemspec | Ruby | mit | 19 | master | 1,006 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "moticons"
spec.version = "1.1.0"
spec.authors = ["Andrew Havens"]
spec.email = ["email@andrewhavens.com"]
spec.summary... |
github | andrewhavens/moticons | https://github.com/andrewhavens/moticons | Rakefile | Ruby | mit | 19 | master | 601 | $:.unshift("/Library/RubyMotion/lib")
$:.unshift("~/.rubymotion/rubymotion-templates")
# case ENV.fetch('platform', 'ios') # allow setting from the command line, default to iOS
# when 'ios' then require 'motion/project/template/ios'
# when 'osx' then require 'motion/project/template/osx'
# when 'android' then require ... |
github | andrewhavens/moticons | https://github.com/andrewhavens/moticons | lib/moticons.rb | Ruby | mit | 19 | master | 323 | unless defined?(Motion::Project::Config)
raise "This gem is intended to be used in a RubyMotion project."
end
require "motion-cocoapods"
Motion::Project::App.setup do |app|
app.files += Dir.glob(File.join(File.dirname(__FILE__), "moticons", "**", "*.rb"))
app.pods do
pod "FontAwesomeKit", "~> 2.2.1"
end
e... |
github | andrewhavens/moticons | https://github.com/andrewhavens/moticons | lib/moticons/icon.rb | Ruby | mit | 19 | master | 1,779 | module Moticons
class Icon
COLLECTION_CLASSES = {
awesome: :FAKFontAwesome,
foundation: :FAKFoundationIcons,
ion: :FAKIonIcons,
zocial: :FAKZocial,
octicon: :FAKOcticons,
material: :FAKMaterialIcons
}
attr_reader :collection, :name, :size, :color
... |
github | andrewhavens/moticons | https://github.com/andrewhavens/moticons | spec/icon_spec.rb | Ruby | mit | 19 | master | 2,206 | describe Moticons::Icon do
before do
@icon = Moticons::Icon.new(:ion, :star)
end
describe '.new' do
it 'creates an instance with the correct attributes' do
@icon.should.be.an.instance_of(Moticons::Icon)
@icon.collection.should == :ion
@icon.name.should == :star
# defaults
@... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | Rakefile | Ruby | mit | 19 | master | 1,334 | # encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | view_inspect.gemspec | Ruby | mit | 19 | master | 709 | require File.expand_path('../lib/view_inspect/version', __FILE__)
Gem::Specification.new do |s|
s.name = "view_inspect"
s.version = ViewInspect::VERSION
s.required_rubygems_version = ">= 1.9.3"
s.authors = ["Reginald Tan"]
s.email = "redge.tan@gmail.com"
s.summary = "Shows you the source location of a se... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | test/test_view_inspect.rb | Ruby | mit | 19 | master | 227 | require 'helper'
class TestViewInspect < Test::Unit::TestCase
should "probably rename this file and start testing for real" do
flunk "hey buddy, you should probably rename this file and start testing for real"
end
end |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | test/helper.rb | Ruby | mit | 19 | master | 676 | require 'simplecov'
module SimpleCov::Configuration
def clean_filters
@filters = []
end
end
SimpleCov.configure do
clean_filters
load_adapter 'test_frameworks'
end
ENV["COVERAGE"] && SimpleCov.start do
add_filter "/.rvm/"
end
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :develop... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect.rb | Ruby | mit | 19 | master | 575 | require 'view_inspect/server_side_template'
require 'view_inspect/client_side_template'
module ViewInspect
def self.init
return unless allow_view_source_location?
ServerSideTemplate.handle
ClientSideTemplate.handle
end
def self.allow_view_source_location?
!@disable && ::Rails.env.development?
... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/server_side_template.rb | Ruby | mit | 19 | master | 1,060 | require 'view_inspect/handlers/erb'
require 'view_inspect/handlers/haml'
require 'view_inspect/handlers/slim'
module ViewInspect
module ServerSideTemplate
def self.handle
Handlers::Haml.augment_source
Handlers::Slim.augment_source
::ActionView::Template.class_eval do
alias_method :ori... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/client_side_template.rb | Ruby | mit | 19 | master | 1,439 | require 'view_inspect/handlers/handlebars'
require 'view_inspect/handlers/ejs'
require 'view_inspect/handlers/eco'
require 'view_inspect/handlers/jst'
# Were monkey patching subclasses of Tilt::Template to add file:line information to the original source
module ViewInspect
module ClientSideTemplate
def self.han... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/handlers/haml.rb | Ruby | mit | 19 | master | 607 | module ViewInspect
module Handlers
module Haml
def self.augment_source
return unless haml_installed?
::Haml::Compiler.class_eval do
alias_method :orig_compile, :compile
def compile(node)
if node.type == :tag
file_line = [@options[:filename], n... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/handlers/handlebars.rb | Ruby | mit | 19 | master | 205 | require 'view_inspect/handlers/html_template'
module ViewInspect
module Handlers
class Handlebars < HTMLTemplate
def self.expression_regex
/\{\{+.*?\}\}+/m
end
end
end
end |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/handlers/erb.rb | Ruby | mit | 19 | master | 311 | require 'view_inspect/handlers/html_template'
module ViewInspect
module Handlers
class ERB < HTMLTemplate
def self.expression_regex
/(<%(=+|-|\#|%)?(.*?)([-=])?%>([ \t]*)?)/m # from erubis 2.7.0 #DEFAULT_REGEX = /(<%(=+|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?)/m
end
end
end
end |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/handlers/slim.rb | Ruby | mit | 19 | master | 655 | module ViewInspect
module Handlers
module Slim
def self.augment_source
return unless slim_installed?
::Slim::Parser.class_eval do
alias_method :orig_parse_attributes, :parse_attributes
def parse_attributes(attributes)
orig_parse_attributes(attributes)
... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/handlers/html_template.rb | Ruby | mit | 19 | master | 2,744 | require 'nokogiri'
module ViewInspect
module Handlers
class HTMLTemplate
STUB_PREFIX = "__template_expression_stub__"
def initialize
@expression_stub_map = {}
end
def self.expression_regex
raise "must be implemented by subclass"
end
def add_file_line_to_htm... |
github | redgetan/view_inspect | https://github.com/redgetan/view_inspect | lib/view_inspect/rails/railtie.rb | Ruby | mit | 19 | master | 206 | module ViewInspect
module Rails
class Railtie < ::Rails::Railtie
initializer "view_inspect_railtie.configure_rails_initialization" do |app|
ViewInspect.init
end
end
end
end |
github | monkrb/glue | https://github.com/monkrb/glue | monk-glue.gemspec | Ruby | mit | 19 | master | 957 | Gem::Specification.new do |s|
s.name = "monk-glue"
s.version = "0.0.1"
s.summary = "Monk, the glue framework"
s.description = "Monk is a glue framework for web development. It means that instead of installing all the tools you need for your projects, you can rely on a git ... |
github | monkrb/glue | https://github.com/monkrb/glue | lib/monk/glue.rb | Ruby | mit | 19 | master | 1,083 | # This file contains the bootstraping code for a Monk application.
RACK_ENV = ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV
ROOT_DIR = $0 unless defined? ROOT_DIR
# Helper method for file references.
#
# @param args [Array] Path components relative to ROOT_DIR.
# @example Referencing a file in config call... |
github | monkrb/glue | https://github.com/monkrb/glue | lib/monk/glue/logger.rb | Ruby | mit | 19 | master | 274 | require 'logger'
def logger
$logger ||= begin
$logger = ::Logger.new(root_path("log", "#{RACK_ENV}.log"))
$logger.level = ::Logger.const_get((monk_settings(:log_level) || :warn).to_s.upcase)
$logger.datetime_format = "%Y-%m-%d %H:%M:%S"
$logger
end
end |
github | monkrb/glue | https://github.com/monkrb/glue | lib/monk/glue/reloader.rb | Ruby | mit | 19 | master | 816 | class Monk::Glue::Reloader
def initialize(app, app_class = Main)
@app = app
@app_class = app_class
@last = last_mtime
end
def call(env)
current = last_mtime
if current > @last
if Thread.list.size > 1
Thread.exclusive { reload! }
else
reload!
end
@last... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.