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 | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit.rb | Ruby | mit | 19 | main | 423 | # frozen_string_literal: true
require_relative 'tenkit/container'
require_relative 'tenkit/client'
require_relative 'tenkit/config'
require_relative 'tenkit/version'
require_relative 'tenkit/weather'
require_relative 'tenkit/weather_alert'
require_relative 'tenkit/tenkit_error'
module Tenkit
class << self
attr_... |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/container.rb | Ruby | mit | 19 | main | 1,967 | require_relative "utils"
module Tenkit
class Container
def initialize(contents)
return unless contents.is_a?(Hash)
contents.each do |key, val|
name = Tenkit::Utils.snake(key)
singleton_class.class_eval { attr_accessor name }
if val.is_a?(Array)
val = if key == "days... |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/weather_alert_collection.rb | Ruby | mit | 19 | main | 312 | module Tenkit
class WeatherAlertCollection
attr_reader :alerts, :details_url
def initialize(weather_alerts)
return if weather_alerts.nil?
@alerts = weather_alerts['alerts'].map { |alert| WeatherAlertSummary.new(alert) }
@details_url = weather_alerts['detailsUrl']
end
end
end |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/weather_alert.rb | Ruby | mit | 19 | main | 216 | module Tenkit
class WeatherAlert
attr_reader :summary
def initialize(response)
parsed_response = JSON.parse(response.body)
@summary = WeatherAlertSummary.new(parsed_response)
end
end
end |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/weather_alert_response.rb | Ruby | mit | 19 | main | 231 | require_relative "response"
module Tenkit
class WeatherAlertResponse < Response
attr_reader :weather_alert
def initialize(response)
super
@weather_alert = Tenkit::WeatherAlert.new(response)
end
end
end |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/weather_response.rb | Ruby | mit | 19 | main | 204 | require_relative './response'
module Tenkit
class WeatherResponse < Response
attr_reader :weather
def initialize(response)
super
@weather = Weather.new(response)
end
end
end |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/config.rb | Ruby | mit | 19 | main | 528 | # frozen_string_literal: true
module Tenkit
class Config
attr_accessor :team_id, :service_id, :key_id, :key
REQUIRED_ATTRIBUTES = [
:@team_id,
:@service_id,
:@key_id,
:@key
]
def validate!
missing_required = REQUIRED_ATTRIBUTES.filter { |required| instance_variable_get... |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/client.rb | Ruby | mit | 19 | main | 1,800 | # frozen_string_literal: true
require 'jwt'
require 'openssl'
require 'httparty'
require_relative './weather_response'
require_relative './weather_alert_response'
module Tenkit
class Client
include HTTParty
base_uri 'https://weatherkit.apple.com/api/v1'
DATA_SETS = {
current_weather: 'currentWeat... |
github | superbasicxyz/tenkit | https://github.com/superbasicxyz/tenkit | lib/tenkit/weather.rb | Ruby | mit | 19 | main | 1,191 | require_relative './next_hour_forecast'
require_relative './trend_comparison'
require_relative './weather_alert_collection'
module Tenkit
class Weather
attr_reader :current_weather,
:forecast_daily,
:forecast_hourly,
:forecast_next_hour,
:trend_comp... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | tournament-system.gemspec | Ruby | mit | 19 | master | 940 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tournament_system/version'
Gem::Specification.new do |spec|
spec.name = 'tournament-system'
spec.version = TournamentSystem::VERSION
spec.authors = ['Benjamin Schaaf']
spec.email ... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | Rakefile | Ruby | mit | 19 | master | 266 | require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'reek/rake/task'
RSpec::Core::RakeTask.new(:rspec)
RuboCop::RakeTask.new
Reek::Rake::Task.new
task default: :test
task test: %w[rspec lint]
task lint: %w[rubocop reek] |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | Gemfile | Ruby | mit | 19 | master | 242 | source 'https://rubygems.org'
gemspec
# For build scripts
gem 'rake'
# Use rspec for tests
gem 'rspec'
# Test coverage
gem 'simplecov'
# Linting
gem 'rubocop', '~> 0.56.0'
gem 'reek'
group :test do
gem 'coveralls', require: false
end |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/spec_helper.rb | Ruby | mit | 19 | master | 619 | require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter,
]
SimpleCov.minimum_coverage 98
SimpleCov.start
require 'tournament_system'
require 'support/test_driver'
RSpec.configure do |config|
# ... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/support/test_driver.rb | Ruby | mit | 19 | master | 1,377 | require 'ostruct'
require 'tournament_system'
class TestDriver < TournamentSystem::Driver
# rubocop:disable Metrics/CyclomaticComplexity
def initialize(options = {})
@teams = options[:teams] || []
@ranked_teams = options[:ranked_teams] || @teams
@matches = options[:matches] || []
@winners = option... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/double_elimination_spec.rb | Ruby | mit | 19 | master | 7,899 | describe TournamentSystem::DoubleElimination do
def gen_matches(num)
Array.new(num) { [0, 1] }
end
describe '#total_rounds' do
it 'calls Algorithm::DoubleBracket#total_rounds' do
driver = instance_double('Driver')
expect(driver).to receive(:seeded_teams) { [1, 2] }
expect(TournamentSys... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/single_elimination_spec.rb | Ruby | mit | 19 | master | 5,571 | describe TournamentSystem::SingleElimination do
describe '#total_rounds' do
it 'calls Algorithm::SingleBracket#total_rounds' do
driver = instance_double('Driver')
expect(driver).to receive(:seeded_teams) { [1, 2] }
expect(TournamentSystem::Algorithm::SingleBracket)
.to receive(:total_ro... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/page_playoff_spec.rb | Ruby | mit | 19 | master | 3,113 | describe TournamentSystem::PagePlayoff do
describe '#total_rounds' do
it 'returns 3' do
expect(described_class.total_rounds).to eq(3)
end
end
describe '#guess_round' do
it 'calls Algorithm::PagePlayoff#guess_round' do
driver = instance_double('Driver')
expect(driver).to receive(:mat... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/round_robin_spec.rb | Ruby | mit | 19 | master | 3,394 | describe TournamentSystem::RoundRobin do
describe '#total_rounds' do
it 'calls Algorithm::RoundRobin#total_rounds' do
driver = instance_double('Driver')
expect(driver).to receive(:seeded_teams) { [1, 2] }
expect(TournamentSystem::Algorithm::RoundRobin)
.to receive(:total_rounds)
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/swiss_spec.rb | Ruby | mit | 19 | master | 837 | describe TournamentSystem::Swiss do
describe '#minimum_rounds' do
it 'calls Algorithm::Swiss#minimum_rounds' do
driver = instance_double('Driver')
expect(driver).to receive(:seeded_teams) { [1, 2] }
expect(TournamentSystem::Algorithm::Swiss)
.to receive(:minimum_rounds)
.with(... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/swiss/dutch_spec.rb | Ruby | mit | 19 | master | 6,140 | describe TournamentSystem::Swiss::Dutch do
describe '#pair' do
context 'first round' do
it 'works for 4 teams' do
driver = TestDriver.new(teams: [1, 2, 3, 4])
matches = described_class.pair driver
match1, match2 = matches
expect(match1[0]).to eq(1)
expect(match1[1]).... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/swiss/accelerated_dutch_spec.rb | Ruby | mit | 19 | master | 6,389 | describe TournamentSystem::Swiss::AcceleratedDutch do
describe '#pair' do
context 'first round' do
it 'works for 4 teams' do
driver = TestDriver.new(teams: [1, 2, 3, 4])
matches = described_class.pair driver
match1, match2 = matches
expect(match1).to eq([1, 2])
expec... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/group_pairing_spec.rb | Ruby | mit | 19 | master | 1,804 | describe TournamentSystem::Algorithm::GroupPairing do
def gen_teams(num)
(1..num).to_a.freeze
end
describe '#adjacent' do
it 'pairs adjacent teams' do
expect(described_class.adjacent(gen_teams(2))).to eq([[1, 2]])
expect(described_class.adjacent(gen_teams(4))).to eq([[1, 2], [3, 4]])
ex... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/util_spec.rb | Ruby | mit | 19 | master | 3,670 | require 'tournament_system/algorithm/util'
describe TournamentSystem::Algorithm::Util do
def gen_teams(num)
(1..num).to_a.freeze
end
describe '#padd_teams_even' do
it 'works for even teams' do
expect(described_class.padd_teams_even(gen_teams(2))).to eq((1..2).to_a)
expect(described_class.pad... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/matching_spec.rb | Ruby | mit | 19 | master | 2,409 | describe TournamentSystem::Algorithm::Matching do
def gen_teams(num)
(1..num).to_a.freeze
end
describe '#all_perfect_matchings' do
it 'works for 2 elements' do
result = described_class.all_perfect_matchings(gen_teams(2)).to_a
expect(result).to eq([[[1, 2]]])
end
it 'works for 4 elem... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/single_bracket_spec.rb | Ruby | mit | 19 | master | 3,232 | describe TournamentSystem::Algorithm::SingleBracket do
def gen_teams(num)
(1..num).to_a.freeze
end
describe '#total_rounds' do
it 'works for powers of 2' do
expect(described_class.total_rounds(2)).to eq(1)
expect(described_class.total_rounds(4)).to eq(2)
expect(described_class.total_rou... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/round_robin_spec.rb | Ruby | mit | 19 | master | 1,870 | describe TournamentSystem::Algorithm::RoundRobin do
describe '#total_rounds' do
it 'works for valid input' do
expect(described_class.total_rounds(3)).to eq(3)
expect(described_class.total_rounds(2)).to eq(1)
expect(described_class.total_rounds(6)).to eq(5)
expect(described_class.total_roun... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/swiss_spec.rb | Ruby | mit | 19 | master | 3,503 | require 'tournament_system/algorithm/swiss'
describe TournamentSystem::Algorithm::Swiss do
describe '#minimum_rounds' do
it 'works' do
expect(described_class.minimum_rounds(2)).to eq(1)
expect(described_class.minimum_rounds(3)).to eq(2)
expect(described_class.minimum_rounds(4)).to eq(2)
e... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/page_playoff_spec.rb | Ruby | mit | 19 | master | 570 | describe TournamentSystem::Algorithm::PagePlayoff do
describe '#guess_round' do
it 'works for valid input' do
expect(described_class.guess_round(0)).to eq(0)
expect(described_class.guess_round(2)).to eq(1)
expect(described_class.guess_round(3)).to eq(2)
end
it 'handles invalid input' do... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | spec/tournament/algorithm/double_bracket_spec.rb | Ruby | mit | 19 | master | 4,933 | describe TournamentSystem::Algorithm::DoubleBracket do
describe '#total_rounds' do
it 'works' do
expect(described_class.total_rounds(3)).to eq(4)
expect(described_class.total_rounds(4)).to eq(4)
expect(described_class.total_rounds(5)).to eq(6)
expect(described_class.total_rounds(6)).to eq(... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system.rb | Ruby | mit | 19 | master | 1,363 | require 'tournament_system/version'
require 'tournament_system/driver'
require 'tournament_system/swiss'
require 'tournament_system/round_robin'
require 'tournament_system/page_playoff'
require 'tournament_system/single_elimination'
require 'tournament_system/double_elimination'
# This library is split into two parts... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/driver_proxy.rb | Ruby | mit | 19 | master | 968 | module TournamentSystem
# Proxies a driver, allowing overriding of certain functions.
#
# Used by tournament systems that build on top of others, with special behaviour.
# By default the behaviour is identical to the proxied driver.
class DriverProxy < Driver
# :nocov:
# @param target [Driver] the dr... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/double_elimination.rb | Ruby | mit | 19 | master | 1,844 | require 'tournament_system/algorithm/double_bracket'
require 'tournament_system/algorithm/group_pairing'
module TournamentSystem
# Implements the double bracket elimination tournament system.
module DoubleElimination
extend self
# Generate matches with the given driver
#
# @param driver [Driver]
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/round_robin.rb | Ruby | mit | 19 | master | 1,461 | require 'tournament_system/algorithm/util'
require 'tournament_system/algorithm/round_robin'
module TournamentSystem
# Implements the round-robin tournament system.
module RoundRobin
extend self
# Generate matches with the given driver.
#
# @param driver [Driver]
# @option options [Integer] ro... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/swiss.rb | Ruby | mit | 19 | master | 1,483 | require 'tournament_system/algorithm/swiss'
require 'tournament_system/swiss/dutch'
require 'tournament_system/swiss/accelerated_dutch'
module TournamentSystem
# Robust implementation of the swiss tournament system
module Swiss
extend self
# Generate matches with the given driver.
#
# @param drive... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/driver.rb | Ruby | mit | 19 | master | 7,934 | module TournamentSystem
# :reek:UnusedParameters :reek:TooManyMethods
# An interface for external tournament data.
#
# To use any tournament system implemented in this gem, simply subclass this class and implement the interface
# functions.
#
# The interface is designed to be useable with arbitrary data,... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/single_elimination.rb | Ruby | mit | 19 | master | 1,740 | require 'tournament_system/algorithm/single_bracket'
require 'tournament_system/algorithm/group_pairing'
module TournamentSystem
# Implements the single bracket elimination tournament system.
module SingleElimination
extend self
# Generate matches with the given driver
#
# @param driver [Driver]
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/page_playoff.rb | Ruby | mit | 19 | master | 2,437 | require 'tournament_system/algorithm/page_playoff'
require 'tournament_system/algorithm/group_pairing'
module TournamentSystem
# Implements the page playoff system.
module PagePlayoff
extend self
# Generate matches with the given driver.
#
# @param driver [Driver]
# @option options [Integer] r... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/swiss/accelerated_dutch.rb | Ruby | mit | 19 | master | 2,700 | require 'tournament_system/swiss/dutch'
require 'tournament_system/driver_proxy'
module TournamentSystem
module Swiss
# A implementation of accelerated (dutch) swiss pairing
module AcceleratedDutch
extend self
# Pair teams using the accelerated (dutch) swiss pairing system.
#
# Behav... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/swiss/dutch.rb | Ruby | mit | 19 | master | 4,106 | require 'ostruct'
require 'tournament_system/algorithm/swiss'
require 'tournament_system/algorithm/matching'
require 'tournament_system/algorithm/group_pairing'
module TournamentSystem
module Swiss
# A Dutch pairing system implementation.
module Dutch
extend self
# Pair teams using dutch pairin... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/util.rb | Ruby | mit | 19 | master | 3,144 | module TournamentSystem
module Algorithm
# This module provides utility functions for helping implement other
# algorithms.
module Util
extend self
# @deprecated Please use {#padd_teams_even} instead.
def padd_teams(teams)
message = 'NOTE: padd_teams is now deprecated in favour ... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/matching.rb | Ruby | mit | 19 | master | 3,844 | require 'graph_matching'
module TournamentSystem
module Algorithm
# Implements graph matching algorithms for tournament systems.
module Matching
extend self
# rubocop:disable Metrics/MethodLength
# :reek:NestedIterators
# Iterate all perfect matchings of a specific size. A perfect m... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/single_bracket.rb | Ruby | mit | 19 | master | 3,430 | require 'ostruct'
module TournamentSystem
module Algorithm
# This module provides algorithms for dealing with single bracket elimination tournament systems.
module SingleBracket
extend self
# Calculates the total number of rounds needed for a single bracket
# tournament with a certain numb... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/page_playoff.rb | Ruby | mit | 19 | master | 920 | module TournamentSystem
module Algorithm
# This module provides algorithms for dealing with the page playoff system.
module PagePlayoff
extend self
# The total number of rounds needed for all page playoff tournaments.
TOTAL_ROUNDS = 3
# Mapping from number of matches to round number
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/double_bracket.rb | Ruby | mit | 19 | master | 4,093 | require 'ostruct'
module TournamentSystem
module Algorithm
# This module provides algorithms for dealing with double bracket elimination tournaments.
module DoubleBracket
extend self
# Get the number of rounds required for a double bracket tournament.
#
# @param teams_count [Number]
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/group_pairing.rb | Ruby | mit | 19 | master | 1,607 | module TournamentSystem
module Algorithm
# This module provides group pairing algorithms
module GroupPairing
extend self
# Adjacent pairing (aka. King Of The Hill pairing)
#
# Pair adjacent teams.
#
# @example
# adjacent([1, 2, 3, 4]) #=> [[1, 2], [3, 4]]
#
... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/round_robin.rb | Ruby | mit | 19 | master | 1,931 | require 'tournament_system/algorithm/util'
require 'tournament_system/algorithm/group_pairing'
module TournamentSystem
module Algorithm
# This module provides algorithms for dealing with round robin tournament
# systems.
module RoundRobin
extend self
# Calculates the total number of rounds n... |
github | ozfortress/tournament-system | https://github.com/ozfortress/tournament-system | lib/tournament_system/algorithm/swiss.rb | Ruby | mit | 19 | master | 1,637 | module TournamentSystem
module Algorithm
# This module provides algorithms for dealing with swiss tournament systems. Specifically it provides algorithms for
# grouping teams.
module Swiss
extend self
# Calculates the minimum number of rounds needed to properly order teams using the swiss tou... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | fastlane-plugin-properties.gemspec | Ruby | mit | 19 | master | 1,350 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/properties/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-properties'
spec.version = Fastlane::Properties::VERSION
spec.author ... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | spec/set_properties_value_action_spec.rb | Ruby | mit | 19 | master | 1,871 | require 'spec_helper'
describe Fastlane::Actions::SetPropertiesValueAction do
describe "Set value in Configs.properties" do
before do
copy_properties_file
end
it "should change VADER propertie" do
result = Fastlane::FastFile.new.parse("lane :test do
get_properties_value(
ke... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | spec/increment_version_name_in_properties_file_action_spec.rb | Ruby | mit | 19 | master | 2,128 | require 'spec_helper'
describe Fastlane::Actions::IncrementVersionNameInPropertiesFileAction do
describe "Set value in Configs.properties" do
before do
copy_properties_file
end
it "Should increment VERSION_CODE inside Configs.properties" do
result = Fastlane::FastFile.new.parse("lane :test d... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | spec/get_properties_value_action_spec.rb | Ruby | mit | 19 | master | 580 | require 'spec_helper'
describe Fastlane::Actions::GetPropertiesValueAction do
describe "Get Version Number from Configs.properties" do
before do
copy_properties_file
end
it "should return version number from Configs.properties" do
result = Fastlane::FastFile.new.parse("lane :test do
... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | spec/increment_version_code_in_properties_file_action_spec.rb | Ruby | mit | 19 | master | 1,074 | require 'spec_helper'
describe Fastlane::Actions::IncrementVersionCodeInPropertiesFileAction do
describe "Set value in Configs.properties" do
before do
copy_properties_file
end
it "Should increment VERSION_CODE inside Configs.properties" do
result = Fastlane::FastFile.new.parse("lane :test d... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | spec/spec_helper.rb | Ruby | mit | 19 | master | 741 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require 'simplecov'
# SimpleCov.minimum_coverage 95
SimpleCov.start
# 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/properti... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties.rb | Ruby | mit | 19 | master | 472 | require 'fastlane/plugin/properties/version'
module Fastlane
module Properties
# 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 availabl... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/helper/properties_helper.rb | Ruby | mit | 19 | master | 769 | require 'fastlane_core/ui/ui'
module Fastlane
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
module Helper
class PropertiesHelper
# Available in actions as `Helper::PropertiesHelper.update_semver_version`
def self.update_semver_version(type, version_name)
type ||= 'minor'
... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/get_properties_value.rb | Ruby | mit | 19 | master | 1,658 | require 'fastlane/action'
require 'java-properties'
require_relative '../helper/properties_helper'
module Fastlane
module Actions
class GetPropertiesValueAction < Action
def self.run(params)
content = JavaProperties.load(params[:path])
return content[params[:key].to_sym]
end
de... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/increment_version_code_in_properties_file.rb | Ruby | mit | 19 | master | 1,800 | require 'fastlane/action'
require 'java-properties'
require_relative '../helper/properties_helper'
module Fastlane
module Actions
class IncrementVersionCodeInPropertiesFileAction < Action
def self.run(params)
content = JavaProperties.load(params[:path])
value = content[params[:key].to_sym].... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/set_properties_value.rb | Ruby | mit | 19 | master | 2,034 | require 'fastlane/action'
require 'java-properties'
require_relative '../helper/properties_helper'
module Fastlane
module Actions
class SetPropertiesValueAction < Action
def self.run(params)
content = JavaProperties.load(params[:path])
content[params[:key].to_sym] = params[:value]
J... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/write_properties_file.rb | Ruby | mit | 19 | master | 1,626 | require 'fastlane/action'
require 'java-properties'
module Fastlane
module Actions
class WritePropertiesFileAction < Action
def self.run(params)
content = JavaProperties.write(params[:hash], params[:path])
return content
end
def self.description
"Write any Hash-like str... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/parse_properties_file.rb | Ruby | mit | 19 | master | 1,373 | require 'fastlane/action'
require 'java-properties'
module Fastlane
module Actions
class ParsePropertiesFileAction < Action
def self.run(params)
content = JavaProperties.load(params[:path])
return content
end
def self.description
"Load .properties file and returns it as... |
github | Kerizer/fastlane-plugin-properties | https://github.com/Kerizer/fastlane-plugin-properties | lib/fastlane/plugin/properties/actions/increment_version_name_in_properties_file.rb | Ruby | mit | 19 | master | 2,127 | require 'fastlane/action'
require 'java-properties'
require_relative '../helper/properties_helper'
module Fastlane
module Actions
class IncrementVersionNameInPropertiesFileAction < Action
def self.run(params)
content = JavaProperties.load(params[:path])
value = content[params[:key].to_sym]
... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | jekyll-chatgpt-translate.gemspec | Ruby | mit | 19 | master | 1,431 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'English'
Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>= 3.0'... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | Rakefile | Ruby | mit | 19 | master | 1,204 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'rubygems'
require 'rake'
def name
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
end
def version
Gem::Specification.load(Dir['*.gemspec'].first).version
end
require 'ra... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | Gemfile | Ruby | mit | 19 | master | 739 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
source 'https://rubygems.org'
gemspec
gem 'cucumber', '~>9.2', require: false
gem 'kramdown-parser-gfm', '~>1.1', require: false
gem 'minitest', '~>6.0', require: false
gem 'minitest-reporte... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | features/step_definitions/steps.rb | Ruby | mit | 19 | master | 1,957 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require 'English'
Before do
@cwd = Dir.pwd
@dir = Dir.mktmpdir('test')
FileUtils.mkdir_p(@dir)
Dir.chdir(@dir)
end
After do
Dir.chdir(@cwd)
FileUtils.rm_rf(@dir... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_chatgpt.rb | Ruby | mit | 19 | master | 4,100 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'webmock/minitest'
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/chatgpt'
# ChatGPT test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyri... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_prompt.rb | Ruby | mit | 19 | master | 1,216 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/prompt'
# Prompt test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_generator.rb | Ruby | mit | 19 | master | 2,011 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require 'webmock/minitest'
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/generator'
# Generator test.
# Author:: Yegor Bugayenko (yegor25... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_pars.rb | Ruby | mit | 19 | master | 1,848 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/pars'
# Test for Pars.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_ping.rb | Ruby | mit | 19 | master | 1,379 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'webmock/minitest'
require 'jekyll'
require 'tempfile'
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/ping'
# Ping test.
# Author:: Yegor Bugayenko... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_permalink.rb | Ruby | mit | 19 | master | 935 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/permalink'
# Permalink test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 202... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test_plain.rb | Ruby | mit | 19 | master | 5,350 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative 'test__helper'
require_relative '../lib/jekyll-chatgpt-translate/plain'
# Plain test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026 Y... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | test/test__helper.rb | Ruby | mit | 19 | master | 2,589 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
$stdout.sync = true
require 'simplecov'
require 'simplecov-cobertura'
unless SimpleCov.running
SimpleCov.command_name('test')
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.n... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/permalink.rb | Ruby | mit | 19 | master | 874 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'cgi'
# The module we are in.
module GptTranslate; end
# Permalink.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026 Yegor Bugayenko
# License::... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/prompt.rb | Ruby | mit | 19 | master | 1,335 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'iso-639'
require 'humanize'
# The module we are in.
module GptTranslate; end
# Prompt for ChatGPT.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/chatgpt.rb | Ruby | mit | 19 | master | 4,821 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'elapsed'
require 'iso-639'
require 'jekyll'
require 'json'
require 'openai'
require 'tiktoken_ruby'
require_relative 'pars'
require_relative 'prompt'
# The module we are in.
module ... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/generator.rb | Ruby | mit | 19 | master | 6,930 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'elapsed'
require 'fileutils'
require 'jekyll'
require 'json'
require_relative 'chatgpt'
require_relative 'permalink'
require_relative 'ping'
require_relative 'plain'
require_relative... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/pars.rb | Ruby | mit | 19 | master | 847 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
# The module we are in.
module GptTranslate; end
# Markdown broken down ito pars.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026 Yegor Bugayenko
# Lice... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/plain.rb | Ruby | mit | 19 | master | 2,511 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'redcarpet'
# The module we are in.
module GptTranslate; end
# Markdown to plain text.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2023-2026 Yegor Bu... |
github | yegor256/jekyll-chatgpt-translate | https://github.com/yegor256/jekyll-chatgpt-translate | lib/jekyll-chatgpt-translate/ping.rb | Ruby | mit | 19 | master | 1,284 | # frozen_string_literal: true
# SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'iri'
require 'net/http'
require 'uri'
require_relative 'version'
# see https://stackoverflow.com/a/6048451/187141
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_... |
github | mose/shellplay | https://github.com/mose/shellplay | Rakefile | Ruby | mit | 19 | master | 307 | require "bundler/gem_tasks"
require 'rake/testtask'
require 'rspec/core/rake_task'
desc 'launch rspec tests'
task :spec do
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['-c', '-f progress', '-r ./spec/spec_helper.rb']
t.pattern = 'spec/lib/**/*_spec.rb'
end
end
task default: :spec |
github | mose/shellplay | https://github.com/mose/shellplay | shellplay.gemspec | Ruby | mit | 19 | master | 1,385 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "shellplay"
spec.version = File.read(File.expand_path('../CHANGELOG.md', __FILE__))[/([0-9]+\.[0-9]+\.[0-9]+)/]
spec.authors = ["mos... |
github | mose/shellplay | https://github.com/mose/shellplay | spec/spec_helper.rb | Ruby | mit | 19 | master | 415 | $LOAD_PATH << File.expand_path('../../lib', __FILE__)
require 'rubygems'
require 'bundler'
if ENV['COV']
require 'simplecov'
SimpleCov.profiles.define :app do
add_filter '/vendor/'
add_filter '/spec/'
end
SimpleCov.start :app
else
require 'coveralls'
Coveralls.wear!
end
RSpec.configure do |config|... |
github | mose/shellplay | https://github.com/mose/shellplay | spec/lib/shellplay/session_spec.rb | Ruby | mit | 19 | master | 894 | require 'spec_helper'
require "shellplay/session"
describe Shellplay::Session, "A shellplay session" do
let(:basedir) { File.expand_path('../../../files/config', __FILE__) }
let(:basefile) { 'session.json' }
let(:input) { StringIO.new }
let(:output) { StringIO.new }
subject { Shellplay::Session.new(basedir... |
github | mose/shellplay | https://github.com/mose/shellplay | spec/lib/shellplay/screen_spec.rb | Ruby | mit | 19 | master | 738 | require 'spec_helper'
require "shellplay/screen"
describe Shellplay::Screen, "A typical screen element" do
let(:goodhash) {
{
"timespent" => 0.123,
"stdin" => "ls -1",
"stdout" => "bin\nCHANGELOG.md\nGemfile\n"
}
}
subject { Shellplay::Screen.new }
describe ".import" do
conte... |
github | mose/shellplay | https://github.com/mose/shellplay | lib/shellplay/session.rb | Ruby | mit | 19 | master | 3,533 | require "cliprompt"
require "json"
require "open-uri"
require "shellplay/config"
require "shellplay/screen"
# session class, controlling the interaction during the presentation
module Shellplay
class Session
include Cliprompt
attr_reader :title, :name, :config, :pointer, :sequence, :prompt, :timeformat
... |
github | mose/shellplay | https://github.com/mose/shellplay | lib/shellplay/screen.rb | Ruby | mit | 19 | master | 1,124 | # class for the screen object
module Shellplay
class Screen
attr_reader :stdin, :stdout, :stderr, :display, :timespent, :displaycommand, :playprompt, :clearscreen, :customprompt
def initialize
@displaycommand = true
@playprompt = true
@clearscreen = false
@customprompt = nil
@s... |
github | mose/shellplay | https://github.com/mose/shellplay | lib/shellplay/config.rb | Ruby | mit | 19 | master | 1,221 | require 'cliprompt'
require 'configstruct'
require 'fileutils'
# config struct class
# refer to https://github.com/mose/configstruct for documentation
module Shellplay
class Config < ConfigStruct
include Cliprompt
def initialize(options = nil, input = STDIN, output = STDOUT)
super(options, input = ST... |
github | rlister/stax | https://github.com/rlister/stax | stax.gemspec | Ruby | mit | 19 | master | 2,255 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'stax/version'
Gem::Specification.new do |spec|
spec.name = 'stax'
spec.version = Stax::VERSION
spec.authors = ['Richard Lister']
spec.email = ['rlister@gmail.... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax.rb | Ruby | mit | 19 | master | 476 | require 'stax/aws/sdk'
require 'stax/aws/cfn'
require 'stax/dsl'
require 'stax/staxfile'
require 'stax/base'
require 'stax/git'
require 'stax/cli'
require 'stax/subcommand'
require 'stax/cfer'
require 'stax/stack'
require 'stax/stack/cfn'
require 'stax/stack/template'
require 'stax/stack/crud'
require 'stax/stack/cha... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/github.rb | Ruby | mit | 19 | master | 513 | require 'octokit'
module Stax
class Github < Base
no_commands do
def self.octokit
abort('Please set GITHUB_TOKEN') unless ENV['GITHUB_TOKEN']
@_octokit ||= Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
end
def self.tags
@_tags ||= octokit.tags(Git.repo)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/subcommand.rb | Ruby | mit | 19 | master | 668 | module Stax
class SubCommand < Base
class << self
def stax_info(*tasks)
@stax_info_tasks ||= []
@stax_info_tasks += tasks
end
def stax_info_tasks
@stax_info_tasks&.uniq
end
end
no_commands do
## return the Stack instance that called this subcommand
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack.rb | Ruby | mit | 19 | master | 1,142 | module Stax
class Stack < Base
no_commands do
## get name of stack in Staxfile, or infer it from class
def class_name
@_class_name ||= self.class.instance_variable_get(:@name).to_s || self.class.to_s.split('::').last.underscore
end
## build valid name for the stack
def sta... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/dsl.rb | Ruby | mit | 19 | master | 453 | ## Staxfile DSL commands
module Stax
module Dsl
def stack(name, opt = {})
opt = {groups: @groups}.merge(opt) # merge with defaults
Stax.add_stack(name, opt)
end
def command(*args)
Stax.add_command(*args)
end
## temporarily change default list of groups
def group(*groups, &b... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators.rb | Ruby | mit | 19 | master | 599 | require 'stax/generators/base'
module Stax
module Generators
def self.load_builtin_generators
Dir[File.join(__dir__, 'generators', '**', '*_generator.rb')].map(&method(:require))
end
## load any generators in project lib/generators/
def self.load_local_generators
if Stax.root_path
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/staxfile.rb | Ruby | mit | 19 | master | 2,596 | module Stax
@@_root_path = nil
@@_stack_list = []
@@_command_list = []
## the stax root is defined as location of Staxfile
def self.root_path
@@_root_path
end
## list of stacks defined in Staxfile
def self.stack_list
@@_stack_list
end
## list of commands defined in Staxfile
def self.com... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli.rb | Ruby | mit | 19 | master | 571 | require 'stax/cli/version'
require 'stax/cli/ls'
require 'stax/cli/new'
require 'stax/cli/generate'
require 'stax/cli/crud'
require 'stax/cli/info'
module Stax
class Cli < Base
class_option :branch, type: :string, default: Git.branch, desc: 'git branch to use'
class_option :app, type: :string, default: Fi... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/iam.rb | Ruby | mit | 19 | master | 266 | require 'stax/aws/iam'
require 'stax/aws/sts'
module Stax
class Iam < Base
desc 'id', 'get account id'
def id
puts Aws::Sts.account_id
end
desc 'aliases', 'get account aliases'
def aliases
puts Aws::Iam.aliases
end
end
end |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/git.rb | Ruby | mit | 19 | master | 1,266 | require 'git_clone_url'
module Stax
class Git < Base
no_commands do
def self.branch
@_branch ||= `git symbolic-ref --short HEAD`.chomp
end
def self.sha
@_sha ||= `git rev-parse HEAD`.chomp
end
def self.short_sha
@_short_sha ||= self.sha.slice(0,7)
en... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/keypair.rb | Ruby | mit | 19 | master | 2,369 | require 'tempfile'
require 'awful/keypair'
require 'awful/param'
module Stax
module Keypair
def self.included(thor)
thor.class_eval do
no_commands do
def key_pair_name
@_key_pair_name ||= stack_name
end
## parameter store name to store private key
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.