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 | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/resource_type_spec.rb | Ruby | mit | 86 | main | 570 | require 'spec_helper'
RSpec.describe Scimitar::ResourceType do
context '#as_json' do
it 'adds the extensionSchemas' do
resource_type = Scimitar::ResourceType.new(
endpoint: '/Gaga',
schema: 'urn:ietf:params:scim:schemas:core:2.0:User',
schemaExtensions: ['urn:ietf:params:scim:schem... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/complex_types/email_spec.rb | Ruby | mit | 86 | main | 582 | require 'spec_helper'
RSpec.describe Scimitar::ComplexTypes::Email do
context '#as_json' do
it 'assumes no defaults' do
expect(described_class.new.as_json).to eq({})
end
it 'allows a custom email type' do
expect(described_class.new(type: 'home').as_json).to eq('type' => 'home')
end
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/complex_types/address_spec.rb | Ruby | mit | 86 | main | 455 | require 'spec_helper'
RSpec.describe Scimitar::ComplexTypes::Address do
context '#as_json' do
it 'assumes no defaults' do
expect(described_class.new.as_json).to eq({})
end
it 'allows a custom address type' do
expect(described_class.new(type: 'home').as_json).to eq('type' => 'home')
end
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/schema/user_spec.rb | Ruby | mit | 86 | main | 19,625 | require 'spec_helper'
RSpec.describe Scimitar::Schema::User do
let(:expected_attributes) {
<<-EOJ
[
{
"multiValued": false,
"required": true,
"caseExact": false,
"mutability": "readWrite",
"uniqueness": "server",
"returned": "default",
"name": "us... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/schema/group_spec.rb | Ruby | mit | 86 | main | 2,351 | require 'spec_helper'
RSpec.describe Scimitar::Schema::Group do
let(:expected_attributes) {
<<-EOJ
[
{
"multiValued": false,
"required": true,
"caseExact": false,
"mutability": "readWrite",
"uniqueness": "none",
"returned": "default",
"name": "dis... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/schema/base_spec.rb | Ruby | mit | 86 | main | 2,078 | require 'spec_helper'
RSpec.describe Scimitar::Schema::Base do
context '#as_json' do
it 'converts the scim_attributes to attributes' do
attribute = Scimitar::Schema::Attribute.new(name: 'nickName')
schema = described_class.new(scim_attributes: [attribute])
expect(schema.as_json['attributes']).t... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/schema/attribute_spec.rb | Ruby | mit | 86 | main | 4,796 | require 'spec_helper'
RSpec.describe Scimitar::Schema::Attribute do
context '#initialize' do
it 'sets the default properties' do
attribute = described_class.new
expect(attribute.multiValued).to be(false)
expect(attribute.required).to be(false)
expect(attribute.caseExact).to be(false)
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/resources/user_spec.rb | Ruby | mit | 86 | main | 2,505 | require 'spec_helper'
RSpec.describe Scimitar::Resources::User do
context '#name' do
it 'allows a setter for a valid name' do
user = described_class.new(name: Scimitar::ComplexTypes::Name.new(
familyName: 'Smith',
givenName: 'John',
formatted: 'John Smith'
))
expect(use... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/resources/base_spec.rb | Ruby | mit | 86 | main | 17,706 | require 'spec_helper'
RSpec.describe Scimitar::Resources::Base do
context 'basic operation' do
FirstCustomSchema = Class.new(Scimitar::Schema::Base) do
def self.id
'urn:ietf:params:scim:schemas:custom-id'
end
def self.scim_attributes
[
Scimitar::Schema::Attribute.new(... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/resources/mixin_spec.rb | Ruby | mit | 86 | main | 148,839 | require 'spec_helper'
RSpec.describe Scimitar::Resources::Mixin do
# ===========================================================================
# Internal classes used in some tests
# ===========================================================================
class StaticMapTest
include ActiveModel::Mod... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/resources/base_validation_spec.rb | Ruby | mit | 86 | main | 4,344 | require 'spec_helper'
RSpec.describe Scimitar::Resources::Base do
context '#valid?' do
MyCustomSchema = Class.new(Scimitar::Schema::Base) do
def self.id
'urn:ietf:params:scim:schemas:custom-id'
end
class NameWithRequirementsSchema < Scimitar::Schema::Base
def self.scim_attribut... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/lists/query_parser_spec.rb | Ruby | mit | 86 | main | 40,947 | require 'spec_helper'
# Note that #
RSpec.describe Scimitar::Lists::QueryParser do
# We use the dummy app's MockUser class, so need a database connection from
# that app too. ActiveRecord can then escape column values, generate SQL and
# so-forth, and we can run tests to check on that output to verify that
#... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/models/scimitar/lists/count_spec.rb | Ruby | mit | 86 | main | 4,624 | require 'spec_helper'
RSpec.describe Scimitar::Lists::Count do
before :each do
@instance = described_class.new
end
# ===========================================================================
# LIMIT
# ===========================================================================
context '#limit' do
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/requests/engine_spec.rb | Ruby | mit | 86 | main | 5,000 | require 'spec_helper'
RSpec.describe Scimitar::Engine do
before :each do
allow_any_instance_of(Scimitar::ApplicationController).to receive(:authenticated?).and_return(true)
end
context 'parameter parser' do
# "params" given here as a String, expecting the engine's custom parser to
# decode it for u... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/requests/application_controller_spec.rb | Ruby | mit | 86 | main | 2,764 | # Some tests require the more flexible driver methods for 'get', 'post'
# etc. than available in RSpec controller tests.
#
# See also spec/controllers/scimitar/application_controller_spec.rb.
#
require 'spec_helper'
RSpec.describe Scimitar::ApplicationController do
before :each do
allow_any_instance_of(Scimitar:... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/requests/active_record_backed_resources_controller_spec.rb | Ruby | mit | 86 | main | 65,650 | require 'spec_helper'
require 'time'
RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
before :each do
allow_any_instance_of(Scimitar::ApplicationController).to receive(:authenticated?).and_return(true)
# If a sort order is unspecified, the controller defaults to ID ascending.
# With UUI... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/requests/controller_configuration_spec.rb | Ruby | mit | 86 | main | 531 | require 'spec_helper'
RSpec.describe 'Controller configuration' do
before :each do
allow_any_instance_of(Scimitar::ApplicationController).to receive(:authenticated?).and_return(true)
end
context 'application_controller_mixin' do
it 'the test before-action declared in configuration gets called' do
... |
github | pond/scimitar | https://github.com/pond/scimitar | config/routes.rb | Ruby | mit | 86 | main | 444 | Scimitar::Engine.routes.draw do
get 'ServiceProviderConfig', to: 'service_provider_configurations#show', as: :scim_service_provider_configuration
get 'ResourceTypes', to: 'resource_types#index', as: :scim_resource_types
get 'ResourceTypes/:name', to: 'resource_types#show', ... |
github | pond/scimitar | https://github.com/pond/scimitar | config/initializers/scimitar.rb | Ruby | mit | 86 | main | 8,977 | # SCIMITAR CONFIGURATION
#
# For supporting information and rationale, please see README.md.
Rails.application.config.to_prepare do # (required for >= Rails 7 / Zeitwerk)
# ===========================================================================
# SERVICE PROVIDER CONFIGURATION
# ============================... |
github | Sutto/slugged | https://github.com/Sutto/slugged | Rakefile | Ruby | mit | 86 | master | 446 | require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end
task :default => :test
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir =... |
github | Sutto/slugged | https://github.com/Sutto/slugged | Gemfile | Ruby | mit | 86 | master | 332 | source 'https://rubygems.org'
# Allow testing multiple versions with Travis.
rails_version = ENV['RAILS_VERSION']
if rails_version && rails_version.length > 0
puts "Testing Rails Version = #{rails_version}"
# Override the specific versions
gem 'activesupport', rails_version
gem 'activerecord', rails_version
e... |
github | Sutto/slugged | https://github.com/Sutto/slugged | slugged.gemspec | Ruby | mit | 86 | master | 1,468 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require 'slugged/version'
Gem::Specification.new do |s|
s.name = "slugged"
s.version = Slugged::VERSION
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_ver... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/helper.rb | Ruby | mit | 86 | master | 1,236 | # encoding: utf-8
$KCODE = 'UTF8' if RUBY_VERSION < '1.9'
require 'rubygems'
require 'bundler'
Bundler.setup
Bundler.require
require 'test/unit'
require 'shoulda'
require 'redgreen' if RUBY_VERSION < '1.9'
require 'ruby-debug' if ENV['DEBUG']
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_P... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/slug_history_test.rb | Ruby | mit | 86 | master | 2,908 | require 'helper'
class FakedModel
attr_reader :id
def self.slug_scope_key; "faked_models"; end
def initialize(id); @id = id; end
end
class SlugHistoryTest < Test::Unit::TestCase
with_tables :slugs, :users do
context 'for arbitrary models' do
setup do
@record_a = FakedModel.new(12)
... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/editable_test.rb | Ruby | mit | 86 | master | 1,836 | require 'helper'
require 'digest/md5'
class EditableTest < Test::Unit::TestCase
with_tables :slugs, :users do
context 'with the editable option' do
setup { setup_slugs! :editable => true }
should 'correctly sluggify a value when cached_slug is blank on create' do
user = User.create(:name =>... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/caching_test.rb | Ruby | mit | 86 | master | 2,324 | require 'helper'
class CachingTest < Test::Unit::TestCase
with_tables :slugs, :users do
setup { Slugged::MemoryCache.reset! }
context 'with the default slug setup' do
setup { setup_slugs! }
should 'store a cache automatically after finding it' do
assert_has_no_cache_... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/model_definitions.rb | Ruby | mit | 86 | master | 312 | require 'reversible_data'
ReversibleData.in_memory!
# Define models here.
ReversibleData.add :slugs do |t|
t.string :scope
t.string :slug
t.integer :record_id
t.datetime :created_at
end
ReversibleData.add :users do |u|
u.string :name
u.string :address
u.string :cached_slug
u.timestamps
end |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/slugged_test.rb | Ruby | mit | 86 | master | 1,034 | require 'helper'
class SluggedTest < Test::Unit::TestCase
class SlugScopeTest
cattr_accessor :slug_scope_key
self.slug_scope_key = "my-test-scope"
end
should 'return the correct counter versions' do
assert_equal 'awesome', Slugged.with_counter('awesome')
assert_equal 'awesome', Sl... |
github | Sutto/slugged | https://github.com/Sutto/slugged | test/is_sluggable_test.rb | Ruby | mit | 86 | master | 5,331 | require 'helper'
require 'digest/md5'
class IsSluggableTest < Test::Unit::TestCase
with_tables :slugs, :users do
class StringWrapper < String
def to_url; "my-demo-slug"; end
end
context 'with the default slug options' do
setup { setup_slugs! }
should 'correctly s... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged.rb | Ruby | mit | 86 | master | 1,739 | require 'active_support'
require 'active_record'
require 'uuid'
require 'active_support/dependencies/autoload'
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/concern'
module Slugged
extend ActiveSupport::Autoload
mattr_accessor :cache_key_prefix, :cache
class << self
... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/active_record_methods.rb | Ruby | mit | 86 | master | 4,325 | module Slugged
module ActiveRecordMethods
AR_CLASS_ATTRIBUTE_NAMES = %w(cached_slug_column slug_source slug_convertor_proc default_uuid_slug use_slug_history sync_slugs slug_scope use_slug_cache use_slug_to_param editable).map(&:to_sym)
def is_sluggable(source = :name, options = {})
options.symboli... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/slug_history.rb | Ruby | mit | 86 | master | 803 | module Slugged
module SlugHistory
extend ActiveSupport::Concern
included do
after_save :record_slug_changes
after_destroy :remove_slug_history!
end
def previous_slugs
Slugged.previous_slugs_for(self)
end
def remove_slug_history!
Slugged.remove_slug_history_fo... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/finders.rb | Ruby | mit | 86 | master | 475 | module Slugged
module Finders
def find_using_slug(slug)
slug = slug.to_s
value = nil
value ||= find_by_id(slug.to_i) if slug =~ /\A\d+\Z/
value ||= with_cached_slug(slug).first
value ||= find_using_slug_history(slug) if use_slug_history
value.found_via_slug = slug if value... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/scopes.rb | Ruby | mit | 86 | master | 303 | module Slugged
module Scopes
def with_cached_slug(slug)
where(self.cached_slug_column => slug.to_s)
end
def other_than(record)
record.new_record? ? where(nil) : where("#{quoted_table_name}.#{connection.quote_column_name(:id)} != ?", record.id)
end
end
end |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/caching.rb | Ruby | mit | 86 | master | 2,808 | require 'digest/sha2'
module Slugged
# Mixin for adding simple caching support to models using slugged.
# Usually included by passing the :cache option as true (by default it is
# true, you can disable by passing :cache as false or nil).
module Caching
extend ActiveSupport::Concern
mattr_accessor ... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/slug.rb | Ruby | mit | 86 | master | 1,465 | module Slugged
class Slug < ActiveRecord::Base
self.table_name = "slugs"
validates_presence_of :record_id, :slug, :scope
scope :ordered, lambda { order('created_at DESC') }
scope :only_slug, lambda { select(:slug) }
scope :for_record, lambda { |r| where(:record_id => r.id, :scope => Slug... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/slugged/memory_cache.rb | Ruby | mit | 86 | master | 544 | module Slugged
# Implements a simple cache store that uses the
# current processes memory. This makes is primarily
# used for testing purposes in the situations where
# caching is used.
class MemoryCache
def self.write(key, value, options = {})
cache[key.to_s] = value
end
def self.... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/generators/slugged/slugs/slugs_generator.rb | Ruby | mit | 86 | master | 667 | module Slugged
module Generators
class SlugsGenerator < Rails::Generators::Base
include Rails::Generators::Migration
def self.source_root
@_ps_source_root ||= File.expand_path("templates", File.dirname(__FILE__))
end
def self.next_migration_number(dirname) #:nodoc:
... |
github | Sutto/slugged | https://github.com/Sutto/slugged | lib/generators/slugged/slug_migration/slug_migration_generator.rb | Ruby | mit | 86 | master | 692 | module Slugged
module Generators
class SlugMigrationGenerator < Rails::Generators::NamedBase
include Rails::Generators::Migration
def self.source_root
@_ps_source_root ||= File.expand_path("templates", File.dirname(__FILE__))
end
def self.next_migration_number(dirname... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | acts_as_taggable_redux.gemspec | Ruby | mit | 86 | master | 1,481 | Gem::Specification.new do |s|
s.name = 'acts_as_taggable_redux'
s.version = '0.0.1'
s.date = '2008-12-06'
s.summary = 'Allows for user owned tags to be added to multiple classes, and makes tags easier to work with.'
s.description = 'Allows for user owned tags to be added to multiple classes, and makes tags e... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | Rakefile | Ruby | mit | 86 | master | 583 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the acts_as_taggable_redux plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the acts_as... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | test/tag_test.rb | Ruby | mit | 86 | master | 1,892 | require File.dirname(__FILE__) + "/test_helper"
class TagTest < Test::Unit::TestCase
def test_taggings
assert_equal [taggings(:bear_animal), taggings(:frog_animal)], tags(:animal).taggings
assert_not_equal [taggings(:cactus_plant), taggings(:orange_plant)], tags(:animal).taggings
end
def test_parse_do... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | test/acts_as_taggable_test.rb | Ruby | mit | 86 | master | 1,668 | require File.dirname(__FILE__) + "/test_helper"
class ActsAsTaggableTest < Test::Unit::TestCase
def test_find_tagged_with_any
assert_equal [things(:bear), things(:frog)].sort_by(&:id), Thing.find_tagged_with("animal")
assert_equal [things(:bear), things(:frog), things(:cactus)].sort_by(&:id), Thing.find_tagg... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | test/test_helper.rb | Ruby | mit | 86 | master | 2,322 | ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
require 'test_help'
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/acts_as_taggable'
require File.dirname(__FILE__) + '/../lib/tag'
require File.dirname(__FILE__) + '/../lib/tagging'
ActiveRec... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | test/tagging_test.rb | Ruby | mit | 86 | master | 400 | require File.dirname(__FILE__) + "/test_helper"
class TaggingTest < Test::Unit::TestCase
def test_taggable
assert_equal things(:bear), taggings(:bear_animal).taggable
assert_not_equal things(:frog), taggings(:bear_animal).taggable
end
def test_tag
assert_equal tags(:animal), taggings(:bear_ani... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | test/schema.rb | Ruby | mit | 86 | master | 845 | ActiveRecord::Schema.define :version => 0 do
create_table :tags, :force => true do |t|
t.column :name, :string
t.column :taggings_count, :integer, :default => 0, :null => false
end
add_index :tags, :name
add_index :tags, :taggings_count
create_table :taggings, :force => true do |t|
t.column :tag... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | tasks/acts_as_taggable_tasks.rake | Ruby | mit | 86 | master | 798 | namespace :acts_as_taggable do
namespace :db do
desc "Creates tag tables for use with acts_as_taggable"
task :create => :environment do
require 'rails_generator'
require 'rails_generator/scripts/generate'
raise "Task unavailable to this database (no migration support)" unless ActiveRecor... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | lib/acts_as_taggable.rb | Ruby | mit | 86 | master | 5,377 | module ActiveRecord
module Acts #:nodoc:
module Taggable #:nodoc:
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def acts_as_taggable(options = {})
has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag
has_m... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | lib/acts_as_taggable_redux.rb | Ruby | mit | 86 | master | 300 | require 'acts_as_taggable'
require 'acts_as_taggable_helper'
require 'acts_as_tagger'
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Taggable)
ActiveRecord::Base.send(:include, ActiveRecord::Acts::Tagger)
ActionView::Base.send(:include, ActsAsTaggableHelper)
require 'tagging'
require 'tag' |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | lib/tag.rb | Ruby | mit | 86 | master | 2,056 | class Tag < ActiveRecord::Base
has_many :taggings
# Parse a text string into an array of tokens for use as tags
def self.parse(list)
tag_names = []
return tag_names if list.blank?
# first, pull out the quoted tags
list.gsub!(/\"(.*?)\"\s*/) { tag_names << $1; "" }
# then, replace all comma... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | lib/acts_as_tagger.rb | Ruby | mit | 86 | master | 553 | module ActiveRecord
module Acts #:nodoc:
module Tagger #:nodoc:
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def acts_as_tagger(options = {})
has_many :taggings
has_many :tags, :through => :taggings, :order => "name"
ex... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | lib/acts_as_taggable_helper.rb | Ruby | mit | 86 | master | 1,366 | module ActsAsTaggableHelper
# Create a link to the tag using restful routes and the rel-tag microformat
def link_to_tag(tag)
link_to(tag.name, tag_url(tag), :rel => 'tag')
end
# Generate a tag cloud of the top 100 tags by usage, uses the proposed hTagcloud microformat.
#
# Inspired by http://www.juixe.... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | generators/acts_as_taggable_tables/templates/migration.rb | Ruby | mit | 86 | master | 859 | class AddActsAsTaggableTables < ActiveRecord::Migration
def self.up
create_table :tags do |t|
t.column :name, :string
t.column :taggings_count, :integer, :default => 0, :null => false
end
add_index :tags, :name
add_index :tags, :taggings_count
create_table :taggings do |t|
... |
github | geemus/acts_as_taggable_redux | https://github.com/geemus/acts_as_taggable_redux | generators/acts_as_taggable_stylesheet/acts_as_taggable_stylesheet_generator.rb | Ruby | mit | 86 | master | 216 | class ActsAsTaggableStylesheetGenerator < Rails::Generator::Base
def manifest
record do |m|
m.file "acts_as_taggable_stylesheet.css", "public/stylesheets/acts_as_taggable_stylesheet.css"
end
end
end |
github | yihangho/emoji-for-jekyll | https://github.com/yihangho/emoji-for-jekyll | update-json.rb | Ruby | mit | 86 | master | 366 | #!/usr/bin/env ruby
require 'net/http'
require 'openssl'
require 'json'
uri = URI('https://api.github.com/emojis')
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
request = Net::HTTP::Get.new uri
response = http.request request
json_obj = JSON.parse response.body
File.open("lib/emoji.json", "w") ... |
github | yihangho/emoji-for-jekyll | https://github.com/yihangho/emoji-for-jekyll | emoji_for_jekyll.gemspec | Ruby | mit | 86 | master | 621 | Gem::Specification.new do |s|
s.name = 'emoji_for_jekyll'
s.version = '0.2.3'
s.date = '2015-12-22'
s.summary = 'Seamlessly enable emoji in Jekyll.'
s.description = 'A plugin for Jekyll that seamlessly enable emoji.'
s.author = 'Yihang Ho'
s.email = 'me@yihangho.com'
s.h... |
github | yihangho/emoji-for-jekyll | https://github.com/yihangho/emoji-for-jekyll | lib/emoji_for_jekyll.rb | Ruby | mit | 86 | master | 3,061 | require 'json'
module EmojiForJekyll
class EmojiGenerator < Jekyll::Generator
def generate(site)
if site.config.has_key?("emoji") and !site.config["emoji"]
return
end
if site.config.has_key?("emoji-additional-keys")
additional_keys = site.config["emoji-additional-keys"]
... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | asciidoctor-confluence.gemspec | Ruby | mit | 86 | master | 1,532 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'asciidoctor/confluence/version'
Gem::Specification.new do |spec|
spec.name = "asciidoctor-confluence"
spec.version = Asciidoctor::Confluence::VERSION
spec.authors = ["G... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | lib/asciidoctor/page.rb | Ruby | mit | 86 | master | 759 | class Page
TYPE = 'page'
REPRESENTATION = 'storage'
@document
attr_reader :page_id, :title, :space_key
attr_writer :revision
def initialize(space_key, title, document, page_id)
@space_key = space_key
@title = title
@document = document
@page_id = page_id
@revision = nil
end
def t... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | lib/asciidoctor/confluence_api.rb | Ruby | mit | 86 | master | 2,928 | module Asciidoctor
module Confluence
class ConfluenceAPI
DEFAULT_CONTENT_TYPE = 'application/json'
API_CONTENT = 'rest/api/content'
attr_reader :url
@page
@auth
def initialize(confluence_options, page)
@url = build_api_content_url(confluence_options)
@auth = ... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | lib/asciidoctor/confluence.rb | Ruby | mit | 86 | master | 2,246 | require_relative 'confluence/version'
require_relative './page'
require_relative './confluence_api'
require 'asciidoctor'
require 'faraday'
require 'json'
module Asciidoctor
module Confluence
class Publisher
SUCCESSFUL_CREATE_RESULT = 'The page has been successfully created. It is available here: '
... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | lib/asciidoctor/confluence/invoker.rb | Ruby | mit | 86 | master | 1,058 | require 'asciidoctor'
require 'stringio'
require 'asciidoctor/cli'
require_relative './options'
require_relative '../confluence/invoker'
module Asciidoctor
module Confluence
class Invoker
def self.invoke(args)
begin
orig_stdout, orig_stderr = $stdout, $stderr
captured_stdout, c... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | lib/asciidoctor/confluence/options.rb | Ruby | mit | 86 | master | 3,255 | require 'asciidoctor/cli/options'
require_relative '../confluence'
module Asciidoctor
module Confluence
class Options < Asciidoctor::Cli::Options
HOST_MISSING = 'FAILED: The hostname of the Confluence instance is missing'
SPACE_KEY_MISSING = 'FAILED: The spaceKey of the Confluence instance is missi... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | test/Asciidoctor/confluence/confluence_api_tests.rb | Ruby | mit | 86 | master | 618 | require 'test/unit'
require 'asciidoctor/confluence_api'
class ConfluenceAPITests < Test::Unit::TestCase
def test_build_content_api_without_ending_slash
url = 'http://confluence.mydomain'
api = Asciidoctor::Confluence::ConfluenceAPI.new({:host => url}, nil)
assert_equal url+'/'+Asciidoctor::Confluence::C... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | test/Asciidoctor/confluence/options_tests.rb | Ruby | mit | 86 | master | 2,216 | require 'test/unit'
require 'asciidoctor/confluence/options'
class OptionsTests < Test::Unit::TestCase
def setup
@orig_stderr = $stderr
$stderr = StringIO.new
end
def teardown
$stderr = @orig_stderr
@orig_stderr = nil
end
def test_init_options
options = Asciidoctor::Confluence::Options.... |
github | asciidoctor/asciidoctor-confluence | https://github.com/asciidoctor/asciidoctor-confluence | test/Asciidoctor/confluence/publisher_tests.rb | Ruby | mit | 86 | master | 2,103 | require 'test-unit'
require 'webmock/test_unit'
require 'asciidoctor/confluence_api'
require 'asciidoctor/confluence'
#require 'asciidoctor-confluence/lib/asciidoctor/confluence'
class PublisherTests < Test::Unit::TestCase
def setup
@orig_stderr = $stderr
$stderr = StringIO.new
@orig_stdout = $stdout
... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | Gemfile | Ruby | mit | 86 | master | 507 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
group :development do
gem 'rubocop', '~> 0.49.0'
gem 'rubyzip', '~> 1.2.1'
gem 's3', '~> 0.3.21'
end
group :test, :development do
gem 'aruba', '~> 0.8.0'
gem 'json', '>= 1.8'
gem 'rake', '>= 0.8.7', '< 13.0'
gem 'rspec', '~> 3.6.0'
g... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | do_snapshot.gemspec | Ruby | mit | 86 | master | 1,285 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'do_snapshot/version'
Gem::Specification.new do |spec|
spec.name = 'do_snapshot'
spec.version = DoSnapshot::VERSION
spec.authors = ['Alexander Merkulov']
spec.email ... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | Rakefile | Ruby | mit | 86 | master | 1,240 | # -*- encoding : utf-8 -*-
require 'bundler/setup'
PROJECT_ROOT = File.expand_path('..', __FILE__)
PROJECT_ROOT_DIR = File.dirname(__FILE__)
$:.unshift "#{PROJECT_ROOT}/lib"
require 'do_snapshot'
begin
require 'rspec/core/rake_task'
desc 'Run all specs'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
# The... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | example/new_adapter/Rakefile | Ruby | mit | 86 | master | 454 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'bundler/setup'
PROJECT_ROOT = File.expand_path('..', __FILE__)
PROJECT_ROOT_DIR = File.dirname(__FILE__)
$LOAD_PATH.unshift "#{PROJECT_ROOT}/lib"
require 'new_adapter'
begin
require 'rspec/core/rake_task'
desc 'Run all specs'
RSpec::Core::RakeTa... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | example/new_adapter/new_adapter.gemspec | Ruby | mit | 86 | master | 962 | # coding: utf-8
# frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'new_adapter/version'
Gem::Specification.new do |spec|
spec.name = 'new_adapter'
spec.version = NewAdapter::VERSION
spec.authors = ['Alexan... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | example/new_adapter/Gemfile | Ruby | mit | 86 | master | 400 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
group :development do
gem 'rubocop', '~> 0.49.0'
end
group :test, :development do
gem 'aruba', '~> 0.8.0'
gem 'json', '>= 1.8'
gem 'rake', '>= 0.8.7', '< 13.0'
gem 'rspec', '~> 3.6.0'
gem 'rspec-core', '~> 3.6.0'
gem 'rspec-expectation... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | example/new_adapter/spec/spec_helper.rb | Ruby | mit | 86 | master | 687 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'bundler'
Bundler.setup
require 'webmock/rspec'
require 'new_adapter'
require 'do_snapshot/cli'
require 'do_snapshot/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
WebMock.disable!(except: [:net_http])
Dir.glob(::File.expand_path('../suppor... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | example/new_adapter/spec/new_adapter/adapter_spec.rb | Ruby | mit | 86 | master | 262 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
module NewAdapter
RSpec.describe Adapter do
include DoSnapshot::RSpec::Environment
include DoSnapshot::RSpec::ApiV2Helpers
include DoSnapshot::RSpec::Adapter
end
end |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/zip.rake | Ruby | mit | 86 | master | 1,197 | # Used part of Heroku script https://github.com/heroku/heroku
#
require 'zip'
require 'digest'
file pkg("do_snapshot-#{version}.zip") => distribution_files('zip') do |t|
tempdir do |dir|
mkchdir('do_snapshot') do
assemble_distribution
assemble_gems
assemble resource('tgz/do_snapshot'), 'bin/do_... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/tgz.rake | Ruby | mit | 86 | master | 1,102 | require 'digest'
# Used part of Heroku script https://github.com/heroku/heroku
#
file pkg("do_snapshot-#{version}.tgz") => distribution_files('tgz') do |t|
tempdir do |dir|
mkchdir('do_snapshot') do
assemble_distribution
assemble_gems
assemble resource('tgz/do_snapshot'), 'bin/do_snapshot', 075... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/gem.rake | Ruby | mit | 86 | master | 448 | # Used part of Heroku script https://github.com/heroku/heroku
#
file pkg("do_snapshot-#{version}.gem") => distribution_files('gem') do |t|
sh 'gem build do_snapshot.gemspec'
sh "mv do_snapshot-#{version}.gem #{t.name}"
end
task 'gem:build' => pkg("do_snapshot-#{version}.gem")
task 'gem:clean' do
clean pkg("do_s... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/brew.rake | Ruby | mit | 86 | master | 731 | task 'brew:release' => pkg("do_snapshot-#{version}.tgz.sha256") do |t|
sha256 = File.read(t.source).strip
tempdir do |dir|
dest = 'homebrew-do-snapshot'
cd = "cd #{dest}"
sh "git clone git@github.com:merqlove/homebrew-do-snapshot.git #{dest}"
formula = File.read('homebrew-do-snapshot/do_snapshot.rb... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/manifest.rake | Ruby | mit | 86 | master | 219 | task 'manifest:update' do
tempdir do |dir|
File.open('VERSION', 'w') do |file|
file.puts version
end
puts "Current version: #{version}"
s3_store "#{dir}/VERSION", 'do_snapshot/VERSION'
end
end |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/helpers/file.rb | Ruby | mit | 86 | master | 1,800 | # Used part of Heroku script https://github.com/heroku/heroku
#
require 'erb'
require 'fileutils'
require 'tmpdir'
def assemble(source, target, perms = 0644)
FileUtils.mkdir_p(File.dirname(target))
File.open(target, 'w') do |f|
f.puts ERB.new(File.read(source)).result(binding)
end
File.chmod(perms, target)... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | tasks/helpers/s3.rb | Ruby | mit | 86 | master | 825 | def s3_connect
return if @s3
require 's3'
unless ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY']
puts 'please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in your environment'
exit 1
end
@s3 = S3::Service.new(
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot_spec.rb | Ruby | mit | 86 | master | 1,847 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot do
include DoSnapshot::RSpec::Environment
describe DoSnapshot::DropletFindError do
subject(:error) { described_class }
it 'should work' do
error.new(droplet_id)
expect(DoSnapshot.logger.bu... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/spec_helper.rb | Ruby | mit | 86 | master | 788 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'coveralls'
Coveralls.wear! do
add_filter '/spec/*'
end
require 'bundler'
Bundler.setup
require 'do_snapshot/cli'
require 'webmock/rspec'
require 'fileutils'
require 'do_snapshot/rspec'
require 'do_snapshot/core_ext/hash'
WebMock.disable_net_connect!... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/support/matchers.rb | Ruby | mit | 86 | master | 372 | # frozen_string_literal: true
RSpec::Matchers.define :be_found_n_times do |str, times|
match do |output|
matches = output.scan(str)
@size = matches.size
@size == times
end
failure_message do |actual|
"was found #{size} times\nexpected that '#{str}' would be found #{times} times in:\n#{actual}"
... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/adapter_spec.rb | Ruby | mit | 86 | master | 929 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Adapter do
include DoSnapshot::RSpec::Environment
module DoSnapshot
module Adapter
class CustomAdapter # rubocop:disable Style/Documentation
def initialize(_ = {}); end
end
end
e... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/cli_spec.rb | Ruby | mit | 86 | master | 5,539 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::CLI do
include DoSnapshot::RSpec::Environment
include DoSnapshot::RSpec::ApiV2Helpers
subject(:cli) { described_class }
subject(:api) { DoSnapshot::Adapter::DropletKit }
describe '.initialize' ... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/mail_spec.rb | Ruby | mit | 86 | master | 1,133 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Mail do
include DoSnapshot::RSpec::Environment
subject(:mail) { described_class }
describe 'will send mail with options' do
it '#notify' do
mail = DoSnapshot.mailer.notify
expect(mail).not_... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/configuration_spec.rb | Ruby | mit | 86 | master | 384 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Configuration do
subject(:cli) { described_class }
it { expect(cli.new).to respond_to(:logger) }
it { expect(cli.new).to respond_to(:logger_level) }
it { expect(cli.new).to respond_to(:verbose) }
it { expect(cli.new).to respond_t... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/log_spec.rb | Ruby | mit | 86 | master | 2,074 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Log do
include DoSnapshot::RSpec::Environment
subject(:log) { described_class }
describe 'will have message' do
it('#info') { logger_respond_to(:info) }
it('#debug') { logger_respond_to(:debug) }... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/command_spec.rb | Ruby | mit | 86 | master | 8,852 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Command do
include DoSnapshot::RSpec::Environment
include DoSnapshot::RSpec::UriHelpers
subject(:cmd) { DoSnapshot::Command.new }
subject(:log) { DoSnapshot::Log }
describe 'V2' do
include ... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/runner_spec.rb | Ruby | mit | 86 | master | 10,228 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Runner, type: :aruba do
include DoSnapshot::RSpec::Environment
context 'commands' do
context '.snap' do
RSpec.shared_examples '.snap methods' do
it 'with error' do
run 'do_snapshot... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/adapter/droplet_kit_spec.rb | Ruby | mit | 86 | master | 254 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Adapter::DropletKit do
include DoSnapshot::RSpec::Environment
include DoSnapshot::RSpec::ApiV2Helpers
include DoSnapshot::RSpec::Adapter
end |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | spec/do_snapshot/adapter/abstract_spec.rb | Ruby | mit | 86 | master | 1,122 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DoSnapshot::Adapter::Abstract do
include DoSnapshot::RSpec::Environment
subject(:api) { described_class }
describe '.initialize' do
describe '#delay' do
let(:delay) { 5 }
let(:instance) { api.new(delay... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot.rb | Ruby | mit | 86 | master | 2,881 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require_relative 'do_snapshot/version'
require_relative 'do_snapshot/configuration'
# Used primary for creating snapshot's as backups for DigitalOcean
#
module DoSnapshot
class << self
attr_accessor :logger, :mailer
def configure
yield(config)
... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/distribution.rb | Ruby | mit | 86 | master | 342 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
module DoSnapshot
# Distributive files
# Used part of Heroku script https://github.com/heroku/heroku
#
module Distribution
def self.files
Dir[File.expand_path('../../../{bin,lib}/**/*', __FILE__)].select do |file|
File.file?(file)
... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/adapter.rb | Ruby | mit | 86 | master | 923 | # frozen_string_literal: true
module DoSnapshot
# Adapter interface for API connections
# Ability to select DigitalOcean API versions.
#
module Adapter
autoload :Abstract, 'do_snapshot/adapter/abstract'
autoload :DropletKit, 'do_snapshot/adapter/droplet_kit'
class << self
def api(protocol, op... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/mail.rb | Ruby | mit | 86 | master | 1,893 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'date'
require 'pony'
require_relative 'core_ext/hash'
require_relative 'helpers'
module DoSnapshot
# Shared mailer.
#
class Mail
attr_writer :mailer, :opts_default, :smtp_default
def initialize(options = {})
options.each { |key, opt... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/rspec.rb | Ruby | mit | 86 | master | 678 | # frozen_string_literal: true
require 'rspec/core/shared_context'
module DoSnapshot
module RSpec # rubocop:disable Style/Documentation
autoload :Adapter, 'do_snapshot/rspec/adapter'
autoload :ApiHelpers, 'do_snapshot/rspec/api_helpers'
autoload :ApiV2Helpers, 'do_snapshot/rspec/api_v2_helpers'
autolo... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/log.rb | Ruby | mit | 86 | master | 1,513 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'logger'
require 'hashie'
module DoSnapshot
# Shared logger
#
class Log
attr_reader :shell
attr_accessor :quiet, :verbose
attr_writer :buffer, :instance
def initialize(options = {})
@verbose = DoSnapshot.config.verbose
... |
github | merqlove/do_snapshot | https://github.com/merqlove/do_snapshot | lib/do_snapshot/cli.rb | Ruby | mit | 86 | master | 7,280 | # -*- encoding : utf-8 -*-
# frozen_string_literal: true
require 'thor'
require 'do_snapshot'
require_relative 'log'
require_relative 'mail'
require_relative 'helpers'
require_relative 'command'
module DoSnapshot
# CLI is here
#
class CLI < Thor # rubocop:disable ClassLength
include DoSnapshot::Helpers
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.