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
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/house_member.rb
Ruby
mit
19
master
3,704
module Hulse class HouseMember attr_reader :bioguide_id, :sort_name, :last_name, :first_name, :middle_name, :suffix, :courtesy, :official_name, :formal_name, :party, :caucus_party, :state_postal, :state_name, :district_code, :hometown, :office_building, :office_room, :office_zip, :phone, :last_elected_da...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/nomination.rb
Ruby
mit
19
master
7,690
# encoding: utf-8 module Hulse class Nomination attr_reader :id, :name, :date, :committee, :committee_code, :url, :text, :actions, :agency, :description, :date_received, :latest_action_text, :latest_action_date, :status, :privileged, :civilian, :partitioned def initialize(params={}) params.each_pair d...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/house_vote.rb
Ruby
mit
19
master
3,349
module Hulse class HouseVote attr_reader :majority, :congress, :session, :chamber, :vote_number, :bill_number, :question, :vote_type, :vote_result, :vote_timestamp, :description, :party_summary, :vote_count, :members, :amendment_number, :amendment_author, :bill_url def initialize(params={}) params...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/senate_member.rb
Ruby
mit
19
master
3,029
module Hulse class SenateMember attr_reader :bioguide_id, :last_name, :first_name, :title, :senate_class, :address, :email, :website, :party, :state_postal, :state_rank, :committees, :lis_member_id def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) ...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/bill.rb
Ruby
mit
19
master
14,669
module Hulse class Bill extend Memoist attr_reader :url, :number, :title, :sponsor_url, :sponsor_bioguide, :sponsor_party, :sponsor_state, :introduced_date, :bill_type, :committees, :latest_action_text, :latest_action_date, :status, :actions_url, :chamber, :amendments, :cosponsors, :total_cosponsors, :bi...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/amendment.rb
Ruby
mit
19
master
5,327
module Hulse class Amendment attr_reader :url, :number, :sponsor_url, :sponsor_party, :sponsor_state, :sponsor_bioguide, :offered_date, :latest_action_text, :latest_action_date, :chamber, :sponsor_name, :purpose def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}",...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/house_floor.rb
Ruby
mit
19
master
1,687
module Hulse class HouseFloor attr_reader :legislative_day, :finished, :actions, :congress, :session, :url, :next_session def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) end end def self.latest_dates url = "http://clerk.house.gov/floor...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/record.rb
Ruby
mit
19
master
3,038
module Hulse class Record attr_reader :date, :section, :topics, :html def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) end end def to_s section end def self.base_url(date=nil) if date year, month, day = date.year,...
github
dwillis/hulse
https://github.com/dwillis/hulse
lib/hulse/sponsorship.rb
Ruby
mit
19
master
3,517
module Hulse class Sponsorship attr_reader :member_bioguide_id, :bill_number, :bill_url, :sponsor_bioguide_id, :congress, :date, :description def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) end end def self.create_from_results(sponsorships) ...
github
dwillis/hulse
https://github.com/dwillis/hulse
test/senate_vote_test.rb
Ruby
mit
19
master
457
require 'test_helper' require_relative '../lib/hulse' module Hulse class SenateVoteTest < Minitest::Test def setup @sv = SenateVote.find(2015,291) @nv = SenateVote.find(2015,274) end def test_bill_url assert_equal @sv.bill_url, "https://www.congress.gov/bill/114th-congress/senate-bill...
github
dwillis/hulse
https://github.com/dwillis/hulse
test/utils_test.rb
Ruby
mit
19
master
991
require 'test_helper' require_relative '../lib/hulse' module Hulse class UtilsTest < Minitest::Test def test_congress_for_year assert_equal 101, Utils.congress_for_year(1990) assert_equal 106, Utils.congress_for_year('2000') assert_equal 6, Utils.congress_for_year('1800') assert_equal 1, ...
github
dwillis/hulse
https://github.com/dwillis/hulse
test/sponsorship_test.rb
Ruby
mit
19
master
462
require 'test_helper' require_relative '../lib/hulse' module Hulse class SponsorshipTest < Minitest::Test def setup @sponsorships = Sponsorship.member_details("https://www.congress.gov/member/joyce-beatty/B001281", "114") end def test_sponsored_bills assert_equal @sponsorships.select{|s| s....
github
dwillis/hulse
https://github.com/dwillis/hulse
test/house_committee_test.rb
Ruby
mit
19
master
319
require 'test_helper' require_relative '../lib/hulse' module Hulse class HouseCommitteeTest < Minitest::Test def setup @committees = HouseCommittee.current end def test_committee_name assert_equal @committees.detect{|c| c.code == 'AG00'}.name, 'Committee on Agriculture' end end end
github
dwillis/hulse
https://github.com/dwillis/hulse
test/bill_test.rb
Ruby
mit
19
master
1,979
require 'test_helper' require_relative '../lib/hulse' module Hulse class BillTest < Minitest::Test def setup @bill = Bill.scrape_bill("https://www.congress.gov/bill/113th-congress/house-bill/1206") @other_bill = Bill.scrape_bill("https://www.congress.gov/bill/114th-congress/house-bill/22") @th...
github
dwillis/hulse
https://github.com/dwillis/hulse
test/house_vote_test.rb
Ruby
mit
19
master
372
require 'test_helper' require_relative '../lib/hulse' module Hulse class HouseVoteTest < Minitest::Test def setup @hv = HouseVote.find(2015,582) @sv = HouseVote.find(2015,581) end def test_bill_url assert_equal @hv.bill_url, "https://www.congress.gov/bill/114th-congress/house-bill/185...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
Gemfile
Ruby
mit
19
master
603
source "https://rubygems.org" # Declare your gem's dependencies in simple_dragonfly_preview.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development her...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
Rakefile
Ruby
mit
19
master
683
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'SimpleDragonflyPreview' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('READM...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
simple_dragonfly_preview.gemspec
Ruby
mit
19
master
968
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "simple_dragonfly_preview/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "simple_dragonfly_preview" s.version = SimpleDragonflyPreview::VERSION s.authors = ["Mich...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
lib/simple_dragonfly_preview/config.rb
Ruby
mit
19
master
347
module SimpleDragonflyPreview class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) end class Configuration attr_accessor :default_image_url def initialize @default_image_url = "simple_dragonfly_preview/defa...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/test_helper.rb
Ruby
mit
19
master
629
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" require "minitest/rails/capybara" require "minitest/reporters" Minitest::Reporters.use! require 'capybara/poltergeist' Capybara.default_driver = :poltergeist Rails....
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/features/preview_test.rb
Ruby
mit
19
master
973
require "test_helper" class PreviewTest < Capybara::Rails::TestCase test "show preview of image selected" do visit new_user_path assert_content page, "New user" fill_in('Name', :with => 'John') fill_in('Email', :with => 'john@doe.com') assert find('.user_avatar img')['src'].include?('default.png'...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/app/controllers/users_controller.rb
Ruby
mit
19
master
1,180
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /users def index @users = User.all end # GET /users/1 def show end # GET /users/new def new @user = User.new end # GET /users/1/edit def edit end # POST /users ...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/db/schema.rb
Ruby
mit
19
master
1,037
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/db/migrate/20131106190012_create_users.rb
Ruby
mit
19
master
250
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :email t.string :avatar_uid t.string :avatar_name t.string :image_uid t.timestamps end end end
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/config/application.rb
Ruby
mit
19
master
899
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "simple_dragonfly_preview" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into f...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/config/routes.rb
Ruby
mit
19
master
1,620
Dummy::Application.routes.draw do resources :users # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" root 'users#index' # Example of regular route: # get 'pro...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/config/initializers/dragonfly.rb
Ruby
mit
19
master
605
require 'dragonfly' # Configure Dragonfly.app.configure do plugin :imagemagick protect_from_dos_attacks true secret "1zk3xegugs8c9wsyoh32b" url_format "/media/:job/:name" datastore :file, root_path: Rails.root.join('public/system/dragonfly', Rails.env), server_root: Rails.root.join('public') end ...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
test/dummy/config/initializers/secret_token.rb
Ruby
mit
19
master
659
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
app/inputs/image_preview_input.rb
Ruby
mit
19
master
816
class ImagePreviewInput < SimpleForm::Inputs::Base def input(wrapper_options = nil) resize = options.delete(:size) || '350x100>' size = resize.sub(/\D$/,'') keys = options.delete(:attribute_keys) name = attribute_name.to_s attribute_keys = @builder.object.attributes.keys.inject([]) do |array, x| ...
github
elfassy/simple_dragonfly_preview
https://github.com/elfassy/simple_dragonfly_preview
app/controllers/simple_dragonfly_preview/image_controller.rb
Ruby
mit
19
master
611
class SimpleDragonflyPreview::ImageController < ApplicationController layout false def upload if params[:image].present? app = Dragonfly.app uid = app.store(params[:image].tempfile) @image = app.fetch(uid) attributes_hash = { uid: uid } if params[:attribute_ke...
github
codecov/example-ruby
https://github.com/codecov/example-ruby
calculator.gemspec
Ruby
mit
19
main
574
# encoding: utf-8 Gem::Specification.new do |s| s.name = 'calculator' s.version = '0.0.1' s.platform = Gem::Platform::RUBY s.authors = ['codecov'] s.email = ['hello@codecov.io'] s.description = %q{hosted code coverage} s.homepage ...
github
codecov/example-ruby
https://github.com/codecov/example-ruby
Rakefile
Ruby
mit
19
main
206
# frozen_string_literal: true require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end task default: :test
github
codecov/example-ruby
https://github.com/codecov/example-ruby
lib/calculator.rb
Ruby
mit
19
main
285
# frozen_string_literal: true class Calculator def self.add(x, y) x + y end def self.subtract(x, y) x - y end def self.multiply(x, y) x * y end def self.divide(x, y) if y == 0 return 'Cannot divide by 0' end return x * 1.0 / y end end
github
codecov/example-ruby
https://github.com/codecov/example-ruby
test/test_helper.rb
Ruby
mit
19
main
210
# frozen_string_literal: true require "simplecov" SimpleCov.start require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter require "calculator" require "minitest/autorun"
github
codecov/example-ruby
https://github.com/codecov/example-ruby
test/calculator_test.rb
Ruby
mit
19
main
1,264
# frozen_string_literal: true require 'test_helper' class TestCalculator < Minitest::Test def test_add assert_equal(3.0, Calculator.add(1, 2)) assert_equal(3.0, Calculator.add(1.0, 2.0)) assert_equal(2.0, Calculator.add(0, 2.0)) assert_equal(2.0, Calculator.add(2.0, 0)) assert_equal(-2.0, Calcul...
github
kofj/homebrew-kofj
https://github.com/kofj/homebrew-kofj
Formula/font2png.rb
Ruby
mit
19
master
445
class Font2png < Formula desc "A platform for building proxies to bypass network restrictions." homepage "https://blog.kongfanjian.com/" url "https://github.com/kofj/font2png/releases/download/v1.0.0/font2png-macos.tar.gz?20210522" version "v1.0.0" sha256 "c18bacb459a533e1e97b16302a9dcf7162af748bda11703d81455...
github
kofj/homebrew-kofj
https://github.com/kofj/homebrew-kofj
Formula/v2ray-core.rb
Ruby
mit
19
master
1,084
class V2rayCore < Formula desc "A platform for building proxies to bypass network restrictions." homepage "https://www.v2ray.com/" url "https://github.com/v2ray/v2ray-core/releases/download/v2.34/v2ray-macos.zip" version "v2.34" sha256 "a5ca67b7480a91682a1c7483f54e30d3cba521d7ca8335e8a869ee4bd2e87116" def ...
github
simple10/resque-heroku
https://github.com/simple10/resque-heroku
resque-heroku.gemspec
Ruby
mit
19
master
803
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "resque/plugins/heroku/version" Gem::Specification.new do |s| s.name = "resque-heroku" s.version = Resque::Plugins::Heroku::VERSION s.authors = ["Joe Johnston"] s.email = ["joe@simple10.com"] s.homepage = "...
github
simple10/resque-heroku
https://github.com/simple10/resque-heroku
lib/resque/plugins/heroku.rb
Ruby
mit
19
master
400
require 'resque/plugins/heroku/version' # extend Resque::Plugins::Heroku in your job class module Resque module Plugins module Heroku def after_perform_heroku(*args) ActiveRecord::Base.connection.disconnect! unless Resque.inline? end def on_failure_heroku(e, *args) ActiveRecord...
github
simple10/resque-heroku
https://github.com/simple10/resque-heroku
lib/resque/plugins/heroku/tasks.rb
Ruby
mit
19
master
435
require 'resque/tasks' task "resque:setup" => :environment do ENV['QUEUE'] = '*' if ENV['QUEUE'].blank? # Fix for handling resque jobs on Heroku cedar # http://stackoverflow.com/questions/2611747/rails-resque-workers-fail-with-pgerror-server-closed-the-connection-unexpectedly Resque.after_fork do |worker| ...
github
adelevie/restivus
https://github.com/adelevie/restivus
restivus.gemspec
Ruby
mit
19
master
3,093
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "restivus" s.version = "0.0.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygem...
github
adelevie/restivus
https://github.com/adelevie/restivus
Gemfile
Ruby
mit
19
master
496
source "http://rubygems.org" # Add dependencies required to use your gem here. # Example: # gem "activesupport", ">= 2.3.5" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do gem "shoulda", ">= 0" gem "bundler", "~> 1.0.0" gem "jewe...
github
adelevie/restivus
https://github.com/adelevie/restivus
Rakefile
Ruby
mit
19
master
1,418
# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem is...
github
adelevie/restivus
https://github.com/adelevie/restivus
lib/restivus.rb
Ruby
mit
19
master
3,441
require 'json' require 'csv' require 'uri' require 'sinatra' require 'rest-client' class Restivus < Sinatra::Base # Doc helpers # these methods generate text for the docs pages # ------------ def curl_req(url) #`curl #{url}` RestClient.get(url) end def truncated_response(url) json = cu...
github
adelevie/restivus
https://github.com/adelevie/restivus
test/test_restivus.rb
Ruby
mit
19
master
224
require 'helper' class TestRestivus < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end
github
adelevie/restivus
https://github.com/adelevie/restivus
test/helper.rb
Ruby
mit
19
master
429
require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),...
github
mtpereira/ansible-passenger
https://github.com/mtpereira/ansible-passenger
tests/Vagrantfile
Ruby
mit
19
master
1,422
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.provider "virtualbox" do |v| v.memory = "512" v.cpus = "1" v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] end config.vm.define "apache" do |apache| apache.vm.host...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
Rakefile
Ruby
mit
19
master
619
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rspec/core/rake_task' RSpec::Core::RakeTask.new task :default => :spec task :test => :spec namespace :doc do begin require 'yard' rescue LoadError # ignore else YARD::Rake::YardocTask.new do |task| task.files = ['lib/**/*.rb'] ta...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
citibikenyc.gemspec
Ruby
mit
19
master
1,190
# -*- encoding: utf-8 -*- require File.expand_path('../lib/citibikenyc/version', __FILE__) Gem::Specification.new do |gem| gem.add_development_dependency 'rake' gem.add_development_dependency('rspec', '~> 2.13.0') gem.add_development_dependency('webmock', '~> 1.12.3') gem.add_development_dependency('yard', '~>...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc.rb
Ruby
mit
19
master
743
require File.expand_path('../citibikenyc/error', __FILE__) require File.expand_path('../citibikenyc/configuration', __FILE__) require File.expand_path('../citibikenyc/api', __FILE__) require File.expand_path('../citibikenyc/client', __FILE__) module Citibikenyc extend Configuration # Alias for Citibikenyc::Client...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/faraday/raise_http_exception.rb
Ruby
mit
19
master
613
require 'faraday' # @private module FaradayMiddleware # @private class RaiseHttpException < Faraday::Middleware def call(env) @app.call(env).on_complete do |response| case response[:status].to_i when 404 raise Citibikenyc::NotFound, error_message(response) end end ...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/configuration.rb
Ruby
mit
19
master
2,250
require 'faraday' require File.expand_path('../version', __FILE__) module Citibikenyc # Defines constants and methods related to configuration module Configuration # An array of valid keys in the options hash when configuring a {Citibikenyc::API} VALID_OPTIONS_KEYS = [ :adapter, :endpoint, ...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/connection.rb
Ruby
mit
19
master
823
require 'faraday_middleware' Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f} module Citibikenyc # @private module Connection private def connection(raw=false) options = { :headers => {'Accept' => "application/json; charset=utf-8", 'User-Agent' => user_agent}, ...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/client.rb
Ruby
mit
19
master
250
module Citibikenyc class Client < API Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f} include Citibikenyc::Client::Stations include Citibikenyc::Client::Helmets include Citibikenyc::Client::Branches end end
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/error.rb
Ruby
mit
19
master
208
module Citibikenyc # Custom error class for rescuing from all Citibikenyc errors class Error < StandardError; end # Raised when Sinlgy returns the HTTP status code 404 class NotFound < Error; end end
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/api.rb
Ruby
mit
19
master
484
require File.expand_path('../connection', __FILE__) require File.expand_path('../request', __FILE__) module Citibikenyc # @private class API # @private attr_accessor *Configuration::VALID_OPTIONS_KEYS # Creates a new API def initialize(options={}) options = Citibikenyc.options.merge(options)...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/request.rb
Ruby
mit
19
master
1,273
module Citibikenyc # Defines HTTP request methods module Request # Perform an HTTP GET request def get(path, options={}, raw=false, unformatted=true) request(:get, path, options, raw, unformatted) end # Perform an HTTP POST request def post(path, options={}, raw=false, unformatted=true) ...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/client/branches.rb
Ruby
mit
19
master
521
module Citibikenyc class Client # Defines methods related to branches module Branches # Returns all information about branches # # @param options [Hash] An optional options hash # @return [Hashie::Mash] # @example Return all information about the branches # Citibikenyc.b...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/client/stations.rb
Ruby
mit
19
master
882
module Citibikenyc class Client # Defines methods related to stations module Stations # Returns all information about stations # # @param options [Hash] An optional options hash # @return [Hashie::Mash] # @example Return all information about the stations # Citibikenyc.s...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
lib/citibikenyc/client/helmets.rb
Ruby
mit
19
master
513
module Citibikenyc class Client # Defines methods related to helmets module Helmets # Returns all information about helmets # # @param options [Hash] An optional options hash # @return [Hashie::Mash] # @example Return all information about the helmets # Citibikenyc.helme...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
spec/citibikenyc_spec.rb
Ruby
mit
19
master
2,389
require 'spec_helper' describe Citibikenyc do after do Citibikenyc.reset end context "when delegating to a client" do before do stub_get("data2/stations.php"). to_return(:body => fixture("stations.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "sho...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
spec/spec_helper.rb
Ruby
mit
19
master
1,021
$:.unshift File.dirname(__FILE__) + '/../lib' require 'citibikenyc' require 'rspec' require 'webmock/rspec' RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus config.include WebMock::API end def a_de...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
spec/citibikenyc/client/stations_spec.rb
Ruby
mit
19
master
1,829
require File.expand_path('../../../spec_helper', __FILE__) describe Citibikenyc::Client do before do @client = Citibikenyc::Client.new end describe ".stations" do before do stub_get('data2/stations.php'). to_return(:body => fixture("stations.json"), :headers => {:content_type => "applicati...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
spec/citibikenyc/client/branches_spec.rb
Ruby
mit
19
master
840
require File.expand_path('../../../spec_helper', __FILE__) describe Citibikenyc::Client do before do @client = Citibikenyc::Client.new end describe ".branches" do before do stub_get('v1/branch/list'). to_return(:body => fixture("branches.json"), :headers => {:content_type => "application/j...
github
edgar/citibikenyc
https://github.com/edgar/citibikenyc
spec/citibikenyc/client/helmets_spec.rb
Ruby
mit
19
master
846
require File.expand_path('../../../spec_helper', __FILE__) describe Citibikenyc::Client do before do @client = Citibikenyc::Client.new end describe ".helmets" do before do stub_get('v1/helmet/list'). to_return(:body => fixture("helmets.json"), :headers => {:content_type => "application/jso...
github
unosk/carrierwave-azure
https://github.com/unosk/carrierwave-azure
carrierwave-azure.gemspec
Ruby
mit
19
master
895
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'carrierwave/azure/version' Gem::Specification.new do |gem| gem.name = 'carrierwave-azure' gem.version = Carrierwave::Azure::VERSION gem.authors = ['Yusuke Shibahara'] gem.email ...
github
unosk/carrierwave-azure
https://github.com/unosk/carrierwave-azure
spec/carrierwave-azure_spec.rb
Ruby
mit
19
master
476
require 'spec_helper' describe CarrierWave::Uploader::Base do it 'should define azure as a storage engine' do expect(described_class.storage_engines[:azure]).to eq 'CarrierWave::Storage::Azure' end it 'should define azure options' do is_expected.to respond_to(:azure_storage_account_name) is_expected...
github
unosk/carrierwave-azure
https://github.com/unosk/carrierwave-azure
lib/carrierwave-azure.rb
Ruby
mit
19
master
379
require 'carrierwave' require 'carrierwave/azure/version' require 'carrierwave/storage/azure' class CarrierWave::Uploader::Base add_config :azure_storage_account_name add_config :azure_storage_access_key add_config :azure_storage_blob_host add_config :azure_container configure do |config| config.storage...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
cody.gemspec
Ruby
mit
19
master
1,811
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "cody/version" Gem::Specification.new do |spec| spec.name = "cody" spec.version = Cody::VERSION spec.authors = ["Tung Nguyen"] spec.email = ["tongueroo@gmail.c...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
Rakefile
Ruby
mit
19
master
299
require "bundler/gem_tasks" require "rspec/core/rake_task" task default: :spec RSpec::Core::RakeTask.new require_relative "lib/cody" require "cli_markdown" desc "Generates cli reference docs as markdown" task :docs do CliMarkdown::Creator.create_all(cli_class: Cody::CLI, cli_name: "cody") end
github
boltops-tools/cody
https://github.com/boltops-tools/cody
.cody/role.rb
Ruby
mit
19
master
294
iam_policy( action: [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "ssm:DescribeDocumentParameters", "ssm:DescribeParameters", "ssm:GetParameter*", ], effect: "Allow", resource: "*" ) managed_iam_policy("AWSCloudFormationReadOnlyAccess")
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody.rb
Ruby
mit
19
master
424
$:.unshift(File.expand_path("../", __FILE__)) require "active_support" require "active_support/core_ext/string" require "aws_data" require "cfn_camelizer" require "cfn_status" require "cody/version" require "dsl_evaluator" require "memoist" require "rainbow/ext/string" require "yaml" require "cody/autoloader" Cody::Au...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli.rb
Ruby
mit
19
master
3,610
require 'cli-format' module Cody class CLI < Command class_option :verbose, type: :boolean class_option :noop, type: :boolean desc "init", "Initialize project with .cody files" long_desc Help.text(:init) Init.cli_options.each do |args| option(*args) end register(Init, "init", "init...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/core.rb
Ruby
mit
19
master
1,680
require 'pathname' require 'yaml' module Cody module Core extend Memoist def root path = ENV['CODY_ROOT'] || '.' Pathname.new(path) end def env # 2-way binding cb_env = env_from_profile || 'development' cb_env = ENV['CODY_ENV'] if ENV['CODY_ENV'] # highest precedence ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/stack.rb
Ruby
mit
19
master
1,013
require "aws-sdk-cloudformation" module Cody class Stack include Cody::AwsServices include Status def initialize(options) @options = options @project_name = @options[:project_name] || inferred_project_name @stack_name = normalize_stack_name(options[:stack_name] || inferred_stack_name(@...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/aws_services.rb
Ruby
mit
19
master
320
require "aws-sdk-codebuild" require "aws-sdk-cloudformation" require "aws_mfa_secure/ext/aws" # add MFA support module Cody module AwsServices include Helpers def codebuild @codebuild ||= Aws::CodeBuild::Client.new end def cfn @cfn ||= Aws::CloudFormation::Client.new end end end
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/role.rb
Ruby
mit
19
master
2,165
require "yaml" module Cody class Role < Dsl::Base include Evaluate include Variables include Dsl::Role def initialize(options={}) super @role_path = options[:role_path] || get_role_path @iam_policy = {} end def run load_variables evaluate_file(@role_path) if Fi...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/project.rb
Ruby
mit
19
master
1,598
require "yaml" module Cody class Project < Dsl::Base include Dsl::Project include Evaluate include Variables attr_reader :project_path def initialize(options={}) super @project_path = options[:project_path] || get_project_path end def exist? File.exist?(@project_path) ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/tailer.rb
Ruby
mit
19
master
6,038
require "aws-logs" module Cody class Tailer include Cody::AwsServices def initialize(options, build_id) @options, @build_id = options, build_id @output = [] # for specs @shown_phases = [] @thread = nil set_trap end def run puts "Showing logs for build #{@build_i...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/schedule.rb
Ruby
mit
19
master
2,758
module Cody class Schedule < Dsl::Base include Cody::Dsl::Schedule include Evaluate include Variables def initialize(options={}) super @schedule_path = options[:schedule_path] || get_schedule_path @iam_policy = {} end def run return unless File.exist?(@schedule_path) ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/setting.rb
Ruby
mit
19
master
2,765
require 'yaml' require 'render_me_pretty' module Cody class Setting extend Memoist def initialize(check_cody_project=true) @check_cody_project = check_cody_project end # data contains the settings.yml config. The order or precedence for settings # is the project ufo/settings.yml and then ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/variables.rb
Ruby
mit
19
master
544
module Cody module Variables def load_variables load_variables_file("base") load_variables_file(Cody.env) # Then load type scope variables, so they take higher precedence load_variables_file("base", @options[:type]) load_variables_file(Cody.env, @options[:type]) end def load...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/autoloader.rb
Ruby
mit
19
master
523
require "zeitwerk" module Cody class Autoloader class Inflector < Zeitwerk::Inflector def camelize(basename, _abspath) map = { cli: "CLI", version: "VERSION" } map[basename.to_sym] || super end end class << self def setup loader = Zeitwerk::Loader.new lo...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/command.rb
Ruby
mit
19
master
2,922
require "thor" # Override thor's long_desc identation behavior # https://github.com/erikhuda/thor/issues/398 class Thor module Shell class Basic def print_wrapped(message, options = {}) message = "\n#{message}" unless message[0] == "\n" stdout.puts message end end end end # Get...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/delete.rb
Ruby
mit
19
master
706
class Cody::CLI class Delete include Cody::AwsServices def initialize(options) @options = options @project_name = options[:project_name] || inferred_project_name @stack_name = normalize_stack_name(options[:stack_name] || inferred_stack_name(@project_name)) end def run message...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/stop.rb
Ruby
mit
19
master
229
class Cody::CLI class Stop < Base def run check_build_id! run_with_exception_handling do codebuild.stop_build(id: build_id) puts "Build has been stopped: #{build_id}" end end end end
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/sequence.rb
Ruby
mit
19
master
1,726
require 'fileutils' require 'thor' class Cody::CLI class Sequence < Thor::Group include Cody::AwsServices include Thor::Actions add_runtime_options! # force, pretend, quiet, skip options # https://github.com/erikhuda/thor/blob/master/lib/thor/actions.rb#L49 def self.source_paths [File.e...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/init.rb
Ruby
mit
19
master
3,509
class Cody::CLI class Init < Sequence # Ugly, this is how I can get the options from to match with this Thor::Group def self.cli_options [ [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"], [:name, desc: "CodeBuild project name"], [:mode, d...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/start.rb
Ruby
mit
19
master
2,499
class Cody::CLI class Start include Cody::AwsServices def initialize(options) @options = options @project_name = options[:project_name] || inferred_project_name @full_project_name = project_name_convention(@project_name) end def run source_version = @options[:branch] || @opti...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/badge.rb
Ruby
mit
19
master
424
class Cody::CLI class Badge < Base def run resp = codebuild.batch_get_projects(names: [@full_project_name]) project = resp.projects.first unless project puts "Project not found: #{@full_project_name}" return end url = project.badge.badge_request_url if @options...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/help.rb
Ruby
mit
19
master
271
class Cody::CLI module Help class << self def text(namespaced_command) path = namespaced_command.to_s.gsub(':','/') path = File.expand_path("../help/#{path}.md", __FILE__) IO.read(path) if File.exist?(path) end end end end
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/base.rb
Ruby
mit
19
master
1,027
# Base only for Stop and Start currently. class Cody::CLI class Base include Cody::AwsServices def initialize(options) @options = options @project_name = options[:project_name] || inferred_project_name @full_project_name = project_name_convention(@project_name) end def run_with_exc...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/status.rb
Ruby
mit
19
master
668
class Cody::CLI class Status < Base def run check_build_id! run_with_exception_handling do puts "Build id: #{build_id}" resp = codebuild.batch_get_builds(ids: [build_id]) build = resp.builds.first puts "Build status: #{colored(build.build_status)}" end end ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/cli/list.rb
Ruby
mit
19
master
1,641
require 'cli-format' class Cody::CLI class List include Cody::AwsServices extend Memoist def initialize(options) @options = options end def run if projects.size > 15 $stderr.puts "Number of projects: #{projects.size}" $stderr.puts "Can take a while for a large number...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/aws_services/helpers.rb
Ruby
mit
19
master
3,157
module Cody::AwsServices module Helpers def find_stack(stack_name) return if ENV['TEST'] resp = cfn.describe_stacks(stack_name: stack_name) resp.stacks.first rescue Aws::CloudFormation::Errors::ValidationError => e # example: Stack with id demo-web does not exist if e.message =~ ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/list/project.rb
Ruby
mit
19
master
788
# Wrap project in object to allow lazy loading of status module Cody::List class Project include Cody::AwsServices extend Memoist delegate :build_status, :start_time, :end_time, to: :build alias_method :time, :end_time alias_method :status, :build_status attr_reader :name def initialize(...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/list/no_builds_project.rb
Ruby
mit
19
master
314
# Represents a project with no builds yet. In this case we just return an info message for the columns. # This allows `cody list` to work without breaking for Fresh projects with zero builds. module Cody::List class NoBuildsProject def method_missing(meth, *args, &block) "no builds" end end end
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/dsl/base.rb
Ruby
mit
19
master
623
module Cody::Dsl class Base attr_reader :options, :project_name, :full_project_name, :type def initialize(options={}) @options = options @project_name = options[:project_name] @type = options[:type] @full_project_name = options[:full_project_name] # includes -development at the end ...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/dsl/schedule.rb
Ruby
mit
19
master
546
module Cody::Dsl module Schedule PROPERTIES = %w[ Description EventPattern Name RoleArn ScheduleExpression State Targets ] PROPERTIES.each do |prop| define_method(prop.underscore) do |v| @properties[prop.to_sym] = v end end def rate(pe...
github
boltops-tools/cody
https://github.com/boltops-tools/cody
lib/cody/dsl/role.rb
Ruby
mit
19
master
1,498
module Cody::Dsl module Role extend Memoist PROPERTIES = %w[ AssumeRolePolicyDocument ManagedPolicyArns MaxSessionDuration Path PermissionsBoundary Policies RoleName ] PROPERTIES.each do |prop| define_method(prop.underscore) do |v| @properties[p...