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
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
spec/models/password_disallows_frequent_changes_spec.rb
Ruby
mit
45
main
3,402
require 'spec_helper' RSpec.describe Devise::Models::PasswordDisallowsFrequentChanges, type: :model do include ActionView::Helpers::DateHelper include Devise::SecurePassword::Grammar let(:password) { 'Bubb1234@#$!' } let(:user) do Isolated::UserFrequentChanges.new( email: 'barney@rubble.com', ...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
spec/models/password_requires_regular_updates_spec.rb
Ruby
mit
45
main
1,774
require 'spec_helper' RSpec.describe Devise::Models::PasswordRequiresRegularUpdates, type: :model do let(:password) { 'Bubb1234@#$!' } let(:user) do Isolated::UserRegularUpdates.new( email: 'barney@rubble.com', password: password, password_confirmation: password ) end describe 'confi...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
spec/controllers/application_controller_spec.rb
Ruby
mit
45
main
2,790
require 'spec_helper' RSpec.describe ApplicationController, type: :controller do let(:password) { 'Bubb1234%$#!' } let(:user) do User.create( email: 'george@jetson.com', password: password, password_confirmation: password ) end describe '#authenticate_secure_password_expired?' do ...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
spec/controllers/devise/sessions_controller_spec.rb
Ruby
mit
45
main
648
require 'spec_helper' RSpec.describe Devise::SessionsController, type: :controller do let(:password) { 'Bubb1234%$#!' } let(:user) do User.create( email: 'george@jetson.com', password: password, password_confirmation: password ) end describe '#authenticate_secure_password_expired?' d...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/generators/devise/templates/secure_password.rb
Ruby
mit
45
main
1,713
# frozen_string_literal: true Devise.setup do |config| # ==> Configuration for the Devise Secure Password extension # Module: password_has_required_content # # Configure password content requirements including the number of uppercase, # lowercase, number, and special characters that are required. To conf...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/generators/devise/secure_password/install_generator.rb
Ruby
mit
45
main
820
# frozen_string_literal: true module Devise module SecurePassword module Generators class InstallGenerator < Rails::Generators::Base LOCALES = %w(en).freeze source_root File.expand_path('../templates', __dir__) desc 'Creates a Devise Secure Password extension initializer and copie...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/support/string/character_counter.rb
Ruby
mit
45
main
1,583
# lib/support/character_counter.rb # module Support module String class CharacterCounter attr_reader :count_hash def initialize @count_hash = { length: { count: 0 }, uppercase: characters_to_dictionary(('A'..'Z').to_a), lowercase: characters_to_dictionary(('a'..'...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/tasks/spec.rake
Ruby
mit
45
main
2,413
# # spec.rake # # Run rspec specs. # require 'rake' SPEC_ROOT_DIR = File.expand_path('../../spec', __dir__) unless Gem::Specification.find_all_by_name('rspec').any? puts 'Rspec gem is missing. Install it.' return end require 'rspec/core/rake_task' def targets version_list = Dir.glob("#{SPEC_ROOT_DIR}/rails-app...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/tasks/benchmarks.rake
Ruby
mit
45
main
711
# # benchmarks.rake # # Run benchmarks. # require 'rake' BENCHMARK_ROOT_DIR = File.expand_path('../../spec/benchmarks', __dir__) unless Gem::Specification.find_all_by_name('rspec').any? puts 'Rspec gem is missing. Install it.' return end require 'rspec/core/rake_task' namespace :test do desc 'Run benchmark tes...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/tasks/flay.rake
Ruby
mit
45
main
784
# # flay.rake # # Run flay code coverage tasks. # require 'rake' FLAY_ROOT_DIR = File.expand_path('../..', __dir__) FLAY_FILES = Dir.glob("#{FLAY_ROOT_DIR}/lib/devise/secure_password/**/*.rb") unless Gem::Specification.find_all_by_name('flay').any? puts 'Flay gem is missing. Install it.' return end require 'flay'...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password.rb
Ruby
mit
45
main
2,846
# # lib/devise-secure_password.rb # require 'active_support/concern' require 'devise' require 'devise/secure_password/routes' require 'devise/secure_password/version' require 'devise/secure_password/models/password_has_required_content' require 'devise/secure_password/models/password_disallows_frequent_reuse' require '...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/routes.rb
Ruby
mit
45
main
317
module ActionDispatch module Routing class Mapper protected def devise_passwords_with_policy(mapping, controllers) resource :password_with_policy, only: %i(edit update), path: mapping.path_names[:change_password], controller: controllers[:passwords_with_policy] end end end end
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/grammar.rb
Ruby
mit
45
main
457
# lib/support/string/grammar.rb # module Devise module SecurePassword module Grammar # distance_in_words without determiner words: about, almost, over, etc. def precise_distance_of_time_in_words(from_time, to_time = 0, options = {}) precise_options = { scope: :'secure_password.datetime.precise...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/controllers/devise_helpers.rb
Ruby
mit
45
main
451
module Devise module SecurePassword module Controllers module DeviseHelpers extend ActiveSupport::Concern class ::DeviseController alias devise_sign_in sign_in protected def sign_in(*args) devise_sign_in(*args).tap do set_devise_secu...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/controllers/helpers.rb
Ruby
mit
45
main
1,662
module Devise module SecurePassword module Controllers module Helpers extend ActiveSupport::Concern included do include Devise::SecurePassword::Grammar before_action :authenticate_secure_password!, unless: :devise_controller? end def authenticate_secure...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/models/password_disallows_frequent_reuse.rb
Ruby
mit
45
main
2,285
module Devise module Models module PasswordDisallowsFrequentReuse extend ActiveSupport::Concern require 'devise/secure_password/models/previous_password' included do # we need to specify the foreign_key here to support the use of isolated subclasses in tests has_many :previous_...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/models/password_has_required_content.rb
Ruby
mit
45
main
6,033
module Devise module Models module PasswordHasRequiredContent extend ActiveSupport::Concern require 'support/string/character_counter' LENGTH_MAX = 255 included do validate :validate_password_content, if: :password_required? validate :validate_password_confirmation_conte...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/models/previous_password.rb
Ruby
mit
45
main
596
module Devise module Models class PreviousPassword < ::ActiveRecord::Base self.table_name = 'previous_passwords' belongs_to :user default_scope -> { order(created_at: :desc) } validates :user_id, presence: true validates :salt, presence: true validates :encrypted_password, pres...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/models/password_disallows_frequent_changes.rb
Ruby
mit
45
main
1,977
module Devise module Models module PasswordDisallowsFrequentChanges extend ActiveSupport::Concern class ConfigurationError < RuntimeError; end included do include ActionView::Helpers::DateHelper include Devise::SecurePassword::Grammar validate :validate_password_freque...
github
ValiMail/devise-secure_password
https://github.com/ValiMail/devise-secure_password
lib/devise/secure_password/models/password_requires_regular_updates.rb
Ruby
mit
45
main
1,838
module Devise module Models module PasswordRequiresRegularUpdates extend ActiveSupport::Concern class ConfigurationError < RuntimeError; end included do set_callback(:initialize, :before, :before_regular_update_initialized) set_callback(:initialize, :after, :after_regular_updat...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
Gemfile
Ruby
mit
45
master
402
source 'https://rubygems.org' ruby '2.5.3' gem 'activesupport', '< 5' gem 'airbrake', '~> 7.3.4' gem 'anki', '0.0.4' gem 'dalli', '~> 2.7.8' gem 'padrino', '0.14.3' gem 'rake' gem 'sassc', '~> 1.12.1' gem 'slim', '~> 3.0.9' gem 'puma', '~> 4.3.1' gem 'wanikani', '~> 2.0.0' group :test do gem 'capybara', '~> 3.4.2' ...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
config.ru
Ruby
mit
45
master
206
#!/usr/bin/env rackup # encoding: utf-8 # This file can be used to start Padrino, # just execute it from the command line. require File.expand_path('../config/boot.rb', __FILE__) run Padrino.application
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
config/puma.rb
Ruby
mit
45
master
253
workers Integer(ENV["WEB_CONCURRENCY"] || 2) threads_count = Integer(ENV["MAX_THREADS"] || 5) threads threads_count, threads_count preload_app! rackup DefaultRackup port ENV["PORT"] || 3000 environment ENV["RACK_ENV"] || "development"
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
config/boot.rb
Ruby
mit
45
master
1,074
# Defines our constants RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV) PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT) # Load our dependencies require 'rubygems' unless defined?(Gem) require 'bundler/setup' Bundler.require(:default, RACK_ENV) ## # ## Enable de...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
config/apps.rb
Ruby
mit
45
master
1,482
## # This file mounts each app in the Padrino project to a specified sub-uri. # You can mount additional applications using any of these commands below: # # Padrino.mount('blog').to('/blog') # Padrino.mount('blog', :app_class => 'BlogApp').to('/blog') # Padrino.mount('blog', :app_file => 'path/to/blog/app.rb').t...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/spec_helper.rb
Ruby
mit
45
master
1,151
RACK_ENV = 'test'.freeze unless defined?(RACK_ENV) require File.expand_path(File.dirname(__FILE__) + '/../config/boot') require File.dirname(__FILE__) + '/../app/helpers/wanikani_api' require File.dirname(__FILE__) + '/../app/helpers/wkanki_helper' require 'capybara' require 'capybara/dsl' Capybara.app = Wkanki::App ...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/acceptance/wanikani_user_spec.rb
Ruby
mit
45
master
1,043
require 'spec_helper' describe 'WaniKani User' do let(:valid_api_key) { 'fe1d61e66c3a8421db3b8fdbff4fa522' } # koichi's API key, as given in the WaniKani forums. xdescribe 'Logging in' do before(:each) do visit '/' end it 'displays an error message if the API key is invalid' do fill_in 'w...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/app/controllers/export_controller_spec.rb
Ruby
mit
45
master
2,514
require 'spec_helper' describe 'ExportController' do let(:api_key_session) { { 'rack.session' => { wanikani_api_key: 'valid-api-key' } } } describe '/export' do before(:each) do allow_any_instance_of(Wanikani::Client).to receive(:user_information).and_return('username' => 'dennmart') end it 're...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/app/controllers/session_controller_spec.rb
Ruby
mit
45
master
1,846
require 'spec_helper' describe 'SessionController' do describe '/login' do context 'with invalid string' do it 'redirects to the home page if the string is invalid' do post '/login', wanikani_api_key: 'this key is invalid because it has spaces' expect(last_response).to be_redirect e...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/app/helpers/wkanki_helper_spec.rb
Ruby
mit
45
master
7,095
require 'spec_helper' describe WkankiHelper do subject do Class.new { include WkankiHelper }.new end describe '#wanikani_user' do it 'returns nil if the API key is blank' do expect(subject.wanikani_user("")).to be_nil end it 'returns nil if the API key is nil' do expect(subject.wani...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
spec/app/helpers/wanikani_api_spec.rb
Ruby
mit
45
master
3,773
require 'spec_helper' describe WanikaniApi do let(:kanji_item) { { 'character' => "了", 'meaning' => 'finish, complete, end', 'onyomi' => "りょう", 'kunyomi' => nil, 'important_reading' => 'onyomi', 'level' => 2, 'percentage' => '72' } } let(:vocabulary_item) { { 'character' => "伝説", 'kana' => "でんせつ", 'meaning' => 'le...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
lib/sass_initializer.rb
Ruby
mit
45
master
485
module SassInitializer def self.registered(app) # Enables support for SASS template reloading in rack applications. # See http://nex-3.com/posts/88-sass-supports-rack for more details. # Store SASS files (by default) within 'app/stylesheets'. require 'sass/plugin/rack' Sass::Plugin.options[:templa...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/app.rb
Ruby
mit
45
master
2,825
require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/array/extract_options' module Wkanki class App < Padrino::Application register Padrino::Rendering register Padrino::Helpers r...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/controllers/session.rb
Ruby
mit
45
master
550
Wkanki::App.controllers :session do post :login, map: '/login' do if params[:wanikani_api_key] =~ /^\S*$/ && Wanikani::Client.valid_api_key?(params[:wanikani_api_key]) session[:wanikani_api_key] = params[:wanikani_api_key] redirect url(:export, :index) else flash[:error] = "Bummer... Your Wa...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/controllers/export.rb
Ruby
mit
45
master
921
Wkanki::App.controllers :export do get :index do redirect url(:home, :index) if api_key_missing?(session[:wanikani_api_key]) @wanikani_user = wanikani_user(session[:wanikani_api_key]) render 'export/index' end post :generate do begin wanikani_api = WanikaniApi.new(session[:wanikani_api_key]...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/controllers/docs.rb
Ruby
mit
45
master
256
Wkanki::App.controllers :docs do get :index do @docs = [ { 'file' => 'how_to_import_into_anki' } ] render 'docs/index' end get :show, with: :id do @doc = { 'file' => 'how_to_import_into_anki' } render 'docs/show' end end
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/helpers/wanikani_api.rb
Ruby
mit
45
master
1,536
class WanikaniApi def initialize(api_key) @client = Wanikani::Client.new(api_key: api_key) end def fetch_critical(params) percentage = params[:argument] || 75 critical_items = @client.critical_items(percentage.to_i) add_keys(critical_items) end def fetch_kanji(params) kanji = @client.kan...
github
dennmart/wanikani-to-anki
https://github.com/dennmart/wanikani-to-anki
app/helpers/wkanki_helper.rb
Ruby
mit
45
master
952
module WkankiHelper HEADERS = %w(key type character meaning image onyomi kunyomi important_reading kana level).freeze def api_key_missing?(api_key) api_key.nil? || api_key.empty? || api_key.match(/\A[[:space:]]*\z/) end def wanikani_user(api_key) return nil if api_key_missing?(api_key) cache_objec...
github
starchow/rails_admin-i18n
https://github.com/starchow/rails_admin-i18n
rails_admin-i18n.gemspec
Ruby
mit
45
master
2,486
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: rails_admin-i18n 1.20.2 ruby lib Gem::Specification.new do |s| s.name = "rails_admin-i18n".freeze s.version = "1.20.2".freeze s.required_rubygems_version =...
github
starchow/rails_admin-i18n
https://github.com/starchow/rails_admin-i18n
Rakefile
Ruby
mit
45
master
1,393
# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem i...
github
starchow/rails_admin-i18n
https://github.com/starchow/rails_admin-i18n
lib/rails_admin-i18n.rb
Ruby
mit
45
master
274
require 'rails' module RailsAdminI18n class Railtie < ::Rails::Railtie #:nodoc: initializer 'rails-i18n' do |app| I18n.load_path << Dir[File.join(File.expand_path(File.dirname(__FILE__) + '/../locales'), '*.yml')] I18n.load_path.flatten! end end end
github
starchow/rails_admin-i18n
https://github.com/starchow/rails_admin-i18n
spec/rails_admin-i18n_spec.rb
Ruby
mit
45
master
308
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') Dir.glob('locales/*.yml').each do |locale_file| describe "a rails_admin-i18n #{locale_file} locale file" do it_behaves_like 'a valid locale file', locale_file it { expect(locale_file).to be_a_subset_of 'locales/en.yml' } end end
github
apeiros/sorting
https://github.com/apeiros/sorting
sorting.gemspec
Ruby
bsd-2-clause
45
master
1,165
# encoding: utf-8 Gem::Specification.new do |s| s.name = "sorting" s.version = "0.0.2" s.authors = "Stefan Rusterholz" s.email = "stefan.rusterholz@gmail.com" s.homepage = "https://github.com/apeiros/sorting" s.d...
github
apeiros/sorting
https://github.com/apeiros/sorting
Rakefile
Ruby
bsd-2-clause
45
master
334
$LOAD_PATH.unshift(File.expand_path('../rake/lib', __FILE__)) Dir.glob(File.expand_path('../rake/tasks/**/*.{rake,task,rb}', __FILE__)) do |task_file| begin import task_file rescue LoadError => e warn "Failed to load task file #{task_file}" warn " #{e.class} #{e.message}" warn " #{e.backtrace.firs...
github
apeiros/sorting
https://github.com/apeiros/sorting
rake/tasks/gem.rb
Ruby
bsd-2-clause
45
master
1,809
# encoding: utf-8 #require 'rake/apeiron/gemtasks' namespace :gem do task :prepare do lib_dir = File.expand_path('lib') # Rake ensures that the working directory is the project root $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include? lib_dir require 'sorting/version' require 'rubygems/specificat...
github
apeiros/sorting
https://github.com/apeiros/sorting
rake/tasks/test.rb
Ruby
bsd-2-clause
45
master
221
# encoding: utf-8 namespace :test do desc "Run all unit tests" task :run do ARGV.clear # FIXME: HAX! load 'test/runner.rb' end end desc "Runs test:run - which runs all unit tests" task :test => 'test:run'
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting.rb
Ruby
bsd-2-clause
45
master
2,027
# encoding: utf-8 require 'sorting/ascending' require 'sorting/bigger' require 'sorting/descending' require 'sorting/helpers' require 'sorting/smaller' require 'sorting/version' # Sorting # Helpful functionality for sorting and comparing. # # Requiring 'sorting' loads all functionality this gem provides, except f...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/ascending.rb
Ruby
bsd-2-clause
45
master
4,443
# encoding: utf-8 module Sorting # This class is used to implement 'asc' (ascending) sorting. # You should not need to use this class directly. # You can `require 'sorting/convenience'` and then use Kernel#asc, # or you can `require 'sorting'` and then use Sorting#asc (which # is a module_function, and he...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/version.rb
Ruby
bsd-2-clause
45
master
302
# encoding: utf-8 begin require 'rubygems/version' # newer rubygems use this rescue LoadError require 'gem/version' # older rubygems use this end module Sorting # The version of the sorting gem. # @note # require 'sorting' loads this module # Version = Gem::Version.new("0.0.2") end
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/convenience.rb
Ruby
bsd-2-clause
45
master
1,029
# encoding: utf-8 # The sorting/convenience.rb file adds Kernel#asc and Kernel#desc for # convenience. The methods are defined as module functions (see # Module#module_function), and hence also available as Kernel.asc and # Kernel.desc require 'sorting' # The 'sorting/convenience' file patches the Kernel module ...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/smaller.rb
Ruby
bsd-2-clause
45
master
1,437
# encoding: utf-8 module Sorting # A value whose #<=> method will always compare as being the smaller value. # Useful for defaultizing potentially nil values before comparing/sorting. # # @example # age = person.age || Sorting::Smaller # # @see Sorting::Bigger # # @note # require 'sorting'...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/descending.rb
Ruby
bsd-2-clause
45
master
1,788
# encoding: utf-8 require 'sorting/ascending' module Sorting # This class is used to implement 'desc' (descending) sorting. # You should not need to use this class directly. # You can `require 'sorting/convenience'` and then use Kernel#desc, # or you can `require 'sorting'` and then use Sorting#desc (whi...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/helpers.rb
Ruby
bsd-2-clause
45
master
2,481
# encoding: utf-8 require 'sorting/ascending' require 'sorting/descending' module Sorting # This module provides convenience methods to create Sorting::Ascending and # Sorting::Descending instances. # # Important: see {Sorting::Helpers.append_to} for how to properly use this # module with other modules...
github
apeiros/sorting
https://github.com/apeiros/sorting
lib/sorting/bigger.rb
Ruby
bsd-2-clause
45
master
1,429
# encoding: utf-8 module Sorting # A value whose #<=> method will always compare as being the bigger value. # Useful for defaultizing potentially nil values before comparing/sorting. # # @example # age = person.age || Sorting::Bigger # # @see Sorting::Smaller # # @note # require 'sorting' ...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/runner.rb
Ruby
bsd-2-clause
45
master
754
#!/usr/bin/env ruby # encoding: utf-8 # run with `ruby test/runner.rb` (or just `./test/runner.rb`) # if you only want to run a single test-file: `ruby test/runner.rb testfile.rb` if ENV['COVERAGE'] # IMPORTANT! It seems simplecov must be required before anything else, not just the code-under-test require 'simpleco...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/lib/sorting_test/helper.rb
Ruby
bsd-2-clause
45
master
822
# encoding: utf-8 require 'stringio' require 'yaml' require 'test/unit/assertions' require 'sorting_test/assertions' module TestSuite attr_accessor :name end module Kernel def suite(name, &block) klass = Class.new(Test::Unit::TestCase) klass.extend TestSuite klass.name = "Suite #{name}" klass.cl...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/unit/sorting/test_sorting.rb
Ruby
bsd-2-clause
45
master
1,493
# encoding: utf-8 require 'sorting/convenience' suite "Sorting" do test "#asc" do assert_equal [1,2,3], [3,1,2].sort_by { |x| asc(x) } end test "#asc with :nils_last" do assert_equal [1,2,3,nil], [3,nil,1,2].sort_by { |x| asc(x, :nils_last) } end test "#asc with :nils_first" do assert_equal [n...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/unit/sorting/test_convenience.rb
Ruby
bsd-2-clause
45
master
2,161
# encoding: utf-8 require 'sorting/convenience' suite "File sorting/convenience" do test "Kernel#asc" do assert_instance_of Sorting::Ascending, asc(0), "Kernel#asc is present" assert_raises NoMethodError, "Kernel#asc is private" do Object.new.asc(0) end end test "Kernel::asc" do assert_instance_of ...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/unit/sorting/test_smaller_bigger.rb
Ruby
bsd-2-clause
45
master
1,636
# encoding: utf-8 require 'sorting/convenience' require 'date' suite "Sorting" do suite "Smaller" do test "#<=>" do assert_equal -1, Sorting::Smaller <=> 1 assert_equal -1, Sorting::Smaller <=> Time.now assert_equal -1, Sorting::Smaller <=> Date.today assert_equal -1, Sorting::Smalle...
github
apeiros/sorting
https://github.com/apeiros/sorting
test/unit/sorting/test_ascending_descending.rb
Ruby
bsd-2-clause
45
master
6,104
# encoding: utf-8 require 'sorting/convenience' suite "Sorting" do suite "Ascending" do test "#initialize" do assert_instance_of Sorting::Ascending, Sorting::Ascending.new(0) assert_instance_of Sorting::Ascending, Sorting::Ascending.new(0, nil) assert_instance_of Sorting::Ascending, Sorting::A...
github
apeiros/sorting
https://github.com/apeiros/sorting
documentation/examples.rb
Ruby
bsd-2-clause
45
master
963
# encoding: utf-8 begin require 'sorting/convenience' rescue LoadError $LOAD_PATH << (p File.expand_path('../../lib', __FILE__)) require 'sorting/convenience' puts "Sorting gem is not installed, using relative lib" end require 'pp' Person = Struct.new(:first_name, :last_name, :age) people = [ Person.new('P...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
example.rb
Ruby
apache-2.0
45
master
1,273
$:.push File.expand_path("../lib", __FILE__) require 'steps' report "This is an example of 'steps' output" step "Single Level Task" do sleep 1 end step "Custom Success Message" do sleep 1 "Yay!" end step "Task with an error" do sleep 1 raise end step "Custom Error Message" do sleep 1 raise "There was...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
steps.gemspec
Ruby
apache-2.0
45
master
907
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'steps/version' require 'date' Gem::Specification.new do |s| s.name = "steps" s.version = Steps::VERSION s.authors = ["Crowd Favorite"] s.date = Date.today.to_s s.s...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
Rakefile
Ruby
apache-2.0
45
master
508
# encoding: utf-8 require 'bundler' require "bundler/gem_tasks" require 'rake/testtask' require 'rake/clean' CLOBBER.include 'pkg/*' CLEAN.include 'pkg/*' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing ge...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
lib/steps.rb
Ruby
apache-2.0
45
master
755
# encoding: utf-8 require 'steps/output' def step(desc, options={}, &block) Steps::Output.singleton.step(desc, options, &block) end def confirm(message, options={}) Steps::Output.singleton.confirm(message, options) end def retrieve(message, answer_type = String, &block) Steps::Output.singleton.retrieve(message...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
lib/steps/output.rb
Ruby
apache-2.0
45
master
4,074
# encoding: utf-8 STDOUT.sync require 'colored' require 'highline' require 'steps/spinner' module Steps class Output @@singleton = nil def self.singleton @@singleton ||= Output.new end def initialize @spinner = Steps::Spinner.new @task_depth = 0 @stacked_result = false ...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
lib/steps/spinner.rb
Ruby
apache-2.0
45
master
575
module Steps # Simple shell spinner to provide user feedback # class Spinner def initialize @running = false @chars = ['|', '/', '-', '\\'] end def running? @running end def start return if @running @running = true @spinner_thread = Thread.new do ...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
specs/spinner_spec.rb
Ruby
apache-2.0
45
master
460
require 'minitest/spec' require 'minitest/autorun' require 'steps/spinner' describe Steps::Spinner do before do @spinner = Steps::Spinner.new end after do @spinner = nil end it "should be initialized in a stopped state" do @spinner.running?.must_equal false end it "reports running? status...
github
crowdfavorite/gem-steps
https://github.com/crowdfavorite/gem-steps
specs/output_spec.rb
Ruby
apache-2.0
45
master
3,178
require 'minitest/spec' require 'minitest/autorun' require 'steps/output' describe Steps::Output do after do $stdin = STDIN end it "should produce a valid singleton" do output = Steps::Output.singleton output.must_be_same_as Steps::Output.singleton output.wont_be_same_as Steps::Output.new end...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
Rakefile
Ruby
mit
45
master
1,209
require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' spec = Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = "git-ruby" s.version = "0.2.0" s.author = "Scott Chacon" s.email = "schacon@gmail.com" s.summary = "A pure ruby implement...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/test_helper.rb
Ruby
mit
45
master
1,940
require 'test/unit' require 'fileutils' require 'logger' require File.dirname(__FILE__) + '/../lib/git-ruby' class Test::Unit::TestCase def set_file_paths cwd = `pwd`.chomp if File.directory?(File.join(cwd, 'files')) @test_dir = File.join(cwd, 'files') elsif File.directory?(File.join(cwd, '..', ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_commit.rb
Ruby
mit
45
master
803
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestCommit < Test::Unit::TestCase def setup set_file_paths end def test_add @git.chdir do new_file('testfile', 'my test content') @git.add('testfile') assert_equal('496e96cbea07239ad519b413758f2cb00700d1c9',...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_raw_internals.rb
Ruby
mit
45
master
1,040
#!/usr/bin/env ruby require 'logger' require File.dirname(__FILE__) + '/../test_helper' class TestRawInternals < Test::Unit::TestCase def setup set_file_paths end def test_raw_log with_temp_bare do |g| t_log(g) end end def test_packed_log with_temp_bare do |g| g.repack ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_index.rb
Ruby
mit
45
master
995
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestIndex < Test::Unit::TestCase def setup set_file_paths end def test_clean @git.chdir do assert @git.index.clean? append_file('example.txt', 'my test content') assert !@git.index.clean? @git.add('e...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_lib.rb
Ruby
mit
45
master
1,011
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestLib < Test::Unit::TestCase def setup set_file_paths end def test_dumb_checkout in_temp_dir do assert !File.exists?('example.txt') @git.lib.dumb_checkout('test_object') assert File.exists?('example.txt') ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_working.rb
Ruby
mit
45
master
253
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestWorking < Test::Unit::TestCase def setup set_file_paths end def test_checkout end def test_with_working end def test_with_temp_working end end
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_branches.rb
Ruby
mit
45
master
246
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestBranches < Test::Unit::TestCase def setup set_file_paths end def test_current_branch end def test_branches end def test_branch end end
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_log.rb
Ruby
mit
45
master
1,749
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' require 'date' class TestLog < Test::Unit::TestCase def setup set_file_paths @start_date = Time.local(2007, 11, 8, 11, 20, 38); @end_date = Time.local(2007, 11, 9, 10, 29, 14) @full_size = @git.rev_list.size end def test_log ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_objects.rb
Ruby
mit
45
master
483
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestObjects < Test::Unit::TestCase def setup set_file_paths end def test_object #GitRuby::Object.new(self, objectish) end def test_gtree #GitRuby::Object.new(self, objectish, 'tree') end def test_gcommit ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_git.rb
Ruby
mit
45
master
568
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestGit < Test::Unit::TestCase def setup set_file_paths end def test_git_open g = GitRuby.open(@wdir) assert_match('.git', g.repo.path) end def test_git_bare g = GitRuby.bare(File.join(@wdir, '.git')) asser...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
tests/units/test_base.rb
Ruby
mit
45
master
465
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' class TestBase < Test::Unit::TestCase def setup set_file_paths end def test_directory_stuff # dir, repo, index # set_working, set_index end def test_chdir end def test_repo_size end def test_log end ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby.rb
Ruby
mit
45
master
2,276
# Add the directory containing this file to the start of the load path if it # isn't there already. $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'git-ruby/base' require 'git-ruby/path' require 'git-ruby/lib' require 'g...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/index.rb
Ruby
mit
45
master
9,455
module GitRuby class GitRubyIndexError < StandardError end # this file implements my imagination of what the index file does. # it accomplishes the same basic tasks, but uses it's own index.gitr file # rather than the actual git index file because I don't have the strength to # reverse engineer that...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/branches.rb
Ruby
mit
45
master
927
module GitRuby # object that holds all the available branches class Branches include Enumerable @base = nil @branches = nil def initialize(base) @branches = {} @base = base @base.lib.branches_all.each do |b| @branches[b[0]] = GitRuby::Branch...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/lib.rb
Ruby
mit
45
master
14,569
require 'tempfile' require 'net/https' module GitRuby class GitRubyInvalidTransport < StandardError; end class Lib @git_dir = nil @git_index = nil @git_work_dir = nil @path = nil @logger = nil @raw_repo = nil def initialize(base = nil, logger = nil) if base....
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/log.rb
Ruby
mit
45
master
1,663
module GitRuby # object that holds the last X commits on given branch class Log include Enumerable @base = nil @commits = nil @object = nil @path = nil @count = nil @since = nil @between = nil @dirty_flag = nil def initialize(base, count = 30) dir...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/author.rb
Ruby
mit
45
master
279
module GitRuby class Author attr_accessor :name, :email, :date def initialize(author_string) if m = /(.*?) <(.*?)> (\d+) (.*)/.match(author_string) @name = m[1] @email = m[2] @date = Time.at(m[3].to_i) end end end end
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/branch.rb
Ruby
mit
45
master
1,926
module GitRuby class Branch < Path attr_accessor :full, :remote, :name @base = nil @gcommit = nil @stashes = nil def initialize(base, name) @remote = nil @full = name @base = base parts = name.split('/') if parts[1] @remote = GitRuby::Rem...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/base.rb
Ruby
mit
45
master
7,742
module GitRuby class Base @working_directory = nil @repository = nil @index = nil @lib = nil @logger = nil # opens a bare Git Repository - no working directory options def self.bare(git_dir, opts = {}) default = {:repository => File.expand_path(git_dir)} git_options =...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/repository.rb
Ruby
mit
45
master
2,102
module GitRuby class Repository < Path # initialize a git repository def self.init(dir, bare = false) puts 'init' + dir FileUtils.mkdir_p(dir) if !File.exists?(dir) FileUtils.cd(dir) do if(File.exists?('objects')) return false # already initialized ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/object.rb
Ruby
mit
45
master
5,876
module GitRuby class GitRubyTagNameDoesNotExist< StandardError end # represents a git object class Object class AbstractObject attr_accessor :objectish, :size, :type, :mode @base = nil @contents = nil @size = nil @sha = nil def initialize(base, obj...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/remote.rb
Ruby
mit
45
master
751
module GitRuby class Remote < Path attr_accessor :name, :url, :fetch_opts @base = nil def initialize(base, name) @base = base config = @base.lib.config_remote(name) @name = name @url = config['url'] @fetch_opts = config['fetch'] end def remove ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/path.rb
Ruby
mit
45
master
458
module GitRuby class Path attr_accessor :path def initialize(path, check_path = true) if !check_path || File.exists?(path) @path = File.expand_path(path) else raise ArgumentError, "path does not exist", File.expand_path(path) end end def readable? ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/repository.rb
Ruby
mit
45
master
6,812
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # require 'git-ruby/raw/internal/object' require 'git-ruby/raw/internal/pack' require 'git-ruby/raw/internal/...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/object.rb
Ruby
mit
45
master
6,951
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # require 'digest/sha1' module GitRuby module Raw # class for author/committer/tagger lines class Use...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/internal/mmap.rb
Ruby
mit
45
master
1,176
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # begin require 'mmap' rescue LoadError module GitRuby module Raw module Internal class Mmap...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/internal/pack.rb
Ruby
mit
45
master
7,878
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # require 'zlib' require 'git-ruby/raw/internal/object' require 'git-ruby/raw/internal/mmap' module GitRuby ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/internal/loose.rb
Ruby
mit
45
master
4,284
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # require 'zlib' require 'digest/sha1' require 'git-ruby/raw/internal/object' module GitRuby module Raw ...
github
schacon/git-ruby
https://github.com/schacon/git-ruby
lib/git-ruby/raw/internal/object.rb
Ruby
mit
45
master
744
# # converted from the gitrb project # # authors: # Matthias Lederhofer <matled@gmx.net> # Simon 'corecode' Schubert <corecode@fs.ei.tum.de> # # provides native ruby access to git objects and pack files # require 'digest/sha1' module GitRuby module Raw module Internal OBJ_NONE = 0 OBJ_COMMI...
github
binance/binance-connector-ruby
https://github.com/binance/binance-connector-ruby
Rakefile
Ruby
mit
45
master
247
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec desc 'Release a new gem version' task :release do sh('gem bump --file lib/binance/version.rb') end