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
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
db/migrate/20141004024109_create_trip_geohashes.rb
Ruby
mit
90
main
256
class CreateTripGeohashes < ActiveRecord::Migration[4.2] def change create_table :trip_geohashes do |t| t.references :trip, index: true t.string :geohash end add_index :trip_geohashes, [:geohash, :trip_id], unique: true end end
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
db/migrate/20141001231532_create_gtfs_engine_fare_attributes.gtfs_engine.rb
Ruby
mit
90
main
578
# This migration comes from gtfs_engine (originally 20140405235947) class CreateGtfsEngineFareAttributes < ActiveRecord::Migration[4.2] TABLE = :gtfs_engine_fare_attributes def change create_table TABLE do |t| t.string :fare_id, null: false t.float :price, null: false ...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/deploy.rb
Ruby
mit
90
main
2,862
# Change these server 'chester.me', roles: [:web, :app, :db], primary: true set :repo_url, 'git@github.com:chesterbr/cruzalinhas.git' set :application, 'cruzalinhas' set :user, 'chester' set :puma_threads, [4, 16] set :puma_workers, 0 set :rbenv_type, :user set :rbenv_ruby, "2.1....
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/application.rb
Ruby
mit
90
main
995
require_relative "boot" 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 Cruzalinhas class Application < Rails::Application # Initialize configuration defaults for originally generated Rai...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/routes.rb
Ruby
mit
90
main
305
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get 'linhasquepassam' => 'python_api#linhasquepassam' get 'linha' => 'python_api#linha' get 'version' => 'home#version' root 'home#index' end
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/environments/production.rb
Ruby
mit
90
main
4,834
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your app...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/initializers/gtfs_engine.rb
Ruby
mit
90
main
547
require 'gtfs_engine/agency' require 'gtfs_engine/calendar' require 'gtfs_engine/calendar_date' require 'gtfs_engine/data_set' require 'gtfs_engine/fare_attribute' require 'gtfs_engine/fare_rule' require 'gtfs_engine/feed_info' require 'gtfs_engine/frequency' require 'gtfs_engine/route' require 'gtfs_engine/shape' requ...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
config/deploy/production.rb
Ruby
mit
90
main
1,443
# Simple Role Syntax # ================== # Supports bulk-adding hosts to roles, the primary server in each group # is considered to be the first unless any hosts have the primary # property set. Don't declare `role :all`, it's a meta role. # role :app, %w{chester.me} # role :web, %w{chester.me} # role :db, %w{chest...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
spec/rails_helper.rb
Ruby
mit
90
main
1,966
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirector...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
app/controllers/python_api_controller.rb
Ruby
mit
90
main
844
class PythonApiController < ApplicationController def linhasquepassam geohash = GeoHash.encode params[:lat].to_f, params[:lng].to_f, Rails.configuration.geohash_precision trips = TripGeohash.includes(:trip, :trip => :route).where(:geohash => geohash).m...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
lib/tasks/sptrans_import.rake
Ruby
mit
90
main
1,361
namespace :sptrans do desc 'Imports data downloaded from SPTrans' task :import => :environment do puts "### STEP 1 OF 2 - Importing GTFS data from OpenMobilityData" FileUtils.mkdir_p "tmp/cache" next unless system("echo 'Downloading...'; wget https://files.mobilitydatabase.org/mdb-8/latest.zip -O/tmp/gt...
github
chesterbr/cruzalinhas
https://github.com/chesterbr/cruzalinhas
lib/tasks/geohashes.rake
Ruby
mit
90
main
647
namespace :geohashes do desc "Recalculates the hashes for the first trip of each route" task rehash: :environment do TripGeohash.delete_all GtfsEngine::Route.all.each do |route| next if route.trips.empty? puts "#{route.route_short_name} #{route.route_long_name}" trip = route.trips.first ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
Appraisals
Ruby
bsd-3-clause
90
master
409
appraise 'spree-4-0' do gem 'spree', '~> 4.0' gem 'spree_auth_devise', '~> 4.0' end appraise 'spree-4-1' do gem 'spree', '~> 4.1' gem 'spree_auth_devise', '~> 4.1' gem 'rails-controller-testing' end appraise 'spree-master' do gem 'spree', github: 'spree/spree', branch: 'master' gem 'spree_auth_devise', ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
Rakefile
Ruby
bsd-3-clause
90
master
363
require 'bundler' require "rubygems" require "bundler/setup" Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' require 'spree/testing_support/common_rake' RSpec::Core::RakeTask.new task default: :spec desc 'Generates a dummy app for testing' task :test_app do ENV['LIB_NAME'] = 'spree_print_invoice' ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spree-print-invoice.gemspec
Ruby
bsd-3-clause
90
master
1,670
# coding: utf-8 lib = File.expand_path('../lib/', __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) require 'spree_print_invoice/version' Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_print_invoice' s.version = SpreePrintInvoice.version s.summary ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
Guardfile
Ruby
bsd-3-clause
90
master
702
group :red_green_refactor, halt_on_fail: true do guard 'rspec', cmd: 'bundle exec rspec' do watch('spec/spec_helper.rb') { 'spec' } watch('config/routes.rb') { 'spec/controllers' } watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.r...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
db/migrate/20150616133616_create_spree_bookkeeping_documents.rb
Ruby
bsd-3-clause
90
master
405
class CreateSpreeBookkeepingDocuments < SpreeExtension::Migration[4.2] def change create_table :spree_bookkeeping_documents do |t| t.references :printable, polymorphic: true t.string :template t.string :number t.string :firstname t.string :lastname t.string :email t.decim...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/controllers/spree/admin/bookkeeping_documents_controller.rb
Ruby
bsd-3-clause
90
master
1,234
module Spree module Admin class BookkeepingDocumentsController < ResourceController before_action :load_order, if: :order_focused? helper_method :order_focused? def show respond_with(@bookkeeping_document) do |format| format.pdf do send_data @bookkeeping_document....
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/controllers/spree/admin/print_invoice_settings_controller.rb
Ruby
bsd-3-clause
90
master
599
module Spree module Admin class PrintInvoiceSettingsController < ResourceController def update settings = Spree::PrintInvoiceSetting.new preferences = params && params.key?(:preferences) ? params.delete(:preferences) : params preferences.each do |name, value| next unless se...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/bookkeeping_document.rb
Ruby
bsd-3-clause
90
master
4,175
module Spree class BookkeepingDocument < ActiveRecord::Base PERSISTED_ATTRS = [ :firstname, :lastname, :email, :total, :number ] # Spree::BookkeepingDocument cares about creating PDFs. Whenever it needs to know # anything about the document to send to the view, it asks a...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/order_decorator.rb
Ruby
bsd-3-clause
90
master
1,784
# frozen_string_literal: true module Spree module OrderDecorator def self.prepended(base) base.has_many :bookkeeping_documents, as: :printable, dependent: :destroy base.has_one :invoice, -> { where(template: 'invoice') }, class_name: 'Spree::BookkeepingDocument', ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/base_view.rb
Ruby
bsd-3-clause
90
master
716
# frozen_string_literal: true require 'forwardable' module Spree class Printables::BaseView extend Forwardable extend Spree::DisplayMoney attr_reader :printable money_methods :item_total, :total def initialize(printable) @printable = printable end def firstname raise NotI...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/order/invoice_view.rb
Ruby
bsd-3-clause
90
master
929
module Spree class Printables::Order::InvoiceView < Printables::Invoice::BaseView def_delegators :@printable, :email, :bill_address, :ship_address, :tax_address, :item_total, :total, ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/invoice/base_view.rb
Ruby
bsd-3-clause
90
master
1,742
require 'forwardable' module Spree class Printables::Invoice::BaseView < Printables::BaseView extend Forwardable extend Spree::DisplayMoney attr_reader :printable money_methods :item_total, :total def bill_address raise NotImplementedError, 'Please implement bill_address' end de...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/invoice/adjustment.rb
Ruby
bsd-3-clause
90
master
268
module Spree class Printables::Invoice::Adjustment extend Spree::DisplayMoney attr_accessor :label, :amount money_methods :amount def initialize(args = {}) args.each do |key, value| send("#{key}=", value) end end end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/invoice/item.rb
Ruby
bsd-3-clause
90
master
307
module Spree class Printables::Invoice::Item extend Spree::DisplayMoney attr_accessor :sku, :name, :options_text, :price, :quantity, :total money_methods :price, :total def initialize(args = {}) args.each do |key, value| send("#{key}=", value) end end end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/models/spree/printables/shipment/packaging_slip_view.rb
Ruby
bsd-3-clause
90
master
275
module Spree class Printables::Shipment::PackagingSlipView def initialize(shipment) @shipment = shipment end def display_number @shipment.number end def date @shipment.shipped_at end def shipment nil end end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/overrides/add_print_invoice_links_to_admin_order_tabs.rb
Ruby
bsd-3-clause
90
master
259
# frozen_string_literal: true Deface::Override.new( virtual_path: 'spree/admin/shared/_order_tabs', name: 'print_invoice_order_tab_links', insert_bottom: '[data-hook="admin_order_tabs"]', partial: 'spree/admin/orders/print_invoice_order_tab_links' )
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/overrides/add_documents_to_main_navigation.rb
Ruby
bsd-3-clause
90
master
438
# frozen_string_literal: true if Spree.version.to_f < 4.0 Deface::Override.new( virtual_path: 'spree/layouts/admin', insert_bottom: '#main-sidebar', partial: 'spree/admin/shared/menu/documents_tab', name: 'documents_tab' ) else Deface::Override.new( virtual_path: 'spree/admin/shared/_main_men...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
app/overrides/add_print_invoice_to_admin_configuration_sidebar.rb
Ruby
bsd-3-clause
90
master
396
# frozen_string_literal: true Deface::Override.new( virtual_path: 'spree/admin/shared/sub_menu/_configuration', name: 'print_invoice_admin_configurations_menu', insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]', text: '<%= configurations_sidebar_menu_item Spree.t(:settings, scope: :print_invoice...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
config/routes.rb
Ruby
bsd-3-clause
90
master
408
Spree::Core::Engine.add_routes do namespace :admin do # https://github.com/spree/spree/blob/3-0-stable/backend/config/routes.rb#L73 resources :orders do resources :bookkeeping_documents, only: :index do get 'refresh', on: :collection end end resource :print_invoice_settings, only:...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/spree_print_invoice.rb
Ruby
bsd-3-clause
90
master
246
require 'spree_core' require 'spree_print_invoice/engine' require 'spree_print_invoice/version' require 'prawn-rails' require 'spree_print_invoice/prawn_rails_configuration' require 'spree_extension' module Spree module PrintInvoice end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/spree/print_invoice_setting.rb
Ruby
bsd-3-clause
90
master
2,875
module Spree class PrintInvoiceSetting < Preferences::Configuration preference :next_number, :integer, default: nil preference :logo_path, :string, default: 'admin/logo.png' preference :page_size, :string, default: 'LETTER' preference :page_layout, :string, default: 'landsca...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/generators/spree_print_invoice/templates/templates_generator.rb
Ruby
bsd-3-clause
90
master
294
module SpreePrintInvoice module Generators class TemplatesGenerator < Rails::Generators::Base source_root File.expand_path('../../../../../app/views/spree', __FILE__) def copy_templates directory 'printables', 'app/views/spree/printables' end end end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/generators/spree_print_invoice/install/install_generator.rb
Ruby
bsd-3-clause
90
master
758
module SpreePrintInvoice module Generators class InstallGenerator < Rails::Generators::Base class_option :auto_run_migrations, type: :boolean, default: true def add_javascripts append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_print_invoice\n" ...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/spree_print_invoice/prawn_rails_configuration.rb
Ruby
bsd-3-clause
90
master
668
module Spree module PrintInvoice class PrawnRailsConfiguration def page_layout @_page_layout ||= Spree::PrintInvoice::Config.page_layout.to_sym end def page_size @_page_size ||= Spree::PrintInvoice::Config.page_size end def skip_page_creation false end...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/spree_print_invoice/version.rb
Ruby
bsd-3-clause
90
master
346
module SpreePrintInvoice module_function # Returns the version of the currently loaded SpreePrintInvoice as a # <tt>Gem::Version</tt>. def version Gem::Version.new VERSION::STRING end module VERSION MAJOR = 3 MINOR = 0 TINY = 0 PRE = 'beta' STRING = [MAJOR, MINOR, TINY, PRE].co...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
lib/spree_print_invoice/engine.rb
Ruby
bsd-3-clause
90
master
714
module SpreePrintInvoice class Engine < Rails::Engine require 'spree/core' isolate_namespace Spree engine_name 'spree_print_invoice' config.autoload_paths += %W(#{config.root}/lib) initializer 'spree.print_invoice.preferences', before: :load_config_initializers do Spree::PrintInvoice::Conf...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/spec_helper.rb
Ruby
bsd-3-clause
90
master
1,106
require 'simplecov' SimpleCov.start do add_filter 'spec' add_group 'Controllers', 'app/controllers' add_group 'Overrides', 'app/overrides' add_group 'Models', 'app/models' add_group 'Libraries', 'lib' end ENV['RAILS_ENV'] ||= 'test' begin require File.expand_path('../dummy/config/environment', __FILE_...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/models/spree/bookkeeping_document_spec.rb
Ruby
bsd-3-clause
90
master
2,928
RSpec.describe Spree::BookkeepingDocument do let(:printable) { Spree::Order.new } let(:template) { 'invoice' } subject { Spree::BookkeepingDocument.new(printable: printable, template: 'invoice') } describe 'attributes' do it { is_expected.to respond_to(:printable) } it { is_expected.to respond_to(:temp...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/models/spree/order_spec.rb
Ruby
bsd-3-clause
90
master
2,916
# frozen_string_literal: true RSpec.describe Spree::Order do describe 'delegates' do let(:order) { Spree::Order.new } let(:invoice) { Spree::BookkeepingDocument.new(printable: order, template: 'invoice') } before do allow(order).to receive(:invoice) { invoice } end describe '#invoice_numb...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/models/spree/printables/base_view_spec.rb
Ruby
bsd-3-clause
90
master
1,304
RSpec.describe Spree::Printables::BaseView do let(:printable) { Object.new } let(:base_view) { Spree::Printables::BaseView.new(printable) } describe 'initialization' do it 'assigns printable' do expect(base_view).to respond_to(:printable) expect(base_view.printable).to eq(printable) end end...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/models/spree/printables/invoice/base_view_spec.rb
Ruby
bsd-3-clause
90
master
2,538
RSpec.describe Spree::Printables::Invoice::BaseView do let(:printable) { Object.new } let(:base_view) { Spree::Printables::Invoice::BaseView.new(printable) } describe '#bill_address' do it 'raises a NotImplementedError' do expect do base_view.bill_address end.to raise_error(NotImplemented...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/models/spree/printables/order/invoice_view_spec.rb
Ruby
bsd-3-clause
90
master
1,823
RSpec.describe Spree::Printables::Order::InvoiceView do let(:invoiceable) { Spree::Order.new } let(:invoice_view) { Spree::Printables::Order::InvoiceView.new(invoiceable) } describe '#bill_address' do it 'calls the orders bill address' do expect(invoiceable).to receive(:bill_address) invoice_view...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/controllers/spree/admin/bookkeeping_documents_controller_spec.rb
Ruby
bsd-3-clause
90
master
3,361
RSpec.describe Spree::Admin::BookkeepingDocumentsController, type: :controller do stub_authorization! before do reset_spree_preferences user = build(:admin_user) allow(controller).to receive(:try_spree_current_user).and_return(user) end describe '#show as :pdf' do context 'an order invoice' do...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/controllers/spree/admin/print_invoice_settings_controller_spec.rb
Ruby
bsd-3-clause
90
master
3,801
RSpec.describe Spree::Admin::PrintInvoiceSettingsController, type: :controller do stub_authorization! before do reset_spree_preferences user = build(:admin_user) allow(controller).to receive(:try_spree_current_user).and_return(user) end context '#update' do it 'redirects to print invoice setti...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/features/spree/admin/print_invoice_settings_spec.rb
Ruby
bsd-3-clause
90
master
1,819
RSpec.feature 'Settings for Print Invoice' do stub_authorization! scenario 'can update settings', :js do visit spree.edit_admin_print_invoice_settings_path check 'use_footer' check 'use_page_numbers' fill_in 'logo_path', with: '/somewhere/logo.png' fill_in 'next_number', with: '200' sele...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/features/spree/admin/print_invoice_spec.rb
Ruby
bsd-3-clause
90
master
1,998
RSpec.feature 'Admin print invoice feature' do stub_authorization! let!(:order) { create(:invoiceable_order) } scenario 'shows documents button on order page.' do visit spree.edit_admin_order_path(id: order.number) within('#sidebar') do expect(page).to have_link Spree.t(:documents, scope: :print_...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/factories/invoiceable_order_factory.rb
Ruby
bsd-3-clause
90
master
925
FactoryBot.define do factory :invoiceable_order, class: Spree::Order do user bill_address ship_address completed_at { nil } email { user.email } state { 'confirm' } store transient do line_items_count { 1 } line_items_price { 10 } shipment_cost { 100 } shipping...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/support/database_cleaner.rb
Ruby
bsd-3-clause
90
master
441
require 'database_cleaner' RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with :truncation end config.before do DatabaseCleaner.strategy = :transaction end config.before(:each, :js) do DatabaseCleaner.strategy = :truncation end config.before do Spree::Prefer...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/support/spree.rb
Ruby
bsd-3-clause
90
master
495
require 'spree/testing_support/factories' require 'spree/testing_support/preferences' require 'spree/testing_support/controller_requests' require 'spree/testing_support/authorization_helpers' require 'spree/testing_support/url_helpers' require 'spree/testing_support/capybara_ext' RSpec.configure do |config| config.i...
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/support/capybara.rb
Ruby
bsd-3-clause
90
master
307
require 'capybara/rspec' require 'capybara/rails' require 'capybara/poltergeist' RSpec.configure do Capybara.server = :webrick Capybara.javascript_driver = :poltergeist Capybara.register_driver(:poltergeist) do |app| Capybara::Poltergeist::Driver.new app, js_errors: true, timeout: 90 end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/support/helpers/select2.rb
Ruby
bsd-3-clause
90
master
226
# frozen_string_literal: true module Select2 def select_select2_dropdown(selector, value) first("#s2id_#{selector}.select2-container").click find('.select2-search .select2-input').send_keys(value, :enter) end end
github
spree-contrib/spree_print_invoice
https://github.com/spree-contrib/spree_print_invoice
spec/lib/spree/print_invoice_setting_spec.rb
Ruby
bsd-3-clause
90
master
1,747
RSpec.describe Spree::PrintInvoiceSetting do subject { described_class.new } describe '#page_sizes' do it 'has a list of page sizes' do expect(subject.page_sizes).to be_a(Array) expect(subject.page_sizes.size).to be(50) end end describe '#page_layouts' do it 'has a list of layouts' do ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
metadata.rb
Ruby
apache-2.0
90
main
461
name 'kafka' maintainer 'Sous-Chefs' maintainer_email 'help@sous-chefs.org' license 'Apache-2.0' description 'Installs and configures a Kafka broker' version '3.1.25' chef_version '>= 13.0' source_url 'https://github.com/mthssdrbrg/kafka-cookbook' issues_url 'htt...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
Berksfile
Ruby
apache-2.0
90
main
304
source 'https://supermarket.chef.io' metadata group :runit do cookbook 'yum-epel', '~> 2.0' cookbook 'packagecloud', '< 1.0' cookbook 'runit', '~> 3.0' end group :test do cookbook 'windows', '~> 3.0' cookbook 'homebrew', '~> 4.0' cookbook 'java', '~> 4.3.0' cookbook 'apt', '~> 6.0' end
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/runit/serverspec/service_spec.rb
Ruby
apache-2.0
90
main
4,117
require 'spec_helper' describe 'service for runit init style' do include_context 'service setup' let :start_command_string do 'sv start kafka' end let :stop_command_string do 'sv stop kafka' end let :status_command_string do 'sv status kafka' end def fetch_pid shell_out!('cat /etc/s...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/runit/serverspec/required_files_spec.rb
Ruby
apache-2.0
90
main
1,057
require 'spec_helper' describe 'required files for runit init style' do describe 'environment files' do let :env_dir do file path end let :path do '/etc/service/kafka/env' end it 'exists' do expect(env_dir).to be_a_directory end it 'is owned by root' do expect(e...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/sysv/serverspec/service_spec.rb
Ruby
apache-2.0
90
main
4,897
require 'spec_helper' describe 'service for sysv init style' do include_context 'service setup' let :start_command_string do 'service kafka start' end let :stop_command_string do 'service kafka stop' end let :status_command_string do 'service kafka status' end let :pidfile do file '...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/sysv/serverspec/required_files_spec.rb
Ruby
apache-2.0
90
main
1,039
require 'spec_helper' describe 'required files for sysv init style' do describe 'environment file' do let :env_file do file path end let :path do if debian? || ubuntu? '/etc/default/kafka' else '/etc/sysconfig/kafka' end end it 'exists' do expect(en...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/default/serverspec/default_spec.rb
Ruby
apache-2.0
90
main
2,333
require 'spec_helper' describe 'kafka::default' do describe group('kafka') do it { should exist } it { should have_gid(5678) } end describe user('kafka') do it { should exist } it { should have_uid(1234) } it { should belong_to_group('kafka') } it { should have_login_shell('/sbin/nologin...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/helpers/serverspec/spec_helper.rb
Ruby
apache-2.0
90
main
261
require 'serverspec' require 'support/await_helper' require 'support/files_common' require 'support/platform_helpers' require 'support/service_common' RSpec.configure do |config| config.backend = :exec config.fail_fast = true config.order = :random end
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/helpers/serverspec/support/service_common.rb
Ruby
apache-2.0
90
main
2,518
shared_context 'service setup' do let :kafka_service do service 'kafka' end let :start_command do start_kafka(true) end let :stop_command do stop_kafka(true) end let :log_file_path do '/var/log/kafka/kafka.log' end let :log_file do file(log_file_path) end let :status_comma...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/helpers/serverspec/support/await_helper.rb
Ruby
apache-2.0
90
main
253
module AwaitHelpers def await(max_time = 30) started_at = Time.now until yield sleep 1 raise 'Wait timed out!' if (Time.now - started_at) > max_time end end end RSpec.configure do |config| config.include(AwaitHelpers) end
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/helpers/serverspec/support/platform_helpers.rb
Ruby
apache-2.0
90
main
492
module PlatformHelpers def debian? family == 'debian' end def ubuntu? family == 'ubuntu' end def centos? family == 'redhat' && %w(5.9 6.4 6.5).include?(release) end def fedora? family == 'fedora' end def systemd? family == 'fedora' || family == 'redhat7' end private def...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/helpers/serverspec/support/files_common.rb
Ruby
apache-2.0
90
main
1,897
shared_examples_for 'a kafka file' do let :kafka_file do file(path) end it 'exists' do expect(kafka_file).to be_a_file end it 'is owned by kafka' do expect(kafka_file).to be_owned_by 'kafka' end it 'belongs to kafka group' do expect(kafka_file).to be_grouped_into 'kafka' end end shar...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/systemd/serverspec/required_files_spec.rb
Ruby
apache-2.0
90
main
982
require 'spec_helper' describe 'required files for systemd init style' do describe 'environment file' do let :env_file do file(debian? ? '/etc/default/kafka' : '/etc/sysconfig/kafka') end it 'exists' do expect(env_file).to be_a_file end it 'is owned by root' do expect(env_file...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/systemd/serverspec/service_spec.rb
Ruby
apache-2.0
90
main
4,214
require 'spec_helper' describe 'service for systemd init style' do include_context 'service setup' let :start_command_string do 'systemctl start kafka.service' end let :stop_command_string do 'systemctl stop kafka.service' end let :status_command_string do 'systemctl status kafka.service' ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/upstart/serverspec/service_spec.rb
Ruby
apache-2.0
90
main
4,136
require 'spec_helper' describe 'service for upstart init style' do include_context 'service setup' let :start_command_string do 'start kafka' end let :stop_command_string do 'stop kafka' end let :status_command_string do 'status kafka' end let :pidfile do file '/var/run/kafka.pid' ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
test/integration/upstart/serverspec/required_files_spec.rb
Ruby
apache-2.0
90
main
933
require 'spec_helper' describe 'required files for upstart init style' do describe 'environment file' do let :env_file do file '/etc/default/kafka' end it 'exists' do expect(env_file).to be_a_file end it 'is owned by root' do expect(env_file).to be_owned_by 'root' end ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
attributes/default.rb
Ruby
apache-2.0
90
main
6,861
# # Cookbook:: kafka # Attributes:: default # # # Version of Kafka to install. default['kafka']['version'] = '1.1.1' # # Base URL for Kafka releases. The recipes will a download URL using the # `base_url`, `version` and `scala_version` attributes. default['kafka']['base_url'] = 'https://archive.apache.org/dist/kafka'...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_setup.rb
Ruby
apache-2.0
90
main
785
# # Cookbook:: kafka # Recipe:: _setup # group node['kafka']['group'] do gid node['kafka']['gid'] if node['kafka']['gid'] only_if { node['kafka']['manage_user'] } end user node['kafka']['user'] do uid node['kafka']['uid'] if node['kafka']['uid'] group node['kafka']['group'] home '/var/empty/kafka' shell '...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/default.rb
Ruby
apache-2.0
90
main
240
# # Cookbook:: kafka # Recipe:: default # include_recipe 'kafka::_defaults' include_recipe 'kafka::_setup' include_recipe 'kafka::_install' include_recipe 'kafka::_configure' include_recipe 'kafka::_service' if node['kafka']['init_style']
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_install.rb
Ruby
apache-2.0
90
main
1,830
# # Cookbook:: kafka # Recipe:: _install # tar_gz = [kafka_version_name, 'tgz'].join('.') local_download_path = ::File.join(Chef::Config.file_cache_path, tar_gz) build_path = ::File.join(node['kafka']['build_dir'], kafka_version_name) remote_path = [node['kafka']['base_url'], node['kafka']['version'], tar_gz].join('/'...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_service.rb
Ruby
apache-2.0
90
main
1,908
# # Cookbook:: kafka # Recipe:: _service # file kafka_init_opts[:env_path] do owner 'root' group 'root' mode '644' content kafka_env.to_file_content(!kafka_systemd?) if restart_on_configuration_change? notifies :run, 'ruby_block[coordinate-kafka-start]', :delayed end end unless kafka_runit? template k...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_configure.rb
Ruby
apache-2.0
90
main
951
# # Cookbook:: kafka # Recipe:: _configure # directory node['kafka']['config_dir'] do owner node['kafka']['user'] group node['kafka']['group'] mode '755' recursive true end template ::File.join(node['kafka']['config_dir'], 'log4j.properties') do source 'log4j.properties.erb' owner node['kafka']['user'] ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_defaults.rb
Ruby
apache-2.0
90
main
560
# # Cookbook:: kafka # Recipe:: _defaults # unless node['kafka']['gc_log_opts'] node.default['kafka']['gc_log_opts'] = %W( -Xloggc:#{::File.join(node['kafka']['log_dir'], 'kafka-gc.log')} -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps ).join(' ') end unless node['kafka']['config_dir'] node.default['k...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
recipes/_coordinate.rb
Ruby
apache-2.0
90
main
250
# # Cookbook:: kafka # Recipe:: _coordinate # ruby_block 'coordinate-kafka-start' do block do Chef::Log.debug 'Default recipe to coordinate Kafka start is used' end action :nothing notifies :restart, kafka_service_resource, :delayed end
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
libraries/configuration.rb
Ruby
apache-2.0
90
main
850
# # Cookbook:: kafka # Libraries:: configuration # module Kafka module Configuration def render_option?(value) if value.is_a?(Array) !value.empty? elsif value.is_a?(Hash) value.values.all? do |v| render_option?(v) end else !value.nil? end end ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
libraries/helpers.rb
Ruby
apache-2.0
90
main
2,354
# # Cookbook:: kafka # Libraries:: helpers # def kafka_version_name %(kafka_#{node['kafka']['scala_version']}-#{node['kafka']['version']}) end def kafka_jar_path ::File.join(node['kafka']['install_dir'], 'libs', %(#{kafka_version_name}.jar)) end def kafka_installed? ::File.exist?(node['kafka']['install_dir']) ...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
libraries/log4j.rb
Ruby
apache-2.0
90
main
1,482
# # Cookbook:: kafka # Libraries:: log4j # module Kafka module Log4J def render_appender(name, options) prefix = format('log4j.appender.%s', name) content = [] options.each do |key, value| case key.to_sym when :type content.unshift(%(#{prefix}=#{value})) when :...
github
sous-chefs/kafka
https://github.com/sous-chefs/kafka
libraries/env.rb
Ruby
apache-2.0
90
main
1,235
# # Cookbook:: kafka # Libraries:: env # module Kafka class Env def initialize(attributes) @attributes = attributes end def to_h hash = {} ATTR_ENV_MAPPINGS.each do |attr_name, env_name| value = @attributes[attr_name] env_name ||= format('KAFKA_%s', attr_name.upcase) ...
github
IcaliaLabs/tailwindcss-rails
https://github.com/IcaliaLabs/tailwindcss-rails
tailwindcss.gemspec
Ruby
mit
89
master
1,128
# -*- encoding: utf-8 -*- # frozen_string_literal: true lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "tailwindcss/version" Gem::Specification.new do |spec| spec.name = "tailwindcss" spec.version = Tailwindcss::VERSION spec.authors ...
github
IcaliaLabs/tailwindcss-rails
https://github.com/IcaliaLabs/tailwindcss-rails
spec/spec_helper.rb
Ruby
mit
89
master
367
require "bundler/setup" require "tailwindcss" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with ...
github
IcaliaLabs/tailwindcss-rails
https://github.com/IcaliaLabs/tailwindcss-rails
lib/generators/tailwindcss/install_generator.rb
Ruby
mit
89
master
1,056
# frozen_string_literal: true require 'rails/generators/base' module Tailwindcss module Generators class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../../templates", __FILE__) def yarn_add_tailwindcss run "yarn --ignore-engines add tailwindcss@1.0.0 --tilde" ...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
Rakefile
Ruby
mit
89
main
2,314
require 'bundler' require 'bundler/setup' Bundler::GemHelper.install_tasks require 'rdoc/task' require 'rspec/core' require 'rspec/core/rake_task' require 'cucumber/rake/task' task :cleanup_rcov_files do rm_rf 'coverage.data' end desc "Run all examples" RSpec::Core::RakeTask.new(:spec) do |t| t.rspec_opts = %w[-...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
Gemfile
Ruby
mit
89
main
916
source 'https://rubygems.org' rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0' rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0' if rspec_version == 'master' gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git' gem "rspec", :git => 'git://github.com/rspec/rspec.git' gem "rspec-core", :git => 'gi...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
ammeter.gemspec
Ruby
mit
89
main
1,651
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "ammeter/version" Gem::Specification.new do |s| s.name = "ammeter" s.version = Ammeter::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Alex Rothenberg"] s.email = ["alex@alexrothenberg.com"] s.hom...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/output_capturer.rb
Ruby
mit
89
main
771
module Ammeter class OutputCapturer # Is this thread safe!?!? # This won't work with sub-processes def self.capture(io, &block) case io when :stdout capture_stdout(&block) when :stderr capture_stderr(&block) else raise "Unknown IO #{io}" end end ...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/init.rb
Ruby
mit
89
main
417
require 'rspec/core' require 'rspec/rails' if RSpec::Core::Version::STRING < '3' require 'ammeter/rspec/rspec_2_compatibility' # if rspec2 end require 'rails' require 'ammeter/output_capturer.rb' require 'ammeter/rspec/generator/example.rb' require 'ammeter/rspec/generator/matchers.rb' if Rails.respond_to?(:applica...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/rspec_2_compatibility.rb
Ruby
mit
89
main
545
require 'rspec/expectations' if RSpec::Expectations::Version::STRING < '3' { :match_when_negated => :match_for_should_not, :failure_message => :failure_message_for_should, :failure_message_when_negated => :failure_message_for_should_not }.each do |rspec3_method, rspec2_method| RSpec::Matchers::DSL::...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers.rb
Ruby
mit
89
main
276
require 'ammeter/rspec/generator/matchers/be_a_migration' require 'ammeter/rspec/generator/matchers/contain' require 'ammeter/rspec/generator/matchers/exist' require 'ammeter/rspec/generator/matchers/have_method' require 'ammeter/rspec/generator/matchers/have_correct_syntax'
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/example.rb
Ruby
mit
89
main
1,008
require 'rspec/core' require 'ammeter/rspec/generator/example/generator_example_group' require 'ammeter/rspec/generator/example/generator_example_helpers' RSpec::configure do |c| def c.escaped_path(*parts) Regexp.compile(parts.join('[\\\/]') + '[\\\/]') end generator_path_regex = c.escaped_path(%w[spec gene...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers/have_method.rb
Ruby
mit
89
main
314
RSpec::Matchers.define :have_method do |method| chain :containing do |content| @method_content = content.strip end match do |file_path| content = File.read(file_path) content =~ /(\s+)def #{method}(\(.+\))?(.*?)\n\1end/m && (@method_content.nil? ? true : $3.include?(@method_content)) end end
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers/contain.rb
Ruby
mit
89
main
1,531
RSpec::Matchers.define :contain do |*expected_contents| match do |file_path| @actual_contents = File.read(file_path) not_found_expectations.empty? end match_when_negated do |file_path| @actual_contents = File.read(file_path) found_expectations.empty? end failure_message do |file_path| "e...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers/have_correct_syntax.rb
Ruby
mit
89
main
1,257
RSpec::Matchers.define :have_correct_syntax do match do |file_path| source = File.read(file_path) extension = File.extname(file_path) case extension when '.rb', '.rake' check_ruby_syntax(source) when '.rhtml', '.erb' check_erb_syntax(source) when '.haml' check_ham...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers/exist.rb
Ruby
mit
89
main
480
# DEPRECATED: use `expect(Pathname.new(path)).to exist` instead RSpec::Matchers.define :exist do |*expected| match do |file_path| if !(file_path.respond_to?(:exist?) || file_path.respond_to?(:exists?)) ActiveSupport::Deprecation.warn "The `exist` matcher overrides one built-in by RSpec; use `expect(Pathname...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/matchers/be_a_migration.rb
Ruby
mit
89
main
394
RSpec::Matchers.define :be_a_migration do match do |file_path| dirname, file_name = File.dirname(file_path), File.basename(file_path) if file_name =~ /\d+_.*\.rb/ migration_file_path = file_path else migration_file_path = Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{file_name}$/).first ...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/example/generator_example_group.rb
Ruby
mit
89
main
3,115
require 'rails/generators' require 'active_support/core_ext' require 'tmpdir' require 'fileutils' module Ammeter module RSpec module Rails # Delegates to Rails::Generators::TestCase to work with RSpec. module GeneratorExampleGroup extend ActiveSupport::Concern include ::RSpec::Rails::...
github
alexrothenberg/ammeter
https://github.com/alexrothenberg/ammeter
lib/ammeter/rspec/generator/example/generator_example_helpers.rb
Ruby
mit
89
main
1,080
require 'rails/generators' require 'active_support/core_ext' module Ammeter module RSpec module Rails # Delegates to Rails::Generators::TestCase to work with RSpec. module GeneratorExampleHelpers # Sets return values for basic shell commands (ex. ask, yes?, no?). # Does this by mock...