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 | sbraford/rbet | https://github.com/sbraford/rbet | examples/list.rb | Ruby | mit | 19 | master | 307 | require File.join(File.dirname(__FILE__),'help.rb')
list = ET::List.new($et_uri, $et_user, $et_pass,:debug_output => $stderr)
#listid = list.add('sample','private')
#puts listid
list = list.retrieve_by_id 1149947 #listid
puts list.inspect
#puts list.title
#puts list.description
puts list.all.inspect |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et.rb | Ruby | mit | 19 | master | 1,317 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/renderable.rb | Ruby | mit | 19 | master | 1,514 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Portions Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/client.rb | Ruby | mit | 19 | master | 2,986 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Portions Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/tracker.rb | Ruby | mit | 19 | master | 1,913 | #
# Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/subscriber.rb | Ruby | mit | 19 | master | 3,022 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Portions Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/error.rb | Ruby | mit | 19 | master | 1,871 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Portions Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... |
github | sbraford/rbet | https://github.com/sbraford/rbet | lib/et/list.rb | Ruby | mit | 19 | master | 4,694 | #
# Copyright (c) 2007 Todd A. Fisher
#
# Portions Copyright (c) 2008 Shanti A. Braford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... |
github | sbraford/rbet | https://github.com/sbraford/rbet | test/help.rb | Ruby | mit | 19 | master | 2,604 | require 'test/unit'
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'et'
require 'webrick'
require 'thread'
require 'rubygems'
gem 'hpricot'
require 'hpricot'
# shut up, webrick :-)
class ::WEBrick::HTTPServer
def access_log(config, req, res)
# nop
end
end
class ::WEBrick::BasicLog
def log(... |
github | sbraford/rbet | https://github.com/sbraford/rbet | test/client_test.rb | Ruby | mit | 19 | master | 555 | require File.join(File.dirname(__FILE__),"help.rb")
class TestClient < Test::Unit::TestCase
include ET::TestCase
def test_client_send_ping
client = ET::Client.new('tester','tester11', {:service_url => 'http://127.0.0.1:99999/test/', :use_ssl => false})
result = client.send do|io|
io << %q(<system>
... |
github | sbraford/rbet | https://github.com/sbraford/rbet | test/list_test.rb | Ruby | mit | 19 | master | 394 | require File.join(File.dirname(__FILE__),"help.rb")
class ListClient < Test::Unit::TestCase
include ET::TestCase
def setup
super
@client = ET::List.new('tester','tester11', :service_url => 'http://127.0.0.1:99999/test/', :use_ssl => false, :debug_output => $stderr)
end
def test_list_all
@client... |
github | sbraford/rbet | https://github.com/sbraford/rbet | test/subscriber_test.rb | Ruby | mit | 19 | master | 673 | require File.join(File.dirname(__FILE__),"help.rb")
class SubscriberClient < Test::Unit::TestCase
include ET::TestCase
def test_subscriber_load
client = ET::Subscriber.new('tester', 'tester11', :service_url => 'http://127.0.0.1:99999/test/', :use_ssl => false)
client.load!('jdoe@email.com')
assert_eq... |
github | jdunphy/crufty | https://github.com/jdunphy/crufty | lib/crufty.rb | Ruby | mit | 19 | master | 1,438 | module Crufty
def self.find_methods(dir, sensitivity)
Dir.chdir(RAILS_ROOT)
sensitivity = (sensitivity || 1).to_i
Dir["#{dir.sub(/\/\Z/, '')}/**/*.rb"].each do |file|
methods = []
File.open(file, 'r') do |f|
f.each_line do |l|
methods.push l[/def ([a-z_\?\.!]+)/, 1]
... |
github | jdunphy/crufty | https://github.com/jdunphy/crufty | tasks/crufty.rake | Ruby | mit | 19 | master | 320 | namespace :crufty do
desc "Run with DIR='something' to check methods just within that location"
task :find_methods do
if ENV['DIR']
require File.dirname(__FILE__) + '/../lib/crufty'
Crufty.find_methods(ENV['DIR'], ENV['SENSITIVITY'])
else
puts "DIR=<location> is required"
end
end
end |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | sized_parallel.gemspec | Ruby | mit | 19 | master | 2,508 | #! /your/favourite/path/to/gem
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the ... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | Rakefile | Ruby | mit | 19 | master | 1,929 | #! /your/favourite/path/to/rake
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | Gemfile | Ruby | mit | 19 | master | 1,311 | #! /your/favourite/path/to/bundler
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in ... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/001_sized_parallel.rb | Ruby | mit | 19 | master | 2,825 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/test_helper.rb | Ruby | mit | 19 | master | 1,363 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/004_complicated.rb | Ruby | mit | 19 | master | 3,126 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/003_task.rb | Ruby | mit | 19 | master | 2,554 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/000_compile.rb | Ruby | mit | 19 | master | 1,428 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | test/002_pool.rb | Ruby | mit | 19 | master | 4,039 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | lib/sized_parallel.rb | Ruby | mit | 19 | master | 2,947 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | lib/sized_parallel/pool.rb | Ruby | mit | 19 | master | 5,028 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | lib/sized_parallel/task.rb | Ruby | mit | 19 | master | 2,422 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shyouhei/sized_parallel | https://github.com/shyouhei/sized_parallel | lib/sized_parallel/version.rb | Ruby | mit | 19 | master | 1,288 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level 2 -*-
# Copyright (c) 2015 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | arduino_ir_remote.gemspec | Ruby | mit | 19 | master | 1,260 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'arduino_ir_remote/version'
Gem::Specification.new do |spec|
spec.name = "arduino_ir_remote"
spec.version = ArduinoIrRemote::VERSION
spec.authors = ["Sho Hashimoto"]
s... |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | lib/arduino_ir_remote.rb | Ruby | mit | 19 | master | 249 | require "serialport"
require "event_emitter"
require "arduino_ir_remote/version"
require "arduino_ir_remote/config"
require "arduino_ir_remote/data"
require "arduino_ir_remote/ir_remote"
require "arduino_ir_remote/main"
module ArduinoIrRemote
end |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | lib/arduino_ir_remote/ir_remote.rb | Ruby | mit | 19 | master | 1,813 | module ArduinoIrRemote
class Device
include EventEmitter
attr_accessor :temp_pin
attr_reader :status
def initialize(port)
@status = Status::CLOSE
@state = nil
@serial = SerialPort.new(port, 57600, 8, 1, SerialPort::NONE) # 57600bps, 8bit, stopbit1, parity-none
@status = Status... |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | lib/arduino_ir_remote/data.rb | Ruby | mit | 19 | master | 291 | require "yaml"
module ArduinoIrRemote
DATA_FILE = ENV["IR_DATA_FILE"] || File.expand_path('.ir_remote.yml', ENV['HOME'])
DATA = File.exists?(DATA_FILE) ? YAML.load_file(DATA_FILE) : {}
def DATA.save
File.open DATA_FILE, "w+" do |f|
f.write self.to_yaml
end
end
end |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | lib/arduino_ir_remote/main.rb | Ruby | mit | 19 | master | 301 | module ArduinoIrRemote
def self.list
Dir.entries('/dev').grep(/tty\.?(usb|acm)/i).map{|fname| "/dev/#{fname}"}
end
def self.connect(port=nil)
port = list[0] unless port
raise ArgumentError, "IR Remote not found" unless port
ArduinoIrRemote::Device.new port || list[0]
end
end |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | test/test_ir_remote.rb | Ruby | mit | 19 | master | 415 | require File.expand_path 'test_helper', File.dirname(__FILE__)
class TestIrRemote < MiniTest::Test
def setup
@ir = ArduinoIrRemote.connect ENV["ARDUINO"]
end
def teardown
@ir.close
end
def test_analog_read
0.upto(5) do |pin|
ain = @ir.analog_read pin
assert 0 <= ain and ain < 1024
... |
github | shokai/arduino_ir_remote | https://github.com/shokai/arduino_ir_remote | samples/read_sensor.rb | Ruby | mit | 19 | master | 271 | $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'arduino_ir_remote'
ir = ArduinoIrRemote.connect ARGV.shift
ir.temp_pin = 0
loop do
0.upto(5).each{ |i|
puts "[analog#{i}] #{ir.analog_read i}"
}
puts "temp #{ir.temp_sensor}"
sleep 1
end |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | spree_google_merchant.gemspec | Ruby | bsd-3-clause | 19 | master | 589 | Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_google_merchant'
s.version = '0.60.0.RC1'
s.summary = 'Add gem summary here'
s.description = 'Add (optional) gem description here'
s.required_ruby_version = '>= 1.8.7'
s.author = 'Seb Weston'
s.e... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | spec/spec_helper.rb | Ruby | bsd-3-clause | 19 | master | 1,081 | # This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../test_app/config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its s... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | app/controllers/spree/admin/google_merchants_controller.rb | Ruby | bsd-3-clause | 19 | master | 274 | class Spree::Admin::GoogleMerchantsController < Spree::Admin::BaseController
def update
Spree::GoogleMerchant::Config.set(params[:preferences])
respond_to do |format|
format.html {
redirect_to admin_google_merchants_path
}
end
end
end |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | app/views/spree/products/google_merchant.rss.builder | Ruby | bsd-3-clause | 19 | master | 1,029 | xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
xml.rss "version" => "2.0", "xmlns:g" => "http://base.google.com/ns/1.0" do
xml.channel do
xml.title Spree::GoogleMerchant::Config[:google_merchant_title]
xml.description Spree::GoogleMerchant::Config[:google_merchant_description]
production_do... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | app/overrides/insert_google_merchant_into_admin_config_menu.rb | Ruby | bsd-3-clause | 19 | master | 338 | Deface::Override.new(
:virtual_path => "spree/admin/configurations/index",
:name => "insert_google_merchant_into_admin_config_menu",
:insert_after => "tbody[data-hook='admin_configurations_menu']",
:text => %(<%= configurations_menu_item(t("google_merchant"), admin_google_merchants_path, t("google_merchants_des... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | lib/spree_google_merchant.rb | Ruby | bsd-3-clause | 19 | master | 595 | require 'spree_core'
module SpreeGoogleMerchant
class Engine < Rails::Engine
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
end
end
co... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | lib/tasks/install.rake | Ruby | bsd-3-clause | 19 | master | 958 | namespace :spree_google_merchant do
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
task :install do
Rake::Task['spree_google_merchant:install:migrations'].invoke
Rake::Task['spree_google_merchant:install:assets'].invoke
end
namespace :install do
desc "Copies al... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | lib/spree/google_merchant_configuration.rb | Ruby | bsd-3-clause | 19 | master | 326 | class Spree::GoogleMerchantConfiguration < Spree::Preferences::Configuration
preference :google_merchant_title, :string, :default => 'My Spree Shop'
preference :google_merchant_description, :string, :default => 'List of our products'
preference :production_domain, :string, :default => 'http://www.myspreeshop.com/... |
github | sebastyuiop/spree_google_merchant | https://github.com/sebastyuiop/spree_google_merchant | lib/spree/google_merchant/config.rb | Ruby | bsd-3-clause | 19 | master | 363 | module Spree
module GoogleMerchant
class Config
include Singleton
class << self
def instance
return nil unless ActiveRecord::Base.connection.tables.include?('spree_configurations')
Spree::GoogleMerchantConfiguration.find_or_create_by_name("Google merchant configuration... |
github | BenMiller3/Programmers-Nightmare | https://github.com/BenMiller3/Programmers-Nightmare | prank.rb | Ruby | mit | 19 | master | 588 | deathChar = " " # Alt code death char - ("invisible character")
fileName = "VICTIM_FILE.extension" # Declare the file name that you want destroyed
file = File.open(fileName) # Open the file for modification
contents = File.read(file) # Save file contents to temporary variable
file.close ... |
github | hayfever/sorcery-jwt | https://github.com/hayfever/sorcery-jwt | sorcery-jwt.gemspec | Ruby | mit | 19 | master | 1,730 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "sorcery/jwt/version"
Gem::Specification.new do |spec|
spec.name = "sorcery-jwt"
spec.version = Sorcery::Jwt::VERSION
spec.authors = [""]
spec.email = [""]
spec.summary ... |
github | hayfever/sorcery-jwt | https://github.com/hayfever/sorcery-jwt | spec/spec_helper.rb | Ruby | mit | 19 | master | 367 | require "bundler/setup"
require "sorcery/jwt"
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`
config.disable_monkey_patching!
config.expect_with ... |
github | hayfever/sorcery-jwt | https://github.com/hayfever/sorcery-jwt | lib/sorcery/jwt.rb | Ruby | mit | 19 | master | 253 | require "sorcery/jwt/version"
module Sorcery
module Controller
module Submodules
require "sorcery/controller/submodules/jwt"
end
end
module Model
module Submodules
require "sorcery/model/submodules/jwt"
end
end
end |
github | hayfever/sorcery-jwt | https://github.com/hayfever/sorcery-jwt | lib/sorcery/controller/submodules/jwt.rb | Ruby | mit | 19 | master | 1,294 | module Sorcery
module Controller
module Submodules
module Jwt
def self.included(base)
base.send(:include, InstanceMethods)
Config.login_sources << :login_from_jwt
end
module InstanceMethods
protected
def login_from_jwt
user = deco... |
github | hayfever/sorcery-jwt | https://github.com/hayfever/sorcery-jwt | lib/sorcery/model/submodules/jwt.rb | Ruby | mit | 19 | master | 1,887 | require "sorcery/jwt/version"
require "jwt"
module Sorcery
module Model
module Submodules
module Jwt
def self.included(base)
base.sorcery_config.class_eval do
# Secret used to encode JWTs. Should correspond to the type needed by the algorithm used.
attr_accessor :j... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | lsd.gemspec | Ruby | mit | 19 | main | 1,399 | # frozen_string_literal: true
require_relative "lib/lsd/version"
Gem::Specification.new do |spec|
spec.name = "lsd-rb"
spec.version = Lsd::VERSION
spec.authors = ["Aristóteles Coutinho"]
spec.email = ["contato@aristoteles.dev"]
spec.summary = "A modern replacement for ls command"
spec.description = "List... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | Rakefile | Ruby | mit | 19 | main | 665 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
require "standard/rake"
namespace :coverage do
desc "Check test coverage using SimpleCov"
task :check do
require "simplecov"
SimpleCov.minimum_coverage 90
SimpleCov.minimum_coverage_by_file 80
SimpleCov.r... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/spec_helper.rb | Ruby | mit | 19 | main | 476 | # Carregue a configuração do SimpleCov primeiro
require_relative "support/coverage"
# Em seguida, carregue a biblioteca principal
require "lsd"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
#
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec ex... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/lsd_spec.rb | Ruby | mit | 19 | main | 1,554 | require "spec_helper"
RSpec.describe Lsd do
it "has a version number" do
expect(Lsd::VERSION).not_to be nil
end
it "defines Error as a StandardError subclass" do
expect(Lsd::Error.ancestors).to include(StandardError)
end
it "loads the DirectoryLister class" do
expect(defined?(Lsd::DirectoryList... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/support/coverage.rb | Ruby | mit | 19 | main | 326 | require "simplecov"
require "simplecov-json"
SimpleCov.start do
enable_coverage :branch
formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::JSONFormatter
]
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
track_files "lib/**/*.rb"
add_filter "/spec/... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/lib/lsd/directory_lister_spec.rb | Ruby | mit | 19 | main | 2,690 | require "spec_helper"
RSpec.describe Lsd::DirectoryLister do
let(:temp_dir) { Dir.mktmpdir }
let(:file_path) { File.join(temp_dir, "test.txt") }
let(:dir_path) { File.join(temp_dir, "test_dir") }
before(:each) do
FileUtils.mkdir_p(dir_path)
File.write(file_path, "test content")
File.write(File.joi... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/lib/lsd/entry_spec.rb | Ruby | mit | 19 | main | 1,674 | require "spec_helper"
RSpec.describe Lsd::Entry do
let(:temp_dir) { Dir.mktmpdir }
let(:file_path) { File.join(temp_dir, "test.txt") }
let(:dir_path) { File.join(temp_dir, "test_dir") }
before(:each) do
FileUtils.mkdir_p(dir_path)
File.write(file_path, "test content")
File.write(File.join(dir_path... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | spec/lib/lsd/table_formatter_spec.rb | Ruby | mit | 19 | main | 2,480 | require "spec_helper"
RSpec.describe Lsd::TableFormatter do
let(:entry) { instance_double("Lsd::Entry") }
let(:entries) { [entry] }
before do
allow(entry).to receive(:name).and_return("test.txt")
allow(entry).to receive(:type).and_return("file")
allow(entry).to receive(:size).and_return("100 B")
... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | lib/lsd.rb | Ruby | mit | 19 | main | 280 | require "terminal-table"
require "colorize"
require "fileutils"
require "tmpdir"
module Lsd
class Error < StandardError; end
require_relative "lsd/version"
require_relative "lsd/directory_lister"
require_relative "lsd/entry"
require_relative "lsd/table_formatter"
end |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | lib/lsd/entry.rb | Ruby | mit | 19 | main | 1,925 | module Lsd
class Entry
attr_reader :stat
def initialize(name)
@full_path = name
@stat = File.stat(name)
end
def name
@name ||= File.basename(@full_path)
end
def type
@type ||= directory? ? "dir".light_blue : "file".light_black
end
def size
@size ||= fo... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | lib/lsd/table_formatter.rb | Ruby | mit | 19 | main | 1,833 | module Lsd
class TableFormatter
MAX_NAME_LENGTH = 30
AVAILABLE_COLUMNS = {
"index" => {header: "#", value: ->(entry, idx) { idx.to_s.light_green }},
"name" => {header: "name", value: ->(entry, _) { entry.name.light_cyan }},
"type" => {header: "type", value: ->(entry, _) { entry.type }},
... |
github | aristotelesbr/lsd | https://github.com/aristotelesbr/lsd | lib/lsd/directory_lister.rb | Ruby | mit | 19 | main | 517 | module Lsd
module DirectoryLister
Error = Class.new(StandardError)
FILE_PRIORITY = 1
DIRECTORY_PRIORITY = 0
def self.list(path = ".")
entries = Dir.entries(path)
.reject { |entry| entry.start_with?(".") }
.sort_by { |name| [File.directory?(name) ? DIRECTORY_PRIORITY : FILE_PRIO... |
github | yohasebe/vim-command-workflow | https://github.com/yohasebe/vim-command-workflow | source/template.rb | Ruby | mit | 19 | main | 82,081 | def apply_template(en_data, data)
[
# global
{
"key" => ":h[elp] " + data["words"]["keyword"],
"catcode"=> "global",
"category"=> data["global"]["title"],
"desc" => data["global"]["commands"]["helpForKeyword"],
"search" => en_data["global"]["commands"]["helpForKeyword"],
"a... |
github | yohasebe/vim-command-workflow | https://github.com/yohasebe/vim-command-workflow | source/compile.rb | Ruby | mit | 19 | main | 1,945 | $:.unshift File.dirname(__FILE__)
require 'template.rb'
require 'json'
class Hash
def deep_merge(*others)
self.clone.deep_merge!(*others)
end
def deep_merge!(*others)
_child_merge = -> (_, self_val, other_val){
if self_val.instance_of?(Hash) && other_val.instance_of?(Hash)
self_val.merge o... |
github | yohasebe/vim-command-workflow | https://github.com/yohasebe/vim-command-workflow | source/vim_command.rb | Ruby | mit | 19 | main | 209 | require 'json'
locale = ARGV[0] || "en_us"
fcurrent = File.dirname(__FILE__)
dcurrent = File.expand_path(fcurrent)
cheatsheet = File.read(File.join(dcurrent, "compiled", locale + ".json"))
print cheatsheet |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | termtime.gemspec | Ruby | apache-2.0 | 19 | main | 616 | require_relative "lib/termtime/version"
Gem::Specification.new do |s|
s.name = "termtime"
s.version = TermTime::VERSION
s.summary = "Pure Ruby terminfo library"
s.description = "This is a pure Ruby terminfo library"
s.authors = [ "Aaron Patterson" ]
s.email = "tenderlove@ruby-lang.... |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | Rakefile | Ruby | apache-2.0 | 19 | main | 918 | require 'rake/clean'
require 'rake/testtask'
CLOBBER << "tmp/Caps"
CLOBBER << "tmp"
file "tmp/Caps" do
require "net/http"
mkdir_p "tmp"
url = URI("https://raw.githubusercontent.com/ThomasDickey/ncurses-snapshots/refs/heads/master/include/Caps")
res = Net::HTTP.get(url)
File.binwrite "tmp/Caps", res
end
fi... |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | test/terminfo_test.rb | Ruby | apache-2.0 | 19 | main | 4,043 | require "helper"
require "termtime"
module TermTime
class TermInfoTest < Test
def test_info
ti = TermInfo.new File.join(FIXTURES, "xterm-256color")
assert_equal ["xterm-256color", "xterm with 256 colors"], ti.names
assert_equal ["am", "bce", "ccc", "xenl", "km", "mir", "msgr", "npc", "mc5i"].so... |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | lib/termtime.rb | Ruby | apache-2.0 | 19 | main | 2,673 | # frozen_string_literal: true
require "strscan"
module TermTime
autoload :TermInfo, "termtime/terminfo"
autoload :DB, "termtime/db"
def self.tparm fmt, p1 = 0, p2 = 0, p3 = 0, p4 = 0, p5 = 0, p6 = 0, p7 = 0, p8 = 0, p9 = 0
return fmt unless fmt =~ /%/
regs = [p1, p2, p3, p4, p5, p6, p7, p8, p9]
st... |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | lib/termtime/terminfo.rb | Ruby | apache-2.0 | 19 | main | 2,658 | # frozen_string_literal: true
require "termtime/db"
module TermTime
class TermInfo
class Number
attr_reader :value, :db
def initialize v, db
@value = v
@db = db
freeze
end
def tiname; @db.tiname; end
end
class String
attr_reader :value, :db
... |
github | tenderlove/termtime | https://github.com/tenderlove/termtime | lib/termtime/db.rb | Ruby | apache-2.0 | 19 | main | 97,517 | # frozen_string_literal: true
# GENERATED FILE, DO NOT EDIT
# :stopdoc:
module TermTime
module DB
class Capability
attr_reader :name, :tiname, :titype, :tcname, :key_name, :value, :flags, :desc, :i
def initialize(name, tiname, titype, tcname, key_name, value, flags, desc, i)
@name = name
... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | Rakefile | Ruby | mit | 19 | master | 678 | begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'RailsRubyProf'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | Gemfile | Ruby | mit | 19 | master | 653 | source "https://rubygems.org"
# Declare your gem's dependencies in rails_ruby_prof.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | ruby_prof_rails.gemspec | Ruby | mit | 19 | master | 1,235 | $:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'ruby-prof/rails/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'ruby-prof-rails'
s.version = RubyProf::Rails::VERSION
s.authors = ['Thomas Leishman']
s.email ... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/test_helper.rb | Ruby | mit | 19 | master | 650 | require 'minitest/spec'
require 'minitest/autorun'
require 'rack/test'
require 'mocha'
require 'mocha/setup'
require './lib/ruby-prof/rails/config'
# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
# ActiveRecord::Migrator.migrations_... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/dummy/config/application.rb | Ruby | mit | 19 | master | 889 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require 'ruby-prof-rails'
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in c... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/dummy/config/environments/production.rb | Ruby | mit | 19 | master | 3,248 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/dummy/config/environments/test.rb | Ruby | mit | 19 | master | 1,797 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/config_test.rb | Ruby | mit | 19 | master | 2,110 | require 'test_helper'
describe RubyProf::Rails::Profiles do
before do
RubyProf::Rails::Config.username = nil
RubyProf::Rails::Config.password = nil
RubyProf::Rails::Config.session_auth_lambda = lambda do |session|
session[:is_admin] == true
end
::Rails.application.config.cache_classes = t... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/printers_test.rb | Ruby | mit | 19 | master | 1,723 | require 'test_helper'
require './lib/ruby-prof/rails/printers'
describe RubyProf::Rails::Printers do
describe 'valid?' do
it 'returns true when the list of printers are valid' do
RubyProf::Rails::Printers.valid?(%w{FlatPrinter FlatPrinterWithLineNumbers}).must_equal true
end
it 'returns false whe... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/config_validation_test.rb | Ruby | mit | 19 | master | 2,374 | require 'test_helper'
require './lib/ruby-prof/rails/config_validation'
describe RubyProf::Rails::ConfigValidation do
before do
@config = RubyProf::Rails::Config
@app_config = OpenStruct.new
@env = mock_env
reset
end
describe 'properly_configured?' do
it 'returns false when no username or p... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/printer_setup_test.rb | Ruby | mit | 19 | master | 829 | require 'test_helper'
require './lib/ruby-prof/rails/printer_setup'
describe RubyProf::Rails::PrinterSetup do
describe 'setup' do
it 'return a printer setup object' do
RubyProf::Rails::Printers.hash.each do |printer, filename|
@setup = RubyProf::Rails::PrinterSetup.new( request: mock_request(mock_... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/printer_test.rb | Ruby | mit | 19 | master | 1,573 | require 'test_helper'
require_relative 'profiles_mock_module'
require './lib/ruby-prof/rails/printer'
require './lib/ruby-prof/rails/printers'
require './lib/ruby-prof/rails/profiles'
require 'digest/sha1'
require 'securerandom'
require 'mocha'
describe RubyProf::Rails::Printer do
include RubyProf::Rails::ProfilesM... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/profiles_mock_module.rb | Ruby | mit | 19 | master | 1,390 | require './lib/ruby-prof/rails/config'
require './lib/ruby-prof/rails/profiles'
require './lib/ruby-prof/rails/printers'
require './lib/ruby-prof/rails/filename_module'
require 'digest/sha1'
require 'fileutils'
module RubyProf
module Rails
module ProfilesMockModule
include RubyProf::Rails::FilenameModule
... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/runner_test.rb | Ruby | mit | 19 | master | 4,600 | require 'test_helper'
require './test/mocks/fake_app'
require_relative 'profiles_mock_module'
require './lib/ruby-prof/rails/runner'
require 'mocha'
describe RubyProf::Rails::Profiles do
include RubyProf::Rails::ProfilesMockModule
before do
@runner = RubyProf::Rails::Runner.new( env: mock_env, app: mock_app... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/profile_test.rb | Ruby | mit | 19 | master | 911 | require 'test_helper'
require_relative 'profiles_mock_module'
describe RubyProf::Rails::Profile do
include RubyProf::Rails::ProfilesMockModule
before do
@request = mock_request
@filename = create_random_profile
@profile = RubyProf::Rails::Profile.new(@filename)
end
after do
cleanup_profiles
... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/profiles_test.rb | Ruby | mit | 19 | master | 1,072 | require 'test_helper'
require_relative 'profiles_mock_module'
describe RubyProf::Rails::Profiles do
include RubyProf::Rails::ProfilesMockModule
before do
@request = mock_request
@profiles = create_random_profiles
end
after do
cleanup_profiles
end
describe 'self.list' do
it 'returns and a... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/lib/ruby-prof/rails/runner_button_test.rb | Ruby | mit | 19 | master | 1,480 | require 'test_helper'
require './test/mocks/fake_app'
require './lib/ruby-prof/rails/runner_button'
require 'mocha'
describe RubyProf::Rails::Profiles do
describe 'draw' do
it 'it returns exact response if header is not html' do
response_orig = [mock_status, mock_header('application/json'), mock_html]
... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | test/controllers/rails_ruby_prof/home_controller_test.rb | Ruby | mit | 19 | master | 341 | require 'test_helper'
# require 'rack/rails_ruby_prof'
# require_relative 'mocks/fake_app'
describe RubyProfRails::HomeController do
# describe 'GET :index' do
#
# before do
# get :index
# end
#
# it 'should get index' do
# assert_response :success
# assert_not_nil assigns(:posts)
... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | config/routes.rb | Ruby | mit | 19 | master | 277 | RubyProf::Rails::Engine.routes.draw do
namespace :ruby_prof_rails do
post '' => 'home#update'
root to: 'home#index'
resources :home , path: ''
post 'profile' => 'profile#batch', :as => :profile_batch
resources :profile
resources :printer
end
end |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/rack/ruby-prof-rails.rb | Ruby | mit | 19 | master | 363 | require 'ruby-prof'
require 'ruby-prof/rails/runner'
module Rack
class RubyProfRails
def initialize(app)
@app = app
end
def call(env)
@ruby_prof_rails = ::RubyProf::Rails::Runner.new(env: env, app: @app)
if @ruby_prof_rails.skip?
@app.call(env)
else
@ruby_prof_ra... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/runner.rb | Ruby | mit | 19 | master | 3,491 | require 'yaml'
require_relative 'config'
require_relative 'printer'
require_relative 'runner_button'
module RubyProf
module Rails
class Runner
MEASUREMENTS = {
PROCESS_TIME: :default,
WALL_TIME: 'Wall Time',
CPU_TIME: 'CPU Time',
ALLOCATIONS: 'Allocation',
MEMORY: '... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/profile.rb | Ruby | mit | 19 | master | 1,150 | require 'yaml'
require_relative 'printers'
module RubyProf
module Rails
# RubyProf Rails Profile Utility
class Profile
ID_PATTERN = [:time, :session_id]
attr_reader :filename, :manifest
def initialize(manifest_filename)
@manifest = manifest_filename
@filename = RubyProf::... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/profiles.rb | Ruby | mit | 19 | master | 645 | require_relative 'config'
require_relative 'profile'
require_relative 'filename_module'
module RubyProf
module Rails
# RubyProf Rails Profile Utility
class Profiles
include RubyProf::Rails::FilenameModule
class << self
def list
Dir[File.join(RubyProf::Rails::Config.path, "#{PR... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/printers.rb | Ruby | mit | 19 | master | 1,248 | module RubyProf
module Rails
# RubyProf Rails Printers
class Printers
LIST = {
FlatPrinter: 'flat.txt',
FlatPrinterWithLineNumbers: 'flat.num.txt',
GraphPrinter: 'graph.txt',
GraphHtmlPrinter: 'graph.html',
DotPrinter: 'graph.dot',
CallTreePrinter: 'grind... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/config_validation.rb | Ruby | mit | 19 | master | 1,562 | module RubyProf
module Rails
# configuration validation for RubyProfRails application
class ConfigValidation
CACHE_CLASS_ENABLED_ALERT = %q{<p>To profile a Rails application it is vital to run it using production like settings
(cache classes, cache view lookups, etc.). Otherwise, Rail's depen... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/filename_module.rb | Ruby | mit | 19 | master | 991 | module RubyProf
module Rails
# RubyProf Rails FilenameHash Methods
module FilenameModule
PREFIX = 'ruby-prof-rails'
REGEXP_HASH = {
prefix: PREFIX,
time: '[0-9]+',
session_id: '[^-]+',
format: nil
}
INVALID_FILENAME = {
prefix: PREFIX,
t... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/runner_button.rb | Ruby | mit | 19 | master | 1,637 | module RubyProf
module Rails
class RunnerButton
BUTTON_HTML_PATH = ::File.expand_path('../../../app/views/ruby_prof_rails/runner/_button.html', ::File.dirname(__FILE__))
def initialize(options)
@status, @headers, @body = options.fetch(:response)
end
def draw
return [@sta... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/printer.rb | Ruby | mit | 19 | master | 1,241 | require_relative 'config'
require_relative 'profiles'
require_relative 'printer_setup'
require 'ruby-prof-flamegraph'
require 'ostruct'
module RubyProf
module Rails
# RubyProf Rails Printer Wrapper
class Printer
def initialize(options = {})
env = options.fetch(:env)
@options = RubyProf... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/printer_setup.rb | Ruby | mit | 19 | master | 825 | require_relative 'profiles'
require_relative 'printers'
require_relative 'filename_module'
module RubyProf
module Rails
# RubyProf Rails PrinterSetup class
class PrinterSetup
attr_accessor :key, :printer_class, :filename
include RubyProf::Rails::FilenameModule
def initialize(options = {})... |
github | tleish/ruby-prof-rails | https://github.com/tleish/ruby-prof-rails | lib/ruby-prof/rails/config.rb | Ruby | mit | 19 | master | 793 | module RubyProf
module Rails
# server configuration for RubyProfRails application
class Config
DEFAULT_EXCLUDE_FORMATS = %w{css js json map jpg jpeg png gif}.join(', ')
class << self
attr_accessor :username, :password, :path, :exclude_formats, :session_auth_lambda, :debug
def pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.