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
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/test_search_mode.rb
Ruby
mit
20
master
7,895
# frozen_string_literal: true require "test_helper" class TestSearchMode < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello world" @buffer.lines[1] = "foo bar baz" @buffer.lines[2] = "hello again" @window = Mui::Window.new(@buffer) @mode_manager = MockModeManager....
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/test_normal_mode.rb
Ruby
mit
20
master
26,789
# frozen_string_literal: true require "test_helper" class TestKeyHandlerNormalMode < Minitest::Test class TestBasicMovement < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello" @buffer.insert_line(1, "world") @window = Mui::Window.new(@buffer) @mode_manag...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/operators/test_change_operator.rb
Ruby
mit
20
master
6,492
# frozen_string_literal: true require "test_helper" class TestChangeOperator < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello world" @window = Mui::Window.new(@buffer) @register = Mui::Register.new @undo_manager = Mui::UndoManager.new @operator = Mui::KeyHandler...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/operators/test_base_operator.rb
Ruby
mit
20
master
7,551
# frozen_string_literal: true require "test_helper" class TestBaseOperator < Minitest::Test # Concrete subclass for testing BaseOperator class TestOperator < Mui::KeyHandler::Operators::BaseOperator def handle_pending(_char, pending_register: nil) # rubocop:disable Lint/UnusedMethodArgument :done en...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/operators/test_yank_operator.rb
Ruby
mit
20
master
6,157
# frozen_string_literal: true require "test_helper" class TestYankOperator < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello world" @window = Mui::Window.new(@buffer) @register = Mui::Register.new @operator = Mui::KeyHandler::Operators::YankOperator.new( buffer...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/operators/test_paste_operator.rb
Ruby
mit
20
master
6,835
# frozen_string_literal: true require "test_helper" class TestPasteOperator < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello world" @window = Mui::Window.new(@buffer) @register = Mui::Register.new @operator = Mui::KeyHandler::Operators::PasteOperator.new( buff...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/operators/test_delete_operator.rb
Ruby
mit
20
master
6,457
# frozen_string_literal: true require "test_helper" class TestDeleteOperator < Minitest::Test def setup @buffer = Mui::Buffer.new @buffer.lines[0] = "hello world" @window = Mui::Window.new(@buffer) @register = Mui::Register.new @undo_manager = Mui::UndoManager.new @operator = Mui::KeyHandler...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/key_handler/motions/test_motion_handler.rb
Ruby
mit
20
master
3,583
# frozen_string_literal: true require "test_helper" class TestMotionHandler < Minitest::Test # Test class that includes the module for isolated testing class TestHandler < Mui::KeyHandler::Base include Mui::KeyHandler::Motions::MotionHandler def result(mode: nil, message: nil, quit: false) Mui::Han...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/editor/test_normal_mode.rb
Ruby
mit
20
master
5,763
# frozen_string_literal: true require "test_helper" class TestEditorNormalMode < Minitest::Test class TestCursorMovement < Minitest::Test include MuiTestHelper def setup @editor = create_test_editor @editor.mode = Mui::Mode::NORMAL clear_key_sequence end def teardown clear_...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/editor/test_execute_command.rb
Ruby
mit
20
master
3,406
# frozen_string_literal: true require "test_helper" require "tempfile" class TestEditorExecuteCommand < Minitest::Test class TestQuit < Minitest::Test include MuiTestHelper def setup @editor = create_test_editor clear_key_sequence end def teardown clear_key_sequence end ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/editor/test_command_mode.rb
Ruby
mit
20
master
5,554
# frozen_string_literal: true require "test_helper" class TestEditorCommandMode < Minitest::Test class TestEscape < Minitest::Test include MuiTestHelper def setup @editor = create_test_editor @editor.mode = Mui::Mode::COMMAND clear_key_sequence end def teardown clear_key_se...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/mui/editor/test_insert_mode.rb
Ruby
mit
20
master
8,436
# frozen_string_literal: true require "test_helper" class TestEditorInsertMode < Minitest::Test class TestEscape < Minitest::Test include MuiTestHelper def setup @editor = create_test_editor @editor.mode = Mui::Mode::INSERT clear_key_sequence end def teardown clear_key_sequ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_vim_operations.rb
Ruby
mit
20
master
14,529
# frozen_string_literal: true require_relative "test_helper" class TestE2EVimOperations < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_vim_navigation_hjkl # Scenario: Cursor movement with hjkl runner = ScriptRunner.ne...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_undo_redo.rb
Ruby
mit
20
master
11,200
# frozen_string_literal: true require_relative "test_helper" class TestE2EUndoRedo < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end # Basic undo (u) def test_u_undoes_dd runner = ScriptRunner.new runner .type("i") ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_tab_page.rb
Ruby
mit
20
master
9,926
# frozen_string_literal: true require_relative "test_helper" class TestE2ETabPage < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end # Tab creation commands def test_tabnew_creates_new_tab runner = ScriptRunner.new runner ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_file_editing.rb
Ruby
mit
20
master
6,398
# frozen_string_literal: true require_relative "test_helper" require "tempfile" class TestE2EFileEditing < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_basic_file_editing # Scenario: Open existing file -> Edit -> Save ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_command_completion.rb
Ruby
mit
20
master
4,594
# frozen_string_literal: true require_relative "test_helper" class TestCommandCompletion < Minitest::Test def setup Mui.reset_config! end class TestPluginCommandCompletion < TestCommandCompletion def test_plugin_command_appears_in_completion runner = ScriptRunner.new # Register plugin comm...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_tty_command.rb
Ruby
mit
20
master
2,109
# frozen_string_literal: true require_relative "test_helper" class TestTtyCommand < Minitest::Test def setup Mui.reset_config! end class TestCommandContextTty < TestTtyCommand def test_run_tty_command_return_hash runner = ScriptRunner.new editor = runner.editor adapter = editor.instan...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_floating_window_redraw.rb
Ruby
mit
20
master
5,065
# frozen_string_literal: true require_relative "test_helper" class TestE2EPopupRedraw < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end end class TestE2EFloatingWindowRedraw < TestE2EPopupRedraw def test_floating_window_sets_needs_clear_...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_japanese_input.rb
Ruby
mit
20
master
7,381
# frozen_string_literal: true require_relative "test_helper" require "tempfile" class TestE2EJapaneseInput < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_insert_japanese_text runner = ScriptRunner.new runner .t...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_named_registers.rb
Ruby
mit
20
master
8,410
# frozen_string_literal: true require_relative "test_helper" class TestE2ENamedRegisters < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end # Named registers ("a - "z) def test_quote_a_yy_yanks_to_named_register_a runner = ScriptRu...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_window_split.rb
Ruby
mit
20
master
4,857
# frozen_string_literal: true require_relative "test_helper" class TestE2EWindowSplit < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_ctrl_w_s_splits_window_horizontally runner = ScriptRunner.new runner .type("i...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_helper.rb
Ruby
mit
20
master
5,450
# frozen_string_literal: true require_relative "../test_helper" # ScriptRunner class for E2E tests # Allows writing test scenarios in Vim notation class ScriptRunner include MuiTestHelper attr_reader :editor, :log def initialize(file_path = nil) # Reset global register to ensure test isolation Mui.res...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_shell_command.rb
Ruby
mit
20
master
6,661
# frozen_string_literal: true require_relative "test_helper" class TestShellCommand < Minitest::Test class TestBasicShellCommand < Minitest::Test def test_shell_command_returns_running_message runner = ScriptRunner.new runner.type(":!echo hello<Enter>") runner.assert_mode(Mui::Mode::NORMAL) ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_visual_mode.rb
Ruby
mit
20
master
13,195
# frozen_string_literal: true require_relative "test_helper" class TestE2EVisualMode < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_v_enters_visual_mode runner = ScriptRunner.new runner .type("iHello World<Esc>...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_insert_completion.rb
Ruby
mit
20
master
8,065
# frozen_string_literal: true require_relative "test_helper" class TestE2EInsertCompletion < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end # Helper to check completion state def assert_completion_active(runner, expected) actual =...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_motion.rb
Ruby
mit
20
master
6,715
# frozen_string_literal: true require_relative "test_helper" class TestE2EMotion < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_word_forward_w runner = ScriptRunner.new runner .type("i") .type("hello worl...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_multi_key_sequence.rb
Ruby
mit
20
master
8,652
# frozen_string_literal: true require_relative "test_helper" class TestMultiKeySequence < Minitest::Test class TestLeaderKeySequence < TestMultiKeySequence def test_leader_key_sequence_executes_handler runner = ScriptRunner.new executed = false # Register a keymap with leader key (default is ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_search.rb
Ruby
mit
20
master
9,258
# frozen_string_literal: true require_relative "test_helper" require "tempfile" class TestE2ESearch < Minitest::Test include MuiTestHelper def setup clear_key_sequence end def teardown clear_key_sequence end def test_search_forward_basic # Scenario: Search for pattern and move to match ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_job_integration.rb
Ruby
mit
20
master
7,215
# frozen_string_literal: true require_relative "test_helper" class TestJobIntegration < Minitest::Test def test_job_manager_exists_in_editor runner = ScriptRunner.new editor = runner.editor assert_instance_of Mui::JobManager, editor.job_manager end def test_async_job_completes_during_polling r...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_command_history.rb
Ruby
mit
20
master
5,820
# frozen_string_literal: true require_relative "test_helper" # Helper module to clear history before each test module ClearHistorySetup def setup super if defined?(super) history_file = File.expand_path("~/.mui_history") FileUtils.rm_f(history_file) end end class TestCommandHistory < Minitest::Test ...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_interactive_command.rb
Ruby
mit
20
master
4,844
# frozen_string_literal: true require_relative "test_helper" class TestInteractiveCommand < Minitest::Test def setup Mui.reset_config! end class TestSuspendUi < TestInteractiveCommand def test_suspend_is_called_during_suspend_ui runner = ScriptRunner.new editor = runner.editor adapter...
github
S-H-GAMELINKS/mui
https://github.com/S-H-GAMELINKS/mui
test/e2e/test_clipboard.rb
Ruby
mit
20
master
5,377
# frozen_string_literal: true require_relative "test_helper" class TestE2EClipboard < Minitest::Test include MuiTestHelper def setup clear_key_sequence Clipboard.clear end def teardown clear_key_sequence Mui.config.set(:clipboard, nil) Clipboard.clear end # Helper to create runner w...
github
nathankot/ledger-get-prices
https://github.com/nathankot/ledger-get-prices
ledger_get_prices.gemspec
Ruby
mit
19
master
911
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ledger_get_prices/version' Gem::Specification.new do |spec| spec.name = "ledger_get_prices" spec.version = LedgerGetPrices::VERSION spec.authors = ["Nathan Kot"] spec...
github
nathankot/ledger-get-prices
https://github.com/nathankot/ledger-get-prices
lib/ledger_get_prices.rb
Ruby
mit
19
master
5,214
require "ledger_get_prices/version" require 'date' require 'open-uri' require 'yahoo-finance' module LedgerGetPrices # = Synopsis # # Tool that uses Yahoo finance to intelligently generate # a ledger price database based on your current ledger # commodities and time period. # # Ensure that you have set ...
github
HurricaneJames/rex
https://github.com/HurricaneJames/rex
Gemfile
Ruby
mit
19
master
388
source 'https://rubygems.org' gem 'rails', '4.1.8' gem 'sqlite3' gem 'sass-rails', '~> 4.0.3' gem 'coffee-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0' gem 'therubyracer', platforms: :ruby gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails' gem 'browserify-rails', '~>0.5' gem 'jquery-rails' gem 'jbuil...
github
HurricaneJames/rex
https://github.com/HurricaneJames/rex
config/application.rb
Ruby
mit
19
master
600
require File.expand_path('../boot', __FILE__) require "active_model/railtie" require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "sprockets/railtie" Bundler.require(*Rails.groups) module Rex class Application < Rails::Application...
github
HurricaneJames/rex
https://github.com/HurricaneJames/rex
config/environments/development.rb
Ruby
mit
19
master
1,141
Rails.application.configure do config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. ...
github
mhuggins/dominatrix
https://github.com/mhuggins/dominatrix
dominatrix.gemspec
Ruby
mit
19
master
1,189
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'dominatrix/version' Gem::Specification.new do |spec| spec.name = 'dominatrix' spec.version = Dominatrix::VERSION spec.authors = ['Matt Huggins'] spec.email = ...
github
mhuggins/dominatrix
https://github.com/mhuggins/dominatrix
lib/dominatrix.rb
Ruby
mit
19
master
1,783
require 'set' require 'uri' require 'dominatrix/version' class Dominatrix class NotFoundError < StandardError; end attr_reader :extensions def initialize(extensions = self.class.default_extensions) warn '[DEPRECATION] Dominatrix has been renamed to Domainator and will no longer be supported. Please switch ...
github
mhuggins/dominatrix
https://github.com/mhuggins/dominatrix
spec/spec_helper.rb
Ruby
mit
19
master
594
require 'dominatrix' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[File.expand_path('spec/support/**/*.rb')].each(&method(:require)) RSpec.configure do |config| # Run specs in random order to surface order dependencies. If you find an # order...
github
mhuggins/dominatrix
https://github.com/mhuggins/dominatrix
spec/dominatrix_spec.rb
Ruby
mit
19
master
2,717
# encoding: UTF-8 require 'spec_helper' RSpec.describe Dominatrix do describe '#parse' do shared_examples_for 'a valid URL' do |domain| it 'returns the domain when given a string' do expect(subject.parse(url)).to eq domain end it 'returns the domain when given a URI' do uri = U...
github
DiogoAndre/motion-reveal
https://github.com/DiogoAndre/motion-reveal
motion-reveal.gemspec
Ruby
mit
19
master
465
Gem::Specification.new do |gem| gem.authors = ["Diogo"] gem.email = 'diogo@regattapix.com' gem.name = 'motion-reveal' gem.summary = "Use Reveal in RubyMotion apps" gem.description = "Just a simple gem to add the Reval framework to your RubyMotion project." gem.version = '2.0.0' ge...
github
DiogoAndre/motion-reveal
https://github.com/DiogoAndre/motion-reveal
lib/motion-reveal.rb
Ruby
mit
19
master
956
unless defined?(Motion::Project::Config) raise "This file must be required within a RubyMotion project Rakefile." end Motion::Project::App.setup do |app| app.development do if File.exist? ('/Applications/Reveal.app') # Fixes build issues with Reveal 1.5 app.libs += ['/usr/lib/libz.dylib', '/usr/lib...
github
matthijsgroen/konacha-chai-matchers
https://github.com/matthijsgroen/konacha-chai-matchers
konacha-chai-matchers.gemspec
Ruby
mit
19
master
787
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "konacha-chai-matchers/version" Gem::Specification.new do |s| s.name = "konacha-chai-matchers" s.version = Konacha::Chai::Matchers::VERSION s.authors = ["Matthijs Groen"] s.email = ["matthijs.groen@gmail.com"] ...
github
matthijsgroen/konacha-chai-matchers
https://github.com/matthijsgroen/konacha-chai-matchers
tasks/update.rb
Ruby
mit
19
master
242
require 'rails' require File.join(File.expand_path(File.dirname(__FILE__)), '../lib/konacha-chai-matchers') desc 'updates all submodules' task :update do collector = Konacha::Chai::Matchers::Collector.new collector.update_libraries end
github
matthijsgroen/konacha-chai-matchers
https://github.com/matthijsgroen/konacha-chai-matchers
lib/konacha-chai-matchers.rb
Ruby
mit
19
master
312
require "konacha-chai-matchers/version" require 'pathname' require 'json' module Konacha module Chai module Matchers class Engine < ::Rails::Engine end autoload :Collector, 'konacha-chai-matchers/collector' autoload :Library, 'konacha-chai-matchers/library' end end end
github
matthijsgroen/konacha-chai-matchers
https://github.com/matthijsgroen/konacha-chai-matchers
lib/konacha-chai-matchers/collector.rb
Ruby
mit
19
master
1,793
require 'yaml' module Konacha module Chai module Matchers class Collector def update_libraries `git submodule init` `git submodule update` modules = collect_libraries modules.each(&:update) modules.each(&:vendor) File.open('VERSIONS', ...
github
matthijsgroen/konacha-chai-matchers
https://github.com/matthijsgroen/konacha-chai-matchers
lib/konacha-chai-matchers/library.rb
Ruby
mit
19
master
2,361
module Konacha module Chai module Matchers class Library attr_reader :data, :name def initialize(data) @data = data @name = data[:name] @commit = data[:commit] end def to_s "#{@data[:name]} => #{@data[:tag]}" end def...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
rails_template.rb
Ruby
mit
19
develop
13,595
## # Application Generator Template # Usage: rails new APP_NAME -T -m https://raw.github.com/lab2023/rails-template/master/rails_template.rb # # If you are customizing this template, you can use any methods provided by Thor::Actions # http://rubydoc.info/github/wycats/thor/master/Thor/Actions # and Rails::Generators::...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/Guardfile
Ruby
mit
19
develop
1,076
guard 'rspec' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } # Rails example watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^app/(.*)(\.erb|\.haml)$}) { |...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/spec/spec_helper.rb
Ruby
mit
19
develop
1,336
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rspec' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/s...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/config/locales/i18n/pluralization.rb
Ruby
mit
19
develop
486
# For Russian # :one = 1, 21, 31, 41, 51, 61... # :few = 2-4, 22-24, 32-34... # :many = 0, 5-20, 25-30, 35-40... # :other = 1.31, 2.31, 5.31... { :ru => { :'i18n' => { :plural => { :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 1...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/lib/templates/rails/strong_parameters_controller/controller.rb
Ruby
mit
19
develop
1,648
# -*- encoding : utf-8 -*- <% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController <% unless options[:singleton] -%> def index @search = <%= class_name %>.search(params[:q]) @<%= table_name %> = @search.result(:distinct => true).paginate(:page => params[:page]) re...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/lib/templates/rails/responders_controller/controller.rb
Ruby
mit
19
develop
1,392
# -*- encoding : utf-8 -*- <% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController <% unless options[:singleton] -%> def index @search = <%= class_name %>.search(params[:q]) @<%= table_name %> = @search.result(:distinct => true).paginate(:page => params[:page]) ...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/lib/tasks/dev.rake
Ruby
mit
19
develop
645
# encoding: utf-8 namespace :dev do desc "Setup db. Drop, create, migrate, dev:seed" task :setup => :environment do Rake::Task['db:drop'].execute Rake::Task['db:create'].execute Rake::Task['db:migrate'].execute Rake::Task['db:seed'].execute Rake::Task['dev:seed'].execute end desc "Setup se...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/app/controllers/application_controller.rb
Ruby
mit
19
develop
691
# encoding: utf-8 require "application_responder" class ApplicationController < ActionController::Base helper :all self.responder = ApplicationResponder respond_to :html, :json, :xml WillPaginate.per_page = 10 before_filter :authenticate_user! protect_from_forgery rescue_from CanCan::AccessDenied do |e...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/app/controllers/admins/registrations_controller.rb
Ruby
mit
19
develop
319
class Admins::RegistrationsController < Devise::RegistrationsController def new redirect_to admins_dashboard_index_path end def create redirect_to admins_dashboard_index_path end def update super end protected def after_update_path_for(resource) admins_dashboard_index_path end end
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/app/controllers/admins/application_controller.rb
Ruby
mit
19
develop
292
# encoding: utf-8 require "application_responder" class Admins::ApplicationController < ActionController::Base helper :all self.responder = ApplicationResponder respond_to :html, :json, :xml WillPaginate.per_page = 10 before_filter :authenticate_admin! protect_from_forgery end
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/app/models/admin.rb
Ruby
mit
19
develop
414
class Admin < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :timeoutable, :registerable, :validatable # Setup accessible (or protected) attributes for your model ...
github
lab2023/rails-template
https://github.com/lab2023/rails-template
files/app/models/user.rb
Ruby
mit
19
develop
652
class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :role_id EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i validates :email,...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
Gemfile
Ruby
mit
19
master
368
source "http://rubygems.org" # Add dependencies required to use your gem here. # Example: # gem "activesupport", ">= 2.3.5" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do gem "rspec", "~> 2.3.0" gem "yard", "~> 0.6.0" gem "bundl...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
Rakefile
Ruby
mit
19
master
1,574
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' require './lib/ripper-plus/version' Jeweler::Tasks.new do...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
spec/transformer_spec.rb
Ruby
mit
19
master
42,264
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe RipperPlus::Transformer do describe 'vcall detection' do it 'should transform a simple vcall in a method' do input_tree = [:program, [[:def, [:@ident, "foo", [1, 4]], [:paren, [:params, [[:@ide...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
spec/spec_helper.rb
Ruby
mit
19
master
824
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'ripper-plus' # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| requir...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
spec/scope_stack_spec.rb
Ruby
mit
19
master
1,351
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe RipperPlus::ScopeStack do before do @stack = RipperPlus::ScopeStack.new end it 'can see variables added at top level' do @stack.should_not have_variable(:hello) @stack.add_variable :hello @stack.should have_variable(:he...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
lib/ripper-plus.rb
Ruby
mit
19
master
270
if RUBY_VERSION < "1.9" raise 'ripper-plus requires Ruby 1.9+' end require 'ripper' $:.unshift(File.expand_path(File.dirname(__FILE__))) require 'ripper-plus/version' require 'ripper-plus/ripper-plus' require 'ripper-plus/scope_stack' require 'ripper-plus/transformer'
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
lib/ripper-plus/ripper-plus.rb
Ruby
mit
19
master
523
# Top-level module for Ripper Plus. Provides global methods for # getting a RipperPlus AST for a given input program. module RipperPlus DEFAULT_OPTS = {:in_place => false} # Parses the given Ruby code into a RipperPlus AST. def self.sexp(text, opts={}) for_ripper_ast(Ripper.sexp(text), opts.merge(:in_place =>...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
lib/ripper-plus/version.rb
Ruby
mit
19
master
256
module RipperPlus module Version MAJOR = 1 MINOR = 3 PATCH = 0 BUILD = '' if BUILD.empty? STRING = [MAJOR, MINOR, PATCH].compact.join('.') else STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.') end end end
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
lib/ripper-plus/scope_stack.rb
Ruby
mit
19
master
1,692
module RipperPlus # internal class that manages the current scopes. class ScopeStack SCOPE_BLOCKER_9000 = :scope_block def initialize # simplifies algorithm to have the scope blocker be the stack base @stack = [SCOPE_BLOCKER_9000, Set.new] @in_method = false end def in_method? ...
github
michaeledgar/ripper-plus
https://github.com/michaeledgar/ripper-plus
lib/ripper-plus/transformer.rb
Ruby
mit
19
master
10,425
require 'set' module RipperPlus class SyntaxError < StandardError; end class LHSError < SyntaxError; end class DynamicConstantError < SyntaxError; end class InvalidArgumentError < SyntaxError; end class DuplicateArgumentError < SyntaxError; end # Transforms a 1.9.2 Ripper AST into a RipperPlus AST. The only...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
swarm/swarm-demo-frontend/app.rb
Ruby
mit
19
master
1,189
require 'sinatra' require 'erb' require 'pg' set :bind, '0.0.0.0' set :port, 8080 AppState = {} AppState[:total_requests] = 0 get '/' do AppState[:total_requests] += 1 manager = RequestManager.new manager.store_request(request.ip, '/', Socket.gethostname, Time.now) number_of_requests = ENV["NUMBER_OF_REQUE...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
demo_web_app/app.rb
Ruby
mit
19
master
600
require 'sinatra' require 'sinatra/activerecord' require 'sinatra/activerecord/rake' require 'erb' require './models/request' set :database, { adapter: 'postgresql', encoding: 'unicode', pool: 2, host: ENV['POSTGRES_HOST'], database: ENV['POSTGRES_DB'], username: ENV['POSTGRES_USER'], password: ENV['POST...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
demo_web_app/db/schema.rb
Ruby
mit
19
master
1,036
# 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. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
demo_web_app/db/migrate/20171128082428_create_requests.rb
Ruby
mit
19
master
207
class CreateRequests < ActiveRecord::Migration[5.1] def change create_table :requests do |t| t.timestamp :timestamp t.string :ip t.string :host t.string :path end end end
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
developing/testing_applications/app/client.rb
Ruby
mit
19
master
359
require './app/anagram_checker.rb' checker = AnagramChecker.new while (true) print "Please input the first word: " a = gets.chomp print "Please enter the second word: " b = gets.chomp puts "Comparing words..." if checker.anagram?(a, b) puts "#{a}/#{b} is a valid anagram" else puts "#{a}/#{b} is...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
developing/testing_applications/spec/anagram_checker_spec.rb
Ruby
mit
19
master
645
require 'spec_helper' require './app/anagram_checker' RSpec.describe AnagramChecker do it 'identifies anagrams' do checker = AnagramChecker.new expect(checker.anagram?('julian', 'nailuj')).to be_truthy expect(checker.anagram?('julian', 'julian')).to be_truthy expect(checker.anagram?('julian', 'uijnla...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
developing/examples/webapp/ruby/app.rb
Ruby
mit
19
master
1,025
require 'sinatra' require 'pg' set :bind, '0.0.0.0' set :port, 9494 get '/' do conn = PG::Connection.open(ENV['POSTGRES_HOST'], 5432, '', '', ENV['POSTGRES_DB'], ENV['POSTGRES_USER'], ENV['POSTGRES_PASSWORD']) sql = "INSERT INTO requests (ip, path, host, requested_at) VALUES ($1, $2,...
github
learndocker/docker_examples
https://github.com/learndocker/docker_examples
developing/pid_files/app.rb
Ruby
mit
19
master
535
def pidfile '/run/app.pid' end def write_pid puts "Writing my PID (#{Process.pid}) to #{pidfile}" File.open(pidfile, "w") do |f| f.write Process.pid end end def running? return false unless File.exists?(pidfile) pid = File.read(pidfile) Process.kill(0, pid.to_i) pid rescue Errno::ESRCH false end...
github
noff/snek
https://github.com/noff/snek
Gemfile
Ruby
mit
19
master
2,374
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.3.1' gem 'coffee-script', '~> 2.4', '>= 2.4.1' gem 'activeadmin' gem 'aasm' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.1.0', require: false gem 'bootstrap', '~> 4.1.3' gem...
github
noff/snek
https://github.com/noff/snek
Capfile
Ruby
mit
19
master
1,153
# Load DSL and set up stages require "capistrano/setup" # Include default deployment tasks require "capistrano/deploy" # Load the SCM plugin appropriate to your project: # # require "capistrano/scm/hg" # install_plugin Capistrano::SCM::Hg # or # require "capistrano/scm/svn" # install_plugin Capistrano::SCM::Svn # or ...
github
noff/snek
https://github.com/noff/snek
spec/spec_helper.rb
Ruby
mit
19
master
4,762
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
github
noff/snek
https://github.com/noff/snek
spec/rails_helper.rb
Ruby
mit
19
master
2,723
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rail...
github
noff/snek
https://github.com/noff/snek
spec/models/arena_spec.rb
Ruby
mit
19
master
225
require 'rails_helper' RSpec.describe Arena, type: :model do let!(:arena) { create(:arena) } context 'initial setup' do it 'has default arena' do expect(arena.area).to eq Arena.default_arena end end end
github
noff/snek
https://github.com/noff/snek
spec/models/snek_spec.rb
Ruby
mit
19
master
1,287
require 'rails_helper' RSpec.describe Snek, type: :model do let!(:user) { create(:user) } let!(:snek) { create(:snek, user_id: user.id) } context 'creation' do it 'saves new snek with default rules' do expect(snek.rules).to eq 9.times.map { [ [ ['default', 'and'], ['default', 'and'], ['default', 'and...
github
noff/snek
https://github.com/noff/snek
spec/models/battle_spec.rb
Ruby
mit
19
master
1,823
require 'rails_helper' RSpec.describe Battle, type: :model do let!(:arena) { create(:arena) } let!(:user) { create(:user) } let!(:snek) { create(:snek, user: user) } context 'check state machine' do it 'creates battle as draft' do expect(Battle.new.draft?).to be_truthy expect(Battle.new.aasm_...
github
noff/snek
https://github.com/noff/snek
spec/controllers/ratings_controller_spec.rb
Ruby
mit
19
master
376
require 'rails_helper' RSpec.describe RatingsController, type: :controller do describe "GET #top" do it "returns http success" do get :top expect(response).to have_http_status(:success) end end describe "GET #national" do it "returns http success" do get :national expect(res...
github
noff/snek
https://github.com/noff/snek
spec/helpers/paid_subscriptions_helper_spec.rb
Ruby
mit
19
master
466
require 'rails_helper' # Specs in this file have access to a helper object that includes # the PaidSubscriptionsHelper. For example: # # describe PaidSubscriptionsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this tha...
github
noff/snek
https://github.com/noff/snek
spec/helpers/ratings_helper_spec.rb
Ruby
mit
19
master
436
require 'rails_helper' # Specs in this file have access to a helper object that includes # the RatingsHelper. For example: # # describe RatingsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # en...
github
noff/snek
https://github.com/noff/snek
spec/helpers/billing_helper_spec.rb
Ruby
mit
19
master
436
require 'rails_helper' # Specs in this file have access to a helper object that includes # the BillingHelper. For example: # # describe BillingHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # en...
github
noff/snek
https://github.com/noff/snek
spec/helpers/feeds_helper_spec.rb
Ruby
mit
19
master
430
require 'rails_helper' # Specs in this file have access to a helper object that includes # the FeedsHelper. For example: # # describe FeedsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # ...
github
noff/snek
https://github.com/noff/snek
db/schema.rb
Ruby
mit
19
master
7,830
# 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. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
noff/snek
https://github.com/noff/snek
db/seeds.rb
Ruby
mit
19
master
961
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
github
noff/snek
https://github.com/noff/snek
db/migrate/20180517035941_create_battle_rounds.rb
Ruby
mit
19
master
244
class CreateBattleRounds < ActiveRecord::Migration[5.2] def change create_table :battle_rounds do |t| t.integer :battle_id t.integer :round_number t.jsonb :arena t.jsonb :sneks t.timestamps end end end
github
noff/snek
https://github.com/noff/snek
db/migrate/20180613062840_create_daily_ratings.rb
Ruby
mit
19
master
356
class CreateDailyRatings < ActiveRecord::Migration[5.2] def change create_table :daily_ratings do |t| t.integer :snek_id t.date :date t.integer :position t.timestamps end add_index :daily_ratings, [:date] add_index :daily_ratings, [:snek_id] add_index :daily_ratings, [:snek...
github
noff/snek
https://github.com/noff/snek
db/migrate/20180804191820_add_efficiency_daily_rating.rb
Ruby
mit
19
master
340
class AddEfficiencyDailyRating < ActiveRecord::Migration[5.2] def change rename_column :daily_ratings, :position, :activity_position add_column :daily_ratings, :efficiency_position, :integer rename_column :daily_ratings, :score, :activity_score add_column :daily_ratings, :efficiency_score, :integer, d...
github
noff/snek
https://github.com/noff/snek
db/migrate/20180606094557_add_pro_flag_to_snek.rb
Ruby
mit
19
master
206
class AddProFlagToSnek < ActiveRecord::Migration[5.2] def change add_column :sneks, :pro, :boolean, default: false change_column :paid_subscriptions, :renewable, :boolean, default: true end end
github
noff/snek
https://github.com/noff/snek
db/migrate/20180423213825_devise_create_admin_users.rb
Ruby
mit
19
master
1,426
# frozen_string_literal: true class DeviseCreateAdminUsers < ActiveRecord::Migration[5.2] def change create_table :admin_users do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable ...
github
noff/snek
https://github.com/noff/snek
db/migrate/20180719195509_create_saved_battles.rb
Ruby
mit
19
master
265
class CreateSavedBattles < ActiveRecord::Migration[5.2] def change create_table :saved_battles do |t| t.integer :battle_id t.integer :user_id t.timestamps end add_index :saved_battles, [:user_id, :battle_id], unique: true end end
github
noff/snek
https://github.com/noff/snek
db/migrate/20180508121404_create_snek_battles.rb
Ruby
mit
19
master
231
class CreateSnekBattles < ActiveRecord::Migration[5.2] def change create_table :snek_battles do |t| t.integer :snek_id t.integer :battle_id t.integer :score, default: 0 t.timestamps end end end