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 | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol_spec.rb | Ruby | mit | 48 | main | 26,396 | module AMQ
RSpec.describe Protocol do
it "should have PROTOCOL_VERSION constant" do
expect(Protocol::PROTOCOL_VERSION).to match(/^\d+\.\d+\.\d$/)
end
it "should have DEFAULT_PORT constant" do
expect(Protocol::DEFAULT_PORT).to be_kind_of(Integer)
end
it "should have PREAMBLE constant"... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/endianness_spec.rb | Ruby | mit | 48 | main | 545 | # encoding: binary
require "amq/endianness"
RSpec.describe AMQ::Endianness do
describe ".big_endian?" do
it "returns a boolean" do
expect([true, false]).to include(described_class.big_endian?)
end
end
describe ".little_endian?" do
it "returns the opposite of big_endian?" do
expect(descr... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/int_allocator_spec.rb | Ruby | mit | 48 | main | 3,202 | require "amq/int_allocator"
RSpec.describe AMQ::IntAllocator do
#
# Environment
#
subject do
described_class.new(1, 5)
end
#
# Examples
#
describe "#initialize" do
it "raises ArgumentError when hi <= lo" do
expect { described_class.new(5, 5) }.to raise_error(ArgumentError)
ex... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/bit_set_spec.rb | Ruby | mit | 48 | main | 6,245 | require "amq/bit_set"
# extracted from amqp gem. MK.
RSpec.describe AMQ::BitSet do
#
# Environment
#
let(:nbits) { (1 << 16) - 1 }
#
# Examples
#
describe "#new" do
it "has no bits set at the start" do
bs = AMQ::BitSet.new(128)
0.upto(127) do |i|
expect(bs[i]).to be_falsey
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/uri_parsing_spec.rb | Ruby | mit | 48 | main | 8,431 | require "amq/uri"
# https://www.rabbitmq.com/uri-spec.html
# http://www.ietf.org/rfc/rfc3986.txt
# https://tools.ietf.org/rfc/rfc5246.txt
RSpec.describe AMQ::URI do
describe ".parse" do
subject { described_class.parse(uri) }
context "schema is not amqp or amqps" do
let(:uri) { "http://rabbitmq" }
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/blank_body_encoding_spec.rb | Ruby | mit | 48 | main | 342 | RSpec.describe AMQ::Protocol::Method, ".encode_body" do
it "encodes 1-byte long payload as exactly 1 body frame" do
expect(described_class.encode_body('1', 1, 65536).size).to eq(1)
end
it "encodes 0-byte long (blank) payload as exactly 0 body frame" do
expect(described_class.encode_body('', 1, 65536).siz... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/table_spec.rb | Ruby | mit | 48 | main | 11,755 | require 'time'
module AMQ
module Protocol
RSpec.describe Table do
timestamp = Time.utc(2010, 12, 31, 23, 58, 59)
bigdecimal_1 = BigDecimal("1.0")
bigdecimal_2 = BigDecimal("5E-3")
DATA = {
{} => "\x00\x00\x00\x00",
{"test" => 1} => ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/confirm_spec.rb | Ruby | mit | 48 | main | 1,018 | # encoding: binary
module AMQ
module Protocol
class Confirm
RSpec.describe Select do
describe '.decode' do
subject do
Select.decode("\x01")
end
its(:nowait) { should be_truthy }
end
describe '.encode' do
it 'encodes the parameter... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/method_spec.rb | Ruby | mit | 48 | main | 2,184 | module AMQ
module Protocol
RSpec.describe Method do
describe '.split_headers' do
it 'splits user defined headers into properties and headers' do
input = {:delivery_mode => 2, :content_type => 'application/octet-stream', :foo => 'bar'}
properties, headers = Method.split_headers(in... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/float_32bit_spec.rb | Ruby | mit | 48 | main | 579 | # encoding: binary
RSpec.describe AMQ::Protocol::Float32Bit do
describe "#initialize" do
it "stores the value" do
f = described_class.new(3.14)
expect(f.value).to eq(3.14)
end
end
describe "#value" do
it "returns the stored value" do
f = described_class.new(2.718)
expect(f.va... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/exchange_spec.rb | Ruby | mit | 48 | main | 3,567 | # encoding: binary
module AMQ
module Protocol
class Exchange
RSpec.describe Declare do
describe '.encode' do
it 'encodes the parameters into a MethodFrame' do
channel = 1
exchange = 'amqclient.adapters.em.exchange1'
type = 'fanout'
passive =... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/exceptions_spec.rb | Ruby | mit | 48 | main | 2,103 | # encoding: binary
RSpec.describe AMQ::Protocol::Error do
describe ".[]" do
it "looks up exception class by error code" do
# This only works if subclasses define VALUE constant
# Default case: no subclass with VALUE defined returns nil
expect { described_class[999999] }.to raise_error(/No such ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/basic_spec.rb | Ruby | mit | 48 | main | 11,342 | # encoding: binary
module AMQ
module Protocol
RSpec.describe AMQ::Protocol::Basic do
describe '.encode_timestamp' do
it 'encodes the timestamp as a 64 byte big endian integer' do
expect(Basic.encode_timestamp(12345).last).to eq("\x00\x00\x00\x00\x00\x0009")
end
end
# ... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/value_decoder_spec.rb | Ruby | mit | 48 | main | 8,137 | require 'time'
require "amq/protocol/table_value_decoder"
module AMQ
module Protocol
RSpec.describe TableValueDecoder do
it "is capable of decoding basic arrays TableValueEncoder encodes" do
input1 = [1, 2, 3]
value, _offset = described_class.decode_array(TableValueEncoder.encode(input1),... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/connection_spec.rb | Ruby | mit | 48 | main | 5,462 | # encoding: binary
module AMQ
module Protocol
class Connection
RSpec.describe Start do
describe '.decode' do
subject do
Start.decode("\x00\t\x00\x00\x00\xFB\tcopyrightS\x00\x00\x00gCopyright (C) 2007-2010 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologi... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/constants_spec.rb | Ruby | mit | 48 | main | 279 | RSpec.describe "(Some) AMQ::Protocol constants" do
it "include regular port" do
expect(AMQ::Protocol::DEFAULT_PORT).to eq(5672)
end
it "provides TLS/SSL port" do
expect(AMQ::Protocol::TLS_PORT).to eq(5671)
expect(AMQ::Protocol::SSL_PORT).to eq(5671)
end
end |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/channel_close_spec.rb | Ruby | mit | 48 | main | 2,009 | # encoding: binary
module AMQ
module Protocol
class Channel
RSpec.describe Close do
describe "#delivery_ack_timeout?" do
it "returns true for delivery acknowledgement timeout" do
close = Close.new(406, "PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Tim... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/channel_spec.rb | Ruby | mit | 48 | main | 3,929 | # encoding: binary
module AMQ
module Protocol
class Channel
RSpec.describe Open do
describe '.encode' do
it 'encodes the parameters into a MethodFrame' do
channel = 1
out_of_band = ''
method_frame = Open.encode(channel, out_of_band)
expect(m... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/tx_spec.rb | Ruby | mit | 48 | main | 1,403 | # encoding: binary
module AMQ
module Protocol
class Tx
RSpec.describe Select do
describe '.encode' do
it 'encodes the parameters into a MethodFrame' do
channel = 1
method_frame = Select.encode(channel)
expect(method_frame.payload).to eq("\000Z\000\n")
... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/value_encoder_spec.rb | Ruby | mit | 48 | main | 5,632 | require 'time'
require "amq/protocol/table_value_encoder"
require "amq/protocol/float_32bit"
module AMQ
module Protocol
RSpec.describe TableValueEncoder do
it "calculates size of string field values" do
expect(described_class.field_value_size("amqp")).to eq(9)
expect(described_class.encode... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/frame_spec.rb | Ruby | mit | 48 | main | 5,915 | module AMQ
module Protocol
RSpec.describe Frame do
describe ".encode" do
it "should raise FrameTypeError if type isn't one of: [:method, :header, :body, :heartbeat]" do
expect { Frame.encode(nil, "", 0) }.to raise_error(FrameTypeError)
end
it "should raise FrameTypeError i... |
github | ruby-amqp/amq-protocol | https://github.com/ruby-amqp/amq-protocol | spec/amq/protocol/queue_spec.rb | Ruby | mit | 48 | main | 3,882 | # encoding: binary
module AMQ
module Protocol
class Queue
RSpec.describe Declare do
describe '.encode' do
it 'encodes the parameters into a MethodFrame' do
channel = 1
queue = 'hello.world'
passive = false
durable = true
exclusiv... |
github | czarneckid/hipchat-api | https://github.com/czarneckid/hipchat-api | Rakefile | Ruby | mit | 48 | master | 286 | require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
spec.rspec_opts = ['--backtrace']
# spec.ruby_opts = ['-w']
end
task :default => :spec |
github | czarneckid/hipchat-api | https://github.com/czarneckid/hipchat-api | hipchat-api.gemspec | Ruby | mit | 48 | master | 952 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require 'hipchat-api/version'
Gem::Specification.new do |s|
s.name = "hipchat-api"
s.version = HipChat::API::VERSION.dup
s.authors = ["David Czarnecki"]
s.email = ["czarneckid@acm.org"]
s.homepage = "http://github... |
github | czarneckid/hipchat-api | https://github.com/czarneckid/hipchat-api | spec/spec_helper.rb | Ruby | mit | 48 | master | 250 | require 'rspec'
require 'hipchat-api'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
end |
github | czarneckid/hipchat-api | https://github.com/czarneckid/hipchat-api | spec/hipchat-api_spec.rb | Ruby | mit | 48 | master | 8,348 | require 'spec_helper'
require 'fakeweb'
require 'mocha'
describe "HipChat::API" do
before(:each) do
FakeWeb.allow_net_connect = false
FakeWeb.clean_registry
@hipchat_api = HipChat::API.new('token')
end
after(:each) do
FakeWeb.allow_net_connect = true
end
it "should be the correct version" d... |
github | czarneckid/hipchat-api | https://github.com/czarneckid/hipchat-api | lib/hipchat-api.rb | Ruby | mit | 48 | master | 9,263 | require 'httparty'
require 'hipchat-api/version'
module HipChat
class API
include HTTParty
# Default timeout of 3 seconds
DEFAULT_TIMEOUT = 3
# Default headers for HTTP requests
DEFAULT_HEADERS = {
'User-Agent' => "HipChat gem #{VERSION}",
}
# HipChat API URL
HIPCHAT_API_URL ... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | Rakefile | Ruby | mit | 48 | master | 1,652 | require 'rubygems'
require 'rake'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'fileutils'
require 'yaml'
require 'pp'
namespace :feather do
desc "Make plugin package"
task :package do
# Grab the path specified, or use all feather-* plugins found
paths = ENV['path'].... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-sitemaps/init.rb | Ruby | mit | 48 | master | 245 | gem "builder"
require "builder"
require File.join(File.dirname(__FILE__), "controllers", "sitemaps")
Feather::Hooks::Routing.register_route do |r|
r.match("/sitemap.xml").to(:controller => "sitemaps", :action => "index", :format => "xml")
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-sitemaps/controllers/sitemaps.rb | Ruby | mit | 48 | master | 1,619 | module Feather
class Sitemaps < Application
def index
@articles = Feather::Article.all(:published => true, :order => [:published_at.desc])
xml = ::Builder::XmlMarkup.new
xml.instruct!
if params[:format] == "xml"
xml.urlset :xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9",
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/init.rb | Ruby | mit | 48 | master | 1,862 | require "net/http"
require "hpricot"
require "uri"
require File.join(File.dirname(__FILE__), "controllers", "admin", "importers")
require File.join(File.dirname(__FILE__), "controllers", "admin", "mephistos")
require File.join(File.dirname(__FILE__), "controllers", "admin", "typos")
require File.join(File.dirname(__FIL... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_section.rb | Ruby | mit | 48 | master | 272 | module Feather
class MephistoSection
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "sections"
property :id, Integer, :key => true
property :name, String
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_article.rb | Ruby | mit | 48 | master | 424 | module Feather
class MephistoArticle
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "contents"
property :id, Integer, :key => true
property :title, String
property :filter, String
property :type, String
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_tagging.rb | Ruby | mit | 48 | master | 347 | module Feather
class MephistoTagging
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "taggings"
property :id, Integer, :key => true
property :taggable_id, Integer
property :taggable_type, String
property... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_assigned_section.rb | Ruby | mit | 48 | master | 333 | module Feather
class MephistoAssignedSection
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "assigned_sections"
property :id, Integer, :key => true
property :article_id, Integer
property :section_id, Inte... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_comment.rb | Ruby | mit | 48 | master | 473 | module Feather
class MephistoComment
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "comments"
property :id, Integer, :key => true
property :article_id, Integer
property :type, String
property :body_htm... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/mephisto_tag.rb | Ruby | mit | 48 | master | 267 | module Feather
class MephistoTag
include DataMapper::Resource
def self.default_repository_name
:mephisto_database
end
storage_names[:mephisto_database] = "tags"
property :id, Integer, :key => true
property :name, String
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/models/feather/typo_comment.rb | Ruby | mit | 48 | master | 255 | module Feather
class TypoComment < TypoBase
property :article_id, Integer
property :body_html, String
property :author, String
property :published_at, DateTime
property :author_url, String
property :author_email, String
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/controllers/admin/typos.rb | Ruby | mit | 48 | master | 5,370 | module Feather
module Admin
class Typos < Base
include_plugin_views __FILE__
@article_map = {}
def show
render
end
def create
DataMapper::Database.setup(:typo_database, {
:adapter => params[:adapter],
:host => params[:host],
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/controllers/admin/mephistos.rb | Ruby | mit | 48 | master | 5,579 | module Feather
module Admin
class Mephistos < Base
include_plugin_views __FILE__
@article_map = {}
def show
render
end
def create
DataMapper.setup(:mephisto_database, {
:adapter => params[:adapter],
:host => params[:host],
:... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-importers/controllers/admin/importers.rb | Ruby | mit | 48 | master | 3,448 | module Feather
module Admin
class Importers < Base
include_plugin_views __FILE__
def show
render
end
def create
# Process the article feed if specified
@articles = process_articles(params[:articles_url]) if params[:articles_url] && params[:articles_url] != ""
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/init.rb | Ruby | mit | 48 | master | 1,177 | require "xmlrpc/client"
require File.join(File.dirname(__FILE__), "controllers", "admin", "ping_logs")
require File.join(File.dirname(__FILE__), "controllers", "admin", "ping_services")
require File.join(File.dirname(__FILE__), "models", "feather", "ping_log")
require File.join(File.dirname(__FILE__), "models", "feathe... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/install.rb | Ruby | mit | 48 | master | 864 | Feather::Database::migrate(Feather::PingService)
Feather::Database::migrate(Feather::PingLog)
Feather::PingService.create(:name => "Twingly", :url => "http://rpc.twingly.com/", :extended => false)
Feather::PingService.create(:name => "Technorati", :url => "http://rpc.technorati.com/rpc/ping", :extended => false)
Feath... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/controllers/admin/ping_services.rb | Ruby | mit | 48 | master | 1,326 | module Feather
module Admin
class PingServices < Base
include_plugin_views __FILE__
before :find_ping_service, :only => %w(edit update delete show)
def index
@ping_services = Feather::PingService.all
display @ping_services
end
def new
@ping_service = Feather... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/controllers/admin/ping_logs.rb | Ruby | mit | 48 | master | 307 | module Feather
module Admin
class PingLogs < Base
include_plugin_views __FILE__
def index
@ping_logs = Feather::PingLog.all
display @ping_logs
end
def show
@ping_log = Feather::PingLog[params[:id]]
display @ping_log
end
end
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/models/feather/ping_service.rb | Ruby | mit | 48 | master | 1,843 | module Feather
class PingService
include DataMapper::Resource
property :id, Integer, :serial => true
property :name, String, :nullable => false
property :url, String, :nullable => false, :length => 255
property :extended, Boolean
validates_present :name, :key => "uniq_ping_service_name"
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-pings/models/feather/ping_log.rb | Ruby | mit | 48 | master | 452 | module Feather
class PingLog
include DataMapper::Resource
property :id, Integer, :serial => true
property :ping_service_id, Integer
property :message, String, :nullable => false, :length => 255
property :successful, Boolean
property :created_at, DateTime
validates_present :message, :... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-search/init.rb | Ruby | mit | 48 | master | 270 | require File.join(File.dirname(__FILE__), "controllers", "search")
Feather::Hooks::Routing.register_route do |r|
r.match('/search').to(:controller => 'search', :action =>'articles').name(:search)
end
Feather::Hooks::View.register_partial_view "sidebar", "search_bar" |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-search/controllers/search.rb | Ruby | mit | 48 | master | 390 | module Feather
class Search < Application
include_plugin_views __FILE__
def articles(query)
@results = []
@empty_query = (query.nil? || query.strip.empty?)
@results = Feather::Article.all(:conditions => ["content like '%#{query}%' OR title like '%#{query}%'"], :order => [:created_at.desc]... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-redirects/init.rb | Ruby | mit | 48 | master | 863 | require File.join(File.dirname(__FILE__), "controllers", "redirector")
require File.join(File.dirname(__FILE__), "controllers", "admin", "redirects")
require File.join(File.dirname(__FILE__), "models", "feather", "redirect")
Feather::Hooks::Routing.register_route do |r|
# This deferred route allows redirects to be h... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-redirects/controllers/redirector.rb | Ruby | mit | 48 | master | 207 | module Feather
class Redirector < Application
def show(id)
@redirect = Feather::Redirect[id]
self.status = @redirect.permanent ? 301 : 302
redirect(@redirect.to_url)
end
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-redirects/controllers/admin/redirects.rb | Ruby | mit | 48 | master | 1,225 | module Feather
module Admin
class Redirects < Base
include_plugin_views __FILE__
before :find_redirect, :only => %w(edit update delete show)
def index
@redirects = Feather::Redirect.all
display @redirects
end
def new
@redirect = Feather::Redirect.new
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-redirects/models/feather/redirect.rb | Ruby | mit | 48 | master | 573 | module Feather
class Redirect
include DataMapper::Resource
property :id, Integer, :serial => true
property :from_url, String, :nullable => false, :length => 255
property :to_url, String, :nullable => false, :length => 255
property :permanent, Boolean
def validate(arg)
super
if ... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-feeds/init.rb | Ruby | mit | 48 | master | 914 | require File.join(File.dirname(__FILE__), "controllers", "feeds")
require File.join(File.dirname(__FILE__), "controllers", "admin", "feed_settings")
require File.join(File.dirname(__FILE__), "models", "feather", "feed_setting")
Feather::Hooks::Routing.register_route do |r|
r.match("/feeds/:action.:format").to(:contr... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-feeds/models/feather/feed_setting.rb | Ruby | mit | 48 | master | 578 | module Feather
class FeedSetting
include DataMapper::Resource
property :id, Integer, :serial => true
property :article_count, Integer
property :comment_count, Integer
property :external_feed_url, String, :length => 255
##
# This returns the current settings, creating them if they aren'... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-feeds/controllers/feeds.rb | Ruby | mit | 48 | master | 871 | module Feather
class Feeds < Application
include_plugin_views __FILE__
before :find_feed_setting
def articles
@articles = Feather::Article.all(:published => true, :limit => @feed_setting.article_count, :order => [:published_at.desc])
content_type params[:format].to_sym
display(@articles... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-feeds/controllers/admin/feed_settings.rb | Ruby | mit | 48 | master | 564 | module Feather
module Admin
class FeedSettings < Base
include_plugin_views __FILE__
before :find_feed_setting
def show
display @feed_setting
end
def edit
display @feed_setting
end
def update(feed_setting)
if @feed_setting.update_attributes(feed_... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-tagging/init.rb | Ruby | mit | 48 | master | 1,403 | gem "dm-tags"
require 'dm-tags'
require File.join(File.dirname(__FILE__), "controllers", "tags")
require File.join(File.dirname(__FILE__), "lib", "global_helpers")
class LazyArray
RETURN_SELF = []
end
Feather::Article.class_eval do
include DataMapper::Tags
has_tags
after :save, :update_cache
after :destr... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-tagging/controllers/tags.rb | Ruby | mit | 48 | master | 226 | module Feather
class Tags < Application
include_plugin_views __FILE__
def show(id)
@tag = Tag.first(:conditions => {:name => id})
display @tag
end
def index
display @tags
end
end
end |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-tagging/lib/global_helpers.rb | Ruby | mit | 48 | master | 627 | module Merb
module GlobalHelpers
def tag_cloud(tags, taggings, classes)
return "" if tags.nil? || tags.empty?
max, min = 0, 0
counter = {}
taggings.each do |t|
counter[t[:tag_id]].nil? ? counter[t[:tag_id]] = 1 : counter[t[:tag_id]] += 1
end
tags.each do |t|
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/Rakefile | Ruby | mit | 48 | master | 934 | require 'rubygems'
require 'rake'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'fileutils'
require 'yaml'
require 'pp'
namespace :feather do
desc "Make plugin package"
task :package do
# Load manifest
puts "Load manifest..."
pp manifest = YAML::load_file('./mani... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/init.rb | Ruby | mit | 48 | master | 748 | gem "RedCloth"
require "redcloth"
gem "BlueCloth"
require "bluecloth"
gem "rubypants"
require "rubypants"
gem 'coderay'
require 'coderay'
def sanitize_code(text)
text.scan(/(<code\:([a-z].+?)>(.+?)<\/code>)/m).each do |match|
text.gsub!(match[0],CodeRay.scan(match[2], match[1].to_sym).div(:css => :class))
end
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/specifications/BlueCloth-1.0.0.gemspec | Ruby | mit | 48 | master | 1,265 | Gem::Specification.new do |s|
s.name = %q{BlueCloth}
s.version = "1.0.0"
s.specification_version = -1 if s.respond_to? :specification_version=
s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
s.autorequire = %q{bluecloth}
s.bindir = nil
s.cert_chain = nil
s.date = %q{2004... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/specifications/rubypants-0.2.0.gemspec | Ruby | mit | 48 | master | 1,178 | Gem::Specification.new do |s|
s.name = %q{rubypants}
s.version = "0.2.0"
s.specification_version = 1 if s.respond_to? :specification_version=
s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
s.cert_chain = nil
s.date = %q{2004-11-15}
s.description = %q{RubyPants is a Ruby p... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/specifications/RedCloth-3.0.4.gemspec | Ruby | mit | 48 | master | 2,262 | Gem::Specification.new do |s|
s.name = %q{RedCloth}
s.version = "3.0.4"
s.specification_version = 1 if s.respond_to? :specification_version=
s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
s.authors = ["why the lucky stiff"]
s.autorequire = %q{redcloth}
s.cert_chain = nil
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-formatters/specifications/coderay-0.7.4.215.gemspec | Ruby | mit | 48 | master | 2,700 | Gem::Specification.new do |s|
s.name = %q{coderay}
s.version = "0.7.4.215"
s.specification_version = 1 if s.respond_to? :specification_version=
s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
s.authors = ["murphy"]
s.autorequire = %q{coderay}
s.cert_chain = nil
s.date = %... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-themes/init.rb | Ruby | mit | 48 | master | 1,608 | require File.join(File.dirname(__FILE__), "controllers", "admin", "themes")
require File.join(File.dirname(__FILE__), 'models', "feather", 'theme')
Feather::Hooks::Routing.register_route do |r|
r.match('/admin/themes/set_default').to(:controller => 'admin/themes', :action => 'set_default')
r.namespace "admin", :pa... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-themes/models/feather/theme.rb | Ruby | mit | 48 | master | 3,107 | require 'fileutils'
module Feather
class Theme
attr_accessor :name, :author, :version, :url, :about
attr_reader :path
def errors
DataMapper::Validate::ValidationErrors.new
end
def initialize(theme = nil)
if theme
@path = File.join(Merb.dir_for(:themes), theme)
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-themes/controllers/admin/themes.rb | Ruby | mit | 48 | master | 1,061 | module Feather
module Admin
class Themes < Base
include_plugin_views __FILE__
def index
@themes = Feather::Theme.all
@default_theme = Feather::PluginSetting.read('theme')
display @themes
end
def new
@theme = Feather::Theme.new
render
end
... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/init.rb | Ruby | mit | 48 | master | 1,168 | $:.unshift(File.join(File.dirname(__FILE__), "vendor", "splam", "lib"))
require 'splam'
require 'splam/rule'
require 'splam/rules'
require File.join(File.dirname(__FILE__), "controllers", "admin", "comments")
require File.join(File.dirname(__FILE__), "controllers", "admin", "comment_blacklists")
require File.join(File... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/controllers/comments.rb | Ruby | mit | 48 | master | 481 | module Feather
class Comments < Application
def create
if params[:comment][:title].blank?
@comment = Comment.new(params[:comment])
@comment.ip_address = request.remote_ip
@comment.save
@article = Article[@comment.article_id]
end
redirect @article.nil? ? request.... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/controllers/admin/comments.rb | Ruby | mit | 48 | master | 1,560 | module Feather
module Admin
class Comments < Base
include_plugin_views __FILE__
before :find_comment, :only => %w(delete show)
def index
@page_count, @comments = Feather::Comment.paginated(:page => (params[:page] || 1).to_i, :per_page => 20, :order => [:created_at.desc])
display... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/controllers/admin/comment_blacklists.rb | Ruby | mit | 48 | master | 631 | module Feather
module Admin
class CommentBlacklists < Base
include_plugin_views __FILE__
before :find_comment_blacklist, :only => %w(delete)
def index
@comment_blacklists = Feather::CommentBlacklist.all
display @comment_blacklists
end
def delete
# Make sure ... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/models/feather/comment_blacklist.rb | Ruby | mit | 48 | master | 442 | module Feather
class CommentBlacklist
include DataMapper::Resource
property :id, Integer, :serial => true
property :ip_address, String, :default => "127.0.0.1"
validates_present :ip_address
class << self
# This returns true if the specified IP address is blacklisted
def ... |
github | ejdraper/feather-plugins | https://github.com/ejdraper/feather-plugins | feather-comments/models/feather/comment.rb | Ruby | mit | 48 | master | 2,309 | module Feather
class Comment
include DataMapper::Resource
include Splam
splammable :comment do |splam|
splam.threshold = 40
splam.rules = [:bad_words, :html, :bbcode, :href]
end
is_paginated
property :id, Integer, :serial => true
property :article_id, Integer
... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | Rakefile | Ruby | mit | 48 | master | 1,820 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the acts_as_mongo_taggable_on plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documen... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | acts_as_mongo_taggable.gemspec | Ruby | mit | 48 | master | 1,543 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{acts_as_mongo_taggable}
s.version = "0.2.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | lib/acts_as_mongo_taggable.rb | Ruby | mit | 48 | master | 6,191 | module ActsAsMongoTaggable
module ClassMethods
def all_tags_with_counts
Tag.most_tagged(self).map{|tag| [tag.word, tag.count_for(self)]}
end
# returns the _first_ widget with this tag, a la ActiveRecord find()
# note: case-insensitive unless you specify otherwise with :case_sensitive=>true
... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | lib/app/models/model_tag.rb | Ruby | mit | 48 | master | 1,617 | class ModelTag
include MongoMapper::EmbeddedDocument
key :word, String, :required => true
key :tagging_count, Integer
key :user_ids, Array
def users
UserProxy.new(self)
end
belongs_to :tag
before_save :set_tagging_count
def save_or_destroy
user_ids.empty? ? d... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | lib/app/models/tag.rb | Ruby | mit | 48 | master | 3,002 | class Tag
include MongoMapper::Document
key :word, String, :required => true, :index => true
key :taggings_count, Integer, :index => true
many :taggings do
def << (tagging)
super << tagging
tagging._parent_document.send(:increment_counts, tagging)
end
def delete(ta... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | test/acts_as_mongo_taggable_test.rb | Ruby | mit | 48 | master | 7,476 | require File.dirname(__FILE__) + '/test_helper.rb'
class ActsAsMongoTaggableTest < ActiveSupport::TestCase
def create_user(name)
u = User.create({:name => name})
puts u.errors unless u.valid?
u
end
def load_multiple_taggers
@m_tagger_1 = create_user "m_tagger_1"
@m_tagger_2 = create_use... |
github | mepatterson/acts_as_mongo_taggable | https://github.com/mepatterson/acts_as_mongo_taggable | test/test_helper.rb | Ruby | mit | 48 | master | 1,409 | require 'rubygems'
require 'active_support'
require 'active_support/test_case'
require 'test/unit'
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
env_rb = File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
if File.exists? env_rb
require env_rb
else
require 'mongo_mapper'
requ... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | Gemfile | Ruby | apache-2.0 | 48 | main | 5,208 | # frozen_string_literal: true
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com'
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org'
gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN']
'https://rubygems-puppetcore.puppet.com'
else
ENV['GEM_SOURCE_PUPPETCORE'] || gems... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/spec_helper_acceptance_local.rb | Ruby | apache-2.0 | 48 | main | 3,169 | # frozen_string_literal: true
require 'puppet_litmus'
require 'puppet_litmus/util'
require 'singleton'
class Helper
include Singleton
include PuppetLitmus
end
def install_pwsh
script_folder = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/scripts/install_pwsh'))
script_path = case os[:family]
... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/spec_helper_acceptance.rb | Ruby | apache-2.0 | 48 | main | 266 | # frozen_string_literal: true
require 'puppet_litmus'
require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__),
'spec_helper_acceptance_local.rb'))
PuppetLitmus.configure! |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/acceptance/exec_powershell_spec.rb | Ruby | apache-2.0 | 48 | main | 14,574 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'powershell provider:', if: (os[:family] == 'windows') do
# Due to https://github.com/PowerShell/PowerShell/issues/1794 the HOME directory must be passed in the environment explicitly
# In this case, it just needs a HOME that has a valid dire... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/acceptance/exec_pwsh_spec.rb | Ruby | apache-2.0 | 48 | main | 17,576 | # frozen_string_literal: true
require 'spec_helper_acceptance'
def windows_platform?
os[:family] == 'windows'
end
describe 'pwsh provider:' do
def platform_string(windows, posix)
windows_platform? ? windows : posix
end
context 'when pwsh is not installed' do
before(:all) do
uninstall_pwsh if p... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/unit/provider/exec/powershell_spec.rb | Ruby | apache-2.0 | 48 | main | 8,386 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'spec_helper'
require 'puppet/util'
require 'fileutils'
describe Puppet::Type.type(:exec).provider(:powershell) do
# Override the run value so we can test the super call
# There is no real good way to do this otherwise, previously we were
# testing Puppe... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | spec/unit/provider/exec/pwsh_spec.rb | Ruby | apache-2.0 | 48 | main | 4,272 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'spec_helper'
require 'puppet/util'
require 'ruby-pwsh'
describe Puppet::Type.type(:exec).provider(:pwsh) do
# Override the run value so we can test the super call
# There is no real good way to do this otherwise, previously we were
# testing Puppet inte... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | lib/puppet/provider/exec/pwsh.rb | Ruby | apache-2.0 | 48 | main | 3,986 | # frozen_string_literal: true
require 'puppet/provider/exec'
Puppet::Type.type(:exec).provide :pwsh, parent: Puppet::Provider::Exec do
confine feature: :pwshlib
desc <<-DESC
Executes PowerShell Core commands. One of the `onlyif`, `unless`, or `creates`
parameters should be specified to ensure the command... |
github | puppetlabs/puppetlabs-powershell | https://github.com/puppetlabs/puppetlabs-powershell | lib/puppet/provider/exec/powershell.rb | Ruby | apache-2.0 | 48 | main | 4,481 | # frozen_string_literal: true
require 'puppet/provider/exec'
Puppet::Type.type(:exec).provide :powershell, parent: Puppet::Provider::Exec do
confine 'os.name': :windows
confine feature: :pwshlib
desc <<-DESC
Executes Powershell commands. One of the `onlyif`, `unless`, or `creates`
parameters should be ... |
github | fixrb/fix | https://github.com/fixrb/fix | Rakefile | Ruby | mit | 48 | main | 375 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
require "rubocop/rake_task"
require "yard"
Rake::TestTask.new do |t|
t.pattern = "test/**/*.rb"
t.verbose = true
t.warning = true
end
RuboCop::RakeTask.new
YARD::Rake::YardocTask.new
Dir["tasks/**/*.rake"].each { |t| load t }
t... |
github | fixrb/fix | https://github.com/fixrb/fix | fix.gemspec | Ruby | mit | 48 | main | 1,438 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "fix"
spec.version = File.read("VERSION.semver").chomp
spec.author = "Cyril Kato"
spec.email = "contact@cyril.email"
spec.summary = "Happy Path to Ruby Testin... |
github | fixrb/fix | https://github.com/fixrb/fix | Gemfile | Ruby | mit | 48 | main | 213 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "bundler"
gem "rake"
gem "rubocop-md"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-thread_safety"
gem "simplecov"
gem "yard" |
github | fixrb/fix | https://github.com/fixrb/fix | examples/duck/app.rb | Ruby | mit | 48 | main | 345 | # frozen_string_literal: true
# A small Duck implementation.
class Duck
attr_reader :name
def initialize(name)
@name = name
end
def say_hi
"Hi, my name is #{name}!"
end
def walks
"Klop klop!"
end
def swims
"Swoosh..."
end
def quacks
puts "Quaaaaaack!"
end
def inspect
... |
github | fixrb/fix | https://github.com/fixrb/fix | examples/duck/fix.rb | Ruby | mit | 48 | main | 792 | # frozen_string_literal: true
require_relative File.join("..", "..", "lib", "fix")
Fix :Duck do
let(:name) { "Bob" }
it SHOULD be_an_instance_of :Duck
on :say_hi do
let(:name) { "Picsou" }
it MUST eq "Hi, my name is Picsou!"
end
on :say_hi do
with name: "Picsou" do
it MUST eq "Hi, my n... |
github | fixrb/fix | https://github.com/fixrb/fix | examples/magic_number/fix.rb | Ruby | mit | 48 | main | 1,619 | # frozen_string_literal: true
require_relative File.join("..", "..", "lib", "fix")
Fix :MagicNumber do
on :-, 1 do
it MUST equal(-43)
on :-, 1 do
it MUST equal(-44)
with zero: 0 do
on :-, 3 do
it MUST equal(-47)
end
end
end
end
let(:foo) { "FOO" }
it... |
github | fixrb/fix | https://github.com/fixrb/fix | examples/empty_string/fix.rb | Ruby | mit | 48 | main | 895 | # frozen_string_literal: true
require_relative File.join("..", "..", "lib", "fix")
Fix "EmptyString" do
on :to_s do
# let(:r) { "foo" }
r = "foo"
on :+, "foo" do
it MUST eql r
end
end
on :to_s do
on :+, "foo" do
it MUST eql "foo"
end
end
on :+, "bar" do
it SHOULD e... |
github | fixrb/fix | https://github.com/fixrb/fix | lib/kernel.rb | Ruby | mit | 48 | main | 3,848 | # frozen_string_literal: true
# Extension of the global Kernel module to provide the Fix method.
# This module provides a global entry point to the Fix testing framework,
# allowing specifications to be defined and managed from anywhere in the application.
#
# The Fix method can be used in two main ways:
# 1. Creating... |
github | fixrb/fix | https://github.com/fixrb/fix | lib/fix.rb | Ruby | mit | 48 | main | 5,797 | # frozen_string_literal: true
require_relative "fix/doc"
require_relative "fix/error/missing_specification_block"
require_relative "fix/error/specification_not_found"
require_relative "fix/set"
require_relative "kernel"
# The Fix framework namespace provides core functionality for managing and running test specificat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.