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 | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | examples/kaminari.rb | Ruby | mit | 45 | master | 334 | # Paginate beer search results using Kaminari.
query = params[:query]
page = params[:page] || 1
per_page = BreweryDB::PaginatedCollection::BATCH_SIZE
results = client.search.beers(q: query, p: page)
count = results.count
beers = Kaminari
.paginate_array(results.take(per_page), total_count: count)
.page(page)
.... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/spec_helper.rb | Ruby | mit | 45 | master | 509 | require 'dotenv'
Dotenv.load
require 'brewery_db'
# This API key is only for use when developing this client library. Please do
# not use it in your own applications. You may request your own API key here:
# http://www.brewerydb.com/developers
ENV['BREWERY_DB_API_KEY'] ||= '1c394d8947e4a5873920d2333c9e9364'
RSpec.con... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/support/vcr.rb | Ruby | mit | 45 | master | 261 | require 'vcr'
VCR.configure do |config|
config.hook_into(:faraday)
config.configure_rspec_metadata!
config.cassette_library_dir = File.expand_path('../../fixtures', __FILE__)
config.filter_sensitive_data('API_KEY') { ENV['BREWERY_DB_API_KEY'] }
end |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/support/shared/a_resource.rb | Ruby | mit | 45 | master | 209 | shared_examples_for 'a resource', :resource do
let(:api_key) { ENV['BREWERY_DB_API_KEY'] }
let(:client) { BreweryDB::Client.new { |config| config.api_key = api_key } }
let(:config) { client.config }
end |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/web_hook_spec.rb | Ruby | mit | 45 | master | 2,031 | require 'spec_helper'
describe BreweryDB::WebHook do
let(:action) { 'edit' }
let(:attribute) { 'beer' }
let(:attribute_id) { 'x6bRxw' }
let(:key) { 'cfae72cf7db09b7508905573c174baf1f026c051' }
let(:nonce) { '576a8003ab8936d99fb104401141d613' }
let(:sub_action) { 'brewery-insert' }
let(:sub_attribute_id) ... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/mash_spec.rb | Ruby | mit | 45 | master | 482 | require 'spec_helper'
describe BreweryDB::Mash do
it { is_expected.to be_a(Hashie::Mash) }
context '#convert_key' do
it 'underscores camelcased keys' do
response = described_class.new(currentPage: 1)
expect(response.current_page).to eq(1)
end
end
context '#convert_value' do
it 'conver... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/config_spec.rb | Ruby | mit | 45 | master | 1,218 | require 'spec_helper'
describe BreweryDB::Config do
subject(:config) { described_class.new }
context 'defaults' do
it { expect(config.adapter).to eq(Faraday.default_adapter) }
it { expect(config.api_key).to be_nil }
it { expect(config.base_uri).to eq(described_class::BASE_URI) }
it { expect(con... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resource_spec.rb | Ruby | mit | 45 | master | 1,293 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resource, :resource do
context '#get', :vcr do
let(:resource) do
Class.new(BreweryDB::Resource) {
def ok
get('breweries', name: 'Rogue Ales').data
end
def list
get('breweries', established: 2006).pagin... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/client_spec.rb | Ruby | mit | 45 | master | 2,289 | require 'spec_helper'
describe BreweryDB::Client do
subject(:client) { described_class.new }
context '#config' do
it 'returns a configuration instance' do
expect(client.config).to be_a(BreweryDB::Config)
end
it 'memoizes the return value' do
expect(BreweryDB::Config).to receive(:new).once... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/middleware/error_handler_spec.rb | Ruby | mit | 45 | master | 1,968 | require 'spec_helper'
describe BreweryDB::Middleware::ErrorHandler do
subject(:handler) { described_class.new }
describe '#on_complete' do
let(:error_body) { double(error_message: error_message, status: 'failure') }
let(:error_message) { 'error' }
let(:over_ratelimit) { { 'x-ratelimit-remaining' => '0... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/breweries_spec.rb | Ruby | mit | 45 | master | 502 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Breweries, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all(established: 2006) }
it 'fetches all of the breweries at once' do
expect(response.count).to eq(74)
end
end
context '#find', ... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/hops_spec.rb | Ruby | mit | 45 | master | 456 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Hops, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the hops at once' do
expect(response.count).to eq(166)
end
end
context '#find', :vcr do
let(:response) {... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/categories_spec.rb | Ruby | mit | 45 | master | 474 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Categories, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the cagtegories at once' do
expect(response.length).to eq(13)
end
end
context '#find', :vcr do
let... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/glassware_spec.rb | Ruby | mit | 45 | master | 471 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Glassware, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the glassware at once' do
expect(response.count).to eq(12)
end
end
context '#find', :vcr do
let(:re... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/yeasts_spec.rb | Ruby | mit | 45 | master | 468 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Yeasts, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the yeasts at once' do
expect(response.count).to eq(404)
end
end
context '#find', :vcr do
let(:respons... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/beers_spec.rb | Ruby | mit | 45 | master | 751 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Beers, :resource do
subject(:beers_resource) { described_class.new(config) }
context '#all', :vcr do
let(:response) { beers_resource.all(abv: '5.5') }
it 'fetches all of the beers at once' do
expect(response.count).to eq(985)
... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/styles_spec.rb | Ruby | mit | 45 | master | 462 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Styles, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the styles at once' do
expect(response.count).to eq(160)
end
end
context '#find', :vcr do
let(:respons... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/menu_spec.rb | Ruby | mit | 45 | master | 332 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Menu, :resource do
describe '#beer_availability', :vcr do
let(:availabilities) { described_class.new(config).beer_availability }
it 'fetches all of the beer availabilities at once' do
expect(availabilities.count).to eq(8)
end... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/search_spec.rb | Ruby | mit | 45 | master | 1,022 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Search, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all(q: 'IPA') }
it 'fetches all of the search results at once' do
expect(response.count).to eq(7202)
end
end
{
beers: 'beer',
... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/locations_spec.rb | Ruby | mit | 45 | master | 492 | require 'spec_helper'
describe BreweryDB::Resources::Locations, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all(locality: 'San Francisco') }
it 'fetches all of the breweries at once' do
expect(response.count).to eq(21)
end
end
context '#find', :vcr do
... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/fluid_size_spec.rb | Ruby | mit | 45 | master | 456 | require 'spec_helper'
describe BreweryDB::Resources::FluidSize, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the fluid sizes at once' do
expect(response.count).to eq(19)
end
end
context '#find', :vcr do
let(:response) { describ... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/brewery_spec.rb | Ruby | mit | 45 | master | 785 | require 'spec_helper'
describe BreweryDB::Resources::Brewery do
context '#beers' do
let(:config) { double }
let(:id) { 'KlSsWY' }
let(:response) { double(collection: :some_beers) }
subject(:brewery) { described_class.new(config, id: id) }
context 'without params' do
it 'returns the beers ... |
github | tylerhunt/brewery_db | https://github.com/tylerhunt/brewery_db | spec/brewery_db/resources/fermentables_spec.rb | Ruby | mit | 45 | master | 486 | # encoding: UTF-8
require 'spec_helper'
describe BreweryDB::Resources::Fermentables, :resource do
context '#all', :vcr do
let(:response) { described_class.new(config).all }
it 'fetches all of the fermentables at once' do
expect(response.count).to eq(222)
end
end
context '#find', :vcr do
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | closeio.gemspec | Ruby | mit | 45 | master | 1,044 | $:.push File.expand_path('../lib', __FILE__)
require 'closeio/version'
require 'base64'
Gem::Specification.new do |s|
s.name = 'closeio'
s.version = Closeio::VERSION
s.authors = ['Taylor Brooks']
s.email = ['dGJyb29rc0BnbWFpbC5jb20='].map { |e| Base64.decode64(e) }
s.homepage ... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | Rakefile | Ruby | mit | 45 | master | 285 | require 'bundler/gem_tasks'
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ''
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "closeio #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/error.rb | Ruby | mit | 45 | master | 724 | module Closeio
class Error < StandardError; end
class NotAuthorized < Error; end
class NotFound < Error; end
class GatewayTimeout < Error; end
class TooManyRequests < Error; end
end
require 'faraday'
module FaradayMiddleware
class CloseioErrorHandler < Faraday::Middleware
ERROR_STATUSES = 400..600
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/client.rb | Ruby | mit | 45 | master | 3,178 | require 'faraday'
require_relative 'error'
require_relative 'version'
Dir[File.expand_path('../resources/*.rb', __FILE__)].each { |f| require f }
module Closeio
class Client
include Closeio::Client::Activity
include Closeio::Client::BulkAction
include Closeio::Client::Contact
include Closeio::Client... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/integration_link.rb | Ruby | mit | 45 | master | 652 | module Closeio
class Client
module IntegrationLink
def list_integration_links
get(integration_link_path)
end
def find_integration_link(id)
get("#{integration_link_path}#{id}/")
end
def create_integration_link(options = {})
post(integration_link_path, options... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/custom_activity.rb | Ruby | mit | 45 | master | 663 | module Closeio
class Client
module CustomActivity
def list_custom_activities(options = {})
get(custom_activity_path, options)
end
def find_custom_activity(id)
get("#{custom_activity_path}#{id}/")
end
def create_custom_activity(options = {})
post(custom_activ... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/task.rb | Ruby | mit | 45 | master | 530 | module Closeio
class Client
module Task
def list_tasks(options = {})
get(task_path, options)
end
def find_task(id)
get(task_path(id))
end
def create_task(options = {})
post(task_path, options)
end
def update_task(id, options = {})
put(ta... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/contact.rb | Ruby | mit | 45 | master | 572 | module Closeio
class Client
module Contact
def list_contacts(options = {})
get(contact_path, options)
end
def find_contact(id)
get(contact_path(id))
end
def create_contact(options = {})
post(contact_path, options)
end
def update_contact(id, opti... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/sequence.rb | Ruby | mit | 45 | master | 567 | module Closeio
class Client
module Sequence
def list_sequences
get(sequence_path, {})
end
def find_sequence(id)
get(sequence_path(id))
end
def create_sequence(options = {})
post(sequence_path, options)
end
def update_sequence(id, options = {})
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/opportunity.rb | Ruby | mit | 45 | master | 740 | module Closeio
class Client
module Opportunity
def list_opportunities(options = {}, paginate = false)
if paginate
paginate(opportunity_path, options)
else
get(opportunity_path, options)
end
end
def find_opportunity(id)
get(opportunity_path(id)... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/email_template.rb | Ruby | mit | 45 | master | 995 | module Closeio
class Client
module EmailTemplate
def list_email_templates(params = {}, paginate = false)
if paginate
paginate(email_template_path, params)
else
get(email_template_path, params)
end
end
def find_email_template(id)
get("#{email_t... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/sequence_subscription.rb | Ruby | mit | 45 | master | 666 | module Closeio
class Client
module SequenceSubscription
def list_sequence_subscriptions(options = {})
get(sequence_subscription_path, options)
end
def find_sequence_subscription(id)
get(sequence_subscription_path(id))
end
def create_sequence_subscription(options = {... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/opportunity_status.rb | Ruby | mit | 45 | master | 613 | module Closeio
class Client
module OpportunityStatus
def list_opportunity_statuses
get(opportunity_status_path)
end
def create_opportunity_status(options = {})
post(opportunity_status_path, options)
end
def update_opportunity_status(id, options = {})
put(opp... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/email_activity.rb | Ruby | mit | 45 | master | 764 | module Closeio
class Client
module EmailActivity
def list_email_activities(options = {}, paginate = false)
if paginate
paginate(email_activity_path, options)
else
get(email_activity_path, options)
end
end
def find_email_activity(id)
get("#{ema... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/bulk_action.rb | Ruby | mit | 45 | master | 745 | module Closeio
class Client
module BulkAction
def list_bulk_emails
get(bulk_action_path)
end
def send_bulk_email(options = {})
post("#{bulk_action_path}email/", options)
end
def bulk_delete(options = {})
post("#{bulk_action_path}delete/", options)
end
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/lead.rb | Ruby | mit | 45 | master | 892 | module Closeio
class Client
module Lead
def list_leads(query = {}, paginate = false, fields = nil, options = {})
options[:_fields] = fields if fields
params = assemble_list_query query, options
if paginate
paginate(lead_path, params)
else
get(lead_path, p... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/organization.rb | Ruby | mit | 45 | master | 252 | module Closeio
class Client
module Organization
def find_organization(id)
get("organization/#{id}/")
end
def update_organization(id, options = {})
put("organization/#{id}/", options)
end
end
end
end |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/webhook.rb | Ruby | mit | 45 | master | 549 | module Closeio
class Client
module Webhook
def list_webhooks
get(webhook_path)
end
def find_webhook(id)
get(webhook_path(id))
end
def create_webhook(options = {})
post(webhook_path, options)
end
def update_webhook(id, options = {})
put(w... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/activity.rb | Ruby | mit | 45 | master | 2,789 | module Closeio
class Client
module Activity
def list_activities(options = {})
get(activity_path, options)
end
#
# Note Activities
#
def list_notes(options = {})
get(note_path, options)
end
def find_note(id)
get("#{note_path}#{id}/")
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/smart_view.rb | Ruby | mit | 45 | master | 594 | module Closeio
class Client
module SmartView
def list_smart_views
get(smart_view_path)
end
def find_smart_view(id)
get(smart_view_path(id))
end
def create_smart_view(options = {})
post(smart_view_path, options)
end
def update_smart_view(id, opti... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/report.rb | Ruby | mit | 45 | master | 599 | module Closeio
class Client
module Report
# OPTIONS [date_start, date_end, user_id]
def activity_report(organization_id, options = {})
get("report/activity/#{organization_id}/?", options)
end
# OPTIONS [date_start, date_end]
def lead_status_report(organization_id, options = ... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/custom_field.rb | Ruby | mit | 45 | master | 606 | module Closeio
class Client
module CustomField
def list_custom_fields
get(custom_field_path)
end
def find_custom_field(id)
get("#{custom_field_path}#{id}/")
end
def create_custom_field(options = {})
post(custom_field_path, options)
end
def updat... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/custom_activity_type.rb | Ruby | mit | 45 | master | 354 | module Closeio
class Client
module CustomActivityType
def list_custom_activity_types
get(custom_activity_type_path)
end
def find_custom_activity_type(id)
get("#{custom_activity_type_path}#{id}/")
end
private
def custom_activity_type_path
'custom_activ... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/lead_status.rb | Ruby | mit | 45 | master | 529 | module Closeio
class Client
module LeadStatus
def list_lead_statuses
get(lead_status_path)
end
def create_lead_status(options = {})
post(lead_status_path, options)
end
def update_lead_status(id, options = {})
put(lead_status_path(id), options)
end
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/user.rb | Ruby | mit | 45 | master | 415 | module Closeio
class Client
module User
def list_users
get('user/')
end
def find_user(id)
get("user/#{id}/")
end
def me
get('me/')
end
def fetch_api_key
get("api_key/#{@api_key}/")
end
def available_users(organization_id)
... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/filter.rb | Ruby | mit | 45 | master | 224 | module Closeio
class Client
module Filter
def filter(body={})
post(advanced_filter_path, body)
end
private
def advanced_filter_path
'data/search/'
end
end
end
end |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/sequence_schedule.rb | Ruby | mit | 45 | master | 380 | module Closeio
class Client
module SequenceSchedule
def list_sequence_schedules
get(sequence_schedule_path, {})
end
def find_sequence_schedule(id)
get(sequence_schedule_path(id))
end
private
def sequence_schedule_path(id = nil)
id ? "sequence_schedule... |
github | taylorbrooks/closeio | https://github.com/taylorbrooks/closeio | lib/closeio/resources/event.rb | Ruby | mit | 45 | master | 206 | module Closeio
class Client
module Event
def list_events(options = {})
get('event/', options)
end
def find_event(id)
get("event/#{id}/")
end
end
end
end |
github | sj26/skinny | https://github.com/sj26/skinny | skinny.gemspec | Ruby | mit | 45 | master | 829 | Gem::Specification.new do |s|
s.name = "skinny"
s.version = File.read(File.expand_path("../VERSION", __FILE__)).strip
s.license = "MIT"
s.summary = "Thin WebSockets"
s.description = "Simple, upgradable WebSockets for Thin."
s.author = "Samuel Cochran"
s.email = "sj26@sj26.com"
s.homepage = "http://gith... |
github | sj26/skinny | https://github.com/sj26/skinny | Rakefile | Ruby | mit | 45 | master | 751 | require 'rubygems'
version_file = File.expand_path __FILE__ + '/../VERSION'
version = File.read(version_file).strip
spec_file = File.expand_path __FILE__ + '/../skinny.gemspec'
spec = Gem::Specification.load spec_file
require 'rdoc/task'
RDoc::Task.new :rdoc => "rdoc",
:clobber_rdoc => "rdoc:clean",
:rerdoc ... |
github | sj26/skinny | https://github.com/sj26/skinny | lib/skinny.rb | Ruby | mit | 45 | master | 12,946 | require 'base64'
require 'eventmachine'
require 'digest/md5'
require 'thin'
module Skinny
module Callbacks
def self.included base
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
module ClassMethods
def define_callback *names
names.each do ... |
github | dunglas/homebrew-frankenphp | https://github.com/dunglas/homebrew-frankenphp | Formula/frankenphp.rb | Ruby | mit | 45 | main | 3,146 | class Frankenphp < Formula
desc "Modern PHP app server"
homepage "https://frankenphp.dev"
url "https://github.com/dunglas/frankenphp/archive/refs/tags/v1.12.2.tar.gz"
sha256 "16872612075422c766be15880734c665e45536464e5717d022c5f048ffcb05d6"
license "MIT"
head "https://github.com/dunglas/frankenphp.git", bra... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | solargraph-rspec.gemspec | Ruby | mit | 45 | main | 1,437 | # frozen_string_literal: true
require_relative 'lib/solargraph/rspec/version'
Gem::Specification.new do |spec|
spec.name = 'solargraph-rspec'
spec.version = Solargraph::Rspec::VERSION
spec.authors = ['Lekë Mula']
spec.email = ['leke.mula@gmail.com']
spec.summary = 'Solargraph plugin supporting RSpec code c... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | Gemfile | Ruby | mit | 45 | main | 1,092 | # frozen_string_literal: true
source 'https://rubygems.org'
# Specify your gem's dependencies in solargraph-rspec.gemspec
gemspec
# Development Dependencies
gem 'appraisal' # Test against multiple versions of dependencies
gem 'bundler' # Dependency management
gem 'debug' # Debuggi... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | Appraisals | Ruby | mit | 45 | main | 298 | # frozen_string_literal: true
appraise 'default' do
# default gems from Gemfile
gem 'net-imap', '~> 0.4.0' # https://github.com/lsegal/yard/issues/1629
gem 'actionmailer', '>= 7'
gem 'airborne'
gem 'rspec-rails', '>= 7'
gem 'rspec-sidekiq'
gem 'shoulda-matchers'
gem 'webmock'
end |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/code_coverage.rb | Ruby | mit | 45 | main | 362 | # frozen_string_literal: true
# Code coverage
require 'simplecov' # Needs to be required first
require 'simplecov-cobertura'
SimpleCov.start do
primary_coverage :line
enable_coverage :branch
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::CoberturaFormatter,
... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/spec_helper.rb | Ruby | mit | 45 | main | 936 | # frozen_string_literal: true
require_relative 'code_coverage' # Needs to be required first
require 'solargraph-rspec'
require 'pry-byebug' unless ENV['NO_DEBUG'] # Useful for: `fswatch lib spec | NO_DEBUG=1 xargs -n1 -I{} rspec`
require 'unparser' # For debugging AST nodes
Solargraph.logger.level = Logger::WARN
YARD... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/support/solargraph_helpers.rb | Ruby | mit | 45 | main | 3,737 | # frozen_string_literal: true
module SolargraphHelpers
def load_string(filename, str)
source = parse_string(filename, str)
api_map.map(source) # api_map should be defined in the spec
source
end
# Util method to parse (but NOT load) a string
# This method is mostly here for heredocs
#
# @param ... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/gems_spec.rb | Ruby | mit | 45 | main | 19,709 | # frozen_string_literal: true
RSpec.describe Solargraph::Rspec::Gems do
let(:api_map) { Solargraph::ApiMap.new }
let(:library) { Solargraph::Library.new }
let(:filename) { File.expand_path('spec/models/some_namespace/transaction_spec.rb') }
describe 'rspec' do
it 'finds definition of DSL methods' do
... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/rspec_configure_spec.rb | Ruby | mit | 45 | main | 4,825 | # frozen_string_literal: true
RSpec.describe Solargraph::Rspec::RSpecConfigure do
let(:api_map) { Solargraph::ApiMap.new }
let(:helper_file_path) { 'spec/spec_helper.rb' }
let(:spec_file_path) { File.expand_path('spec/models/transaction_spec.rb') }
before do
# For performance reasons, avoid solargraph loa... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/spec_configuration_walker_spec.rb | Ruby | mit | 45 | main | 1,957 | # frozen_string_literal: true
RSpec.describe Solargraph::Rspec::SpecConfigurationWalker do
describe '#extract_included_modules' do
it 'extracts modules from RSpec.configure blocks' do
ast = Solargraph::Parser.parse(%(
RSpec.configure do |config|
config.include ModuleName
config.... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/convention_spec.rb | Ruby | mit | 45 | main | 25,533 | # frozen_string_literal: true
require 'tmpdir'
RSpec.describe Solargraph::Rspec::Convention do
let(:api_map) { Solargraph::ApiMap.new }
let(:library) { Solargraph::Library.new }
let(:filename) { File.expand_path('spec/models/some_namespace/transaction_spec.rb') }
before do
# For performance reasons, avoi... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/spec_walker_spec.rb | Ruby | mit | 45 | main | 8,495 | # frozen_string_literal: true
RSpec.describe Solargraph::Rspec::SpecWalker do
let(:api_map) { Solargraph::ApiMap.new }
let(:filename) { File.expand_path('spec/models/some_namespace/transaction_spec.rb') }
let(:config) { Solargraph::Rspec::Config.new }
let(:source_map) { api_map.source_maps.first }
before do... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/fixture_debug_spec.rb | Ruby | mit | 45 | main | 819 | # frozen_string_literal: true
# NOTE: This spec is disabled and meant only for debugging rspec files specifically.
# It loads external fixture files to test solargraph-rspec completion behavior.
# Enable by changing `xdescribe` to `describe` when debugging fixture file completion.
RSpec.xdescribe 'Fixture Debug' do
... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | spec/solargraph/rspec/spec_walker/node_types_spec.rb | Ruby | mit | 45 | main | 4,218 | # frozen_string_literal: true
RSpec.describe Solargraph::Rspec::SpecWalker::NodeTypes do
def parse(code)
Solargraph::Parser.parse(code)
end
describe '.a_block?' do
it 'returns true for block nodes' do
node = parse('describe "something" do end')
expect(described_class.a_block?(node)).to be(tr... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | bin/vernier.rb | Ruby | mit | 45 | main | 815 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'solargraph'
require 'solargraph-rspec'
require 'vernier'
require 'fileutils'
require 'benchmark'
puts <<~MSG
NOTE: Ensure you have build and installed the latest version of solargraph-rspec
gem build
gem install solargraph-rs... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph-rspec.rb | Ruby | mit | 45 | main | 274 | # rubocop:disable Naming/FileName
# frozen_string_literal: true
require 'solargraph'
require_relative 'solargraph/rspec/version'
require_relative 'solargraph/rspec/convention'
Solargraph::Convention.register Solargraph::Rspec::Convention
# rubocop:enable Naming/FileName |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/rspec_configure.rb | Ruby | mit | 45 | main | 2,027 | # frozen_string_literal: true
require_relative 'spec_configuration_walker'
require_relative 'pin_factory'
module Solargraph
module Rspec
# Handles RSpec.configure ... config.include parsing
# Provides pins for modules included globally via RSpec.configure
class RSpecConfigure
# @param config [Conf... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/pin_factory.rb | Ruby | mit | 45 | main | 3,578 | # frozen_string_literal: true
# Credits: This file was originally copied and adapted from the solargraph-rails gem.
module Solargraph
module Rspec
# Factory class for building pins and references.
module PinFactory
# @param namespace [Solargraph::Pin::Namespace]
# @param name [String]
# @p... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/convention.rb | Ruby | mit | 45 | main | 5,247 | # frozen_string_literal: true
require_relative 'config'
require_relative 'spec_walker'
require_relative 'annotations'
require_relative 'correctors/context_block_namespace_corrector'
require_relative 'correctors/example_and_hook_blocks_binding_corrector'
require_relative 'correctors/described_class_corrector'
require_r... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_configuration_walker.rb | Ruby | mit | 45 | main | 2,541 | # frozen_string_literal: true
require_relative 'walker'
require_relative 'spec_walker/full_constant_name'
module Solargraph
module Rspec
# Walks AST to find RSpec.configure blocks and extract included modules
class SpecConfigurationWalker
# @param ast [::Parser::AST::Node]
# @param filename [Str... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/walker.rb | Ruby | mit | 45 | main | 2,675 | # frozen_string_literal: true
#
# Credits: This file was originally copied and adapted from the solargraph-rails gem
module Solargraph
module Rspec
class Walker
class ParsingError < StandardError; end
class Hook
attr_reader :node_type
# @param node_type [Symbol]
# @param ar... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_walker.rb | Ruby | mit | 45 | main | 7,121 | # frozen_string_literal: true
require_relative 'walker'
require_relative 'spec_walker/node_types'
require_relative 'spec_walker/full_constant_name'
require_relative 'spec_walker/rspec_context_namespace'
require_relative 'spec_walker/fake_let_method'
module Solargraph
module Rspec
class SpecWalker
# @param... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/config.rb | Ruby | mit | 45 | main | 2,004 | # frozen_string_literal: true
module Solargraph
module Rspec
# @example .solargraph.yml configuration for rspec
# rspec:
# let_methods:
# - let_it_be
# config_helper_files:
# - spec/spec_helper.rb
# - spec/rails_helper.rb
class Config
def initialize(s... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/gems.rb | Ruby | mit | 45 | main | 3,269 | # frozen_string_literal: true
module Solargraph
module Rspec
class Gems
# rubocop:disable YARD/MeaninglessTag
# @param required_gems [Array<String>]
# @param helper_modules [Array<String>]
# rubocop:enable YARD/MeaninglessTag
GemHelpers = Struct.new(:required_gems, :helper_modules, ... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/annotations.rb | Ruby | mit | 45 | main | 227 | # frozen_string_literal: true
# @!override ActionController::TestCase::Behavior#request
# @return [ActionDispatch::Request]
#
# @!override ActionController::TestCase::Behavior#response
# @return [ActionDispatch::Response] |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/subject_method_corrector.rb | Ruby | mit | 45 | main | 4,112 | # frozen_string_literal: true
require_relative 'let_methods_corrector'
module Solargraph
module Rspec
module Correctors
# Defines let-like methods in the example group block
class SubjectMethodCorrector < LetMethodsCorrector
# @param _source_map [Solargraph::SourceMap]
# @return [voi... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/context_block_namespace_corrector.rb | Ruby | mit | 45 | main | 2,130 | # frozen_string_literal: true
require_relative 'base'
module Solargraph
module Rspec
module Correctors
# RSpec generates a namespace class for each context block. This corrector add the pins for those namespaces.
class ContextBlockNamespaceCorrector < Base
# @param source_map [Solargraph::So... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/base.rb | Ruby | mit | 45 | main | 4,163 | # frozen_string_literal: true
module Solargraph
module Rspec
module Correctors
# A corrector of RSpec parsed pins by Solargraph
# @abstract
class Base
# @return [Array<Solargraph::Pin::Namespace>]
attr_reader :namespace_pins
# @return [Solargraph::Rspec::SpecWalker]
... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/described_class_corrector.rb | Ruby | mit | 45 | main | 1,339 | # frozen_string_literal: true
require_relative 'base'
module Solargraph
module Rspec
module Correctors
# Defines `described_class` method in the example group block
class DescribedClassCorrector < Base
# @param _source_map [Solargraph::SourceMap]
# @return [void]
def correct(... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/example_and_hook_blocks_binding_corrector.rb | Ruby | mit | 45 | main | 2,345 | # frozen_string_literal: true
require_relative 'base'
module Solargraph
module Rspec
module Correctors
# RSpec executes example and hook blocks in the context of the example group (ie. describe blocks).
# This correctors sets the right bindings to those blocks.
class ExampleAndHookBlocksBindin... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/dsl_methods_corrector.rb | Ruby | mit | 45 | main | 1,141 | # frozen_string_literal: true
require_relative 'base'
require 'yard'
module Solargraph
module Rspec
module Correctors
# Corrects RSpec DSL methods in the specs by adding superclass references to the namespace pins (ie. contexts).
# The DSLs methods are generated by rspec-core YARD annotations define... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/correctors/let_methods_corrector.rb | Ruby | mit | 45 | main | 1,350 | # frozen_string_literal: true
require_relative 'base'
module Solargraph
module Rspec
module Correctors
# Defines let-like methods in the example group block
class LetMethodsCorrector < Base
# @param _source_map [Solargraph::SourceMap]
# @return [void]
def correct(_source_map)... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_walker/full_constant_name.rb | Ruby | mit | 45 | main | 813 | # frozen_string_literal: true
module Solargraph
module Rspec
class SpecWalker
class FullConstantName
class << self
# @param ast [::Parser::AST::Node]
# @return [String]
def from_ast(ast)
parts = []
until ast.nil?
if ast.is_a? ::Pa... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_walker/rspec_context_namespace.rb | Ruby | mit | 45 | main | 1,790 | # frozen_string_literal: true
module Solargraph
module Rspec
class SpecWalker
class RspecContextNamespace
class << self
# @param block_ast [::Parser::AST::Node]
# @return [String, nil]
def from_block_ast(block_ast)
return unless block_ast.is_a?(::Parser::AS... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_walker/fake_let_method.rb | Ruby | mit | 45 | main | 853 | # frozen_string_literal: true
module Solargraph
module Rspec
class SpecWalker
class FakeLetMethod
MATCH_DO_END = /.*? do(.*)end/m
MATCH_CURLY = /{(.*)}/m
class << self
# Transforms let block to method ast node
# @param block_ast [::Parser::AST::Node]
#... |
github | lekemula/solargraph-rspec | https://github.com/lekemula/solargraph-rspec | lib/solargraph/rspec/spec_walker/node_types.rb | Ruby | mit | 45 | main | 2,570 | # frozen_string_literal: true
module Solargraph
module Rspec
class SpecWalker
class NodeTypes
# @param ast [::Parser::AST::Node]
# @return [Boolean]
def self.a_block?(ast)
ast.is_a?(::Parser::AST::Node) && ast.type == :block
end
# @param block_ast [::Parse... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | Capfile | Ruby | apache-2.0 | 45 | master | 1,070 | # frozen_string_literal: true
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# See sv man pages for more commands: http://smarden.org/runit/sv.8.html
RUNIT_COMMANDS = %w(status up down once exit restart force-shutdown force-restart)
# Includes default deployment tasks
require 'capistrano/deploy'
# Includ... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | Rakefile | Ruby | apache-2.0 | 45 | master | 293 | # frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CloudBenchmarking::Application.load_tasks |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | Guardfile | Ruby | apache-2.0 | 45 | master | 1,573 | # frozen_string_literal: true
require 'active_support/inflector'
# Guard docs: https://github.com/guard/guard
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | Gemfile | Ruby | apache-2.0 | 45 | master | 3,969 | # frozen_string_literal: true
source 'https://rubygems.org'
def ruby_version(file = '.ruby-version')
# Ensure that symlinks are correctly handled
path = File.join(File.dirname(__FILE__), file)
File.read(path).chomp!
end
ruby ruby_version
gem 'rails', '~> 5.2', '>= 5.2.1'
# General
gem 'silencer', '~> 1.0', '>=... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/routes.rb | Ruby | apache-2.0 | 45 | master | 1,695 | # frozen_string_literal: true
Rails.application.routes.draw do
devise_for :users
root 'dashboards#show'
get 'dashboard' => 'dashboards#show'
# Exceptions
%w( 404 422 500 ).each do |code|
match code, to: 'errors#show', code: code, via: :all
end
# Resources
resource :vagrant_config, only: [:edit, :... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/application.rb | Ruby | apache-2.0 | 45 | master | 3,505 | # frozen_string_literal: true
require_relative 'boot'
require 'csv'
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 CloudBenchmarking
class Application < Rails::Application
# Initialize ... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/unicorn.rb | Ruby | apache-2.0 | 45 | master | 694 | # frozen_string_literal: true
# Based on Heroku example: https://devcenter.heroku.com/articles/rails-unicorn
worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT inst... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/puma.rb | Ruby | apache-2.0 | 45 | master | 2,337 | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/deploy.rb | Ruby | apache-2.0 | 45 | master | 5,146 | # frozen_string_literal: true
# Capistrano 3 announcements: http://capistranorb.com/2013/06/01/release-announcement.html
# Capistrano 3 docs: https://github.com/capistrano/capistrano
# For path helpers see: 'Capistrano::DSL::Paths' in capistrano/lib/capistrano/dsl/paths.rb
# Capistrano
# ----------
# Config valid onl... |
github | sealuzh/cloud-workbench | https://github.com/sealuzh/cloud-workbench | config/deploy/development.rb | Ruby | apache-2.0 | 45 | master | 429 | # frozen_string_literal: true
set :rails_env, :production # dont try and infer something as important as environment from stage name.
server '33.33.33.20', user: 'deploy', roles: %w{web app db}
set :delayed_job_workers, 2
# set :branch, 'branch-name'
namespace :deploy do
after 'deploy:restart', :create_default_user... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.