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 | kylewlacy/timerizer | https://github.com/kylewlacy/timerizer | spec/timerizer_spec.rb | Ruby | mit | 45 | master | 2,690 | require "spec_helper"
RSpec.describe Time do
it "can be added or subtracted to Duration" do
time = Time.new(2000, 1, 1, 3, 45, 00)
expect(time + 5.minutes).to eq(Time.new(2000, 1, 1, 3, 50, 00))
expect(time - 5.minutes).to eq(Time.new(2000, 1, 1, 3, 40, 00))
end
it "can be converted to a Date object... |
github | kylewlacy/timerizer | https://github.com/kylewlacy/timerizer | spec/timerizer/duration_spec.rb | Ruby | mit | 45 | master | 18,489 | require "spec_helper"
RSpec.describe Timerizer::Duration do
describe "#new" do
it "constructs a new `Duration` from a hash of units" do
duration = Timerizer::Duration.new
expect(duration.get(:seconds)).to eq(0)
expect(duration.get(:months)).to eq(0)
duration = Timerizer::Duration.new(sec... |
github | kylewlacy/timerizer | https://github.com/kylewlacy/timerizer | spec/timerizer/wall_clock_spec.rb | Ruby | mit | 45 | master | 3,683 | require "spec_helper"
RSpec.describe Timerizer::WallClock do
it "can be created" do
Timerizer::WallClock.new(12, 30, :pm)
Timerizer::WallClock.new(23, 30)
end
it "can be created from a string" do
expect(
Timerizer::WallClock.from_string("9:00 PM")
).to eq(Timerizer::WallClock.new(9, 00, :p... |
github | kylewlacy/timerizer | https://github.com/kylewlacy/timerizer | spec/timerizer/duration/to_rounded_s_spec.rb | Ruby | mit | 45 | master | 3,520 | # frozen_string_literal: true
require "spec_helper"
require 'timerizer/duration'
RSpec.describe Timerizer::Duration do
describe '#to_rounded_s' do
describe 'passes all (adjusted) #to_s specs including' do
it "converts all units into a string" do
expect(
(1.year 3.months).to_rounded_s(:l... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | pumi.gemspec | Ruby | mit | 45 | master | 1,952 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "pumi/version"
Gem::Specification.new do |spec|
spec.name = "pumi"
spec.version = Pumi::VERSION
spec.authors = ["David Wilkie"]
spec.email = ["dwilkie@gmail.com"]
spec.summary ... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/spec_helper.rb | Ruby | mit | 45 | master | 5,357 | $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "pumi"
Dir[(__dir__ + "/support/**/*.rb")].each { |f| require f }
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file conta... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/rails_helper.rb | Ruby | mit | 45 | master | 710 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("dummy/config/environment", __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requi... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/support/capybara.rb | Ruby | mit | 45 | master | 362 | require "capybara"
Capybara.default_driver = :rack_test
Capybara.javascript_driver = :selenium_chrome_headless
RSpec.configure do |config|
config.before(:each, type: :system) do
driven_by :rack_test
Capybara.server = :puma, { Silent: true }
end
config.before(:each, type: :system, js: true) do
driv... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/support/vcr.rb | Ruby | mit | 45 | master | 1,185 | require "vcr"
VCR.configure do |vcr_config|
vcr_config.hook_into :webmock
vcr_config.ignore_localhost = true
end
RSpec.configure do |config|
config.around(vcr: true) do |example|
original_cassette_library_dir = nil
VCR.configure do |vcr_config|
original_cassette_library_dir = vcr_config.cassette_... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/dummy/app/controllers/addresses_controller.rb | Ruby | mit | 45 | master | 306 | class AddressesController < ApplicationController
def new
@address = Address.new
end
def create
@address = Address.new(address_params)
render(:new)
end
private
def address_params
params.require(:address).permit(:province_id, :district_id, :commune_id, :village_id)
end
end |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/dummy/config/application.rb | Ruby | mit | 45 | master | 950 | require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
require "sprockets/railtie"
require "active_model"
Bundler.require(*Rails.groups)
require "pumi/rails"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified h... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/dummy/config/environments/development.rb | Ruby | mit | 45 | master | 1,604 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/dummy/config/environments/production.rb | Ruby | mit | 45 | master | 3,306 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/dummy/config/environments/test.rb | Ruby | mit | 45 | master | 1,757 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/system/pumi_spec.rb | Ruby | mit | 45 | master | 1,421 | require "rails_helper"
RSpec.describe "pumi.js", :js, type: :system do
it "submits a Pumi form" do
visit(new_address_path)
expect(page).to have_field("District", disabled: true)
expect(page.find("#district")[:class]).to eq("my-disabled-class")
expect(page).to have_field("Commune", disabled: true)
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/requests/api_spec.rb | Ruby | mit | 45 | master | 1,437 | require "rails_helper"
RSpec.describe "API" do
describe "GET /pumi/provinces" do
it "returns all provinces" do
get(Pumi::Engine.routes.url_helpers.provinces_path)
results = JSON.parse(response.body)
expect(results.size).to eq(25)
expect(results.dig(0, "name_latin")).to eq("Banteay Meanch... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/district_spec.rb | Ruby | mit | 45 | master | 2,012 | require "spec_helper"
module Pumi
RSpec.describe District do
describe ".all" do
it "returns all districts" do
results = District.all
expect(results.size).to eq(210)
expect(results.first).to be_a(District)
end
end
describe ".where" do
it "filters by id" do
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/commune_spec.rb | Ruby | mit | 45 | master | 2,475 | require "spec_helper"
module Pumi
RSpec.describe Commune do
describe ".all" do
it "returns all communes" do
results = Commune.all
expect(results.size).to eq(1652)
expect(results.first).to be_a(Commune)
end
end
describe ".where" do
it "filters by id" do
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/province_spec.rb | Ruby | mit | 45 | master | 2,796 | require "spec_helper"
module Pumi
RSpec.describe Province do
describe ".all" do
it "returns all provinces" do
results = Province.all
expect(results.size).to eq(25)
expect(results.first).to be_a(Province)
end
end
describe ".where" do
it "returns an empty result ... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/village_spec.rb | Ruby | mit | 45 | master | 3,351 | require "spec_helper"
module Pumi
RSpec.describe Village do
describe "#address" do
it "returns the address" do
village = Village.where(name_km: "ខ្ទុម្ពរាយលិច").first
expect(village.address_km).to eq(
"ភូមិខ្ទុម្ពរាយលិច ឃុំបត់ត្រង់ ស្រុកមង្គលបូរី ខេត្តបន្ទាយមានជ័យ"
)
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/bot/wikipedia/districts_in_cambodia_article_spec.rb | Ruby | mit | 45 | master | 933 | require "spec_helper"
require "pumi/bot/wikipedia"
module Pumi
module Bot
module Wikipedia
RSpec.xdescribe DistrictsInCambodiaArticle, :vcr, vcr_options: { tag: :wikipedia_api } do
describe "#publish", cassette: :update_wikipedia_districts_in_cambodia_article do
it "updates the article ab... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/bot/wikipedia/communes_in_cambodia_article_spec.rb | Ruby | mit | 45 | master | 902 | require "spec_helper"
require "pumi/bot/wikipedia"
module Pumi
module Bot
module Wikipedia
RSpec.xdescribe CommunesInCambodiaArticle, :vcr, vcr_options: { tag: :wikipedia_api } do
describe "#publish", cassette: :update_wikipedia_communes_in_cambodia_article do
it "updates the article abou... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/data_source/wikipedia_spec.rb | Ruby | mit | 45 | master | 2,132 | require "spec_helper"
require "pumi/data_source/wikipedia"
module Pumi
module DataSource
RSpec.describe Wikipedia, :vcr do
describe "#load_data!" do
it "loads data from Wikipedia", cassette: :wikipedia_provinces_in_cambodia_article do
data_source = Wikipedia.new(
scraper: Pumi... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/data_source/geocoder_spec.rb | Ruby | mit | 45 | master | 2,037 | require "spec_helper"
require "pumi/data_source/geocoder"
module Pumi
module DataSource
RSpec.xdescribe Geocoder, :vcr, vcr_options: { tag: :google_api, record: :new_episodes } do
describe "#load_data!", cassette: :geocode_cambodian_provinces do
it "loads geodata" do
data_source = Geocode... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/data_source/ncdd_spec.rb | Ruby | mit | 45 | master | 720 | require "spec_helper"
require "pumi/data_source/ncdd"
module Pumi
module DataSource
RSpec.describe NCDD do
describe "#load_data!" do
it "loads data from source" do
data_source = NCDD.new
data_source.load_data!(
source_dir: "spec/fixtures/files/source_data/ncdd",
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | spec/pumi/data_source/iso31662_spec.rb | Ruby | mit | 45 | master | 467 | require "spec_helper"
require "pumi/data_source/iso31662"
module Pumi
module DataSource
RSpec.describe ISO31662 do
describe "#load_data!" do
it "loads ISO3166-2 codes" do
data_source = ISO31662.new
data_source.load_data!(output_dir: "tmp")
data = YAML.load_file("tmp/... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi.rb | Ruby | mit | 45 | master | 612 | require_relative "pumi/store_cache"
require_relative "pumi/data_store"
module Pumi
class << self
def data_store
@data_store ||= reset_data_store!
end
private
def reset_data_store!
@data_store = StoreCache.new(DataStore.new)
end
end
end
require_relative "pumi/version"
require_rela... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/parser.rb | Ruby | mit | 45 | master | 4,813 | require "yaml"
require "pathname"
module Pumi
class Parser
DEFAULT_DATA_DIRECTORY = File.join(File.expand_path("..", File.dirname(__dir__)), "data")
AdministrativeDivision = Struct.new(
:type, :name, :data_key, :id_length, :parent_divisions, keyword_init: true
)
PROVINCE = AdministrativeDivis... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_source.rb | Ruby | mit | 45 | master | 200 | module Pumi
module DataSource
end
end
require_relative "data_source/geocoder"
require_relative "data_source/iso31662"
require_relative "data_source/ncdd"
require_relative "data_source/wikipedia" |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_file.rb | Ruby | mit | 45 | master | 811 | require "yaml"
require "pathname"
module Pumi
class DataFile
DEFAULT_DATA_DIRECTORY = File.join(File.expand_path("..", File.dirname(__dir__)), "data")
TYPES = %w[provinces districts communes villages].freeze
attr_reader :type
def initialize(type)
@type = type.to_s
raise ArgumentError, "... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/store_cache.rb | Ruby | mit | 45 | master | 289 | require "delegate"
module Pumi
class StoreCache < SimpleDelegator
attr_reader :cached
def initialize(data_store)
super(data_store)
@cached = {}
end
def load(type, *args)
cached.fetch(type) do
cached[type] = super
end
end
end
end |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/location.rb | Ruby | mit | 45 | master | 962 | module Pumi
Location = Struct.new(
:id, :province_id, :district_id, :commune_id, :village_id,
:province, :district, :commune,
:name_km, :full_name_km,
:name_latin, :full_name_latin,
:name_en, :full_name_en,
:name_ungegn, :full_name_ungegn,
:address_km, :address_latin, :address_en,
:adm... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_source/iso31662.rb | Ruby | mit | 45 | master | 565 | module Pumi
module DataSource
class ISO31662
attr_reader :data_file
def initialize(data_file: Pumi::DataFile.new(:provinces))
@data_file = data_file
end
def load_data!(output_dir: "data")
data.each do |code, attributes|
attributes["iso3166_2"] = "KH-#{code.to_i}... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_source/geocoder.rb | Ruby | mit | 45 | master | 7,267 | require "geocoder"
module Pumi
module DataSource
class Geocoder
Result = Struct.new(:code, :lat, :long, :bounding_box, keyword_init: true)
class AbstractGeocoder
Result = Struct.new(
:lat, :long, :bounding_box, :country_code,
:types, :iso3166_2, :district_name_en,
... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_source/wikipedia.rb | Ruby | mit | 45 | master | 5,631 | require "nokogiri"
require "open-uri"
module Pumi
module DataSource
class Wikipedia
attr_reader :data_file, :scraper
def initialize(data_file:, scraper:)
@data_file = data_file
@scraper = scraper
end
def load_data!(output_dir: "data")
data.each do |code, attribut... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/data_source/ncdd.rb | Ruby | mit | 45 | master | 5,947 | require "pathname"
require "csv"
require "yaml"
# https://en.wikipedia.org/wiki/Administrative_divisions_of_Cambodia
# https://en.wikipedia.org/wiki/Romanization_of_Khmer
# https://en.wikipedia.org/wiki/United_Nations_Group_of_Experts_on_Geographical_Names
module Pumi
module DataSource
class NCDD
CSV_HEAD... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/bot/wikipedia.rb | Ruby | mit | 45 | master | 219 | module Pumi
module Bot
module Wikipedia
end
end
end
require_relative "wikipedia/article"
require_relative "wikipedia/communes_in_cambodia_article"
require_relative "wikipedia/districts_in_cambodia_article" |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/bot/wikipedia/article.rb | Ruby | mit | 45 | master | 222 | module Pumi
module Bot
module Wikipedia
class Article
attr_reader :client
def initialize(client: Pumi::Wikipedia::Client.new)
@client = client
end
end
end
end
end |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/bot/wikipedia/districts_in_cambodia_article.rb | Ruby | mit | 45 | master | 5,027 | require "ostruct"
require "erb"
module Pumi
module Bot
module Wikipedia
class DistrictsInCambodiaArticle < Article
PAGE_TITLE = "List_of_districts,_municipalities_and_sections_in_Cambodia".freeze
INTRO_TEXT = "This is a list of [[Cambodia]]'s %<districts_count>s districts ({{lang|km|ស្រុក}... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/bot/wikipedia/communes_in_cambodia_article.rb | Ruby | mit | 45 | master | 5,711 | require "ostruct"
require "nokogiri"
module Pumi
module Bot
module Wikipedia
class CommunesInCambodiaArticle < Article
class Location < SimpleDelegator
def communes_summary
summary = communes_by_type.map do |administrative_unit, communes|
next if Array(communes).... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/wikipedia/response.rb | Ruby | mit | 45 | master | 249 | module Pumi
module Wikipedia
class Response < SimpleDelegator
def fetch(key)
response_body.fetch(key.to_s)
end
private
def response_body
@response_body ||= JSON.parse(body)
end
end
end
end |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | lib/pumi/wikipedia/client.rb | Ruby | mit | 45 | master | 1,842 | require "faraday"
module Pumi
module Wikipedia
class Client
attr_reader :http_client
def initialize(http_client: default_http_client)
@http_client = http_client
end
def create_page(params)
execute_request(:post, build_url(resource: :page), params)
end
def up... |
github | dwilkie/pumi | https://github.com/dwilkie/pumi | app/serializers/pumi/response_serializer.rb | Ruby | mit | 45 | master | 268 | module Pumi
class ResponseSerializer
attr_reader :data
def initialize(data)
@data = data
end
def as_json(*)
data.map do |location|
location.attributes.except(:province, :district, :commune, :village)
end
end
end
end |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | ansible_doc_generator.gemspec | Ruby | mit | 45 | main | 1,227 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ansible_doc_generator/version'
Gem::Specification.new do |spec|
spec.name = 'ansible_doc_generator'
spec.version = AnsibleDocGenerator::VERSION
spec.authors ... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator.rb | Ruby | mit | 45 | main | 1,694 | require_relative "playbook_helpers"
require_relative "doc_generator/playbook_introduction_extractor"
require_relative "doc_generator/role_doc_extractor"
module AnsibleDocGenerator
class DocGenerator
include PlaybookHelpers
attr_reader :playbook_path, :lang
attr_accessor :md_output
def initialize pl... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/playbook_helpers.rb | Ruby | mit | 45 | main | 473 | require 'yaml'
module AnsibleDocGenerator
module PlaybookHelpers
private
def delete_if_exists path
FileUtils.remove_entry(path, true)
end
def paths
@paths ||= roles.map{|role| role['role'] }.reject(&:nil?)
end
def roles
playbook['roles']
end
def project_folder
... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/playbook_introduction_extractor.rb | Ruby | mit | 45 | main | 1,441 | # frozen_string_literal: true
require_relative "extractor_helper"
require_relative "interpolator"
module AnsibleDocGenerator
class DocGenerator
class PlaybookIntroductionExtractor
include ExtractorHelper
attr_reader :playbook_path, :lang
attr_accessor :parsed_content, :md_output
def in... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/interpolator.rb | Ruby | mit | 45 | main | 598 | # frozen_string_literal: true
require_relative "interpolator/variable_extractor"
require_relative "interpolator/file_extractor"
module AnsibleDocGenerator
class DocGenerator
class Interpolator
attr_reader :input, :task, :role_path
def initialize input, task, role_path
@input = input
... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/role_doc_extractor.rb | Ruby | mit | 45 | main | 2,962 | # frozen_string_literal: true
require_relative "extractor_helper"
require_relative "interpolator"
module AnsibleDocGenerator
class DocGenerator
class RoleDocExtractor
include ExtractorHelper
attr_reader :yml_path, :lang
attr_accessor :parsed_content, :md_output
META_KEYWORDS = %w(metat... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/extractor_helper.rb | Ruby | mit | 45 | main | 2,460 | # frozen_string_literal: true
module AnsibleDocGenerator
class DocGenerator
module ExtractorHelper
def extract_from keyword, lines
line = lines.find{|line| selectable_line?(keyword, line) }
clean_line(keyword, line)
end
# - a comment, for instance, can be in several lines and ... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/interpolator/variable_extractor.rb | Ruby | mit | 45 | main | 2,312 | # frozen_string_literal: true
module AnsibleDocGenerator
class DocGenerator
class Interpolator
class VariableExtractor
class MissingInterpolationError < StandardError; end
attr_reader :input, :task, :role_path
def initialize input, task, role_path
@input = input
... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | lib/ansible_doc_generator/doc_generator/interpolator/file_extractor.rb | Ruby | mit | 45 | main | 1,165 | # frozen_string_literal: true
module AnsibleDocGenerator
class DocGenerator
class Interpolator
class FileExtractor
attr_reader :input, :role_path
def initialize input, role_path
@input = input
@role_path = role_path
end
def call
output = input... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | spec/spec_helper.rb | Ruby | mit | 45 | main | 256 | # frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
require 'ansible_doc_generator'
RSpec.configure do |config|
config.mock_with :rspec
config.order = 'random'
config.expect_with :rspec do |c|
c.syntax = :expect
end
end |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | spec/ansible_doc_generator/doc_generator/playbook_introduction_extractor_spec.rb | Ruby | mit | 45 | main | 477 | require "spec_helper"
describe AnsibleDocGenerator::DocGenerator::PlaybookIntroductionExtractor do
let(:playbook_path) { 'spec/support/files/example_playbook.yml' }
let(:lang) { 'es' }
subject { described_class.new(playbook_path, lang) }
describe '#call' do
let(:expected_output) { File.read("spec/support... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | spec/ansible_doc_generator/doc_generator/role_doc_extractor_spec.rb | Ruby | mit | 45 | main | 753 | require "spec_helper"
describe AnsibleDocGenerator::DocGenerator::RoleDocExtractor do
let(:yml_path) { 'spec/support/files/example_role.yml' }
subject { described_class.new(yml_path, lang) }
describe '#call' do
context 'spanish' do
let(:lang) { 'es' }
let(:expected_output) { File.read("spec/sup... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | spec/ansible_doc_generator/doc_generator/interpolator/variable_extractor_spec.rb | Ruby | mit | 45 | main | 3,366 | require "spec_helper"
describe AnsibleDocGenerator::DocGenerator::Interpolator::VariableExtractor do
let(:role_path) { 'fake/path' }
subject { described_class.new(input, task, role_path) }
describe '#call' do
context 'basic interpolation' do
let(:input) { 'Add a line in #{lineinfile>destfile} to acti... |
github | PopulateTools/ansible-doc-generator | https://github.com/PopulateTools/ansible-doc-generator | spec/ansible_doc_generator/doc_generator/interpolator/file_extractor_spec.rb | Ruby | mit | 45 | main | 848 | require "spec_helper"
describe AnsibleDocGenerator::DocGenerator::Interpolator::FileExtractor do
subject { described_class.new(input, path) }
describe '#call' do
let(:input) { "El output es:\nf{example_file_content.txt}" }
let(:path) { 'spec/support/files/fake_non_existent_file.yml' }
context 'existi... |
github | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | Gemfile | Ruby | mit | 45 | master | 1,510 | source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
#... |
github | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | config/application.rb | Ruby | mit | 45 | master | 1,265 | require File.expand_path('../boot', __FILE__)
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 GotQuotes
class Application < Rails::Application
# Settings in config/environments/* take pre... |
github | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | db/seeds.rb | Ruby | mit | 45 | master | 6,127 | quotes = [
{quote: "Never forget what you are, for surely the world will not. Make it your strength. Then it can never be your weakness. Armor yourself in it, and it will never be used to hurt you.", character: "Tyrion"},
{quote: "Let them see that their words can cut you, and you’ll never be free of the mocker... |
github | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | db/schema.rb | Ruby | mit | 45 | master | 1,099 | # 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 | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | test/controllers/quotes_controller_test.rb | Ruby | mit | 45 | master | 972 | require 'test_helper'
class QuotesControllerTest < ActionController::TestCase
setup do
@quote = quotes(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:quotes)
end
test "should get new" do
get :new
assert_response :success
end
tes... |
github | wsizoo/game-of-thrones-quotes | https://github.com/wsizoo/game-of-thrones-quotes | app/controllers/quotes_controller.rb | Ruby | mit | 45 | master | 844 | class QuotesController < ApplicationController
before_action :set_quote, only: [:show]
# GET /quotes
# GET /quotes.json
def index
@character = params[:char]
if @character.nil?
@quote = Quote.offset(rand(Quote.count)).first
else
@quotes = Quote.where("lower(character) like ?", "%#{@chara... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | Rakefile | Ruby | apache-2.0 | 45 | master | 901 | # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
begin
require 'voxpupuli/test/rake'
rescue LoadError
# only available if gem group test is installed
end
begin
require 'voxpupuli/acceptance/rake'
rescue LoadError
# only available if gem group acceptanc... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/spec_helper_acceptance.rb | Ruby | apache-2.0 | 45 | master | 798 | # frozen_string_literal: true
require 'voxpupuli/acceptance/spec_helper_acceptance'
require 'splunk_data'
OLD_SPLUNK_VERSIONS = [
['7.2.4.2', 'fb30470262e3'],
['9.0.0', '6818ac46f2ec'],
['9.4.0', '6b4ebe426ca6'],
].freeze
configure_beaker do |host|
# Need to stage the Splunk/Splunkforwarder packages here.
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/splunk_data.rb | Ruby | apache-2.0 | 45 | master | 1,066 | # frozen_string_literal: true
SPLUNK_SERVER_TYPES = {
splunk_alert_actions: 'alert_actions.conf',
splunk_authentication: 'authentication.conf',
splunk_authorize: 'authorize.conf',
splunk_deploymentclient: 'deploymentclient.conf',
splunk_distsearch: 'distsearch.conf',
splunk_indexes: 'indexes.conf',
splun... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/spec_helper.rb | Ruby | apache-2.0 | 45 | master | 869 | # frozen_string_literal: true
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly set.
ENV['COVERAGE'] ||= 'yes' if Dir.exis... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/unit/puppet_x/voxpupuli/splunk/util_spec.rb | Ruby | apache-2.0 | 45 | master | 1,075 | # frozen_string_literal: true
require 'spec_helper'
require 'puppet_x/voxpupuli/splunk/util'
describe PuppetX::Voxpupuli::Splunk::Util do
describe '.decrypt' do
context 'when called with an unencrypted value' do
it 'returns the value unmodified' do
expect(described_class.decrypt('secrets_file', 'n... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/unit/puppet/type/splunk_config_spec.rb | Ruby | apache-2.0 | 45 | master | 1,265 | # frozen_string_literal: true
require 'spec_helper'
describe Puppet::Type.type(:splunk_config) do
let(:subject) do # rubocop:disable RSpec/SubjectDeclaration
described_class.new(
name: 'config',
server_confdir: '/opt/splunk/etc',
forwarder_confdir: '/opt/splunkforwarder/etc',
)
end
de... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/unit/puppet/type/splunk_types_spec.rb | Ruby | apache-2.0 | 45 | master | 4,881 | # frozen_string_literal: true
require 'spec_helper'
# The majority of splunk and splunkforwarder types are identical and inherit
# the same functionality off ini_file, so we don't need individual tests for them
SPLUNK_TYPES.each do |type, file_name|
describe Puppet::Type.type(type) do
context 'attributes' do
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/unit/facter/splunkforwarder_version_spec.rb | Ruby | apache-2.0 | 45 | master | 1,417 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunkforwarder_version Fact' do
before do
Facter.clear
end
it 'returns version for Windows' do
allow(File).to receive(:exist?).with('C:/Program Files/SplunkUniversalForwarder/bin/splunk.exe').and_return(true)
allow(Facter::Util::Resolut... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/unit/facter/splunk_version_spec.rb | Ruby | apache-2.0 | 45 | master | 1,242 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunk_version Fact' do
before do
Facter.clear
end
it 'returns version for Windows' do
allow(File).to receive(:exist?).with('C:/Program Files/Splunk/bin/splunk.exe').and_return(true)
allow(Facter::Util::Resolution).to receive(:exec).with... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/acceptance/splunk_forwarder_spec.rb | Ruby | apache-2.0 | 45 | master | 3,915 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'splunk::forwarder class' do
init = shell('/bin/readlink /sbin/init', acceptable_exit_codes: [0, 1]).stdout
service_name = if init.include? 'systemd'
'SplunkForwarder'
else
'splunk'
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/acceptance/splunk_enterprise_spec.rb | Ruby | apache-2.0 | 45 | master | 7,334 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'splunk enterprise class' do
init = shell('/bin/readlink /sbin/init', acceptable_exit_codes: [0, 1]).stdout
service_name = if init.include? 'systemd'
'Splunkd'
else
'splunk'
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/defines/addon_spec.rb | Ruby | apache-2.0 | 45 | master | 1,810 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunk::addon' do
context 'fail if class prerequisit not declared' do
on_supported_os.each do |os, facts|
next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows
context "on #{os}" do
let(:facts) do
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/classes/forwarder_spec.rb | Ruby | apache-2.0 | 45 | master | 21,377 | # frozen_string_literal: true
require 'spec_helper'
shared_examples_for 'splunk forwarder' do
it { is_expected.to contain_class('splunk') }
it { is_expected.to contain_class('splunk::params') }
it { is_expected.to contain_class('splunk::forwarder') }
it { is_expected.to contain_class('splunk::forwarder::insta... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/classes/enterprise_spec.rb | Ruby | apache-2.0 | 45 | master | 29,323 | # frozen_string_literal: true
require 'spec_helper'
shared_examples_for 'splunk enterprise nix defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('splunk') }
it { is_expected.to contain_class('splunk::params') }
it { is_expected.to contain_class('splunk::enterprise') }
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/classes/splunk_spec.rb | Ruby | apache-2.0 | 45 | master | 538 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunk' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows
context "on #{os}" do
let(:facts) do
facts
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/classes/forwarder/password/seed_spec.rb | Ruby | apache-2.0 | 45 | master | 5,569 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunk::forwarder::password::seed' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
if os.start_with?('windows')
# Splunk Server not used supported on windows
else
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | spec/classes/enterprise/password/seed_spec.rb | Ruby | apache-2.0 | 45 | master | 5,525 | # frozen_string_literal: true
require 'spec_helper'
describe 'splunk::enterprise::password::seed' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
if os.start_with?('windows')
# Splunk Server not used supported on windows
else
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/facter/splunk_version.rb | Ruby | apache-2.0 | 45 | master | 601 | # frozen_string_literal: true
Facter.add(:splunk_version) do
setcode do
value = nil
cmd = if File.exist?('C:/Program Files/Splunk/bin/splunk.exe')
'"C:/Program Files/Splunk/bin/splunk.exe" --version'
elsif File.exist?('/opt/splunk/bin/splunk')
'/opt/splunk/bin/splunk --versi... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/facter/splunkforwarder_version.rb | Ruby | apache-2.0 | 45 | master | 625 | # frozen_string_literal: true
Facter.add(:splunkforwarder_version) do
setcode do
value = nil
cmd = if File.exist?('C:/Program Files/SplunkUniversalForwarder/bin/splunk.exe')
'"C:/Program Files/SplunkUniversalForwarder/bin/splunk.exe" --version'
elsif File.exist?('/opt/splunkforwarder/bi... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet_x/voxpupuli/splunk/util.rb | Ruby | apache-2.0 | 45 | master | 1,012 | # frozen_string_literal: true
require 'openssl'
require 'base64'
module PuppetX
module Voxpupuli
module Splunk
class Util
def self.decrypt(secrets_file, value)
return value unless value.start_with?('$7$')
Puppet.debug "Decrypting splunk >= 7.2 data using secret from #{secrets_... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet_x/puppetlabs/splunk/type.rb | Ruby | apache-2.0 | 45 | master | 2,541 | # frozen_string_literal: true
require File.join(File.dirname(__FILE__), '..', '..', 'voxpupuli/splunk/util')
module PuppetX
module Puppetlabs
module Splunk
module Type
def self.clone_type(type)
type.ensurable
type.define_singleton_method(:title_patterns) do
[
... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_authorize/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 211 | # frozen_string_literal: true
Puppet::Type.type(:splunk_authorize).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'authorize.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_indexes/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 207 | # frozen_string_literal: true
Puppet::Type.type(:splunk_indexes).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'indexes.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_props/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 203 | # frozen_string_literal: true
Puppet::Type.type(:splunk_props).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'props.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_limits/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 214 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_limits).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'limits.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_limits/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 205 | # frozen_string_literal: true
Puppet::Type.type(:splunk_limits).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'limits.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_metadata/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 1,590 | # frozen_string_literal: true
require 'puppet/util/ini_file'
class SectionNoGlobal < Puppet::Util::IniFile::Section
def initialize(model)
super(model.name, model.start_line, model.end_line,
model.instance_variable_get(:@existing_settings),
model.indentation)
end
# this section is never global, ... |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_input/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 213 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_input).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'inputs.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_authentication/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 221 | # frozen_string_literal: true
Puppet::Type.type(:splunk_authentication).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'authentication.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_deploymentclient/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 234 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_deploymentclient).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'deploymentclient.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_server/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 205 | # frozen_string_literal: true
Puppet::Type.type(:splunk_server).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'server.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_transforms/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 213 | # frozen_string_literal: true
Puppet::Type.type(:splunk_transforms).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'transforms.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_server/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 214 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_server).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'server.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_alert_actions/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 219 | # frozen_string_literal: true
Puppet::Type.type(:splunk_alert_actions).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'alert_actions.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_props/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 212 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_props).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'props.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunk_serverclass/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 215 | # frozen_string_literal: true
Puppet::Type.type(:splunk_serverclass).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'serverclass.conf'
end
end |
github | voxpupuli/puppet-splunk | https://github.com/voxpupuli/puppet-splunk | lib/puppet/provider/splunkforwarder_web/ini_setting.rb | Ruby | apache-2.0 | 45 | master | 208 | # frozen_string_literal: true
Puppet::Type.type(:splunkforwarder_web).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk),
) do
def self.file_name
'web.conf'
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.