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 | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/spec_helper.rb | Ruby | mit | 89 | main | 599 | require 'rails/all'
require 'rspec/rails'
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
module TestApp
class Application < Rails::Application
config.root = File.dirname(__FILE__)
end
end
require 'ammeter/init'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/support/mock_generator.rb | Ruby | mit | 89 | main | 264 | # Used in generator_example_helpers_spec.rb
# set_shell_prompt_responses requires a generator w/ a shell
# as an argument. This class defines that generator w/ a shell.
class MockGenerator
attr_accessor :shell
def initialize
@shell = Object.new
end
end |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/support/matchers.rb | Ruby | mit | 89 | main | 546 | # Copied from rspec-rails spec/support/matchers.rb
module MatchesForRSpecRailsSpecs
extend RSpec::Matchers::DSL
matcher :be_included_in_files_in do |path|
match do |mod|
if RSpec::Core::Version::STRING >= '3'
stub_metadata(
:file_path => "#{path}whatever_spec.rb:15"
)
else... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/support/memoized_helpers_rspec2compatibility.rb | Ruby | mit | 89 | main | 239 | # rspec3 defines this method in RSpec::Core::MemoizedHelpers
# see https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/memoized_helpers.rb
module RSpec2MemoizedHelpersCompatibility
def is_expected
expect(subject)
end
end |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/support/helpers.rb | Ruby | mit | 89 | main | 360 | module Helpers
def stub_metadata(additional_metadata)
stub_metadata = metadata_with(additional_metadata)
allow(RSpec::Core::ExampleGroup).to receive(:metadata) { stub_metadata }
end
def metadata_with(additional_metadata)
::RSpec.describe("example group").metadata.merge(additional_metadata)
end
R... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/example/generator_example_helpers_spec.rb | Ruby | mit | 89 | main | 1,031 | require "spec_helper"
module Ammeter::RSpec::Rails
describe GeneratorExampleHelpers do
include GeneratorExampleHelpers
let(:generator) { MockGenerator.new }
it "mocks return value of ask to response" do
set_shell_prompt_responses(generator, { :ask => "response" })
expect(generator.shell.ask)... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/example/generator_example_group_spec.rb | Ruby | mit | 89 | main | 2,584 | require "spec_helper"
module Ammeter::RSpec::Rails
describe GeneratorExampleGroup do
it { is_expected.to be_included_in_files_in('./spec/generators/') }
it { is_expected.to be_included_in_files_in('.\\spec\\generators\\') }
let(:group_class) do
::RSpec::Core::ExampleGroup.describe do
inclu... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/matchers/exist_spec.rb | Ruby | mit | 89 | main | 657 | require 'spec_helper'
describe "exist" do
it 'passes when the file exists' do
allow(File).to receive(:exist?).with('/some/file/path').and_return(true)
expect('/some/file/path').to exist
end
it 'fails when the file does not exist' do
allow(File).to receive(:exist?).with('/some/file/path').and_return(... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/matchers/have_method_spec.rb | Ruby | mit | 89 | main | 561 | require 'spec_helper'
describe 'have_method' do
let(:contents) { "class SomeClass\n def some_method\n puts 'Hello world!'\n end\nend" }
subject { '/some/file/path' }
before { allow(File).to receive(:read).with('/some/file/path').and_return(contents) }
it { is_expected.to have_method(:some_method) }
it... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb | Ruby | mit | 89 | main | 931 | require 'spec_helper'
describe "be_a_migration" do
let(:migration_files) { ['db/migrate/20110504132601_create_posts.rb', 'db/migrate/20110520132601_create_users.rb'] }
before do
migration_files.each do |migration_file|
allow(File).to receive(:exist?).with(migration_file).and_return(true)
end
end
... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/matchers/have_correct_syntax_spec.rb | Ruby | mit | 89 | main | 2,805 | require 'spec_helper'
describe 'have_correct_syntax' do
describe 'ruby files' do
subject { '/test.rb' }
it 'checks if Ruby file has a proper syntax' do
stub_file subject, "class SomeClass\n def some_method\n puts 'Hello world!'\n end\nend"
expect(subject).to have_correct_syntax
end
... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | spec/ammeter/rspec/generator/matchers/contain_spec.rb | Ruby | mit | 89 | main | 995 | require 'spec_helper'
describe "contain" do
context "when the file exists" do
let(:contents) { "This file\ncontains\nthis text" }
subject { '/some/file/path' }
before do
allow(File).to receive(:read).with('/some/file/path').and_return(contents)
end
it { is_expected.to contain "This file\n... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/support/env.rb | Ruby | mit | 89 | main | 1,682 | require 'aruba/cucumber'
Before do
if RUBY_VERSION == "1.9.3"
@aruba_timeout_seconds = 60
else
@aruba_timeout_seconds = 30
end
end
def aruba_path(file_or_dir, source_foldername)
File.expand_path("../../../#{file_or_dir.sub(source_foldername,'aruba')}", __FILE__)
end
def example_app_path(file_or_dir)
... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/support/aruba_timeout.rb | Ruby | mit | 89 | main | 365 | # see https://github.com/cucumber/aruba#jruby-tips
Aruba.configure do |config|
config.before_cmd do |cmd|
set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") # force jRuby to use client JVM for faster startu... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/generate_example_app.rb | Ruby | mit | 89 | main | 944 | rspec_version = ENV['RSPEC_VERSION']
rspec_major_version = (rspec_version && rspec_version != 'master') ? rspec_version.scan(/\d+/).first : '3'
if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
gem "rspec", :git => 'git://github.com/rspec/rspec.git'
gem "rspec-core"... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/my_rails_gem/Gemfile | Ruby | mit | 89 | main | 920 | source 'https://rubygems.org'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'
if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
gem "rspec", :git => 'git://github.com/rspec/rspec.git'
gem "rspec-core", :git => 'gi... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/my_rails_gem/my_rails_gem.gemspec | Ruby | mit | 89 | main | 704 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/my_rails_gem/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Alex Rothenberg"]
gem.email = ["alex@alexrothenberg.com"]
gem.description = %q{TODO: Write a gem description}
gem.summary = %q{TODO: Write a gem summ... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/my_rails_gem/spec/spec_helper.rb | Ruby | mit | 89 | main | 458 | require 'bundler/setup'
require 'rails/all'
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
begin
# This prevents 'uninitialized constant Jquery::Rails::Railtie::PROTOTYPE_JS (NameError)'
require 'jquery/rails'
rescue LoadError
end
module MyRailsGem
module TestApp
cla... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/my_railties_gem/my_railties_gem.gemspec | Ruby | mit | 89 | main | 716 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/my_railties_gem/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Alex Rothenberg"]
gem.email = ["alex@alexrothenberg.com"]
gem.description = %q{TODO: Write a gem description}
gem.summary = %q{TODO: Write a gem s... |
github | alexrothenberg/ammeter | https://github.com/alexrothenberg/ammeter | features/templates/my_railties_gem/Gemfile | Ruby | mit | 89 | main | 923 | source 'https://rubygems.org'
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'
if rspec_version == 'master'
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
gem "rspec", :git => 'git://github.com/rspec/rspec.git'
gem "rspec-core", :git => 'gi... |
github | vwochnik/jekyll-email-protect | https://github.com/vwochnik/jekyll-email-protect | jekyll-email-protect.gemspec | Ruby | mit | 89 | master | 1,005 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jekyll/email-protect/version'
Gem::Specification.new do |spec|
spec.name = "jekyll-email-protect"
spec.version = Jekyll::EmailProtect::VERSION
spec.authors = ["Vincent ... |
github | vwochnik/jekyll-email-protect | https://github.com/vwochnik/jekyll-email-protect | lib/jekyll/email-protect.rb | Ruby | mit | 89 | master | 549 | module Jekyll
module EmailProtect
module EmailProtectionFilter
# Percent-encode alphanumeric characters of an email address
def encode_email(input)
input.to_s.chars.inject(String.new) do |result, char|
if char =~ /\p{Alnum}/
char.bytes.inject(result) do |result, byte|
... |
github | vwochnik/jekyll-email-protect | https://github.com/vwochnik/jekyll-email-protect | spec/protect_email_filter_spec.rb | Ruby | mit | 89 | master | 795 | require 'spec_helper'
describe(Jekyll::EmailProtect::EmailProtectionFilter) do
let(:output) do
render_liquid(content, {'email' => email})
end
context "simple example address" do
let(:email) { "example@example.com" }
let(:content) { "{{ '#{email}' | encode_email }}" }
it "produces the correct p... |
github | vwochnik/jekyll-email-protect | https://github.com/vwochnik/jekyll-email-protect | spec/spec_helper.rb | Ruby | mit | 89 | master | 381 | TEST_DIR = File.dirname(__FILE__)
require 'liquid'
require File.expand_path("../lib/jekyll-email-protect.rb", TEST_DIR)
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.order = 'random'
def render_liquid(content, variables)
template = Liquid::Temp... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | Rakefile | Ruby | mit | 89 | main | 258 | require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.libs << "test"
end
desc "Run tests"
task :default => :test
task :test do
system("bundle exec rspec spec/main_spec.rb")
system("bundle exec rspec spec/inline_spec.rb")
end |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | dbg-rb.gemspec | Ruby | mit | 89 | main | 884 | # -*- encoding: utf-8 -*-
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "dbg_rb/version"
Gem::Specification.new do |s|
s.name = "dbg-rb"
s.version = DbgRb::VERSION
s.authors = ["pawurb"]
s.email = ["contact@pawelurbanek.com"]
s.summary = "Simple de... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | lib/dbg-rb.rb | Ruby | mit | 89 | main | 3,700 | # frozen_string_literal: true
require "json"
module DbgRb
def self.color_code=(val)
Impl.color_code = val
end
def self.highlight!(wrapper = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
Impl.highlight!(wrapper)
end
def self.logger=(val)
Impl.logger = val
end
def self.log_level=(val)
Impl.log_level ... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | spec/inline_spec.rb | Ruby | mit | 89 | main | 5,459 | # frozen_string_literal: true
require "spec_helper"
require_relative '../inline/dbg_rb'
require "ostruct"
describe DbgRb do
before do
DbgRb.color_code = nil
DbgRb.highlight!(false)
end
it "constant values" do
expect do
dbg("123")
end.to output("[spec/inline_spec.rb:15] \"123\"\n").to_stdo... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | spec/main_spec.rb | Ruby | mit | 89 | main | 5,392 | # frozen_string_literal: true
require "spec_helper"
require "dbg-rb"
require "ostruct"
describe DbgRb do
before do
DbgRb.color_code = nil
DbgRb.highlight!(false)
end
it "constant values" do
expect do
dbg("123")
end.to output("[spec/main_spec.rb:15] \"123\"\n").to_stdout
expect do
... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | inline/sync.rb | Ruby | mit | 89 | main | 1,659 | #!/usr/bin/env ruby
require "fileutils"
FileUtils.cp("lib/dbg-rb.rb", "inline/dbg_rb.rb")
license = <<~LICENSE
# Source https://github.com/pawurb/dbg-rb
# The MIT License (MIT)
# Copyright © Paweł Urbanek 2024
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and a... |
github | pawurb/dbg-rb | https://github.com/pawurb/dbg-rb | inline/dbg_rb.rb | Ruby | mit | 89 | main | 4,861 | # frozen_string_literal: true
# Source https://github.com/pawurb/dbg-rb
# The MIT License (MIT)
# Copyright © Paweł Urbanek 2024
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without r... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | fly-ruby.gemspec | Ruby | bsd-3-clause | 89 | main | 645 | require_relative 'lib/fly-ruby/version'
Gem::Specification.new do |spec|
spec.name = "fly-ruby"
spec.version = Fly::VERSION
spec.authors = ["Joshua Sierles"]
spec.homepage = "https://github.com/superfly/fly-ruby"
spec.summary = "Augment Ruby web apps for deployment in Fly.io"
spec.description = "Automate t... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | Rakefile | Ruby | bsd-3-clause | 89 | main | 496 | require "bundler/gem_tasks"
require "rake/testtask"
require_relative "lib/fly-ruby/version"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/*.rb']
t.verbose = true
end
desc "Run tests"
task default: :test
task :top do
puts Rake.application.top_level_tasks
end
task :publish do
vers... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | test/configuration_test.rb | Ruby | bsd-3-clause | 89 | main | 824 | require "rack/test"
require "minitest/autorun"
require_relative "../lib/fly-ruby"
ENV["TESTING"] = "1"
class ConfigurationTest < Minitest::Test
def setup
ENV["REDIS_URL"] = "redis://redis.internal:6379"
ENV["DATABASE_URL"] = "postgresql://db.internal:6379"
ENV["FLY_REGION"] = "iad"
ENV["PRIMARY_REGI... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | test/rails_test.rb | Ruby | bsd-3-clause | 89 | main | 4,041 | require "rack/test"
require "minitest/autorun"
require "bundler/setup"
require "climate_control"
require "minitest/around/unit"
require "active_support/testing/isolation"
require_relative "test_rails_app/app"
POSTGRES_HOST = ENV["DATABASE_HOST"] || "localhost"
class TestFlyRails < Minitest::Test
include ActiveSupp... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | test/regional_database_test.rb | Ruby | bsd-3-clause | 89 | main | 1,920 | require "rack/test"
require "minitest/autorun"
require_relative "../lib/fly-ruby"
ENV["TESTING"] = "1"
class RegionalDatabaseTest < Minitest::Test
include Rack::Test::Methods
def setup
ENV['DATABASE_URL'] = 'postgres://localhost:5432'
Fly.configuration = nil
Fly.configure do |config|
config.pri... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | test/fly_test.rb | Ruby | bsd-3-clause | 89 | main | 825 | require "minitest/autorun"
require_relative "../lib/fly-ruby"
ENV["TESTING"] = "1"
class FlyTest < Minitest::Test
def test_configuration
assert_kind_of Fly::Configuration, Fly.configuration
end
def test_configuration_can_be_reset
old_configuration = Fly.configuration
Fly.configuration = nil
as... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | test/test_rails_app/app.rb | Ruby | bsd-3-clause | 89 | main | 2,177 | require "rails"
require "active_record"
require "active_record/railtie"
require "action_view/railtie"
require "action_controller/railtie"
require_relative "../../lib/fly-ruby/railtie"
# Bare bones Rails app, borrowed from the mighty sentry-rails gem
class TestApp < Rails::Application;end
ActiveRecord::Base.establish... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | lib/fly-ruby.rb | Ruby | bsd-3-clause | 89 | main | 638 | # frozen_string_literal: true
require_relative "fly-ruby/configuration"
require_relative "fly-ruby/regional_database"
require_relative "fly-ruby/headers"
require "forwardable"
if defined?(::Rails)
require_relative "fly-ruby/railtie"
end
module Fly
class << self
extend Forwardable
def instance
@in... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | lib/fly-ruby/regional_database.rb | Ruby | bsd-3-clause | 89 | main | 3,423 | # frozen_string_literal: true
require 'rake'
module Fly
# Note that using instance variables in Rack middleware is considered a poor practice in
# multithreaded environments. Instead of using dirty tricks like using Object#dup,
# values are passed to methods.
module RegionalDatabase
# Stop the current re... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | lib/fly-ruby/railtie.rb | Ruby | bsd-3-clause | 89 | main | 929 | # frozen_string_literal: true
class Fly::Railtie < Rails::Railtie
initializer("fly.regional_database", before: "active_record.initialize_database") do |app|
# Insert the request middleware high in the stack, but after static file delivery
app.config.middleware.insert_after ActionDispatch::Executor, Fly::Head... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | lib/fly-ruby/headers.rb | Ruby | bsd-3-clause | 89 | main | 329 | # frozen_string_literal: true
module Fly
class Headers
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
response = Rack::Response.new(body, status, headers)
response.set_header('Fly-Region', ENV['FLY_REGION'])
response.finish
end
... |
github | superfly/fly-ruby | https://github.com/superfly/fly-ruby | lib/fly-ruby/configuration.rb | Ruby | bsd-3-clause | 89 | main | 4,282 | # frozen_string_literal: true
module Fly
class Configuration
# Set the region where this instance of the application is deployed
attr_accessor :current_region
# Set the region where the primary database lives, i.e "ams"
attr_accessor :primary_region
# Automatically replay these HTTP methods in ... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | metadata.rb | Ruby | apache-2.0 | 89 | main | 676 | # frozen_string_literal: true
name 'erlang'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Provides resources to install Erlang from distro packages, Erlang Solutions packages, or source.'
version '9.0.0'
source_url ... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | libraries/helpers.rb | Ruby | apache-2.0 | 89 | main | 1,086 | # frozen_string_literal: true
module ErlangCookbook
module Helpers
def erlang_package_name
platform_family?('debian') ? 'erlang-dev' : 'erlang'
end
def erlang_build_dependencies
case node['platform_family']
when 'debian'
%w(tar libncurses-dev openssl libssl-dev)
when 'rhe... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | spec/spec_helper.rb | Ruby | apache-2.0 | 89 | main | 304 | # frozen_string_literal: true
require 'chefspec'
require 'chefspec/berkshelf'
RSpec.configure do |config|
config.color = true # Use color in STDOUT
config.formatter = :documentation # Use the specified formatter
config.log_level = :error # Avoid deprecation notice SPAM
end |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | spec/unit/resources/esl_spec.rb | Ruby | apache-2.0 | 89 | main | 1,497 | # frozen_string_literal: true
require 'spec_helper'
describe 'erlang_esl' do
step_into :erlang_esl
context 'on ubuntu' do
platform 'ubuntu', '24.04'
recipe do
erlang_esl 'default' do
lsb_codename 'noble'
end
end
it { is_expected.to periodic_apt_update('update') }
it { is... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | spec/unit/resources/source_spec.rb | Ruby | apache-2.0 | 89 | main | 1,392 | # frozen_string_literal: true
require 'spec_helper'
describe 'erlang_source' do
step_into :erlang_source
context 'on ubuntu' do
platform 'ubuntu', '24.04'
recipe do
erlang_source 'default' do
version '23.1'
checksum 'cb5b7246eeaac9298c51c9915386df2f784e82a3f7ff93b68453591f0b370400'... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | spec/unit/resources/package_spec.rb | Ruby | apache-2.0 | 89 | main | 1,058 | # frozen_string_literal: true
require 'spec_helper'
describe 'erlang_package' do
step_into :erlang_package
context 'on ubuntu' do
platform 'ubuntu', '24.04'
recipe do
erlang_package 'default'
end
it { is_expected.to periodic_apt_update('update') }
it { is_expected.to install_package('... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | resources/source.rb | Ruby | apache-2.0 | 89 | main | 2,398 | # frozen_string_literal: true
provides :erlang_source
unified_mode true
property :version, String, default: '28.5'
property :checksum, [String, nil]
property :url, String, default: lazy { "https://github.com/erlang/otp/releases/download/OTP-#{version}/otp_src_#{version}.tar.gz" }
property :build_flags, String, defaul... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | resources/esl.rb | Ruby | apache-2.0 | 89 | main | 2,329 | # frozen_string_literal: true
provides :erlang_esl
unified_mode true
property :package_name, String, default: 'esl-erlang'
property :version, [String, nil]
property :lsb_codename, String, default: lazy { node.dig('lsb', 'codename') || node['platform_version'] }
property :apt_repo_uri, String, default: 'https://packag... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | resources/package.rb | Ruby | apache-2.0 | 89 | main | 864 | # frozen_string_literal: true
provides :erlang_package
unified_mode true
property :package_name, [String, Array, nil]
property :version, [String, nil]
property :install_epel_repository, [true, false], default: true
default_action :install
action :install do
apt_update 'update' do
action :periodic
end if pla... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | test/integration/spec_helper.rb | Ruby | apache-2.0 | 89 | main | 243 | # frozen_string_literal: true
def erlang_version_command
'erl -eval \'{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().\' -noshell'
end |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | test/integration/source/controls/source_spec.rb | Ruby | apache-2.0 | 89 | main | 617 | # frozen_string_literal: true
require_relative '../../spec_helper'
title 'Erlang Source Install Tests'
control 'erlang-source-01' do
impact 1.0
title 'Erlang source install is linked into the PATH'
describe file('/usr/local/erlang/28.5/bin/erl') do
it { should exist }
it { should be_executable }
end... |
github | sous-chefs/erlang | https://github.com/sous-chefs/erlang | test/integration/default/controls/default_spec.rb | Ruby | apache-2.0 | 89 | main | 491 | # frozen_string_literal: true
require_relative '../../spec_helper'
title 'Default Erlang Package Tests'
control 'erlang-package-01' do
impact 1.0
title 'Erlang is installed from packages'
describe command('erl -eval "erlang:display(erlang:system_info(otp_release)), halt()." -noshell') do
its('exit_status'... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | image_info.gemspec | Ruby | mit | 89 | master | 1,442 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'image_info/version'
Gem::Specification.new do |spec|
spec.name = 'image_info'
spec.version = ImageInfo::VERSION
spec.authors = ['Pierre-Louis Gottfrois']
spec.email = ['pierrelou... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info.rb | Ruby | mit | 89 | master | 793 | require 'image_info/version'
require 'image_info/processor'
require 'image_info/configurable'
module ImageInfo
extend Configurable
# Returns type and size given an url or a list of urls.
#
# @example
# ImageInfo.from('http://foo.com/foo.png').first.size
# => [250, 86]
#
# @example
# ImageInfo... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/configuration.rb | Ruby | mit | 89 | master | 330 | module ImageInfo
class Configuration
attr_accessor :max_concurrency, :max_image_size, :redirect_limit, :http_open_timeout, :http_read_timeout
def initialize
@max_concurrency = 20
@max_image_size = -1
@redirect_limit = 50
@http_open_timeout = nil
@http_read_timeout = nil
end
... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/request_handler.rb | Ruby | mit | 89 | master | 952 | require 'stringio'
module ImageInfo
class RequestHandler
attr_reader :image, :buffer, :options
def initialize(image, options: {})
@image = image
@buffer = StringIO.new
@options = options
end
def build
::Typhoeus::Request.new(image.uri.to_s, followlocation: true, accept_encod... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/parser.rb | Ruby | mit | 89 | master | 612 | require 'image_size'
require 'image_info/null_parser'
module ImageInfo
class Parser
attr_reader :image, :data
def initialize(image, data)
@image = image
@data = data
end
def call
set_image_size
set_image_type
end
private
def set_image_size
image.width = ... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/processor.rb | Ruby | mit | 89 | master | 856 | require 'typhoeus'
require 'image_info/image'
require 'image_info/parser'
require 'image_info/request_handler'
module ImageInfo
class Processor
attr_reader :images, :options
def initialize(urls, options = { max_concurrency: ::ImageInfo.config.max_concurrency, redirect_limit: ::ImageInfo.config.redirect_lim... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/image.rb | Ruby | mit | 89 | master | 498 | require 'addressable/uri'
module ImageInfo
class Image
attr_reader :uri
attr_accessor :width, :height, :type
def initialize(uri)
@uri = ::Addressable::URI.parse(uri.to_s)
@uri.scheme = 'http' unless @uri.scheme
@uri.normalize!
rescue ::Addressable::URI::InvalidURIError
... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | lib/image_info/configurable.rb | Ruby | mit | 89 | master | 219 | require 'image_info/configuration'
module ImageInfo
module Configurable
def config
@config ||= ::ImageInfo::Configuration.new
end
def configure
yield config if block_given?
end
end
end |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | spec/image_info_spec.rb | Ruby | mit | 89 | master | 467 | require 'spec_helper'
describe ImageInfo do
let(:url) { 'http://foo.com/ad.gif' }
let(:data) { File.read(File.expand_path('fixtures/ad.gif', __dir__)) }
before do
stub_request(:get, url).to_return(body: data, status: 200)
end
subject(:image) { described_class.from(url).first }
it { expect(image.widt... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | spec/image_info/image_spec.rb | Ruby | mit | 89 | master | 1,237 | require 'spec_helper'
describe ImageInfo::Image do
let(:uri) { 'http://foo.com/foo.png' }
let(:instance) { described_class.new(uri) }
it { expect(instance.width).to eq(nil) }
it { expect(instance.height).to eq(nil) }
it { expect(instance.valid?).to eq(true) }
describe '#size' do
it { expect(instance.... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | spec/image_info/parser_spec.rb | Ruby | mit | 89 | master | 2,184 | require 'spec_helper'
describe ImageInfo::Parser do
let(:uri) { 'http://foo.com' }
let(:image) { ImageInfo::Image.new(uri) }
let(:instance) { described_class.new(image, data) }
describe '#call' do
subject(:call) { instance.call }
context 'animated_gif' do
let(:data) { File.read(File.expand_path... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | spec/image_info/configurable_spec.rb | Ruby | mit | 89 | master | 403 | require 'spec_helper'
describe ImageInfo::Configurable do
let(:klass) do
Class.new do
include ImageInfo::Configurable
end
end
let(:instance) { klass.new }
describe '#configure' do
let(:configuration) { ImageInfo::Configuration.new }
it 'yields' do
expect(instance).to receive(:conf... |
github | gottfrois/image_info | https://github.com/gottfrois/image_info | spec/image_info/processor_spec.rb | Ruby | mit | 89 | master | 2,333 | require 'spec_helper'
describe ImageInfo::Processor do
let(:instance) { described_class.new(urls) }
describe '#process' do
context 'with one valid url' do
let(:urls) { 'http://foo.com' }
let!(:stub) { stub_request(:get, urls).to_return(body: '', status: 200) }
it 'requests url' do
i... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | negasonic.gemspec | Ruby | mit | 89 | master | 1,207 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "negasonic/version"
Gem::Specification.new do |spec|
spec.name = "negasonic"
spec.version = Negasonic::VERSION
spec.authors = ["Jose Anasco"]
spec.email = ["joseanasco1@gmail.... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | config.ru | Ruby | mit | 89 | master | 326 | require 'bundler'
Bundler.require
require 'opal/rspec'
sprockets_env = Opal::RSpec::SprocketsEnvironment.new(spec_pattern='spec/**/*_spec.rb')
run Opal::Server.new(sprockets: sprockets_env) { |s|
s.main = 'opal/rspec/sprockets_runner'
s.append_path 'spec'
sprockets_env.add_spec_paths_to_sprockets
s.debug = fa... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | Gemfile | Ruby | mit | 89 | master | 338 | source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'tone.rb', git: "https://github.com/merongivian/tone.rb"
gem 'opal-sprockets'
gem 'opal-rspec', git: 'https://github.com/opal/opal-rspec', submodules: true
gem 'rspec'
# Specify your gem's dependencies in negasoni... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | spec/instrument/effects_set_spec.rb | Ruby | mit | 89 | master | 542 | require 'tone'
require 'negasonic/instrument/effects_set'
describe Negasonic::Instrument::EffectsSet do
let(:effects_set) { described_class.new }
describe '#create_from_array' do
it 'creates a collection of tone effects just with effects names' do
effects_set =
Negasonic::Instrument::EffectsSet.... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic.rb | Ruby | mit | 89 | master | 580 | if RUBY_ENGINE == 'opal'
require 'tone'
require 'negasonic/instrument'
require 'negasonic/looped_event'
require 'negasonic/notes_generation'
require 'negasonic/dsl'
require 'negasonic/time'
extend Negasonic::DSL
module Negasonic
@default_instrument =
Instrument.add('default').tap do |instrum... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/time.rb | Ruby | mit | 89 | master | 1,295 | module Negasonic
module Time
CYCLE_DURATION = 1200
NOTATION = 'i'
CYCLE_DURATION_IN_NOTATION = "#{CYCLE_DURATION}#{NOTATION}"
@just_started = true
@next_cycle_number = 0
class << self
attr_accessor :just_started, :next_cycle_number
def schedule_next_cycle(&block)
if @just... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/instrument.rb | Ruby | mit | 89 | master | 2,820 | require 'negasonic/instrument/effects_set'
require 'negasonic/instrument/synth'
require 'negasonic/notes_generation/dsl'
require 'negasonic/dsl'
module Negasonic
class Instrument
include Negasonic::NotesGeneration::DSL
@all = []
class << self
attr_accessor :all
def find(name)
@all.... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/looped_event.rb | Ruby | mit | 89 | master | 614 | require 'js'
require 'negasonic/looped_event/part'
require 'negasonic/looped_event/pattern'
require 'negasonic/looped_event/cycle'
module Negasonic
module LoopedEvent
class << self
def start(looped_element, duration)
looped_element.loop = true
looped_element.loop_end = duration
loop... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation.rb | Ruby | mit | 89 | master | 3,822 | #--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/dsl.rb | Ruby | mit | 89 | master | 2,305 | require 'negasonic/notes_generation/dsl'
require 'negasonic/time'
module Negasonic
module DSL
include Negasonic::NotesGeneration::DSL
def part(instrument:, &block)
the_instrument = Negasonic::Instrument.find(instrument)
the_loop = Negasonic::LoopedEvent::Part.new(the_instrument.input_node)
... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation/note.rb | Ruby | mit | 89 | master | 4,301 | #--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation/wrapping_array.rb | Ruby | mit | 89 | master | 856 | #--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation/dsl.rb | Ruby | mit | 89 | master | 467 | module Negasonic
module NotesGeneration
module DSL
def scale(tonic_or_name, *opts)
NotesGeneration.scale(tonic_or_name, *opts).to_a
end
def chord(tonic_or_name, *opts)
NotesGeneration.chord(tonic_or_name, *opts).to_a
end
def chord_degree(degree, tonic, scale=:major,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation/chord.rb | Ruby | mit | 89 | master | 5,508 | #--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/notes_generation/scale.rb | Ruby | mit | 89 | master | 6,871 | #--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/looped_event/part.rb | Ruby | mit | 89 | master | 559 | module Negasonic
module LoopedEvent
class Part
def initialize(synth)
@synth = synth
@definitions = []
end
def start
do_start do |time, event|
@synth.trigger_attack_release(event.JS['note'], event.JS['duration'], time)
end
end
def play(note,... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/looped_event/pattern.rb | Ruby | mit | 89 | master | 988 | module Negasonic
module LoopedEvent
class Pattern
TYPES = {
random: 'random',
random_walk: 'randomWalk',
random_once: 'randomOnce',
up: 'up',
down: 'down',
up_down: 'upDown',
down_up: 'downUp',
alternate_up: 'alternateUp',
alternate_dow... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/looped_event/cycle.rb | Ruby | mit | 89 | master | 2,830 | require 'negasonic/notes_generation/dsl'
require 'negasonic/time'
module Negasonic
module LoopedEvent
class Cycle
attr_reader :synth
include Negasonic::NotesGeneration::DSL
def initialize(synth, segments = [], humanize: false, probability: 1, expand: 1, every: 1, sustain: 0.15)
@synth... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/instrument/synth.rb | Ruby | mit | 89 | master | 807 | module Negasonic
class Instrument
class Synth
class << self
def simple(**opts)
Tone::Synth::Simple.new(**opts)
end
def membrane(**opts)
Tone::Synth::Membrane.new(**opts)
end
def am(**opts)
Tone::Synth::AM.new(**opts)
end
... |
github | merongivian/negasonic | https://github.com/merongivian/negasonic | lib/negasonic/instrument/effects_set.rb | Ruby | mit | 89 | master | 1,970 | module Negasonic
class Instrument
class EffectsSet
attr_reader :nodes
def self.create_from_array(nodes_names)
new.tap do |effects_set|
nodes_names.each do |node_name|
effects_set.send(node_name)
end
end
end
def initialize
@nodes = [... |
github | fastlane-community/fastlane-plugin-ionic | https://github.com/fastlane-community/fastlane-plugin-ionic | fastlane-plugin-ionic.gemspec | Ruby | mit | 89 | master | 1,009 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/ionic/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-ionic'
spec.version = Fastlane::Ionic::VERSION
spec.author = 'Jan Piotrowski'
spec.email... |
github | fastlane-community/fastlane-plugin-ionic | https://github.com/fastlane-community/fastlane-plugin-ionic | spec/spec_helper.rb | Ruby | mit | 89 | master | 378 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
# This module is only used to check the environment is currently a testing env
module SpecHelper
end
require 'fastlane' # to import the Action super class
require 'fastlane/plugin/ionic' # import the actual plugin
Fastlane.load_actions # load other actions (... |
github | fastlane-community/fastlane-plugin-ionic | https://github.com/fastlane-community/fastlane-plugin-ionic | lib/fastlane/plugin/ionic.rb | Ruby | mit | 89 | master | 457 | require 'fastlane/plugin/ionic/version'
module Fastlane
module Ionic
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all available actions ... |
github | fastlane-community/fastlane-plugin-ionic | https://github.com/fastlane-community/fastlane-plugin-ionic | lib/fastlane/plugin/ionic/actions/ionic_action.rb | Ruby | mit | 89 | master | 14,364 | module Fastlane
module Actions
module SharedValues
CORDOVA_IOS_RELEASE_BUILD_PATH = :CORDOVA_IOS_RELEASE_BUILD_PATH
CORDOVA_ANDROID_RELEASE_BUILD_PATH = :CORDOVA_ANDROID_RELEASE_BUILD_PATH
end
class IonicAction < Action
# valid action params
ANDROID_ARGS_MAP = {
keystore_... |
github | fastlane-community/fastlane-plugin-ionic | https://github.com/fastlane-community/fastlane-plugin-ionic | lib/fastlane/plugin/ionic/helper/ionic_helper.rb | Ruby | mit | 89 | master | 296 | module Fastlane
module Helper
class IonicHelper
# class methods that you define here become available in your action
# as `Helper::IonicHelper.your_method`
#
def self.show_message
UI.message("Hello from the ionic plugin helper!")
end
end
end
end |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | tty-option.gemspec | Ruby | mit | 89 | master | 1,327 | # frozen_string_literal: true
require_relative "lib/tty/option/version"
Gem::Specification.new do |spec|
spec.name = "tty-option"
spec.version = TTY::Option::VERSION
spec.authors = ["Piotr Murach"]
spec.email = ["piotr@piotrmurach.com"]
spec.summary = "An intuitive and fle... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | Gemfile | Ruby | mit | 89 | master | 490 | source "https://rubygems.org"
gemspec
gem "json", "2.4.1" if RUBY_VERSION == "2.0.0"
group :test do
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1.0")
gem "rspec-benchmark", "~> 0.6"
end
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5.0")
gem "coveralls_reborn", "~> 0.21.0"
g... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | spec/spec_helper.rb | Ruby | mit | 89 | master | 1,385 | # frozen_string_literal: true
if ENV["COVERAGE"] == "true"
require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
command_name "spec"
add_filter "spec... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | spec/perf/parse_spec.rb | Ruby | mit | 89 | master | 2,508 | # frozen_string_literal: true
require "optparse"
require "rspec-benchmark"
RSpec.describe TTY::Option, "#parse" do
include RSpec::Benchmark::Matchers
it "parses option with argument 3.5x slower than optparse" do
cmd = new_command do
include TTY::Option
option :foo do
short "-f string"
... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | spec/unit/subclass_spec.rb | Ruby | mit | 89 | master | 3,711 | # frozen_string_literal: true
RSpec.describe TTY::Option do
it "inherits parameters from parent class" do
parent_class = command("ParentCmd") do
option :foo do
long "--foo string"
end
end
child_class = command("ChildCmd", parent_class)
expect(parent_class.parameters.map(&:key))
... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | spec/unit/converter_spec.rb | Ruby | mit | 89 | master | 1,042 | # frozen_string_literal: true
RSpec.describe TTY::Option::Converter do
let(:converter) do
stub_const("Casting", Module.new do
extend TTY::Option::Converter
end)
Casting
end
it "checks if conversion is defined" do
expect(converter.contain?(:foo)).to eq(false)
end
it "checks if conversi... |
github | piotrmurach/tty-option | https://github.com/piotrmurach/tty-option | spec/unit/usage_spec.rb | Ruby | mit | 89 | master | 7,409 | # frozen_string_literal: true
RSpec.describe TTY::Option::Usage do
context "program" do
it "defaults program to current executable name" do
usage = described_class.new
expect(usage.program).to eq("rspec")
end
it "changes default program name via property" do
usage = described_class.new... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.