repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
rubinius/rubinius-bridge | lib/rubinius/bridge/compiled_code.rb | <reponame>rubinius/rubinius-bridge
require "securerandom"
module Rubinius
class CompiledCode
KernelMethodSerial = 47
attr_accessor :hints # added by the VM to indicate how it's being used.
attr_accessor :metadata # [Tuple] extra data
attr_accessor :name # [Symbol] name of th... |
DavidJFelix/home | Brewfile.dev.rb | <reponame>DavidJFelix/home<gh_stars>1-10
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
brew "asciinema"
brew "asdf"
brew "bazel"
brew "cocoapods"
brew "exa"
brew "exercism"
brew "gnupg"
brew "jq"
brew "miller"
brew "ripgrep"
|
DavidJFelix/home | Brewfile.fonts.rb | tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
cask "font-arvo"
cask "font-fira-mono-for-powerline"
cask "font-jetbrains-mono"
cask "font-jetbrains-mono-nerd-font"
cask "font-roboto"
|
DavidJFelix/home | Brewfile.core.rb | tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
brew "mas"
cask "1password"
cask "discord"
cask "google-chrome"
cask "kap"
cask "little-snitch"
cask "micro-snitch"
cask "rectangle"
cask "spotify"
cask "visual-studio-code"
cask "vlc"
cask "whatsapp"
cask "zoom"
mas "Amphetamine", id: 937984704
mas "Gifski"... |
rochefort/serie_a_bot | test/test_google_shortner.rb | <filename>test/test_google_shortner.rb
require_relative "helper"
require "serie_a_bot"
class TestGoogleShortner < Test::Unit::TestCase
sub_test_case "shorten" do
sub_test_case "when correct_response" do
def test_shorten_is_correct_response
stub_request(:post, GoogleShortner::API_BASE_URL).to_return... |
rochefort/serie_a_bot | test/helper.rb | $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))
ENV["RUBY_ENV"] = "test"
require_relative "../config/boot"
require_relative "../lib/model"
require "simplecov"
require "test/unit"
require "test/unit/rr"
require "webmock/test_unit"
SimpleCov.start if ENV["COVERAGE"]
|
rochefort/serie_a_bot | config/boot.rb | <reponame>rochefort/serie_a_bot
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), ".."))
initializers_path = File.join(PROJECT_ROOT, "config/initializers")
Dir.glob(File.join(initializers_path, "*.rb")).each do |f|
require f
end
|
rochefort/serie_a_bot | exe/tweet.rb | <gh_stars>0
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "../lib"))
require "serie_a_bot"
s = SerieABot.new
s.tweet_rss
|
rochefort/serie_a_bot | config/initializers/init_environment.rb | # puts '-- called init environment'
ENV["RUBY_ENV"] = "production" unless ENV["RUBY_ENV"]
|
rochefort/serie_a_bot | test/test_serie_a_bot.rb | <filename>test/test_serie_a_bot.rb
require_relative "helper"
require "serie_a_bot"
class TestSerieABot < Test::Unit::TestCase
setup do
@bot = SerieABot.new
end
# privates
sub_test_case "#generate_tweet" do
setup do
stub(GoogleShortner).shorten { "https://goo.gl/U98s" }
end
data(
"... |
rochefort/serie_a_bot | lib/model.rb | <filename>lib/model.rb
require "active_record"
class BaseModel < ActiveRecord::Base
self.abstract_class = true
config = YAML.load_file(File.join(PROJECT_ROOT, "config/database.yml"))
ActiveRecord::Base.configurations = config
ActiveRecord::Base.establish_connection(ENV["RUBY_ENV"].to_sym)
end
class RssItem < ... |
rochefort/serie_a_bot | lib/serie_a_bot.rb | #!/usr/bin/env ruby
require_relative "../config/boot"
require "json"
require "rss"
require "active_support/core_ext/string/filters"
require "sanitize"
require "twitter"
require_relative "model"
require_relative "google_shortner"
class SerieABot
MAX_TWEET_SIZE = 140
# url形式だと23bytesとして扱われる。
TWEET_URL_SIZE = 23
... |
rochefort/serie_a_bot | exe/regular_tweet.rb | #!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "../lib"))
require "serie_a_bot"
s = SerieABot.new
msg = File.read(File.join(PROJECT_ROOT, "config/regular_msg.txt"))
s.tweet(msg)
|
rochefort/serie_a_bot | lib/google_shortner.rb | require "json"
require "httpclient"
class GoogleShortner
API_BASE_URL = "https://www.googleapis.com/urlshortener/v1/url"
# Response:
# {
# "kind": "urlshortener#url",
# "id": "http://goo.gl/CfPqZs",
# "longUrl": "http://rochefort.hatenablog.com/"
# }
#
# Error Response:
# {"error"=>
# {"erro... |
pjkelly/api_cache | spec/memory_store_spec.rb | require 'spec_helper'
describe APICache::MemoryStore do
let(:cache) { {} }
let(:store) { APICache::MemoryStore.new(cache) }
# Deleting created_at makes no sense given the way MemoryStore stores data
@skip_created_at_deletion = true
include_examples "generic store"
end
|
pjkelly/api_cache | init.rb | # To use api_cache as a rails plugin
require "api_cache"
|
pjkelly/api_cache | lib/api_cache/abstract_store.rb | class APICache
class AbstractStore
def initialize
raise "Method not implemented. Called abstract class."
end
# Set value. Returns true if success.
def set(key, value)
raise "Method not implemented. Called abstract class."
end
# Get value.
def get(key)
raise "Method not ... |
pjkelly/api_cache | spec/null_store_spec.rb | require 'spec_helper'
describe APICache::NullStore do
before :each do
@store = APICache::NullStore.new
end
it "should NOT set" do
@store.exists?('foo').should be_false
@store.set('foo', 'bar')
@store.exists?('foo').should be_false
end
it "should always say keys are expired" do
@store.ex... |
pjkelly/api_cache | spec/shared_store_specs.rb | <filename>spec/shared_store_specs.rb
shared_examples "generic store" do
before :each do
cache.delete("foo")
end
it "should allow set and get" do
store.set("foo", "bar")
store.get("foo").should == "bar"
end
it "should report existence" do
store.exists?("foo").should == false
store.set("fo... |
pjkelly/api_cache | lib/api_cache/dalli_store.rb | <reponame>pjkelly/api_cache
class APICache
class DalliStore < APICache::AbstractStore
def initialize(store)
@dalli = store
end
# Set value. Returns true if success.
def set(key, value)
@dalli.set(key, value)
@dalli.set("#{key}_created_at", Time.now)
true
end
# Get val... |
pjkelly/api_cache | lib/api_cache/api.rb | require 'net/http'
class APICache
# Wraps up querying the API.
#
# Ensures that the API is not called more frequently than every +period+
# seconds, and times out API requests after +timeout+ seconds.
#
class API
# Takes the following options
#
# period:: Maximum frequency to call the API. If s... |
pjkelly/api_cache | spec/api_spec.rb | <gh_stars>100-1000
require 'spec_helper'
describe APICache::API do
before :each do
stub_request(:get, "http://www.google.com/").to_return(:body => "Google")
stub_request(:get, "http://froogle.google.com/").to_return(:status => 302, :headers => {:location => "http://products.google.com"})
stub_request(:ge... |
pjkelly/api_cache | lib/api_cache/memory_store.rb | <filename>lib/api_cache/memory_store.rb
class APICache
class MemoryStore < APICache::AbstractStore
def initialize(cache = {})
APICache.logger.debug "Using memory store"
@cache = cache
true
end
def set(key, value)
APICache.logger.debug("cache: set (#{key})")
@cache[key] = [Ti... |
pjkelly/api_cache | spec/integration_spec.rb | <gh_stars>100-1000
require 'spec_helper'
describe "api_cache" do
before :each do
stub_request(:get, "http://www.google.com/").to_return(:body => "Google")
APICache.store = nil
end
it "should work when url supplied" do
APICache.get('http://www.google.com/').should =~ /Google/
end
it "should wor... |
pjkelly/api_cache | spec/moneta_store_spec.rb | require 'spec_helper'
require 'moneta'
describe APICache::MonetaStore do
let(:cache) { Moneta.new(:Memcached) }
let(:store) { APICache::MonetaStore.new(cache) }
include_examples "generic store"
end
|
pjkelly/api_cache | spec/cache_spec.rb | require 'spec_helper'
describe APICache::Cache do
before :each do
@options = {
:cache => 1, # After this time fetch new data
:valid => 2 # Maximum time to use old data
}
end
it "should set and get" do
cache = APICache::Cache.new('flubble', @options)
cache.set('Hello world')
... |
pjkelly/api_cache | spec/dalli_store_spec.rb | require 'spec_helper'
require 'dalli'
describe APICache::DalliStore do
let(:cache) { Dalli::Client.new("localhost:11211") }
let(:store) { APICache::DalliStore.new(cache) }
include_examples "generic store"
end
|
pjkelly/api_cache | lib/api_cache.rb | require 'logger'
# Contains the complete public API for APICache.
#
# See APICache.get method and the README file.
#
# Before using APICache you should set the store to use using
# APICache.store=. For convenience, when no store is set an in memory store
# will be used (and a warning will be logged).
#
class APICache
... |
dustmoo/seadragon-paperclip | libs/paperclip_processors/tile_art.rb | #Code for Tiler from http://blog.aisleten.com/2007/08/25/attachment_fu-s3-ruby-tile-cutter-google-maps-easy-custom-maps-in-ruby-on-rails/
#Taken from his modified tiler and then modified! :D Thanks for thie inspiration!
#This is released under the MIT License which only applies to this code and not RMagic or Papercli... |
utkarsh2102/aruba | lib/aruba/platforms/determine_disk_usage.rb | require 'aruba/file_size'
module Aruba
module Platforms
# Determinate disk usage
#
# @private
class DetermineDiskUsage
def call(paths)
size = paths.flatten.map do |path|
minimum_disk_space_used path
end.inject(0, &:+)
FileSize.new(size)
end
privat... |
poloniculmov/google_music_api | lib/google_music_api/playlist.rb | module GoogleMusicApi
#Holds all the playlist related methods
module Playlist
#Gets all the playlists that user has
#@return [Array] of Hashes that describe a playlist
def get_all_playlists
url = 'playlistfeed'
make_post_request(url).fetch('data', {'items' => []})['items']
end
#Ge... |
poloniculmov/google_music_api | lib/google_music_api/track.rb | <filename>lib/google_music_api/track.rb
require 'base64'
require 'openssl'
require 'google_music_api/util'
module GoogleMusicApi
module Track
#Gets details about a track
# @param [string] track_id
# @return [hash] describing the track
include Util
def get_track_info(track_id)
url = 'fetchtr... |
poloniculmov/google_music_api | lib/google_music_api/library.rb | module GoogleMusicApi
#Holds all the library related methods
module Library
#Gets all tracks in the library#
# @return [Array] of hashes describing tracks
def get_all_tracks
url = 'trackfeed'
make_post_request(url)['data']['items']
end
#Gets the promoted songs
# @return [Array... |
poloniculmov/google_music_api | lib/google_music_api/podcast.rb | <reponame>poloniculmov/google_music_api
require 'google_music_api/util'
require 'google_music_api/track'
module GoogleMusicApi
#Holds all the playlist related methods
module Podcast
include Util
include Track
#Get podcast episodes from series
#@id [string] id of the podcast series
#@num [in... |
poloniculmov/google_music_api | lib/google_music_api/album.rb | <reponame>poloniculmov/google_music_api
module GoogleMusicApi
module Album
#Gets an album's details
# @param [string] album_id
# @param [string] include_tracks
# @return [Hash] describing an album and tracks
def get_album_info(album_id, include_tracks = true)
url = 'fetchalbum'
optio... |
poloniculmov/google_music_api | lib/google_music_api/mobile_client.rb | require 'gpsoauth'
require 'google_music_api/http'
require 'google_music_api/genre'
require 'google_music_api/playlist'
require 'google_music_api/library'
require 'google_music_api/station'
require 'google_music_api/album'
require 'google_music_api/artist'
require 'google_music_api/track'
require 'google_music_api/podc... |
poloniculmov/google_music_api | lib/google_music_api/errors.rb | module GoogleMusicApi
class ApiError < StandardError
end
class AuthenticationError < ApiError
end
end
|
poloniculmov/google_music_api | lib/google_music_api/artist.rb | module GoogleMusicApi
module Artist
# Gets an artists details
# @param [String] artist_id
# @param [boolean] include_albums
# @param [integer] max_top_tracks
# @param [integer] max_related_artists
def get_artist_info(artist_id, include_albums = true, max_top_tracks = 5, max_related_artists = ... |
poloniculmov/google_music_api | lib/google_music_api.rb | <filename>lib/google_music_api.rb<gh_stars>1-10
require 'google_music_api/version'
require 'google_music_api/mobile_client'
require 'google_music_api/errors'
module GoogleMusicApi
# Your code goes here...
end
|
poloniculmov/google_music_api | lib/google_music_api/station.rb | <reponame>poloniculmov/google_music_api
require 'google_music_api/util'
module GoogleMusicApi
module Station
include Util
#Gets the current listen now situations and their associated stations
# @return [Array] of situations and their respected stations
def get_listen_now_situations
url = 'liste... |
poloniculmov/google_music_api | lib/google_music_api/http.rb | <reponame>poloniculmov/google_music_api<filename>lib/google_music_api/http.rb
module GoogleMusicApi
module Http
private
def make_get_request(url, options = {})
url ="#{self.class::SERVICE_ENDPOINT}#{url}"
if options[:headers] == nil
options[:headers] = {}
end
options[:headers]... |
poloniculmov/google_music_api | lib/google_music_api/util.rb | require "base64"
require 'openssl'
module GoogleMusicApi
module Util
# Gets the radio seed type for a particular id
# @param [string] id
# @return [string] Type name
def get_seed_type_from_id(id)
case id.chars[0]
when 'T'
'2'
when 'B'
'1'
when 'A'
'3'
... |
poloniculmov/google_music_api | lib/google_music_api/genre.rb | module GoogleMusicApi
#Keeps all the genre-related methods
module Genre
#Returns all genres or all subgenres if parent_id is passed
# @param [String] parent_id
# @return [Array] of hashes that describe a genre
# @example Get all the subgenres of Jazz
# mobile_client.get_genres('JAZZ')
def ge... |
poloniculmov/google_music_api | spec/mobile_client_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe GoogleMusicApi::MobileClient do
let(:api) { GoogleMusicApi::MobileClient.new }
describe '#authenticated?' do
it 'returns true if authentication token is set' do
api.instance_variable_set '@authorization_token', 'abc'
expect(api.authenticated?).to be_tru... |
poloniculmov/google_music_api | spec/google_music_api_spec.rb | require 'spec_helper'
describe GoogleMusicApi do
it 'has a version number' do
expect(GoogleMusicApi::VERSION).not_to be nil
end
end
|
poloniculmov/google_music_api | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'google_music_api'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
|
celluloid/culture | gems/loader.rb | <gh_stars>1-10
require "yaml"
module Celluloid
module Sync
module Gemfile
class << self
def [](dsl)
dsl.source("https://rubygems.org")
dsl.gemspec # Runs gemspec, but also @sets gem_name.
Gems.gemfile(dsl)
end
end
end
module Gemspec
class <<... |
tfhartmann/puppet-stash | spec/classes/stash_facts_spec.rb | require 'spec_helper.rb'
describe 'stash::facts', :type => :class do
regexp_pe = /^#\!\/opt\/puppet\/bin\/ruby$/
regexp_oss = /^#\!\/usr\/bin\/env ruby$/
pe_external_fact_file = '/etc/puppetlabs/facter/facts.d/stash_facts.rb'
external_fact_file = '/etc/facter/facts.d/stash_facts.rb'
it { should contain_file... |
tfhartmann/puppet-stash | spec/classes/stash_init_spec.rb | require 'spec_helper.rb'
describe 'stash', :type => :class do
context 'prepare for upgrade of stash' do
let(:params) {{ :version => '3.3.3' }}
let(:facts) {{ :stash_version => "2.10.1" }}
it {
should contain_exec('service stash stop && sleep 15').with({
:command => 'service stash stop && s... |
tfhartmann/puppet-stash | spec/classes/stash_backup_deploy_spec.rb | require 'spec_helper.rb'
describe 'stash' do
describe 'stash::backup' do
context 'install stash backup client with deploy module' do
it { should contain_group('stash') }
it { should contain_user('stash').with_shell('/bin/bash') }
it 'should deploy stash backup client 1.6.0 from tar.gz' do
... |
tfhartmann/puppet-stash | spec/classes/stash_upgrade_spec.rb | <filename>spec/classes/stash_upgrade_spec.rb
require 'spec_helper.rb'
describe 'stash' do
describe 'stash::install' do
context 'default params' do
let(:params) {{
:javahome => '/opt/java',
}}
let(:facts) { {
:stash_version => "3.1.0",
}}
it 'should stop service ... |
tfhartmann/puppet-stash | spec/classes/stash_config_spec.rb | require 'spec_helper.rb'
describe 'stash' do
describe 'stash::config' do
context 'default params' do
let(:params) {{
:javahome => '/opt/java',
:version => '3.2.4',
}}
it { should contain_file('/opt/stash/atlassian-stash-3.2.4/bin/setenv.sh') \
.with_content(/JAVA_HOM... |
tfhartmann/puppet-stash | spec/spec_helper_acceptance.rb | require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
# This will install the latest available package on el and deb based
# systems fail on windows and osx, and install via gem on other *nixes
... |
tfhartmann/puppet-stash | spec/spec_helper.rb | <filename>spec/spec_helper.rb<gh_stars>0
require 'puppetlabs_spec_helper/module_spec_helper'
RSpec.configure do |c|
c.default_facts = {
:osfamily => 'Debian',
:augeasversion => '1.0.0',
:staging_http_get => 'curl',
:path => '/usr/local/bin:/usr/bin:/bin',
:stash_vers... |
mseri/rails-purecss | lib/purecss/generators/install_generator.rb | require 'rails/generators'
module Purecss
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.join(File.dirname(__FILE__), 'templates')
argument :stylesheets_type, :type => :string, :default => 'responsive', :banner => '*responsive or nonresponsive'
class_option ... |
mseri/rails-purecss | lib/purecss/version.rb | module Purecss
VERSION = "0.5.0.2"
end
|
mseri/rails-purecss | lib/purecss.rb | <gh_stars>1-10
require "purecss/version"
require "purecss/generators/install_generator"
module Purecss
require "purecss/engine"
end
|
mseri/rails-purecss | lib/purecss/engine.rb | <gh_stars>1-10
module Purecss
class Engine < Rails::Engine
# auto wire assets
end
end |
mseri/rails-purecss | purecss.gemspec | <filename>purecss.gemspec
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'purecss/version'
Gem::Specification.new do |spec|
spec.name = "purecss"
spec.version = Purecss::VERSION
spec.authors = ["mseri"]
spec.email ... |
panyult/LTRunLoop | LTRunLoop.podspec | <reponame>panyult/LTRunLoop<filename>LTRunLoop.podspec
Pod::Spec.new do |s|
s.name = 'LTRunLoop'
s.version = '0.1.1'
s.summary = 'LTRunLoop help you to define self-define input source when you want use the run loop of a secondary thread to handle something for you.'
s.homepage = '... |
bfernandesbfs/AirBar | AirBar.podspec | <gh_stars>0
Pod::Spec.new do |spec|
spec.name = "AirBar"
spec.version = "2.0.5"
spec.summary = "Airbnb expandable bar."
spec.homepage = "https://github.com/uptechteam/AirBar"
spec.license = { type: 'MIT', file: 'LICENSE' }
spec.authors = { "<NAME>" => '<EMAIL>' }
spec.platform = :ios, "9.1"
spec.swift_... |
otamm/RMathPlus | lib/r_math_plus/version.rb | <reponame>otamm/RMathPlus<filename>lib/r_math_plus/version.rb
module RMathPlus
VERSION = "0.0.2"
end
|
otamm/RMathPlus | r_math_plus.gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'r_math_plus/version'
Gem::Specification.new do |spec|
spec.name = "r_math_plus"
spec.version = RMathPlus::VERSION
spec.authors = ["<NAME>"]
spec.email = ["<EM... |
otamm/RMathPlus | spec/spec_helper.rb | require 'r_math_plus'
|
otamm/RMathPlus | spec/r_math_plus_spec.rb | require 'spec_helper'
describe RMathPlus do
describe ".is_prime?" do
it "returns true when a number is prime" do
(RMathPlus.is_prime?(3)).should == true
end
it "returns false when a number is not prime" do
(RMathPlus.is_prime?(4)).should == false
end
it "returns true when a big p... |
otamm/RMathPlus | lib/r_math_plus.rb | require "r_math_plus/version"
module RMathPlus
def self.is_prime?(n,prime_array=false) # number to be checked as first parameter, optional second parameter to be used with the 'prime_array' method.
if n < 2
return false
elsif n == 2
return true
else
if prime_array
f... |
DarthMax/lobbyliste | lib/lobbyliste/factories.rb | <gh_stars>1-10
require 'lobbyliste/factories/list_factory'
require 'lobbyliste/factories/organisation_factory'
require 'lobbyliste/factories/address_factory'
require 'lobbyliste/factories/person_factory'
module Lobbyliste
module Factories
end
end |
DarthMax/lobbyliste | test/lobbyliste/name_and_address_test.rb | <gh_stars>1-10
require 'test_helper'
class Lobbyliste::NameAndAddressTest < Minitest::Test
def test_full_address
name_and_address = Lobbyliste::Address.new(
"Test Name",
"Test Address",
"012345",
"City",
"Germany",
"012345678",
"012345678",
"<EMAIL>",
"http:... |
DarthMax/lobbyliste | lib/lobbyliste.rb | <gh_stars>1-10
require "lobbyliste/version"
require "lobbyliste/factories"
require "lobbyliste/list"
require "lobbyliste/organisation"
require "lobbyliste/address"
require "lobbyliste/person"
require "lobbyliste/downloader"
require "lobbyliste/core_ext/string"
require 'json'
module Lobbyliste
# Download the PDF and... |
DarthMax/lobbyliste | lib/lobbyliste/factories/address_factory.rb | module Lobbyliste
module Factories
# This class is used to build an address from raw data
# Since it is to hard to separate the na,e and address data without markup,
# we use the html data to accomplish that
class AddressFactory
# @return [Lobbyliste::Address]
def self.build(name,raw_data... |
DarthMax/lobbyliste | lib/lobbyliste/address.rb | module Lobbyliste
# This class represents addresses found in the lobbylist.
class Address
# @return [String] organisation name (the bold part)
attr_reader :name
# @return [String] Everything that is not part of the name or any other field
attr_reader :address
# @return [String] Postcode
a... |
DarthMax/lobbyliste | lib/lobbyliste/person.rb | <reponame>DarthMax/lobbyliste
module Lobbyliste
# Class to encapsulate a person.
class Person
# @return [String] the persons name (hopefully) stripped of all titles
attr_reader :name
# @return [Array] list of all titles (job, academic, positions)
attr_reader :titles
# @return [String] the ori... |
DarthMax/lobbyliste | test/test_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'lobbyliste'
require 'minitest/autorun'
require 'mocha/mini_test'
require 'webmock/minitest'
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = "test/vcr_cassettes"
config.hook_into :webmock
end
|
DarthMax/lobbyliste | test/lobbyliste/factories/address_factory_test.rb | require 'test_helper'
class Lobbyliste::Factories::AddressFactoryTest < Minitest::Test
def setup
@data = [
"1219. Deutsche Stiftung für interreligiösen und interkulturellen",
"Dialog e. V.",
"Hinter der katholischen Kirche 3",
"10117 Berlin",
"Tel.: (030) 51057773 Fax: (03... |
DarthMax/lobbyliste | test/lobbyliste_test.rb | <reponame>DarthMax/lobbyliste
require 'test_helper'
class LobbylisteTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Lobbyliste::VERSION
end
def test_fetch_and_parse
Lobbyliste::Downloader.any_instance.expects(:text_data).returns("TEXT_DATA")
Lobbyliste::Downloader.any_instan... |
DarthMax/lobbyliste | lib/lobbyliste/downloader.rb | <filename>lib/lobbyliste/downloader.rb<gh_stars>1-10
require 'open-uri'
require 'nokogiri'
module Lobbyliste
# This class finds the lobbyliste pdf on the Bundestag website, downloads it and extracts the pdf content
class Downloader
# Creates a new Downloader
# @param [String] link that will be used to fe... |
DarthMax/lobbyliste | lib/lobbyliste/core_ext/string.rb | <reponame>DarthMax/lobbyliste
class Object
def blank?
respond_to?(:empty?) ? !!empty? : !self
end
class String
def squish
self.dup.gsub(/[[:space:]]+/, ' ').strip
end
def blank?
empty? || /\A[[:space:]]*\z/ === self
end
end
class Nil
def blank?
true
end
end
... |
DarthMax/lobbyliste | lib/lobbyliste/factories/list_factory.rb | module Lobbyliste
module Factories
# This class is used to build the list from raw data
class ListFactory
attr_reader :data
# @return [Lobbyliste::List]
def self.build(text_data,html_data)
factory = new(text_data,html_data)
::Lobbyliste::List.new(
factory.organisat... |
DarthMax/lobbyliste | test/lobbyliste/organisation_test.rb | <reponame>DarthMax/lobbyliste
require 'test_helper'
class Lobbyliste::OrganisationTest < Minitest::Test
def test_addresses
org = Lobbyliste::Organisation.new(1,"Name","Main Address","Other Address","3. Address",nil,nil,nil,nil,nil,nil)
assert_equal ["Main Address","Other Address","3. Address"], org.addresses... |
DarthMax/lobbyliste | test/lobbyliste/factories/organisation_factory_test.rb | <reponame>DarthMax/lobbyliste
require 'test_helper'
class Lobbyliste::Factories::OrganisationFactoryTest < Minitest::Test
def setup
@organisation_data = [
"1",
"N a m e u n d S i t z , 1 . A d r e s s e",
"1219. Deutsche Stiftung für interreligiösen und interkulturellen",
"Dialog ... |
DarthMax/lobbyliste | lib/lobbyliste/factories/organisation_factory.rb | <reponame>DarthMax/lobbyliste
module Lobbyliste
module Factories
# This class is used to build an organisation from raw data
class OrganisationFactory
# @return [Lobbyliste::Organisation]
def self.build(name, raw_data,tags,abbreviations)
factory = new(name, raw_data)
::Lobbyliste... |
DarthMax/lobbyliste | test/real_world_test.rb | require 'test_helper'
class RealWorldTest < Minitest::Test
def test_real_world_sanity_check
skip unless ENV["RUN_REAL_WORLD_TEST"] == "true"
VCR.turned_off do
WebMock.allow_net_connect!
liste = Lobbyliste.fetch_and_parse
# There are 2000-3000 organisations
assert (2000..3000).include... |
DarthMax/lobbyliste | lib/lobbyliste/list.rb | module Lobbyliste
# This class represents an instance of the parsed lobbylist.
class List
# @return [Array] list of organisations
attr_reader :organisations
# @return [Hash] keys are the tags, values are Arrays of organisation ids
attr_reader :tags
# @return [Hash] keys are the abbreviations... |
DarthMax/lobbyliste | test/lobbyliste/downloader_test.rb | require 'test_helper'
class Lobbyliste::OrganisationTest < Minitest::Test
def test_pdf_link
VCR.use_cassette("bundestag_website") do
downloader = Lobbyliste::Downloader.new
assert_equal "https://bundestag.de/blob/189476/b5c8f2195537f84bdb1fe398ff721d9d/lobbylisteaktuell-data.pdf", downloader.pdf_lin... |
DarthMax/lobbyliste | test/lobbyliste/factories/person_factory_test.rb | require 'test_helper'
class Lobbyliste::Factories::PersonFactoryTest < Minitest::Test
def test_extract_names
data = [
["Prof. Dr.med.vet <NAME>, 1. Vorsitzender", "<NAME>"],
["Dipl.-Ing <NAME>","<NAME>"],
["<NAME>, Geschäftsführerin","<NAME>"],
["<NAME>","<NAME>"],
["<NAME... |
DarthMax/lobbyliste | test/lobbyliste/factories/list_factory_test.rb | require 'test_helper'
class Lobbyliste::Factories::ListFactoryTest < Minitest::Test
def setup
@text_data = File.read(File.join(File.dirname(File.expand_path(__FILE__)), '../../test_data/lobbyliste_text.txt'))
@html_data = File.read(File.join(File.dirname(File.expand_path(__FILE__)), '../../test_data/lobbylis... |
DarthMax/lobbyliste | lib/lobbyliste/organisation.rb | <reponame>DarthMax/lobbyliste
module Lobbyliste
# Class to encapsulate an organisation
class Organisation
# @return [Integer] the organisation id of the organisation. This number is not fix and may change with every new document version
attr_reader :id
# @return [String] the organisations name
att... |
jpamaya/casino-moped_yubi_authenticator | casino-moped_authenticator.gemspec | <gh_stars>0
# -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
require 'casino/moped_yubi_authenticator/version'
Gem::Specification.new do |s|
s.name = 'casino-moped_yubi_authenticator'
s.version = CASino::MopedYubiAuthenticator::VERSION
s.authors = ['<NAME>']
s.email =... |
jpamaya/casino-moped_yubi_authenticator | lib/casino-moped_yubi_authenticator.rb | <reponame>jpamaya/casino-moped_yubi_authenticator
require 'casino/moped_authenticator/version'
require 'casino/moped_authenticator'
|
jpamaya/casino-moped_yubi_authenticator | lib/casino/moped_yubi_authenticator.rb | require 'casino/moped_authenticator'
class CASino::MopedYubiAuthenticator < CASino::MopedAuthenticator
def validate(username, password, yubi_key)
return false unless user = collection.find(@options[:username_column] => username).first
password_from_database = user[@options[:password_column]]
registered_y... |
jpamaya/casino-moped_yubi_authenticator | spec/casino_core/moped_authenticator_spec.rb | require 'spec_helper'
require 'casino/moped_authenticator'
module CASino
describe MopedAuthenticator do
let(:pepper) { nil }
let(:extra_attributes) {{ email: 'mail_address' }}
let(:options) {{
database_url: 'mongodb://localhost:27017/my_db?safe=true',
collection: 'users',
username_colu... |
nikolalsvk/soto | spec/ordinare/sort_spec.rb | <gh_stars>100-1000
require "spec_helper"
require "fileutils"
describe Ordinare::Sort do
describe "#sort_gemfile" do
context "no Gemfile found" do
it "aborts with message" do
expect {
Ordinare::Sort.sort_gemfile(false, "spec/fixtures/no_gemfile")
}.to raise_error(SystemExit)
... |
nikolalsvk/soto | spec/ordinare/check_spec.rb | <reponame>nikolalsvk/soto
require "spec_helper"
describe Ordinare::Check do
describe "#gemfile_sorted?" do
context "no Gemfile found" do
it "aborts with message" do
expect {
described_class.gemfile_sorted?("spec/fixtures/no_gemfile")
}.to raise_error(SystemExit)
end
end
... |
nikolalsvk/soto | lib/ordinare/sort.rb | module Ordinare
class Sort
def self.sort_gemfile(overwrite = true, path = "Gemfile")
new(overwrite, path).sort_gemfile
end
def self.sort_content(path = "Gemfile", content)
new(false, path).sort_content(content)
end
def initialize(overwrite, path)
@overwrite = overwrite
@r... |
nikolalsvk/soto | lib/ordinare.rb | require "ordinare/version"
require "ordinare/sort"
require "ordinare/check"
require "optparse"
module Ordinare
module_function
def hi
"Ciao, sono Ordinare"
end
def parse_args
path = "Gemfile"
overwrite = true
version = nil
help = nil
check = nil
OptionParser.new do |opts|
o... |
nikolalsvk/soto | ordinare.gemspec | <reponame>nikolalsvk/soto
# coding: utf-8
lib = File.expand_path("../lib/", __FILE__)
$:.unshift lib unless $:.include?(lib)
require "ordinare/version"
Gem::Specification.new do |s|
s.name = "ordinare"
s.version = Ordinare::VERSION
s.licenses = ["MIT"]
s.summary = "Sort your gems in ... |
nikolalsvk/soto | spec/ordinare_spec.rb | require "spec_helper"
describe Ordinare do
describe "#hi" do
it "says hi in italian" do
expect(Ordinare.hi).to eq "Ciao, sono Ordinare"
end
end
describe "#parse_args" do
context "path to Gemfile is passed" do
context "using -p" do
before { ARGV = ["-p spec/fixtures/Gemfile"] }
... |
nikolalsvk/soto | lib/ordinare/check.rb | <reponame>nikolalsvk/soto<filename>lib/ordinare/check.rb
module Ordinare
class Check
def self.gemfile_sorted?(path = "Gemfile")
new(path).gemfile_sorted?
end
def initialize(path)
@path = path
end
def gemfile_sorted?
unless File.file?(@path)
abort "No Gemfile found in th... |
mohitsethi/chef-storm | metadata.rb | name 'storm'
maintainer "<NAME>"
maintainer_email "<EMAIL>"
license 'MIT License'
description "Installs Twitter's Storm distributed computation system"
version "1.2.35"
depends "java"
depends "runit"
depends "zookeeper"
depends "partial_search... |
mohitsethi/chef-storm | recipes/dependencies.rb |
include_recipe "java::oracle"
node['storm']['packages'].each do |pkg|
package pkg
end
bash "flush iptables" do
command "service iptables stop"
end
if node['zookeeper']['required']
include_recipe "storm::zookeeper"
end
if node['zeromq']['required']
remote_file "#{Chef::Config[:file_cache_path]}/zeromq-#{nod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.