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
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
spec/spec_helper.rb
Ruby
mit
47
main
329
require 'support/helpers' # Support gems require 'awesome_print' require 'timecop' require 'pry' # Gem under test require 'icalendar/recurrence' include Icalendar::Recurrence include Helpers RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus config.order = 'ran...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
spec/lib/time_util_spec.rb
Ruby
mit
47
main
5,047
require 'spec_helper' describe TimeUtil do describe ".datetime_to_time" do it "converts DateTime to Time correctly" do datetime = Icalendar::Values::DateTime.new(DateTime.parse("2014-01-27T12:55:21-08:00")) correct_time = Time.parse("2014-01-27T12:55:21-08:00") expect(TimeUtil.datetime_to_time(...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
spec/lib/recurrence_spec.rb
Ruby
mit
47
main
8,676
require 'spec_helper' describe "Event#occurrences_between" do let(:start_time) { event.start_time } context "event repeating daily" do let(:event) { example_event :daily } # has exclusion on Jan 28th it "properly calculates recurrence, including exclusion date" do occurrences = event.occurrences_bet...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
spec/lib/schedule_spec.rb
Ruby
mit
47
main
2,761
require 'spec_helper' describe Icalendar::Recurrence::Schedule do describe "#occurrences_between" do let(:example_occurrence) do daily_event = example_event :daily schedule = Schedule.new(daily_event) schedule.occurrences_between(Date.parse("2014-02-01"), Date.parse("2014-03-01")).first end...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
spec/support/helpers.rb
Ruby
mit
47
main
331
module Helpers def example_event(ics_name) ics_path = File.expand_path "#{File.dirname(__FILE__)}/fixtures/#{ics_name}_event.ics" ics_string = File.read(ics_path) calendars = Icalendar::Calendar.parse(ics_string) Array(calendars).first.events.first end end class Integer def days self*60*60*24...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
lib/icalendar/recurrence.rb
Ruby
mit
47
main
315
require "icalendar" require "icalendar/recurrence/version" require "icalendar/recurrence/event_extensions" require "icalendar/recurrence/weekday_extensions" require "icalendar/recurrence/schedule" require "icalendar/recurrence/time_util" module Icalendar module Recurrence # Your code goes here... end end
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
lib/icalendar/recurrence/weekday_extensions.rb
Ruby
mit
47
main
221
module Icalendar module Recurrence module WeekdayExtensions attr_accessor :day, :position end end class RRule class Weekday include Icalendar::Recurrence::WeekdayExtensions end end end
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
lib/icalendar/recurrence/time_util.rb
Ruby
mit
47
main
4,500
require 'tzinfo' begin require 'active_support/time' rescue LoadError # that's ok, will just fall back to Time end module Icalendar module Recurrence module TimeUtil def datetime_to_time(datetime, options = {}) raise ArgumentError, "Unsupported DateTime object passed (must be Icalendar::Values:...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
lib/icalendar/recurrence/event_extensions.rb
Ruby
mit
47
main
785
module Icalendar module Recurrence module EventExtensions def start dtstart end def start_time TimeUtil.to_time(start) end def end dtend end def occurrences_between(begin_time, closing_time, spans: false) schedule.occurrences_between(beg...
github
icalendar/icalendar-recurrence
https://github.com/icalendar/icalendar-recurrence
lib/icalendar/recurrence/schedule.rb
Ruby
mit
47
main
2,984
require 'ice_cube' module Icalendar module Recurrence class Occurrence < Struct.new(:start_time, :end_time, :parent) end class Schedule attr_reader :event def initialize(event) @event = event end def timezone event.tzid end def rrules event....
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
Rakefile
Ruby
mit
47
master
1,799
require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task :default => :spec pwd = File.expand_path('../', __FILE__) gemfiles = Dir.glob(File.join(pwd, "gemfiles", "*.gemfile")).map { |f| File.basename(f, ".*") } namespace :js do desc "Cleanup built javascripts" task :clea...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
crono_trigger.gemspec
Ruby
mit
47
master
1,701
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'crono_trigger/version' Gem::Specification.new do |spec| spec.name = "crono_trigger" spec.version = CronoTrigger::VERSION spec.authors = ["joker1007"] spec.email ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/spec_helper.rb
Ruby
mit
47
master
2,638
require 'simplecov' if ENV["CI"] require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter end SimpleCov.start require "rollbar" require "crono_trigger" require "serverengine" require "crono_trigger/rollbar" require "timecop" Time.zone = "UTC" case ENV["DB"] when "mysql" A...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/integration/execution_spec.rb
Ruby
mit
47
master
3,246
require "spec_helper" RSpec.describe "Execute records" do let(:worker_class) do Class.new do include CronoTrigger::Worker def initialize @logger = Logger.new(nil) super end end end context "when there are so many records that the execution queue reaches the maximum siz...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/db/migrate/10_create_notifications.rb
Ruby
mit
47
master
914
class CreateNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration def self.up create_table :notifications do |t| t.string :name t.string :cron t.datetime :next_execute_at t.datetime :last_executed_at t.string :timezone t.in...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/db/migrate/00_create_crono_trigger_system_tables.rb
Ruby
mit
47
master
1,587
class CreateCronoTriggerSystemTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration def self.up create_table :crono_trigger_workers, id: :string, primary_key: :worker_id do |t| t.integer :max_thread_size, null: false t.integer :current_executing_size, nu...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/crono_trigger/schedulable_spec.rb
Ruby
mit
47
master
26,434
require "spec_helper" RSpec.describe CronoTrigger::Schedulable do let(:notification1) do Notification.create!( name: "notification1", cron: "0,30 * * * *", started_at: Time.current, ).tap(&:activate_schedule!) end let(:notification2) do Notification.new( name: "notification2",...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/crono_trigger/worker_spec.rb
Ruby
mit
47
master
5,208
require "spec_helper" RSpec.describe CronoTrigger::Worker do before do stub_const("CronoTrigger::Worker::HEARTBEAT_INTERVAL", 0.5) stub_const("CronoTrigger::Worker::SIGNAL_FETCH_INTERVAL", 0.5) stub_const("CronoTrigger::Worker::MONITOR_INTERVAL", 0.5) end let(:worker) { Class.new { include CronoTrig...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/crono_trigger/polling_thread_spec.rb
Ruby
mit
47
master
7,064
require "spec_helper" RSpec.describe CronoTrigger::PollingThread do let(:notification1) do Notification.create!( name: "notification1", cron: "0,30 * * * *", started_at: Time.current, ).tap(&:activate_schedule!) end let(:notification2) do Notification.create!( name: "notificat...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
spec/crono_trigger/models/execution_spec.rb
Ruby
mit
47
master
1,927
require "spec_helper" RSpec.describe CronoTrigger::Models::Execution do let(:notification) do Notification.create!( name: "notification1", cron: "0,30 * * * *", started_at: Time.current, ).tap(&:activate_schedule!) end describe ".create_with_timestamp", aggregate_failures: true do ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger.rb
Ruby
mit
47
master
1,547
require "crono_trigger/version" require "ostruct" require "socket" require "active_record" require "concurrent" require "retriable" require "crono_trigger/events" require "crono_trigger/models/worker" require "crono_trigger/models/signal" require "crono_trigger/models/execution" require "crono_trigger/worker" require ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/exception_handler.rb
Ruby
mit
47
master
901
module CronoTrigger class ExceptionHandler def self.handle_exception(record, ex) new(record).handle_exception(ex) end def initialize(record) @record = record end def handle_exception(ex) handlers = CronoTrigger.config.error_handlers + Array(@record.crono_trigger_options[:error_...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/rollbar.rb
Ruby
mit
47
master
727
require 'rollbar' module Rollbar class CronoTrigger def self.handle_exception(ex, record = nil) scope = { framework: "CronoTrigger: #{::CronoTrigger::VERSION}", } if record scope.merge!({context: "#{record.class}/#{record.id}"}) end Rollbar.scope(scope).error(ex, u...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/schedulable.rb
Ruby
mit
47
master
12,580
require "active_support/concern" require "active_support/core_ext/object" require "chrono" require "tzinfo" require "crono_trigger/exception_handler" require "crono_trigger/execution_tracker" module CronoTrigger module Schedulable DEFAULT_RETRY_LIMIT = 10 DEFAULT_RETRY_INTERVAL = 4 DEFAULT_EXECUTE_LOCK_...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/web.rb
Ruby
mit
47
master
6,541
require "crono_trigger" require "sinatra/base" require "rack/contrib/post_body_content_type_parser" require "oj" module CronoTrigger class Web < Sinatra::Application use Rack::PostBodyContentTypeParser set :root, File.expand_path("../../../web", __FILE__) set :public_folder, Proc.new { File.join(root, "...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/worker.rb
Ruby
mit
47
master
7,838
require "active_support/core_ext/string" require "crono_trigger/global_exception_handler" module CronoTrigger module Worker HEARTBEAT_INTERVAL = 60 SIGNAL_FETCH_INTERVAL = 10 MONITOR_INTERVAL = 20 WORKER_COUNT_UPDATE_INTERVAL = 60 EXECUTOR_SHUTDOWN_TIMELIMIT = 300 OTHER_THREAD_SHUTDOWN_TIMEL...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/execution_tracker.rb
Ruby
mit
47
master
754
module CronoTrigger class ExecutionTracker def initialize(schedulable) @schedulable = schedulable end def self.track(schedulable, &pr) new(schedulable).track(&pr) end def track(&pr) if @schedulable.track_execution begin execution = @schedulable.crono_trigger_e...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/railtie.rb
Ruby
mit
47
master
359
module CronoTrigger class Railtie < ::Rails::Railtie config.after_initialize do CronoTrigger.reloader = CronoTrigger::Railtie::Reloader.new end class Reloader def initialize(app = ::Rails.application) @app = app end def call @app.reloader.wrap do yield ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/global_exception_handler.rb
Ruby
mit
47
master
740
module CronoTrigger class GlobalExceptionHandler def self.handle_global_exception(ex) new.handle_global_exception(ex) end def handle_global_exception(ex) handlers = CronoTrigger.config.global_error_handlers handlers.each do |callable| callable, arity = ensure_callable(callable) ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/cli.rb
Ruby
mit
47
master
2,742
require "optparse" require "crono_trigger" require "serverengine" options = { daemonize: false, pid_path: "./crono_trigger.pid", } opt_parser = OptionParser.new do |opts| opts.banner = "Usage: crono_trigger [options] [MODEL..]\n If MODEL is not given, Search classes including CronoTrigger::Schedulable module a...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/polling_thread.rb
Ruby
mit
47
master
2,892
module CronoTrigger class PollingThread def initialize(model_queue, stop_flag, logger, executor, execution_counter) @model_queue = model_queue @stop_flag = stop_flag @logger = logger @executor = executor if @executor.fallback_policy != :caller_runs raise ArgumentError, "execu...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/models/execution.rb
Ruby
mit
47
master
1,314
module CronoTrigger module Models class Execution < ActiveRecord::Base self.table_name = "crono_trigger_executions" belongs_to :schedule, polymorphic: true, inverse_of: :crono_trigger_executions scope :recently, ->(schedule_type:) { where(schedule_type: schedule_type).order(executed_at: :desc)...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/models/signal.rb
Ruby
mit
47
master
1,505
module CronoTrigger module Models class Signal < ActiveRecord::Base self.table_name = "crono_trigger_signals" IGNORE_THRESHOLD = 300 if ActiveRecord.version >= Gem::Version.new("7.0") enum :signal, {TERM: "TERM", USR1: "USR1", CONT: "CONT", TSTP: "TSTP"} else enum signal:...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/crono_trigger/models/worker.rb
Ruby
mit
47
master
853
require "crono_trigger/worker" module CronoTrigger module Models class Worker < ActiveRecord::Base self.table_name = "crono_trigger_workers" ALIVE_THRESHOLD = CronoTrigger::Worker::HEARTBEAT_INTERVAL * 5 if ActiveRecord.version >= Gem::Version.new("7.0") enum :executor_status, {runnin...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/install/install_generator.rb
Ruby
mit
47
master
487
require "rails/generators/active_record/migration" module CronoTrigger module Generators class InstallGenerator < Rails::Generators::Base include ActiveRecord::Generators::Migration source_root File.expand_path("../templates", __FILE__) desc "Create migration for CronoTrigger System Table" ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/install/templates/install.rb
Ruby
mit
47
master
1,543
class CreateCronoTriggerSystemTables < ActiveRecord::Migration<%= Rails::VERSION::MAJOR >= 5 ? "[#{ActiveRecord::Migration.current_version}]" : "" %> def change create_table :crono_trigger_workers, id: :string, primary_key: :worker_id do |t| t.integer :max_thread_size, null: false t.integer :current...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/migration/migration_generator.rb
Ruby
mit
47
master
316
require "rails/generators/active_record/migration/migration_generator" module CronoTrigger module Generators class MigrationGenerator < ActiveRecord::Generators::MigrationGenerator source_root File.expand_path("../templates", __FILE__) desc "Create migration for Scheduled Job" end end end
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/migration/templates/create_table_migration.rb
Ruby
mit
47
master
1,818
class <%= migration_class_name %> < ActiveRecord::Migration<%= Rails::VERSION::MAJOR >= 5 ? "[#{ActiveRecord::Migration.current_version}]" : "" %> def change create_table :<%= table_name %><%= respond_to?(:primary_key_type) ? primary_key_type : "" %> do |t| <% attributes.each do |attribute| -%> <% if attribute.pa...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/migration/templates/migration.rb
Ruby
mit
47
master
992
class <%= migration_class_name %> < ActiveRecord::Migration<%= Rails::VERSION::MAJOR >= 5 ? "[#{ActiveRecord::Migration.current_version}]" : "" %> def change # columns for CronoTrigger::Schedulable add_column :<%= table_name %>, :cron, :string add_column :<%= table_name %>, :next_execute_at, :datetime ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/model/model_generator.rb
Ruby
mit
47
master
296
require "rails/generators/active_record/model/model_generator" module CronoTrigger module Generators class ModelGenerator < ActiveRecord::Generators::ModelGenerator source_root File.expand_path("../templates", __FILE__) desc "Create model for Scheduled Job" end end end
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/model/templates/model.rb
Ruby
mit
47
master
678
<% module_namespacing do -%> class <%= class_name %> < <%= parent_class_name.classify %> include CronoTrigger::Schedulable <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? ...
github
joker1007/crono_trigger
https://github.com/joker1007/crono_trigger
lib/generators/crono_trigger/model/templates/module.rb
Ruby
mit
47
master
214
<% module_namespacing do -%> module <%= class_path.map(&:camelize).join('::') %> def self.table_name_prefix '<%= namespaced? ? namespaced_class_path.join('_') : class_path.join('_') %>_' end end <% end -%>
github
ndbroadbent/capistrano_deploy_lock
https://github.com/ndbroadbent/capistrano_deploy_lock
capistrano_deploy_lock.gemspec
Ruby
mit
47
master
872
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'capistrano_deploy_lock/version' Gem::Specification.new do |gem| gem.name = "capistrano_deploy_lock" gem.version = CapistranoDeployLock::VERSION gem.authors = ...
github
ndbroadbent/capistrano_deploy_lock
https://github.com/ndbroadbent/capistrano_deploy_lock
Gemfile
Ruby
mit
47
master
212
source 'https://rubygems.org' # Include rake in Gemfile so that `bundle exec rake` doesn't raise an error gem 'rake', :group => :test # Specify your gem's dependencies in capistrano_deploy_lock.gemspec gemspec
github
ndbroadbent/capistrano_deploy_lock
https://github.com/ndbroadbent/capistrano_deploy_lock
lib/capistrano/deploy_lock.rb
Ruby
mit
47
master
2,709
# Capistrano Deploy Lock # # Add "require 'capistrano/deploy_lock'" in your Capistrano deploy.rb. # Based on deploy_lock.rb from https://github.com/bokmann/dunce-cap require 'time' # Provide advanced expiry time parsing via Chronic, if available begin; require 'chronic'; rescue LoadError; end begin # Use Rails dista...
github
ndbroadbent/capistrano_deploy_lock
https://github.com/ndbroadbent/capistrano_deploy_lock
lib/capistrano/recipes/deploy_lock.rb
Ruby
mit
47
master
6,235
Capistrano::Configuration.instance(:must_exist).load do before "deploy:update_code", "deploy:check_lock" before "deploy:update_code", "deploy:refresh_lock" before "deploy:update_code", "deploy:create_lock" after "deploy:create_symlink", "deploy:unlock" after "deploy:rollback", "deploy:unlock"...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
hanami-assets.gemspec
Ruby
mit
47
main
1,376
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml. lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "hanami/assets/version" Gem::Specification.new do |spec| spec.name = "hanami-assets" spe...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
Gemfile
Ruby
mit
47
main
472
# frozen_string_literal: true source "https://rubygems.org" eval_gemfile "Gemfile.devtools" gemspec unless ENV["CI"] gem "yard", require: false end gem "hanami-view", github: "hanami/view", branch: "main", require: false gem "hanami-devtools", github: "hanami/devtools", branch: "main", require: false ge...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
lib/hanami/assets.rb
Ruby
mit
47
main
3,057
# frozen_string_literal: true require "json" require "pathname" require "zeitwerk" module Hanami # Assets management for Ruby web applications # # @since 0.1.0 class Assets # @since 2.1.0 # @api private def self.gem_loader @gem_loader ||= Zeitwerk::Loader.new.tap do |loader| root = F...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
lib/hanami/assets/config.rb
Ruby
mit
47
main
2,278
# frozen_string_literal: true require "dry/configurable" require_relative "base_url" module Hanami class Assets # Hanami assets configuration. # # @api public # @since 0.1.0 class Config include Dry::Configurable # @api public # @since 2.1.0 BASE_URL = "" private_c...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
lib/hanami/assets/base_url.rb
Ruby
mit
47
main
1,259
# frozen_string_literal: true require "uri" module Hanami class Assets # Base URL # # @since 2.1.0 # @api private class BaseUrl # @since 2.1.0 # @api private attr_reader :url private :url # Initialize a base URL # # @param url [String] the URL # @...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
lib/hanami/assets/asset.rb
Ruby
mit
47
main
1,849
# frozen_string_literal: true module Hanami class Assets # Represents a single front end asset. # # @api public # @since 2.1.0 class Asset # @api private # @since 2.1.0 attr_reader :config private :config # Returns the asset's absolute URL path. # # @exa...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
lib/hanami/assets/errors.rb
Ruby
mit
47
main
847
# frozen_string_literal: true module Hanami class Assets # Base error for Hanami::Assets. # # @api public # @since 0.1.0 class Error < ::StandardError end # Error returned when the assets manifest file is missing. # # @api public # @since 2.1.0 class ManifestMissingError ...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
spec/spec_helper.rb
Ruby
mit
47
main
206
# frozen_string_literal: true require "hanami-assets" require "pathname" SPEC_ROOT = Pathname(__FILE__).dirname require_relative "support/rspec" SPEC_ROOT.glob("support/**/*.rb").each { |f| require(f) }
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
spec/support/sources.rb
Ruby
mit
47
main
209
# frozen_string_literal: true module Test module Sources PATH = Pathname(__dir__).join(".", "sources").freeze private_constant :PATH def self.path(*dir) PATH.join(*dir) end end end
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
spec/support/app.rb
Ruby
mit
47
main
697
# frozen_string_literal: true require "pathname" require "securerandom" require "fileutils" module App PATH = Pathname(__dir__).join("..", "..", "tmp").freeze private_constant :PATH def self.create(app) root = PATH.join(SecureRandom.uuid).tap(&:mkpath) sources = [ app.join("app"), app.join...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
spec/integration/hanami/assets/manifest_spec.rb
Ruby
mit
47
main
1,160
# frozen_string_literal: true require "tmpdir" RSpec.describe "manifest handling" do subject(:assets) { Hanami::Assets.new( config: Hanami::Assets::Config.new(**config_kwargs), root: root ) } let(:config_kwargs) { {} } context "manifest_path configured and real file exists" do let(:r...
github
hanami/hanami-assets
https://github.com/hanami/hanami-assets
spec/unit/hanami/assets/public_assets_dir_spec.rb
Ruby
mit
47
main
770
# frozen_string_literal: true RSpec.describe Hanami::Assets, ".public_assets_dir" do subject(:public_assets_dir) { described_class.public_assets_dir(slice) } let(:slice) { double(:slice, slice_name: double(to_s: slice_name), app: double(:app)) } let(:slice_name) { "main" } describe "top-level slices" do ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
githelp.gemspec
Ruby
mit
47
master
1,024
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'githelp/version' Gem::Specification.new do |spec| spec.name = "githelp" spec.version = Githelp::VERSION spec.authors = ["Toshiyuki Masui"] spec.email = ["masu...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
test/change_test.rb
Ruby
mit
47
master
316
# coding: utf-8 require 'test_helper' include Githelp class GitHelpTest < Minitest::Test def test_onehour githelp(" 1時間 ").each { |a| assert a.length == 2 assert a[0] =~ /1時間/ } end def test_diff githelp(" 比較 ").each { |a| assert a[1] =~ /diff/ } end end
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp.rb
Ruby
mit
47
master
1,101
# coding: utf-8 require "githelp/version" require 're_expand' require "githelp/args" require "githelp/files" require "githelp/params" require "githelp/patterns" require "githelp/tags" require "githelp/numbers" require "githelp/branches" require "githelp/changes" require "githelp/glossary" require "githelp/git_check" ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/params.rb
Ruby
mit
47
master
359
# coding: utf-8 # module Githelp def params(argv=ARGV) a = [] argv.each { |arg| if arg =~ /^(\d+)[^\d]*$/ then # a << $1 elsif arg =~ /^'.*'$/ || arg =~ /^".*"$/ || arg =~ /^「.*」$/ a << arg.sub(/^['"]/,'').sub(/['"]$/,'').sub('「','').sub('」','') end } a.length > 0 ? a ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/tags.rb
Ruby
mit
47
master
543
# coding: utf-8 # # 存在するタグのリストを作る # module Githelp def tags(force=false,argv=ARGV) # # 引数の中にタグ名とマッチするものがあればタグリストを取得 # list = begin `git tag`.split(/\n/) rescue [] end matched = false list.each { |tag| args.each { |arg| matched = tr...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/patterns.rb
Ruby
mit
47
master
388
# coding: utf-8 # module Githelp def patterns(argv=ARGV) a = [] argv.each { |arg| if arg =~ /^(\d+)[^\d]*$/ then # a << $1 elsif arg =~ /^'.*'$/ || arg =~ /^".*"$/ || arg =~ /^「.*」$/ # a << arg.sub(/^['"]/,'').sub(/['"]$/,'').sub('「','').sub('」','') else a << arg e...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/glossary.rb
Ruby
mit
47
master
256
# coding: utf-8 module Githelp #def branch # "(ブランチ|branch)" #end # def mins # "(1|2|3|4|5|6|7|8|9|10|20|30|40|50)" # end # def hours # "(1|2|4|6|8|10|12|18)" # end # def days # "(1|2|3|4|5|6|7|8|9|10)" # end end
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/files.rb
Ruby
mit
47
master
510
# coding: utf-8 # # 見えるファイル名のリストを作る # def files(force=false, argv=ARGV) # # 引数の中にファイル名とマッチするものがあればファイルリストを取得 # list = begin `git ls-files`.split(/\n/) rescue [] end matched = false list.each { |file| args.each { |arg| matched = true if file.match arg } ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/changes.rb
Ruby
mit
47
master
521
# coding: utf-8 module Githelp def git_log_wc(since,file) begin `git log --oneline --since='#{since}' #{file} | wc` rescue nil end end def changed(since) files(true).find_all { |file| wc = git_log_wc(since,file) if wc wc !~ / 0 / else false ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/branches.rb
Ruby
mit
47
master
513
# coding: utf-8 module Githelp def git_branch begin `git branch` rescue nil end end def branches b = git_branch if b b.split(/\n/).map { |line| line.chomp! line.sub(/^../,'') } else [ '##BRANCH##' ] end end def branch b = git...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/numbers.rb
Ruby
mit
47
master
200
# coding: utf-8 # module Githelp def numbers(argv=ARGV) a = [] argv.each { |arg| if arg =~ /^(\d+)[^\d]*$/ then a << $1 end } a.length > 0 ? a : ['1'] end end
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
lib/githelp/args.rb
Ruby
mit
47
master
320
# coding: utf-8 # module Githelp def args(argv=ARGV) a = [] argv.each { |arg| if arg =~ /^(\d+)([^\d]+)?$/ then a << $1 a << $2 if $2.to_s != '' else a << arg.sub(/^['"]/,'').sub(/['"]$/,'').sub('「','').sub('」','') end } a.length > 0 ? a : [''] end end
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/change.rb
Ruby
mit
47
master
4,492
# coding: utf-8 patterns != ['##PATTERN##'] ? [ [ "「(#{files.join('|')})」ファイルを(#{numbers.join('|')})分前の(もの|バージョン)と比較する", 'git diff HEAD "@{#{$2} minutes ago}" #{$1}' ], [ "「(#{files.join('|')})」ファイルが(#{numbers.join('|')})分前から(変化した|変わった)ところを(表示する|見る)", 'git diff HEAD "@{#{$2} minut...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/afteradd.rb
Ruby
mit
47
master
514
# coding: utf-8 # # 結城氏が欲しいといったもの # https://www.facebook.com/toshiyukimasui/posts/10154167175512498?comment_id=10154167320572498 # if params.length > 0 [ [ "最初に「(#{params.join('|')})」という文字列を含むコミットをした時から現在までに追加されたファイルはどれとどれ?", 'git log --oneline --date=iso-strict --format=\'%cd %s\' | grep #{$1} | tai...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/branch.rb
Ruby
mit
47
master
652
# coding: utf-8 [ [ "ブランチをリストする", "git branch" ], [ "ブランチのリストを表示する", "git branch" ], [ "「(#{branches.join('|')})」ブランチを削除する", 'git branch -d #{$1}' ], [ "「(#{params.join('|')})」ブランチを作成する", 'git branch #{$1}' ], ] + if params.length > 0 [ [ "「(#{params.join('|')...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/freq.rb
Ruby
mit
47
master
445
# coding: utf-8 # https://bayashi.net/diary/2015/0224 [ [ "(よく|頻繁に)(編集|修正)されているファイルを(リスト|表示)する", 'git log --name-only --pretty="format:" | grep -ve "^$" | sort | uniq -c | sort -r | more' ], [ "ファイルの(編集|修正)のランキングを(リスト|表示)する", 'git log --name-only --pretty="format:" | grep -ve "^$" | sort | uniq -...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/checkout.rb
Ruby
mit
47
master
692
# coding: utf-8 [ [ "「(#{branches.join('|')})」ブランチの最新状態に移動する", 'git checkout #{$1} ' ], [ "最新の状態に戻す", 'git checkout #{branch}' ], [ "(#{numbers.join('|')})分前の状態に一時的に戻す", 'git checkout "@{#{$1} minutes ago}"' ], [ "(#{numbers.join('|')})時間前の状態に一時的に戻す", 'git checkout "@{#{$1}...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/mv.rb
Ruby
mit
47
master
209
# coding: utf-8 [ [ "「(#{files.join('|')})」というファイルを「(#{params.join('|')})」という名前に((変更|移動|改名|リネーム)する|変える)", 'git mv #{$1} #{$2}' ] ]
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/ls-files.rb
Ruby
mit
47
master
383
# coding: utf-8 [ [ "(Gitで?)管理されているファイルを(表示する|見る|リストする)", 'git ls-files' ], [ "(Gitで?)管理されているファイルのリストを(表示する|見る)", 'git ls-files' ], [ "(Gitで?)管理されているファイルの(大きさ|サイズ)をリストする", 'git ls-files | xargs wc' ], ]
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/adddelete.rb
Ruby
mit
47
master
269
# coding: utf-8 # http://koyamay.hatenablog.com/entry/2014/10/06/022654 [ [ "これまで追加/削除された行数を表示する", 'git log --numstat --pretty="%H" | awk \'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\\\\n", plus, minus)}\'' ], ]
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/shortlog.rb
Ruby
mit
47
master
207
# coding: utf-8 # coding: utf-8 [ [ "コミッタのランキングを表示する", 'git shortlog -sn' ], [ "コミッタのコミット数を表示する", 'git shortlog -sn' ], ]
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/appear.rb
Ruby
mit
47
master
426
# coding: utf-8 if params.length > 0 && files.length > 0 [ [ "「(#{files.join('|')})」ファイルに「(#{params.join('|')})」という名前が出現したのはいつ?", 'git blame #{$1} | grep #{$2}' ], [ "「(#{params.join('|')})」という名前が「(#{files.join('|')})」ファイルに出現したのはいつ?", 'git blame #{$2} | grep #{$1}' ] ] else ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/log.rb
Ruby
mit
47
master
366
# coding: utf-8 [ [ "(#{files.join('|')})が追加されたコミットの(情報|ログ)を表示する", 'git log --format="%h" #{$1} | tail -1 | xargs -J xxxx git log xxxx #{$1}' # 'githelp-fileadded #{$1} range | xargs git log' ログの範囲は abcde^..abcde みたいに指定する必要があるがこれを生成するのが難しい! ], ]
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/removed.rb
Ruby
mit
47
master
567
# coding: utf-8 if params.length > 0 && files.length > 0 [ [ "「(#{files.join('|')})」ファイルから「(#{params.join('|')})」という名前が消えたのはいつ?", 'git log --oneline | awk \'{print $1}\' | xargs -J xxx git show xxx #{$1} | grep -C10 \'^-.*#{$2}\'' ], [ "「(#{params.join('|')})」という名前が「(#{files.join('|')})...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/cat-file.rb
Ruby
mit
47
master
632
# coding: utf-8 [ [ "(#{numbers.join('|')})分前の「(#{files.join('|')})」ファイルを(表示する|見る)", 'git cat-file -p "@{#{$1} minutes ago}":#{$2}' ], [ "(#{numbers.join('|')})時間前の「(#{files.join('|')})」ファイルを(表示する|見る)", 'git cat-file -p "@{#{$1} hours ago}":#{$2}' ], [ "(#{numbers.join('|')})日前の「(#{files.j...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/tag.rb
Ruby
mit
47
master
661
# coding: utf-8 if params.length > 0 [ [ "現在使われているタグを(リスト|表示)する", 'git tag' ], [ "現在のコミットIDに「(#{params.join('|')})」というタグを関連付けする", 'git tag #{$1}' ], [ "「(#{params.join('|')})」というタグを現在のコミットIDに関連付けする", 'git tag #{$1}' ], [ "「(#{tags.join('|')})」というタグ...
github
masui/GitHelp_old
https://github.com/masui/GitHelp_old
data/ignore.rb
Ruby
mit
47
master
334
# coding: utf-8 [ [ "(Gitで?)管理されていないファイルを(表示する|見る|リストする)", 'git ls-files --exclude-standard --others --ignored' ], [ "(Gitで?)管理されていないファイルのリストを(表示する|見る)", 'git ls-files --exclude-standard --others --ignored' ], ]
github
yyuu/hotdog
https://github.com/yyuu/hotdog
hotdog.gemspec
Ruby
mit
47
master
1,111
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "hotdog/version" Gem::Specification.new do |spec| spec.name = "hotdog" spec.version = Hotdog::VERSION spec.authors = ["Yamashita Yuu"] spec.email = ["peek82454...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/core/application_spec.rb
Ruby
mit
47
master
1,136
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/hosts" require "hotdog/commands/search" require "hotdog/commands/tags" describe "application" do let(:app) { Hotdog::Application.new } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/core/commands_spec.rb
Ruby
mit
47
master
5,799
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" describe "commands" do let(:cmd) { Hotdog::Commands::Search.new(Hotdog::Application.new) } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV["DATADOG_APPLICATION_KEY"] = "DATAD...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/parser/parser_spec.rb
Ruby
mit
47
master
12,864
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "parser" do let(:cmd) { Hotdog::Commands::Search.new(Hotdog::Application.new) } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV["DATADOG_APPLICATIO...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/optimizer/unary_expression_spec.rb
Ruby
mit
47
master
10,247
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "unary expression" do 3.times do |o| it "NOT nothing should return everything (#{o})" do expr = Hotdog::Expression::UnaryExpressionNode.new("NOT", Hotdog::Expression::Not...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/optimizer/regexp_expression_spec.rb
Ruby
mit
47
master
1,753
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag regexp expression" do 3.times do |o| it "interprets tag regexp with host (#{o})" do expr = Hotdog::Expression::RegexpHostNode.new("foo", ":") expect(optimize_n...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/optimizer/glob_expression_spec.rb
Ruby
mit
47
master
3,764
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag glob expression" do 3.times do |o| it "interprets tag glob with host (#{o})" do expr = Hotdog::Expression::GlobHostNode.new("foo*", ":") expect(optimize_n(o+1,...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/optimizer/binary_expression_spec.rb
Ruby
mit
47
master
1,932
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "binary expression" do 3.times do |o| it "everything AND x should return x (#{o})" do expr = Hotdog::Expression::BinaryExpressionNode.new("AND", Hotdog::Expression::Every...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/optimizer/string_expression_spec.rb
Ruby
mit
47
master
3,687
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag expression" do 3.times do |o| it "interprets tag with host (#{o})" do expr = Hotdog::Expression::StringHostNode.new("foo", ":") expect(optimize_n(o+1, expr).du...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/evaluator/string_expression_spec.rb
Ruby
mit
47
master
3,797
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag expression" do let(:cmd) { Hotdog::Commands::Search.new(Hotdog::Application.new) } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV["DATADOG_AP...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/evaluator/glob_expression_spec.rb
Ruby
mit
47
master
4,075
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag glob expression" do let(:cmd) { Hotdog::Commands::Search.new(Hotdog::Application.new) } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV["DATAD...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/evaluator/regexp_expression_spec.rb
Ruby
mit
47
master
3,964
require "spec_helper" require "hotdog/application" require "hotdog/commands" require "hotdog/commands/search" require "parslet" describe "tag regexp expression" do let(:cmd) { Hotdog::Commands::Search.new(Hotdog::Application.new) } before(:each) do ENV["DATADOG_API_KEY"] = "DATADOG_API_KEY" ENV["DAT...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/formatter/tsv_spec.rb
Ruby
mit
47
master
688
require "spec_helper" require "hotdog/formatters" require "hotdog/formatters/tsv" describe "tsv" do let(:fmt) { Hotdog::Formatters::Tsv.new } it "generates tsv without headers" do options = { headers: false, } expect(fmt.format([["foo", "aaa", 1], ["bar", "bbb", 2], ["baz", "ccc", 3]], opt...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/formatter/text_spec.rb
Ruby
mit
47
master
2,101
require "spec_helper" require "hotdog/formatters" require "hotdog/formatters/text" describe "text" do let(:fmt) { Hotdog::Formatters::Text.new } it "generates text (print0) without headers" do options = { headers: false, print0: true, print1: false, print2: false, } expec...
github
yyuu/hotdog
https://github.com/yyuu/hotdog
spec/formatter/yaml_spec.rb
Ruby
mit
47
master
771
require "spec_helper" require "hotdog/formatters" require "hotdog/formatters/yaml" describe "yaml" do let(:fmt) { Hotdog::Formatters::Yaml.new } it "generates yaml without headers" do options = { headers: false, } expect(fmt.format([["foo", "aaa", 1], ["bar", "bbb", 2], ["baz", "ccc", 3]],...