repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
earlino727/byebug | test/commands/var_test.rb | require 'test_helper'
module Byebug
#
# Tests variable evaluation.
#
class VarTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: #
3: # Toy class to test variable evaluation.
4: #
5: class #{example_class}
6: ... |
earlino727/byebug | test/post_mortem_test.rb | <gh_stars>1-10
require 'test_helper'
module Byebug
#
# Tests post mortem functionality.
#
class PostMortemTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: #
3: # Toy class to test post mortem functionality
4: #
5: clas... |
earlino727/byebug | test/commands/restart_test.rb | <reponame>earlino727/byebug
require 'test_helper'
require 'rbconfig'
module Byebug
#
# Tests restarting functionality.
#
class RestartTest < TestCase
def test_restart_without_arguments_in_standalone_mode
with_mode(:standalone) do
with_command_line(example_path, '1') do
assert_restar... |
earlino727/byebug | test/commands/list_test.rb | <gh_stars>1-10
require 'test_helper'
module Byebug
#
# Tests for listing source files.
#
class ListTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: #
3: # Toy class to test breakpoints
4: #
5: class #{example_class}
... |
earlino727/byebug | script/minitest_runner.rb | #!/usr/bin/env ruby
$LOAD_PATH << File.expand_path(File.join('..', 'lib'), __dir__)
$LOAD_PATH << File.expand_path(File.join('..', 'test'), __dir__)
require 'minitest'
#
# Helper class to aid running minitest
#
class MinitestRunner
def initialize
@test_suites = extract_from_argv { |cmd_arg| test_suite?(cmd_arg... |
earlino727/byebug | test/support/coverage.rb | #
# Starts code coverage tracking.
#
def start_coverage_tracking
require 'simplecov'
SimpleCov.add_filter 'test'
SimpleCov.start
end
start_coverage_tracking if ENV['NOCOV'].nil?
|
earlino727/byebug | test/support/temporary.rb | <gh_stars>1-10
module Byebug
#
# Some custom matches for changing stuff temporarily during tests
#
module TestTemporary
#
# Yields a block using temporary values for command line program name and
# command line arguments.
#
# @param program_name [String] New value for the program name
# ... |
earlino727/byebug | test/test_helper.rb | require 'support/coverage'
require 'support/test_case'
Byebug::TestCase.before_suite
|
earlino727/byebug | test/support/utils.rb | <filename>test/support/utils.rb
require 'support/matchers'
require 'support/temporary'
module Byebug
#
# Misc tools for the test suite
#
module TestUtils
include TestMatchers
include TestTemporary
#
# Adds commands to the input queue, so they will be later retrieved by
# Processor, i.e., i... |
earlino727/byebug | test/commands/disable_test.rb | require 'test_helper'
module Byebug
#
# Tests disabling breakpoints.
#
class DisableTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: #
3: # Toy class to test breakpoints
4: #
5: class #{example_class}
6: ... |
Innarticles/spree_simple_weight_calculator | lib/spree_simple_weight_calculator.rb | <filename>lib/spree_simple_weight_calculator.rb
require 'spree_core'
require 'spree_simple_weight_calculator/engine'
|
Innarticles/spree_simple_weight_calculator | spec/models/spree/calculator/shipping/item_weight_spec.rb | <reponame>Innarticles/spree_simple_weight_calculator<filename>spec/models/spree/calculator/shipping/item_weight_spec.rb
require 'spec_helper'
module Spree
module Calculator::Shipping
describe ItemWeight do
options = { preferred_costs_string: "0.5:5\n1:10\n50:20\n100:50.3",
preferred_hand... |
Innarticles/spree_simple_weight_calculator | app/models/spree/variant_decorator.rb | module Spree
Variant.class_eval do
# you can add custom weight logic here
def calculator_weight
weight
end
end
end |
Innarticles/spree_simple_weight_calculator | app/models/spree/calculator/shipping/simple_weight.rb | module Spree
module Calculator::Shipping
class SimpleWeight < ShippingCalculator
preference :costs_string, :text, default: "1:5\n2:7\n5:10\n10:15\n100:50"
preference :default_weight, :decimal, default: 1
preference :max_item_size, :decimal, default: 0
preference :handling_fee, :decimal, de... |
Innarticles/spree_simple_weight_calculator | app/models/spree/calculator/shipping/item_weight.rb | <reponame>Innarticles/spree_simple_weight_calculator
module Spree
module Calculator::Shipping
class ItemWeight < SimpleWeight
preference :costs_string, :text, default: "25:7\n50:15\n100:25\n9999:45"
def self.description
Spree.t(:item_weight)
end
def compute_package(package)
... |
clampz/edurange | app/models/subnet.rb | class Subnet < ActiveRecord::Base
include Provider
include Aws
include Cidr
belongs_to :cloud
has_many :instances, dependent: :destroy
has_one :user, through: :cloud
validates :name, presence: true, uniqueness: { scope: :cloud, message: "name already taken" }
validates_presence_of :cidr_block, :cloud... |
clampz/edurange | app/controllers/instructor_controller.rb | <reponame>clampz/edurange
class InstructorController < ApplicationController
before_action :authenticate_instructor
before_action :set_student_group, only: [:student_group_destroy]
def index
@players = Player.where(user_id: current_user.id)
end
def student_group_create
@user = User.find(current_user... |
clampz/edurange | app/models/recipe.rb | <reponame>clampz/edurange
class Recipe < ActiveRecord::Base
belongs_to :scenario
has_many :role_recipes, dependent: :destroy
has_one :user, through: :scenario
validates :name, presence: true, uniqueness: { scope: :scenario, message: "Name taken" }
after_create :set_custom
after_save :update_scenario_modi... |
clampz/edurange | app/controllers/admin_controller.rb | <filename>app/controllers/admin_controller.rb
class AdminController < ApplicationController
before_action :authenticate_admin
before_action :set_student_group, only: [:student_group_destroy]
def index
@instructors = User.where role: 3
@students = User.where role: 4
end
def instructor_create
name... |
clampz/edurange | db/schema.rb | <filename>db/schema.rb
# encoding: UTF-8
# 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 i... |
clampz/edurange | app/models/scenario.rb | <reponame>clampz/edurange
class Scenario < ActiveRecord::Base
include Aws
include Provider
attr_accessor :template # For picking a template when creating a new scenario
belongs_to :user
has_many :clouds, dependent: :destroy
has_many :questions, dependent: :destroy
has_many :roles, dependent: :destroy
... |
clampz/edurange | test/integration/admin_ui_test.rb | <gh_stars>0
require 'test_helper'
class AdminUITest < ActionDispatch::IntegrationTest
test 'sign in' do
visit('/')
sign_in_form = page.all('form')[0]
assert /users\/sign_in/.match(sign_in_form['action']) != nil
end
end |
clampz/edurange | app/models/student_group.rb | <reponame>clampz/edurange
class StudentGroup < ActiveRecord::Base
belongs_to :user
has_many :student_group_users, dependent: :destroy
has_many :users, through: :student_group_users
validates :name, presence: true, uniqueness: { scope: :user, message: "Name taken" }
# before_destroy :check_if_all
# def... |
clampz/edurange | app/services/create_admin_service.rb | class CreateAdminService
def call
user = nil
if not user = User.find_by_email(Rails.application.secrets.admin_email)
user = User.new(email: Rails.application.secrets.admin_email, name: Rails.application.secrets.admin_name)
end
user.password = <PASSWORD>
user.password_confirmation = <PASSWORD>
us... |
clampz/edurange | app/models/instance_group.rb | <reponame>clampz/edurange
class InstanceGroup < ActiveRecord::Base
belongs_to :group
belongs_to :instance
has_one :user, through: :instance
has_one :scenario, through: :group
after_save :update_scenario_modified
after_destroy :update_scenario_modified
def update_scenario_modified
if self.scenario.mo... |
clampz/edurange | app/models/concerns/aws.rb | # This file contains the implementation of the AWS API calls. They are implemented
# as hooks, called dynamically by the {Provider} concern when {Scenario}, {Cloud}, {Subnet}, and {Instance} are booted.
# @see Provider#boot
require 'active_support'
module Aws
extend ActiveSupport::Concern
# #######################... |
clampz/edurange | test/models/scoring_test.rb | require 'test_helper'
class ScoringTest < ActiveSupport::TestCase
test 'text presence' do
s = scenarios(:two)
q = Question.new(order: 1, type_of: 'String', values: [{value: "foo", points: 1}], scenario_id: s.id)
q.save
assert_not q.valid?
assert_equal [:text], q.errors.keys
end
test 'type presence' do
... |
clampz/edurange | app/models/user.rb | class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
enum role: [:user, :vip, :admin, :instructor, :student]
has_... |
clampz/edurange | test/models/scenario_test.rb | <reponame>clampz/edurange
require 'test_helper'
class ScenarioTest < ActiveSupport::TestCase
test 'should only allow instructor and admin to create scenario' do
student = users(:student1)
instructor = users(:instructor1)
admin = users(:admin1)
scenario = student.scenarios.new(location: :test, name:... |
clampz/edurange | config/initializers/rails_config.rb | <reponame>clampz/edurange
Config.setup do |config|
config.const_name = "Settings"
Config.load_files(
Rails.root.join("config", "settings.yml").to_s,
Rails.root.join("config", "settings.local.yml").to_s
)
end
|
clampz/edurange | app/models/concerns/provider.rb | # This file is included in {Scenario}, {Cloud}, {Subnet} and {Instance}. Essentialy it has glue code for
# both defining methods dynamically (within concerns such as Aws that handle provider specific API calls) as well as
# routing those methods (within {#method_missing})
# Apart from defining these methods, the only o... |
clampz/edurange | app/controllers/statistics_controller.rb | class StatisticsController < ApplicationController
before_action :authenticate_admin_or_instructor
require 'rubygems'
require 'zip'
require 'tempfile'
require 'json'
def index
# view for all statistics
@statistics = []
if @user.is_admin?
@statistics = Statistic.all
else
@statist... |
clampz/edurange | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
# before_filter :authenticate_user!
AWS.config({
:access_key_id => Settings.access_key_id,
:secret_access_key => Settings.secret_access_key,
})
include Pundit
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_s... |
clampz/edurange | app/models/instance.rb | class Instance < ActiveRecord::Base
include Provider
include Aws
validates_presence_of :name, :os, :subnet
belongs_to :subnet
has_many :instance_groups, dependent: :destroy
has_many :instance_roles, dependent: :destroy
has_many :groups, through: :instance_groups, dependent: :destroy
has_many :roles, t... |
clampz/edurange | app/models/role.rb | <reponame>clampz/edurange<gh_stars>0
class Role < ActiveRecord::Base
belongs_to :scenario
has_many :role_recipes, dependent: :destroy
has_many :recipes, through: :role_recipes
has_many :instance_roles, dependent: :destroy
has_one :user, through: :scenario
serialize :packages, Array
validates :name, pres... |
clampz/edurange | lib/yml_record.rb | <filename>lib/yml_record.rb<gh_stars>0
module YmlRecord
# Returns an array of [filename, scenario name, description]
def self.yml_headers_old
output = []
Dir.foreach(Settings.app_path + "scenarios-yml/") do |filename|
next if filename == '.' or filename == '..' or filename == 'ddos.yml'
scenario... |
clampz/edurange | app/controllers/student_controller.rb | class StudentController < ApplicationController
# layout 'student'
before_action :authenticate_student
before_action :set_user
before_action :set_scenario, only: [:show, :answer_string, :answer_number, :answer_essay]
before_action :set_question, only: [:answer_string, :answer_number, :answer_essay]
before_a... |
clampz/edurange | app/models/group.rb | class Group < ActiveRecord::Base
belongs_to :scenario
has_many :instance_groups, dependent: :destroy
has_many :instances, through: :instance_groups
has_many :players, dependent: :destroy
has_one :user, through: :scenario
validates :name, presence: true, uniqueness: { scope: :scenario, message: "Name taken"... |
aznalo/Qhapaq-back | controllers/genre.rb | # ジャンル一覧
get '/genres' do
Genre.all.to_json
end
# ジャンルの詳細
get '/genre/:id' do
Genre.find_by(id: params[:id]).to_json
end
# ジャンルの作成
post '/genre' do
genre_params = JSON.parse(request.body.read)
(status 403) unless User.authentication(genre_params['userToken'])
genre = Genre.new({ name: genre_params['name'] }... |
aznalo/Qhapaq-back | db/seeds.rb | genres = ['主食', '副菜', '汁物', '甘味']
genres.each do |t|
Genre.create(name: t)
end
[
{name: '鯖の味噌煮', genre: '主食', category: '和食'},
{name: '回鍋肉', genre: '主食', category: '中華'},
{name: '白身魚のナージュ', genre: '主食', category: 'フレンチ'},
{name: 'なめこの味噌汁', genre: '汁物', category: '和食'},
{name: 'プリン', ... |
aznalo/Qhapaq-back | app.rb | require 'bundler/setup'
Bundler.require
require 'sinatra/reloader' if development?
require 'pry' if development?
require './models'
set :server, 'thin'
set :sockets, []
before do
Time.zone = 'Tokyo'
content_type :json
headers 'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => %w[G... |
aznalo/Qhapaq-back | controllers/user.rb | <reponame>aznalo/Qhapaq-back
# ユーザのログイン用
post '/user/sign_in' do
user_params = JSON.parse(request.body.read)
user = User.find_by(name: user_params['name'])
if user && user.authenticate(user_params['password'])
token = UserToken.create(
user_id: user.id,
uuid: SecureRandom.uuid,
expiration_ti... |
aznalo/Qhapaq-back | db/migrate/20190210021320_create_menus.rb | class CreateMenus < ActiveRecord::Migration[5.2]
def change
create_table :menus do |t|
t.integer :category_id, null: false
t.integer :genre_id , null: false
t.string :name, null: false
t.string :description
t.timestamps null: false
end
end
end
|
aznalo/Qhapaq-back | controllers/menu.rb | # index
get '/menus' do
Menu.all.to_json
end
# genre filter menus
get '/menus/:id' do
Genre.find_by(id: params[:id]).menus.to_json
end
#show
get '/menu/:id' do
menu = Menu.find_by(id: params[:id])
menu.attributes.merge({
ingredients: menu.ingredients,
steps: menu.steps
}).to_json
end
# create
post ... |
aznalo/Qhapaq-back | db/migrate/20190210044513_create_user_tokens.rb | <gh_stars>1-10
class CreateUserTokens < ActiveRecord::Migration[5.2]
def change
create_table :user_tokens do |t|
t.integer :user_id, null: false
t.string :uuid
t.datetime :expiration_time, null: false
t.timestamps null: false
end
end
end
|
aznalo/Qhapaq-back | db/migrate/20190210021356_create_ingredients.rb | <filename>db/migrate/20190210021356_create_ingredients.rb<gh_stars>1-10
class CreateIngredients < ActiveRecord::Migration[5.2]
def change
create_table :ingredients do |t|
t.integer :menu_id, null: false
t.string :name, null: false
t.integer :amount, null: false, default: 0
t.string :... |
aznalo/Qhapaq-back | controllers/category.rb | <filename>controllers/category.rb<gh_stars>1-10
get '/categories' do
Category.all
end
|
aznalo/Qhapaq-back | models.rb | <filename>models.rb
require 'bundler/setup'
Bundler.require
require './controllers/user'
require './controllers/genre'
require './controllers/category'
require './controllers/menu'
config = YAML.load_file('./database.yml')
ActiveRecord::Base.configurations = config
if development?
ActiveRecord::Base.establish_conne... |
hi-artem/homebrew-boringssl | bssl.rb | class Bssl < Formula
desc "BoringSSL is a fork of OpenSSL that is designed to meet Google's needs"
homepage "https://boringssl.googlesource.com/boringssl/"
url "https://boringssl.googlesource.com/boringssl/+archive/1607f54fed72c6589d560254626909a64124f091.tar.gz"
version "1607f54fed72c6589d560254626909a64124f09... |
TheClimateCorporation/coherence-2-x-swift-4 | Coherence.podspec | <filename>Coherence.podspec
#
# Be sure to run `pod lib lint Coherence.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::... |
voxpupuli/puppet-lint-classes_and_types_beginning_with_digits-check | spec/puppet-lint/plugins/classes_and_types_beginning_with_digits/classes_and_types_beginning_with_digits_spec.rb | <gh_stars>0
require 'spec_helper'
describe 'classes_and_types_beginning_with_digits' do
let (:msg) { 'class or defined type found beginning with a digit' }
context 'with fix disabled' do
context 'no classes or defined types that begin with digits' do
let (:code) {
<<-EOS
class apache {}
... |
voxpupuli/puppet-lint-classes_and_types_beginning_with_digits-check | lib/puppet-lint/plugins/classes_and_types_beginning_with_digits.rb | PuppetLint.new_check(:classes_and_types_beginning_with_digits) do
def check
tokens.each do |token|
if (token.type == :CLASS) or (token.type == :DEFINE)
if token.next_code_token.value =~ /^\d+/
notify :warning, {
:message => 'class or defined type found beginning with a digit',
... |
naruhito/Checkout-Ruby-SDK | lib/core/version.rb | <gh_stars>1-10
module PayPal
VERSION = "1.0.3"
end
|
naruhito/Checkout-Ruby-SDK | samples/authorize_intent_examples/capture_order.rb | <reponame>naruhito/Checkout-Ruby-SDK
require_relative '../paypal_client'
include PayPalCheckoutSdk::Payments
module Samples
module AuthorizeIntentExamples
class CaptureOrder
# This function can be used to perform capture on an authorization.
# An valid authorization id dhould be passed as an argument... |
naruhito/Checkout-Ruby-SDK | spec/orders/orders_validate_spec.rb |
require_relative '../test_harness'
require_relative '../../lib/lib'
require 'json'
include PayPalCheckoutSdk::Orders
describe OrdersValidateRequest do
it 'successfully makes a request' , :skip => 'This test is an example, in production, orders require payer approval' do
request = OrdersValidateRequest.new("O... |
naruhito/Checkout-Ruby-SDK | spec/payments/authorizations_reauthorize_spec.rb | <filename>spec/payments/authorizations_reauthorize_spec.rb
require_relative '../test_harness'
require_relative '../../lib/lib'
require 'json'
include PayPalCheckoutSdk::Payments
describe AuthorizationsReauthorizeRequest do
it 'successfully makes a request', :skip => 'This test is an example, in production, orders... |
naruhito/Checkout-Ruby-SDK | samples/patch_order.rb | require_relative './paypal_client'
require_relative './capture_intent_examples/create_order'
require_relative './get_order'
include PayPalCheckoutSdk::Orders
module Samples
class PatchOrder
# Below function can be used to patch and order.
# Patch is supported on only specific set of fields.
# Please ref... |
naruhito/Checkout-Ruby-SDK | samples/get_order.rb | <filename>samples/get_order.rb
require_relative './paypal_client'
require_relative './authorize_intent_examples/create_order'
require 'json'
require 'ostruct'
include PayPalCheckoutSdk::Orders
module Samples
class GetOrder
# This function can be used to retrieve an order by passing order id as argument
... |
naruhito/Checkout-Ruby-SDK | lib/core/access_token.rb | <reponame>naruhito/Checkout-Ruby-SDK
module PayPal
class AccessToken
attr_accessor :access_token, :token_type, :expires_in, :date_created
def initialize(options)
@access_token = options.access_token
@token_type = options.token_type
@expires_in = options.expires_in * 1000
@date_created... |
naruhito/Checkout-Ruby-SDK | spec/orders/orders_patch_spec.rb |
require_relative '../test_harness'
require_relative './orders_helper'
require 'json'
include PayPalCheckoutSdk::Orders
describe OrdersPatchRequest do
def build_request_body
return [
{
"op": "add",
"path": "/purchase_units/@reference_id=='test_ref_id1'/description",
... |
naruhito/Checkout-Ruby-SDK | lib/paypal-checkout-sdk.rb | <reponame>naruhito/Checkout-Ruby-SDK<filename>lib/paypal-checkout-sdk.rb
require_relative './lib'
|
lee-dohm/lush | lib/lush/version.rb | <reponame>lee-dohm/lush
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
# Contains all code pertaining to the `lush` shell.
module Lush
# Version of the shell.
VERSION = '0.0.1'
end
|
lee-dohm/lush | spec/commands/change_directory_spec.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
require 'tmpdir'
describe ChangeDirectory do
let!(:original) { Dir.pwd }
before do
$stdout = StringIO.new
$stderr = StringIO.new
end
after do
Dir.chdir(original)
$stdout = STDOUT
$stderr = STDERR
end
subject { ChangeDi... |
lee-dohm/lush | spec/commands/export_variable_spec.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
describe ExportVariable do
let(:env) { {} }
before { redirect_standard_streams }
after { reset_standard_streams }
context 'when given a key and value' do
subject(:command) { ExportVariable.new('KEY', 'value') }
before do
command.... |
lee-dohm/lush | spec/spec_helper.rb | <filename>spec/spec_helper.rb
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
require 'lush'
include Lush::Commands
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
root = File.expand_path('../..', __FILE__)
Dir[File.join(root, 'spec/s... |
lee-dohm/lush | lib/lush/streams.rb | <reponame>lee-dohm/lush
#
# Copyright (c) 2014 by <NAME>. All Rights Reserved.
#
module Lush
# Encapsulates all the stream shuffling code for dealing with creating and managing pipelines.
class Streams
# Stream to use for `STDIN`.
attr_reader :in
# Stream to use for `STDOUT`.
attr_reader :out
... |
lee-dohm/lush | spec/support/stream_redirection.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
# Redirects standard streams into `StringIO` objects to capture the output of code.
def redirect_standard_streams
$stdout = StringIO.new
$stderr = StringIO.new
end
# Resets standard streams to normal.
def reset_standard_streams
$stdout = STDOUT
... |
lee-dohm/lush | lib/lush/commands/command.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
module Lush
module Commands
# Base class for all built-in commands.
class Command
# Initializes the command with the supplied arguments.
#
# @param [Array<String>] args Arguments passed to the command.
def initialize(*ar... |
lee-dohm/lush | lib/lush/commands/exit_shell.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
module Lush
module Commands
# Represents the `exit` built-in command.
#
# @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_21
# POSIX shell exit command
class ExitShell < Command
# Status ... |
lee-dohm/lush | spec/commands/exit_shell_spec.rb | <reponame>lee-dohm/lush<filename>spec/commands/exit_shell_spec.rb
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
describe ExitShell do
def exit_status(command)
begin
command.execute
rescue SystemExit => e
return e.status
end
raise 'Expected to raise SystemExit but did n... |
lee-dohm/lush | lib/lush/commands/change_directory.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
module Lush
module Commands
# Represents the `cd` command.
#
# @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html#top POSIX shell cd
# command
class ChangeDirectory < Command
# Directory to which to chang... |
lee-dohm/lush | lib/lush/commands/export_variable.rb | <filename>lib/lush/commands/export_variable.rb
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
module Lush
module Commands
# Represents the `export` built-in command.
#
# @see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_22
# POSIX shell export co... |
lee-dohm/lush | lib/lush/cli.rb | <reponame>lee-dohm/lush
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
require 'shellwords'
module Lush
# Handles the command-line interface of the shell.
class CLI
# List of built in commands and Command class.
BUILTINS = {
'cd' => Lush::Commands::ChangeDirectory,
'exit' => ... |
lee-dohm/lush | lib/lush.rb | #
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
require 'lush/commands'
require 'lush/cli'
require 'lush/streams'
require 'lush/version'
|
lee-dohm/lush | lib/lush/commands.rb | <reponame>lee-dohm/lush
#
# Copyright (c) 2014 by Lifted Studios. All Rights Reserved.
#
require 'lush/commands/command'
require 'lush/commands/change_directory'
require 'lush/commands/exit_shell'
require 'lush/commands/export_variable'
module Lush
# Contains all built-in command definitions.
module Commands
... |
etagwerker/astor | spec/astor/browser_spec.rb | require "spec_helper"
RSpec.describe Astor::Browser do
describe "browse" do
context "simple assignments" do
let(:result) { "y = 1" }
it "displays a simple AST" do
node = RubyVM::AbstractSyntaxTree.parse("y = 1")
displayed = Astor::Browser.browse(node)
expect(displayed).to eq(... |
etagwerker/astor | spec/astor_spec.rb | RSpec.describe Astor do
it "has a version number" do
expect(Astor::VERSION).not_to be nil
end
end
|
etagwerker/astor | lib/astor/browser.rb | <reponame>etagwerker/astor
module Astor
class Browser
class << self
def visit(node, level = 0)
prepend = ("\t" * level * 2)
if (node.respond_to?(:type))
result = prepend + "#{node.type}\n"
if node.children.any?
result += "<CHILDREN>\t"
node.chi... |
etagwerker/astor | lib/astor.rb | <reponame>etagwerker/astor
require "astor/version"
require "astor/browser"
module Astor
end
|
baldowl/cucumber-rails | lib/cucumber/rails/version.rb | module Cucumber
module Rails
VERSION = '0.4.0'
DEPS = {
'aruba' => '>= 0.3.4',
'cucumber' => '>= 0.10.1',
'bundler' => '>= 1.0.10',
'rack-test' => '>= 0.5.7',
'nokogiri' => '>= 1.4.4',
'rails' => '>= 3.0.3',
... |
baldowl/cucumber-rails | lib/cucumber/rails/capybara/select_dates_and_times.rb | <filename>lib/cucumber/rails/capybara/select_dates_and_times.rb
module Cucumber
module Rails
module Capybara
module SelectDatesAndTimes
def select_date(field, options = {})
date = Date.parse(options[:with])
base_dom_id = get_base_dom_id_from_label_tag(field)
fin... |
baldowl/cucumber-rails | cucumber-rails.gemspec | # -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require 'cucumber/rails/version'
Gem::Specification.new do |s|
s.name = 'cucumber-rails'
s.version = Cucumber::Rails::VERSION
s.authors = ["<NAME>", "<NAME>", "<NAME>"]
s.description = "Cucumber Generators and Runt... |
arnab0073/idea | .rvm/src/ruby-2.3.0/lib/rdoc/constant.rb | # frozen_string_literal: false
##
# A constant
class RDoc::Constant < RDoc::CodeObject
MARSHAL_VERSION = 0 # :nodoc:
##
# Sets the module or class this is constant is an alias for.
attr_writer :is_alias_for
##
# The constant's name
attr_accessor :name
##
# The constant's value
attr_accessor ... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/ext/pathname/lib/pathname.rb | <gh_stars>0
#
# = pathname.rb
#
# Object-Oriented Pathname Class
#
# Author:: <NAME> <<EMAIL>>
# Documentation:: Author and <NAME>
#
# For documentation, see class Pathname.
#
# <tt>pathname.rb</tt> is distributed with Ruby since 1.8.0.
#
require 'pathname.so'
class Pathname
# :stopdoc:
if RUBY_VERSION < "1.9"
... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/knife-windows-1.4.1/spec/dummy_winrm_service.rb | <reponame>arnab0073/idea
module Dummy
class WinRMTransport
attr_reader :httpcli
def initialize
@httpcli = HTTPClient.new
end
end
class WinRMService
attr_reader :xfer
def initialize
@xfer = WinRMTransport.new
end
def set_timeout(timeout); end
def open_shell; end
... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/openstack/models/baremetal/chassis_collection.rb | <filename>.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/openstack/models/baremetal/chassis_collection.rb
require 'fog/core/collection'
require 'fog/openstack/models/baremetal/chassis'
module Fog
module Baremetal
class OpenStack
class ChassisCollection < Fog::Collection
model Fog::Baremetal::OpenStac... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/fog-1.29.0/tests/openstack/requests/orchestration/stack_tests.rb | Shindo.tests('Fog::Orchestration[:openstack] | stack requests', ['openstack']) do
@stack_format = {
'links' => Array,
'id' => String,
'stack_name' => String,
'description' => Fog::Nullable::String,
'stack_status' => String,
'stack_status_r... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/tool/file2lastrev.rb | <gh_stars>0
#!/usr/bin/env ruby
ENV.delete('PWD')
require 'optparse'
unless File.respond_to? :realpath
require 'pathname'
def File.realpath(arg)
Pathname(arg).realpath.to_s
end
end
Program = $0
class VCS
class NotFoundError < RuntimeError; end
@@dirs = []
def self.register(dir)
@@dirs << [dir,... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/logging-2.1.0/test/test_mapped_diagnostic_context.rb | <filename>.rvm/gems/ruby-2.3.0/gems/logging-2.1.0/test/test_mapped_diagnostic_context.rb
require File.expand_path('../setup', __FILE__)
module TestLogging
class TestMappedDiagnosticContext < Test::Unit::TestCase
include LoggingTestCase
def test_key_value_access
assert_nil Logging.mdc['foo']
L... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/ext/bigdecimal/sample/pi.rb | <reponame>arnab0073/idea<gh_stars>10-100
#!/usr/local/bin/ruby
#
# pi.rb
#
# Calculates 3.1415.... (the number of times that a circle's diameter
# will fit around the circle) using J. Machin's formula.
#
require "bigdecimal"
require "bigdecimal/math.rb"
include BigMath
if ARGV.size == 1
print "PI("+ARGV[0]+"):\... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi.rb | require 'net/ssh/multi/session'
module Net; module SSH
# Net::SSH::Multi is a library for controlling multiple Net::SSH
# connections via a single interface. It exposes an API similar to that of
# Net::SSH::Connection::Session and Net::SSH::Connection::Channel, making it
# simpler to adapt programs designed fo... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/lib/ohai/plugins/rackspace.rb | #
# Author:: <NAME> (<<EMAIL>>)
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb | <reponame>arnab0073/idea<filename>.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Canvasprintdialog.new.activate
Tk.mainloop
|
arnab0073/idea | .rvm/src/ruby-2.3.0/gems/did_you_mean-1.0.0/benchmark/memory_usage.rb | <filename>.rvm/src/ruby-2.3.0/gems/did_you_mean-1.0.0/benchmark/memory_usage.rb
# -*- frozen-string-literal: true -*-
require 'memory_profiler'
require 'did_you_mean'
# public def foo; end
# error = (self.fooo rescue $!)
# executable = -> { error.to_s }
class DidYouMean::WordCollection
include DidYouMean::Spe... |
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/lib/ohai/plugins/sigar/cpu.rb | <filename>.rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/lib/ohai/plugins/sigar/cpu.rb
#
# Author:: <NAME> <<EMAIL>>
# Copyright:: Copyright (c) 2010 VMware, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
arnab0073/idea | .rvm/src/ruby-2.3.0/ext/tk/lib/tk/after.rb | <gh_stars>0
# frozen_string_literal: false
#
# tk/after.rb : methods for Tcl/Tk after command
#
# $Id: after.rb 53143 2015-12-16 05:31:54Z naruse $
#
require 'tk/timer'
|
arnab0073/idea | .rvm/gems/ruby-2.3.0/gems/rubyntlm-0.6.0/lib/net/ntlm/target_info.rb | module Net
module NTLM
# Represents a list of AV_PAIR structures
# @see https://msdn.microsoft.com/en-us/library/cc236646.aspx
class TargetInfo
# Allowed AvId values for an AV_PAIR
MSV_AV_EOL = "\x00\x00".freeze
MSV_AV_NB_COMPUTER_NAME = "\x01\x00".freeze
... |
arnab0073/idea | .rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/rvm-1.11.3.9/lib/rvm/shell/utility.rb | <reponame>arnab0073/idea<gh_stars>1-10
module RVM
module Shell
module Utility
public
# Takes an array / number of arguments and converts
# them to a string useable for passing into a shell call.
def escape_arguments(*args)
return '' if args.nil?
args.flatten.map { |a| esc... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb | #!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300)
pw.add('top')
pw.add('middle', :margin=>10)
pw.add('bottom', :margin=>10, :minimum=>10)
pw.pack(:fill=>:both, :expand=>true)
pw.child_site_list.each{|pane|
TkButton.new(pane, :text=>pane.path... |
arnab0073/idea | .rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tclx/tclx.rb | <reponame>arnab0073/idea
#
# tclx/tclx.rb
# by <NAME> (<EMAIL>)
#
require 'tk'
# call setup script for general 'tkextlib' libraries
require 'tkextlib/setup.rb'
# call setup script
require 'tkextlib/tclx/setup.rb'
# TkPackage.require('Tclx', '8.0')
TkPackage.require('Tclx')
module Tk
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.