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
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/verb.rb
Ruby
mit
47
master
289
module IDEF0 class Verb PATTERN = "[a-z][^ ]*?(?: [a-z][^ ]*?)*" def self.parse(text) normalised_text = text.to_s.squish.downcase raise(ArgumentError, "Invalid verb: #{text.inspect}") unless /^#{PATTERN}$/ === normalised_text normalised_text end end end
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/external_mechanism_line.rb
Ruby
mit
47
master
1,480
require_relative 'external_line' module IDEF0 class ExternalMechanismLine < ExternalLine def self.make_line(source, target) source.bottom_side.each_anchor do |anchor| yield(new(source, target, anchor.name)) if target.bottom_side.expects?(anchor.name) end end def initialize(*args) ...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/box.rb
Ruby
mit
47
master
1,135
require_relative 'point' require_relative 'sides' module IDEF0 class Box extend Forwardable attr_reader :name attr_reader :top_side, :bottom_side, :left_side, :right_side def initialize(name) @name = name @top_left = Point.origin @top_side = TopSide.new(self) @bottom_side = ...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/unsatisfied_guidance_line.rb
Ruby
mit
47
master
331
module IDEF0 class UnsatisfiedGuidanceLine < ExternalGuidanceLine def self.make_line(source, target) target.top_side.each_unattached_anchor do |anchor| source.top_side.expects(anchor.name) yield(new(source, target, anchor.name)) end end alias_method :svg_line, :svg_dashed_line...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/sides.rb
Ruby
mit
47
master
2,299
require_relative 'array_set' require_relative 'point' require_relative 'anchor' module IDEF0 class Side attr_reader :margin def initialize(box) @box = box @anchors = ArraySet.new @margin = 0 end def name "#{@box.name}.#{self.class.name}" end # TODO: This is a fudge ...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/forward_input_line.rb
Ruby
mit
47
master
1,542
require_relative 'point' require_relative 'labels' require_relative 'line' module IDEF0 class ForwardInputLine < Line def self.make_line(source, target) return unless source.before?(target) source.right_side.each_anchor do |anchor| yield(new(source, target, anchor.name)) if target.left_side.e...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/noun.rb
Ruby
mit
47
master
325
module IDEF0 class Noun PATTERN = "[^a-z; ][^; ]*?(?: [^a-z; ][^; ]*?)*" def self.parse(text) normalised_text = text.to_s.squish.gsub(/(^|\s)[a-z]/) { |l| l.upcase } raise(ArgumentError, "Invalid noun: #{text.inspect}") unless /^#{PATTERN}$/ === normalised_text normalised_text end end...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/external_guidance_line.rb
Ruby
mit
47
master
1,510
require_relative 'point' require_relative 'labels' require_relative 'external_line' module IDEF0 class ExternalGuidanceLine < ExternalLine def self.make_line(source, target) source.top_side.each_anchor do |anchor| yield(new(source, target, anchor.name)) if target.top_side.expects?(anchor.name) ...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/forward_mechanism_line.rb
Ruby
mit
47
master
1,764
require_relative 'collection_negation' require_relative 'point' require_relative 'labels' require_relative 'internal_mechanism_line' module IDEF0 class ForwardMechanismLine < InternalMechanismLine def self.make_line(source, target) return unless source.before?(target) source.right_side.each_anchor do...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/statement.rb
Ruby
mit
47
master
1,114
require_relative 'noun' require_relative 'verb' require_relative 'string_squishing' require_relative 'string_comment_detection' module IDEF0 class Statement FORMAT = /^(#{Noun::PATTERN}) (#{Verb::PATTERN}) (#{Noun::PATTERN})$/ attr_reader :subject, :predicate, :object def self.assemble(subject, predica...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/anchor.rb
Ruby
mit
47
master
693
require_relative 'array_set' module IDEF0 class Anchor attr_reader :name attr_accessor :sequence def initialize(side, name) @side = side @name = name @sequence = 1 @lines = ArraySet.new end def attach(line) @lines << line end def position @side.ancho...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/backward_input_line.rb
Ruby
mit
47
master
2,494
require_relative 'collection_negation' require_relative 'point' require_relative 'labels' require_relative 'line' module IDEF0 class BackwardInputLine < Line def self.make_line(source, target) return unless source.after?(target) || source == target source.right_side.each_anchor do |anchor| yi...
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/internal_guidance_line.rb
Ruby
mit
47
master
224
require_relative 'line' module IDEF0 class InternalGuidanceLine < Line def attach @source_anchor = source.right_side.attach(self) @target_anchor = target.top_side.attach(self) self end end end
github
jimmyjazz/IDEF0-SVG
https://github.com/jimmyjazz/IDEF0-SVG
lib/idef0/forward_guidance_line.rb
Ruby
mit
47
master
1,029
require_relative 'collection_negation' require_relative 'internal_guidance_line' module IDEF0 class ForwardGuidanceLine < InternalGuidanceLine def self.make_line(source, target) return unless source.before?(target) source.right_side.each_anchor do |anchor| yield(new(source, target, anchor.nam...
github
hopsoft/pipe_envy
https://github.com/hopsoft/pipe_envy
pipe_envy.gemspec
Ruby
mit
47
master
876
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pipe_envy/version' Gem::Specification.new do |spec| spec.name = "pipe_envy" spec.version = PipeEnvy::VERSION spec.authors = ["Nathan Hopkins"] spec.email = ["...
github
hopsoft/pipe_envy
https://github.com/hopsoft/pipe_envy
lib/pipe_envy.rb
Ruby
mit
47
master
999
require_relative "./pipe_envy/version" module PipeEnvy def self.refine_pipe(klass) refine klass do define_method :| do |arg| #puts "#{self.class.name}, arg=#{arg.inspect}" if arg.is_a?(Array) method = arg.shift block = arg.pop if arg.last.is_a?(Proc) args = ...
github
hopsoft/pipe_envy
https://github.com/hopsoft/pipe_envy
test/pipe_envy_test.rb
Ruby
mit
47
master
1,357
require "open-uri" require "nokogiri" require "coveralls" Coveralls.wear! SimpleCov.command_name "pry-test" require_relative "../lib/pipe_envy" using PipeEnvy class PipeEnvyTest < PryTest::Test test "simple readme example" do assert "Ruby Rocks" | :upcase | :split == ["RUBY", "ROCKS"] end test "chained pip...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
Gemfile
Ruby
apache-2.0
47
master
1,066
source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test, :system_tests do spec_helper_dir = '/home/zuul/src/opendev.org/openstack/puppet-openstack_spec_helper' if File.directory?(spec_helper_dir) if ENV['ZUUL_PROJECT'] == 'openstack/puppet-openstack_spec_helper' gem 'puppet-openstack...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
lib/puppet/provider/ceilometer_config/openstackconfig.rb
Ruby
apache-2.0
47
master
209
Puppet::Type.type(:ceilometer_config).provide( :openstackconfig, :parent => Puppet::Type.type(:openstack_config).provider(:ruby) ) do def self.file_path '/etc/ceilometer/ceilometer.conf' end end
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
lib/puppet/provider/ceilometer_rootwrap_config/ini_setting.rb
Ruby
apache-2.0
47
master
219
Puppet::Type.type(:ceilometer_rootwrap_config).provide( :ini_setting, :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do def self.file_path '/etc/ceilometer/rootwrap.conf' end end
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
lib/puppet/type/ceilometer_rootwrap_config.rb
Ruby
apache-2.0
47
master
705
Puppet::Type.newtype(:ceilometer_rootwrap_config) do ensurable newparam(:name, :namevar => true) do desc 'Section/setting name to manage from /etc/ceilometer/rootwrap.conf' newvalues(/\S+\/\S+/) end newparam(:ensure_absent_val) do desc 'A value that is specified as the value property will behave ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
lib/puppet/type/ceilometer_config.rb
Ruby
apache-2.0
47
master
1,545
Puppet::Type.newtype(:ceilometer_config) do ensurable newparam(:name, :namevar => true) do desc 'Section/setting name to manage from ceilometer.conf' newvalues(/\S+\/\S+/) end newproperty(:value, :array_matching => :all) do desc 'The value of the setting to be defined.' def insync?(is) ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/spec_helper.rb
Ruby
apache-2.0
47
master
743
# Load libraries here to simulate how they live together in a real puppet run (for provider unit tests) $LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'inifile', 'lib')) $LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib')) require 'puppetlabs_spec_he...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/shared_examples.rb
Ruby
apache-2.0
47
master
213
shared_examples_for "a Puppet::Error" do |description| it "with message matching #{description.inspect}" do expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) end end
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_config_spec.rb
Ruby
apache-2.0
47
master
1,007
require 'spec_helper' describe 'ceilometer::config' do let(:config_hash) do { 'DEFAULT/foo' => { 'value' => 'fooValue' }, 'DEFAULT/bar' => { 'value' => 'barValue' }, 'DEFAULT/baz' => { 'ensure' => 'absent' } } end shared_examples_for 'ceilometer_config' do let :params do { :ceilometer...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_coordination_spec.rb
Ruby
apache-2.0
47
master
1,212
require 'spec_helper' describe 'ceilometer::coordination' do shared_examples 'ceilometer::coordination' do context 'with default parameters' do it { is_expected.to contain_oslo__coordination('ceilometer_config').with( :backend_url => '<SERVICE DEFAULT>', :manage_backe...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_logging_spec.rb
Ruby
apache-2.0
47
master
5,466
require 'spec_helper' describe 'ceilometer::logging' do let :params do { } end let :log_params do { :logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s', :logging_default_format_string =...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_agent_notification_spec.rb
Ruby
apache-2.0
47
master
10,058
# # Copyright (C) 2014 eNovance SAS <licensing@enovance.com> # # Author: Emilien Macchi <emilien.macchi@enovance.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apach...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_agent_service_credentials_spec.rb
Ruby
apache-2.0
47
master
4,223
require 'spec_helper' describe 'ceilometer::agent::service_credentials' do let :params do { :password => 'password' } end shared_examples_for 'ceilometer::agent::service_credentials' do context 'with default values' do it 'configures authentication' do is_expected.to contain_ceilometer_c...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_agent_polling_service_types_spec.rb
Ruby
apache-2.0
47
master
2,118
require 'spec_helper' describe 'ceilometer::agent::polling::service_types' do shared_examples 'ceilometer::agent::polling::service_types' do context 'with default parameters' do it 'configures the default values' do is_expected.to contain_ceilometer_config('service_types/glance').with_value('<SERVI...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_db_sync_spec.rb
Ruby
apache-2.0
47
master
2,112
require 'spec_helper' describe 'ceilometer::db::sync' do shared_examples_for 'ceilometer-upgrade' do it { is_expected.to contain_class('ceilometer::deps') } it 'runs ceilometer-upgrade' do is_expected.to contain_exec('ceilometer-upgrade').with( :command => 'ceilometer-upgrade ', ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_agent_polling_rgw_spec.rb
Ruby
apache-2.0
47
master
1,476
require 'spec_helper' describe 'ceilometer::agent::polling::rgw' do shared_examples 'ceilometer::agent::polling::rgw' do context 'with default parameters' do it 'configures the default values' do is_expected.to contain_ceilometer_config('rgw_admin_credentials/access_key').with_value('<SERVICE DEFAU...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_agent_polling_spec.rb
Ruby
apache-2.0
47
master
15,003
require 'spec_helper' describe 'ceilometer::agent::polling' do let :pre_condition do "include nova include nova::compute class { 'ceilometer': telemetry_secret => 's3cr3t' }" end let :params do {} end shared_examples 'ceilometer::agent::polling' do context 'with default params' do ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_reports_spec.rb
Ruby
apache-2.0
47
master
1,275
require 'spec_helper' describe 'ceilometer::reports' do shared_examples 'ceilometer::reports' do context 'with default parameters' do it { is_expected.to contain_oslo__reports('ceilometer_config').with( :log_dir => '<SERVICE DEFAULT>', :file_event_handler ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_cache_spec.rb
Ruby
apache-2.0
47
master
9,097
require 'spec_helper' describe 'ceilometer::cache' do let :params do {} end shared_examples_for 'ceilometer::cache' do context 'with default parameters' do it 'configures cache' do is_expected.to contain_oslo__cache('ceilometer_config').with( :config_prefix ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_keystone_auth_spec.rb
Ruby
apache-2.0
47
master
2,465
# # Unit tests for ceilometer::keystone::auth # require 'spec_helper' describe 'ceilometer::keystone::auth' do shared_examples_for 'ceilometer::keystone::auth' do context 'with default class parameters' do let :params do { :password => 'ceilometer_password' } end it { is_expected.to c...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/classes/ceilometer_init_spec.rb
Ruby
apache-2.0
47
master
8,937
require 'spec_helper' describe 'ceilometer' do let :params do { :http_timeout => '600', :max_parallel_requests => 64, :telemetry_secret => 'metering-s3cr3t', :package_ensure => 'present', :purge_config => false, :host => 'foo.dom...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/acceptance/10_basic_ceilometer_config_spec.rb
Ruby
apache-2.0
47
master
782
require 'spec_helper_acceptance' describe 'ceilometer with mysql' do context 'default parameters' do it 'should work with no errors' do pp= <<-EOS include openstack_integration include openstack_integration::repos include openstack_integration::apache include openstack_integration...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/acceptance/99_ceilometer_config_spec.rb
Ruby
apache-2.0
47
master
2,669
require 'spec_helper_acceptance' describe 'basic ceilometer_config resource' do context 'default parameters' do it 'should work with no errors' do pp= <<-EOS Exec { logoutput => 'on_failure' } File <||> -> Ceilometer_config <||> File <||> -> Ceilometer_rootwrap_config <||> file ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/unit/provider/ceilometer_rootwrap_config/ini_setting_spec.rb
Ruby
apache-2.0
47
master
1,421
require 'spec_helper' provider_class = Puppet::Type.type(:ceilometer_rootwrap_config).provider(:ini_setting) describe provider_class do it 'should default to the default setting when no other one is specified' do resource = Puppet::Type::Ceilometer_rootwrap_config.new( {:name => 'DEFAULT/foo', :value => '...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/unit/provider/ceilometer_config/openstackconfig_spec.rb
Ruby
apache-2.0
47
master
1,429
require 'spec_helper' provider_class = Puppet::Type.type(:ceilometer_config).provider(:openstackconfig) describe provider_class do it 'should default to the default setting when no other one is specified' do resource = Puppet::Type::Ceilometer_config.new( { :name => 'DEFAULT/foo', :value ...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/unit/type/ceilometer_config_spec.rb
Ruby
apache-2.0
47
master
2,106
require 'puppet' require 'puppet/type/ceilometer_config' describe 'Puppet::Type.type(:ceilometer_config)' do before :each do @ceilometer_config = Puppet::Type.type(:ceilometer_config).new(:name => 'DEFAULT/foo', :value => 'bar') end it 'should require a name' do expect { Puppet::Type.type(:ceilome...
github
openstack/puppet-ceilometer
https://github.com/openstack/puppet-ceilometer
spec/unit/type/ceilometer_rootwrap_config_spec.rb
Ruby
apache-2.0
47
master
2,281
require 'puppet' require 'puppet/type/ceilometer_rootwrap_config' describe 'Puppet::Type.type(:ceilometer_rootwrap_config)' do before :each do @ceilometer_rootwrap_config = Puppet::Type.type(:ceilometer_rootwrap_config).new(:name => 'DEFAULT/foo', :value => 'bar') end it 'should require a name' do expect...
github
mallio/orbited
https://github.com/mallio/orbited
init.rb
Ruby
mit
47
master
210
require 'yaml' require 'ostruct' ::OrbitedConfig = OpenStruct.new(YAML.load_file(File.join(RAILS_ROOT, 'config', 'orbited.yml'))[RAILS_ENV]) ActionView::Base.send :include, OrbitedHelper Orbited.set_defaults
github
mallio/orbited
https://github.com/mallio/orbited
Rakefile
Ruby
mit
47
master
560
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the orbited plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the orb...
github
mallio/orbited
https://github.com/mallio/orbited
install.rb
Ruby
mit
47
master
260
templates = File.join(File.dirname(__FILE__), 'generators', 'orbited', 'templates') orbited = File.join('config', 'orbited.yml') FileUtils.cp File.join(templates, 'orbited.yml'), File.join(RAILS_ROOT, orbited) unless File.exist?(File.join(RAILS_ROOT, orbited))
github
mallio/orbited
https://github.com/mallio/orbited
lib/orbited.rb
Ruby
mit
47
master
988
require 'stomp' class Orbited # Sends data in string form to the STOMP server, which sends it to anyone subscribed to # the specified channel def self.send_data(channel, data, headers = {}) user = OrbitedConfig.stomp_user password = OrbitedConfig.stomp_password host = OrbitedConfig.stomp_host ...
github
mallio/orbited
https://github.com/mallio/orbited
lib/orbited_helper.rb
Ruby
mit
47
master
3,390
# A few view helpers to generate the necessary javascript to get # connected to the Orbited server module OrbitedHelper # Includes the necessary javascript files from the Orbited server (Orbited.js and stomp.js) # This should be called after prototype.js is included def orbited_javascript js = javascript_tag...
github
mallio/orbited
https://github.com/mallio/orbited
generators/orbited_config/orbited_config_generator.rb
Ruby
mit
47
master
756
require 'yaml' class OrbitedConfigGenerator < Rails::Generator::Base def initialize(runtime_args, runtime_options={}) super env = @args[0] || 'development' @config = YAML.load_file(File.join(RAILS_ROOT, 'config', 'orbited.yml'))[env] @config.symbolize_keys! defaults end def defaults @...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
resque-multi-step.gemspec
Ruby
mit
47
master
1,130
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'resque/plugins/multi_step_task/version' Gem::Specification.new do |spec| spec.name = 'resque-multi-step' spec.version = Resque::Plugins::MultiStepTask::VERSION spec.authors ...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
Rakefile
Ruby
mit
47
master
740
require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec require 'rdoc/task' Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" rdoc.rdoc_dir = 'rdoc' rdoc.title = "resque-multi-step #{version}" rdoc.rdoc_files...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/spec_helper.rb
Ruby
mit
47
master
471
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'resque-multi-step' require 'pp' require 'rspec' RSpec.configure do |config| config.before do # Tests are jailed to a testing namespace and that space does # contains in left over d...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/resque-multi-step_spec.rb
Ruby
mit
47
master
204
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "ResqueMultiStepTask" do it "defines MultiStepTask" do defined?(Resque::Plugins::MultiStepTask).should be_true end end
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/acceptance/job_handling_spec.rb
Ruby
mit
47
master
5,302
require File.expand_path("spec_helper", File.dirname(__FILE__)) require 'resque/plugins/multi_step_task' # These tests are inherently sensitive to timing. There are sleeps a # the appropriate places to reduce/eliminate false failures where # possible. However, a failure does not always indicate a bug. Run # the tes...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/acceptance/acceptance_jobs.rb
Ruby
mit
47
master
587
module MultiStepAcceptance class WaitJob def self.perform(duration) sleep duration end end class CounterJob def self.perform(key) Resque.redis.incr key end end class FailJob def self.perform raise "boom" end end class FailOnceJob def self.perform(key) ...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/acceptance/spec_helper.rb
Ruby
mit
47
master
666
require File.expand_path("../spec_helper", File.dirname(__FILE__)) $LOAD_PATH << File.dirname(__FILE__) require 'acceptance_jobs' RSpec.configure do |c| c.before(:all) do puts '---------- Starting Resque Workers ----------' 3.times do |index| system "BACKGROUND=yes PIDFILE=resque#{index}.pid QUEUE=* NAM...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/resque/plugins/multi_step_task_spec.rb
Ruby
mit
47
master
7,990
require File.expand_path("../../spec_helper", File.dirname(__FILE__)) module Resque::Plugins describe MultiStepTask, "class" do it "allows creating new tasks" do MultiStepTask.create("brand-new-task").should be_kind_of(MultiStepTask) end it "allows creating new tasks with job specification bloc...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
spec/resque/plugins/multi_step_task/finalization_job_spec.rb
Ruby
mit
47
master
875
require File.expand_path("../../../spec_helper", File.dirname(__FILE__)) module Resque::Plugins class MultiStepTask describe FinalizationJob do let(:task){MultiStepTask.create("some-task")} before do task.finalizable! end it "queues next finalization job when done" do ...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
lib/resque/plugins/multi_step_task.rb
Ruby
mit
47
master
12,324
require 'resque' require 'redis-namespace' require 'resque/plugins/multi_step_task/assure_finalization' require 'resque/plugins/multi_step_task/finalization_job' require 'resque/plugins/multi_step_task/constantization' require 'resque/plugins/multi_step_task/atomic_counters' require 'logger' require 'yajl' module Resq...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
lib/resque/plugins/multi_step_task/atomic_counters.rb
Ruby
mit
47
master
491
module Resque module Plugins class MultiStepTask module AtomicCounters def counter(name) class_eval <<-INCR def increment_#{name} redis.incrby('#{name}', 1) logger.info("[Resque Multi-Step-Task] Incremented #{name}") end INCR ...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
lib/resque/plugins/multi_step_task/constantization.rb
Ruby
mit
47
master
538
module Resque module Plugins class MultiStepTask module Constantization # Courtesy ActiveSupport (Ruby on Rails) def constantize(camel_cased_word) names = camel_cased_word.split('::') names.shift if names.empty? || names.first.empty? constant = Objec...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
lib/resque/plugins/multi_step_task/assure_finalization.rb
Ruby
mit
47
master
525
module Resque module Plugins class MultiStepTask # in the case that all normal jobs have completed before the job group # is finalized, the job group will never receive the hook to enter # finalizataion. To avoid this, an AssureFinalization job will be added # to the queue for the sole pu...
github
openlogic/resque-multi-step
https://github.com/openlogic/resque-multi-step
lib/resque/plugins/multi_step_task/finalization_job.rb
Ruby
mit
47
master
1,681
require 'resque/plugins/multi_step_task/constantization' module Resque module Plugins class MultiStepTask # Executes a single finalization job class FinalizationJob extend Constantization # Handle job invocation def self.perform(task_id, job_module_name, *args) tas...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
cocoapods-dependency.gemspec
Ruby
mit
47
master
1,157
lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'cocoapods-dependency/version' Gem::Specification.new do |spec| spec.name = 'cocoapods-dependency' spec.version = CocoapodsDependency::VERSION spec.authors = ['Xinyu Zhao'] spec.email ...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
lib/cocoapods-dependency/analyze.rb
Ruby
mit
47
master
3,042
require 'cocoapods' require 'pathname' module CocoapodsDependency # # Analyze the project using cocoapods # class Analyzer def self.analyze(podfile_dir_path) path = Pathname.new(podfile_dir_path) raise 'absolute path is needed' unless path.absolute? Dir.chdir(podfile_dir_path) do ...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
lib/cocoapods-dependency/visual_out.rb
Ruby
mit
47
master
1,008
require 'json' require 'yaml' require 'cocoapods' module CocoapodsDependency class VisualOutHelper def initialize(dependency_map) @dependency_map = dependency_map end def to_d3js_json json = {} links = [] @dependency_map.each do |node, v| v.each do |dependency| l...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
lib/cocoapods-dependency/command/dependency.rb
Ruby
mit
47
master
1,404
require 'cocoapods-dependency/analyze' require 'pp' require 'cocoapods-dependency/visual_out' require 'tmpdir' module Pod class Command class Dependency < Command self.summary = 'Analyzes the dependencies of any cocoapods projects.' self.description = <<-DESC Analyzes the dependencies of any ...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
spec/spec_helper.rb
Ruby
mit
47
master
421
require 'coveralls' Coveralls.wear! require 'bundler/setup' require 'cocoapods-dependency/analyze' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` ...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
spec/cocoapods/visual_out_spec.rb
Ruby
mit
47
master
1,327
require 'cocoapods-dependency/visual_out' RSpec.describe 'CocoapodsDependency' do it 'visual out works' do dependency_map = { 'A': %w[B C], 'B': %w[C D] } json_output = CocoapodsDependency::VisualOutHelper.new(dependency_map).to_d3js_json json_expected = { 'links': [ { 'sour...
github
X140Yu/cocoapods-dependency
https://github.com/X140Yu/cocoapods-dependency
spec/cocoapods/dependency_spec.rb
Ruby
mit
47
master
5,252
RSpec.describe 'CocoapodsDependency' do it 'has a version number' do expect(CocoapodsDependency::VERSION).not_to be nil end it 'no podfile exists in path will raise error' do expect { CocoapodsDependency::Analyzer.analyze(Pathname.new('/')) }.to raise_error(/No Podfile exists/) end it 'generate cust...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
kommandant.gemspec
Ruby
mit
47
main
948
require_relative "lib/kommandant/version" Gem::Specification.new do |spec| spec.name = "kommandant" spec.version = Kommandant::VERSION spec.authors = ["Nicolai Bach Woller"] spec.email = ["woller@traels.it"] spec.homepage = "https://traels.it" spec.summary = "A command palette for Rails" spec.description...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
Gemfile
Ruby
mit
47
main
488
source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem's dependencies in kommandant.gemspec. gemspec gem "puma" gem "sqlite3" gem "sprockets-rails" gem "turbo-rails", "~> 2.0" group :development do gem "standard", "~> 1.32" end group :test do gem "kredis...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
db/migrate/20240611051736_add_default_command.rb
Ruby
mit
47
main
320
class AddDefaultCommand < ActiveRecord::Migration[7.1] def change Kommandant::Command.create( icon: "kommandant", path: Kommandant::Engine.routes.url_helpers.commands_path, http_method: "get", translations: {"da" => {"name" => "Kommandoer"}, "en" => {"name" => "Commands"}} ) end end
github
traels-it/kommandant
https://github.com/traels-it/kommandant
db/migrate/20240605130158_create_kommandant_commands.rb
Ruby
mit
47
main
486
class CreateKommandantCommands < ActiveRecord::Migration[7.1] def change create_table :kommandant_commands do |t| t.string :icon t.string :path t.string :http_method t.string :resource_class t.string :redirect_path t.string :search_result_text_method t.boolean :admin_only...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/test_helper.rb
Ruby
mit
47
main
1,288
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__) require "rails/test_help" ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/controllers/kommandant/searches_controller_test.rb
Ruby
mit
47
main
1,767
require "test_helper" class SearchesControllerTest < ActionDispatch::IntegrationTest describe "#search" do before do sign_in users(:not_admin) end it "renders search results, when there are any" do find_user = kommandant_commands(:find_user) find_post = kommandant_commands(:find_post) ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/controllers/kommandant/commands_controller_test.rb
Ruby
mit
47
main
4,225
require "test_helper" class CommandsControllerTest < ActionDispatch::IntegrationTest before do sign_in(users(:not_admin)) end let(:find_user) { kommandant_commands(:find_user) } describe "#index" do it "lists all commands" do get kommandant.commands_path assert_response :success as...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/controllers/kommandant/commands/searches_controller_test.rb
Ruby
mit
47
main
2,451
require "test_helper" class Kommandant::Commands::SearchesControllerTest < ActionDispatch::IntegrationTest before do sign_in(users(:not_admin)) end describe "#show" do let(:find_user) { kommandant_commands(:find_user) } it "finds resources" do resource = users(:not_admin) expected_path ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/test/controllers/posts_controller_test.rb
Ruby
mit
47
main
1,017
require "test_helper" class PostsControllerTest < ActionDispatch::IntegrationTest setup do @post = posts(:one) end test "should get index" do get posts_url assert_response :success end test "should get new" do get new_post_url assert_response :success end test "should create post" ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/test/controllers/users_controller_test.rb
Ruby
mit
47
main
1,022
require "test_helper" class UsersControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:admin) end test "should get index" do get users_url assert_response :success end test "should get new" do get new_user_url assert_response :success end test "should create user...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/test/system/posts_test.rb
Ruby
mit
47
main
932
require "application_system_test_case" class PostsTest < ApplicationSystemTestCase setup do @post = posts(:one) end test "visiting the index" do visit posts_url assert_selector "h1", text: "Posts" end test "should create post" do visit posts_url click_on "New post" fill_in "Name", ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/test/system/users_test.rb
Ruby
mit
47
main
930
require "application_system_test_case" class UsersTest < ApplicationSystemTestCase setup do @user = users(:admin) end test "visiting the index" do visit users_url assert_selector "h1", text: "Users" end test "should create user" do visit users_url click_on "New user" fill_in "Email...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/app/controllers/users_controller.rb
Ruby
mit
47
main
1,145
class UsersController < ApplicationController before_action :set_user, only: %i[show edit update destroy] # GET /users def index @users = User.all end # GET /users/1 def show end # GET /users/new def new @user = User.new end # GET /users/1/edit def edit end # POST /users def c...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/app/controllers/posts_controller.rb
Ruby
mit
47
main
1,149
class PostsController < ApplicationController before_action :set_post, only: %i[show edit update destroy] # GET /posts def index @posts = Post.all end # GET /posts/1 def show end # GET /posts/new def new @post = Post.new end # GET /posts/1/edit def edit end # POST /posts def c...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/app/controllers/application_controller.rb
Ruby
mit
47
main
376
class ApplicationController < ActionController::Base include Pagy::Backend before_action :set_current def current_user @current_user ||= Current.user end def set_current Current.user ||= User.find(session[:user_id]) end def current_ability current_user end def current_admin return...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/db/schema.rb
Ruby
mit
47
main
1,581
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/config/application.rb
Ruby
mit
47
main
788
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) require "kommandant" module Dummy class Application < Rails::Application config.load_defaults Rails::VERSION::STRING.to_f ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/config/environments/production.rb
Ruby
mit
47
main
3,870
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your applica...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/config/initializers/meilisearch.rb
Ruby
mit
47
main
211
MeiliSearch::Rails.configuration = { meilisearch_url: ENV.fetch("MEILI_HTTP_ADDR") { "http://localhost:7700" }, meilisearch_api_key: ENV.fetch("MEILI_MASTER_KEY") { "MASTER_KEY" }, per_environment: true }
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/dummy/config/initializers/kommandant.rb
Ruby
mit
47
main
327
Kommandant.configure do |config| config.pagination.enabled = false config.search_result_filter_lambda = ->(current_user, resource) { current_user.id == resource.id } config.admin_only_filter_lambda = ->(current_user, current_admin) { current_user.admin? } config.commands_path = "test/fixtures/files/commands.jso...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/lib/generators/kommandant/install_generator_test.rb
Ruby
mit
47
main
408
require "test_helper" require "generators/kommandant/install_generator" module Kommandant class InstallGeneratorTest < Rails::Generators::TestCase tests Kommandant::InstallGenerator destination Rails.root.join("tmp/generators") setup :prepare_destination test "it copies the initializer file" do ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
test/models/kommandant/commands/search_result_test.rb
Ruby
mit
47
main
1,049
require "test_helper" module Kommandant class Commands::SearchResultTest < ActiveSupport::TestCase setup do @user = User.new(id: 1, name: "Isaiah Wiegand") end test "path is inferable from the resource class to be used for further redirecting" do command = kommandant_commands(:find_user) ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
lib/kommandant.rb
Ruby
mit
47
main
1,058
require "kommandant/version" require "kommandant/engine" require "meilisearch-rails" require "dry-configurable" module Kommandant extend Dry::Configurable setting :commands_path, default: "config/kommandant/commands.json" setting :search_result_filter_lambda setting :admin_only_filter_lambda setting :parent...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
lib/kommandant/engine.rb
Ruby
mit
47
main
342
module Kommandant class Engine < ::Rails::Engine isolate_namespace Kommandant PRECOMPILE_ASSETS = %w[kommandant.js kommandant.css] initializer "kommandant.assets" do |app| if Rails.application.config.respond_to?(:assets) Rails.application.config.assets.precompile += PRECOMPILE_ASSETS ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
lib/tasks/kommandant_tasks.rake
Ruby
mit
47
main
1,160
namespace :kommandant do desc "Reindexes all commmands defined in the commands.json file (or whatever you called it)" task reindex_commands: :environment do puts "Reindexing all Kommandant commands" Kommandant::Command.reindex! end desc "Reindexes all models set up with Kommandant" task reindex_mode...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
lib/generators/kommandant/install_generator.rb
Ruby
mit
47
main
241
require "rails/generators" class Kommandant::InstallGenerator < Rails::Generators::Base source_root File.expand_path("templates", __dir__) def copy_templates template "initializer.rb", "config/initializers/kommandant.rb" end end
github
traels-it/kommandant
https://github.com/traels-it/kommandant
lib/generators/kommandant/templates/initializer.rb
Ruby
mit
47
main
2,405
Kommandant.configure do |config| # Commands are loaded from a JSON file. "config/kommandant/commands.json" is the default path. If you want to use a different path, you can set it here. # config.commands_path = "your/custom/path" # When meilisearch returns a result, it might include items, that the current user ...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
app/controllers/concerns/kommandant/recent_commands.rb
Ruby
mit
47
main
520
module Kommandant::RecentCommands extend ActiveSupport::Concern included do before_action :set_recent_commands end def set_recent_commands return unless current_user.present? if current_user.recent_commands.elements.any? @recent_commands ||= current_user.recent_commands.elements.map do |com...
github
traels-it/kommandant
https://github.com/traels-it/kommandant
app/controllers/kommandant/application_controller.rb
Ruby
mit
47
main
209
module Kommandant class ApplicationController < Kommandant.config.parent_controller.constantize layout false private alias_method :current_user, Kommandant.config.current_user_method end end
github
traels-it/kommandant
https://github.com/traels-it/kommandant
app/controllers/kommandant/searches_controller.rb
Ruby
mit
47
main
349
class Kommandant::SearchesController < ApplicationController def index @results = Kommandant::Command.search(params[:query]) unless Kommandant.config.admin_only_filter_lambda.present? && Kommandant.config.admin_only_filter_lambda.call(current_user, current_admin) @results.reject!(&:admin_only?) end...