repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
Rainiugnas/password_manager | lib/password_manager/version.rb | <gh_stars>0
# frozen_string_literal: true
module PasswordManager
# Gem version number
VERSION = '1.2.0'
end
|
Rainiugnas/password_manager | lib/cli/input/stop.rb | # frozen_string_literal: true
module Cli
module Input
# Model to stop the program execution and wait for input
# @attr_reader [String] value Data from input, alway nil
# @attr_reader [String] error Alway nil
# @attr_reader [Boolean] success Alway true
class Stop
attr_reader :value, :error, ... |
Rainiugnas/password_manager | spec/matcher/be_crypter.rb | # frozen_string_literal: true
# Success if all the site in the expected array have
# the same attribute than the site in the actual array
RSpec::Matchers.define :be_crypter do
match do |actual|
actual.respond_to?(:encrypt) && actual.respond_to?(:decrypt)
end
end
|
Rainiugnas/password_manager | spec/spec_helper.rb | # frozen_string_literal: true
# rubocop:disable Style/MixinUsage
# Launch test coverage
require 'simplecov'
SimpleCov.start
require 'bundler/setup'
# Lib
require 'password_manager'
require 'cli'
require 'cli_file_crypter'
require 'byebug'
# Spec tools
require 'dummies/dummy_crypter'
require 'matcher/match_site_arr... |
Rainiugnas/password_manager | spec/lib/password_manager/converter_spec.rb | <gh_stars>0
# frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
require 'json'
RSpec.describe Converter do
let(:crypter1) { DummyCrypter.new 'c1' }
let(:crypter2) { DummyCrypter.new 'c1v2' }
let(:crypters) { [crypter1, crypter2] }
let(:site) { PasswordManager::Site.new 'name', 'user', 'passw... |
Rainiugnas/password_manager | lib/password_manager/site.rb | # frozen_string_literal: true
module PasswordManager
# Model for site data.
# @attr_reader [String] name The site name, also the key use to store the site (required)
# @attr_reader [String] user The username associated to the site (required)
# @attr_reader [String] password The password associated to the site
... |
Rainiugnas/password_manager | spec/lib/cli/input/site_spec.rb | # frozen_string_literal: true
RSpec.describe Cli::Input::Site do
let(:message) { "sitename: \nusername: \npassword: \n" }
let(:input1) { "site name\n" }
let(:input2) { "user name\n" }
let(:input3) { "<PASSWORD>" }
let(:site) { described_class.new }
before(:each) do
expect($stdin).to receive(:gets).and... |
Rainiugnas/password_manager | spec/lib/cli_file_crypter_spec.rb | <filename>spec/lib/cli_file_crypter_spec.rb
# frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
RSpec.describe CliFileCrypter do
describe '.interupt!' do
it 'should raise an password manager exception with the given message' do
expect { described_class.interupt! 'message' }.to raise_except... |
Rainiugnas/password_manager | spec/dummies/dummy_crypter.rb | # frozen_string_literal: true
# Fake crypter, add / remove the salt at the begin of the given data
class DummyCrypter
def initialize salt; @salt = "#{salt}:" end
def encrypt data; "#{@salt}#{data}" end
def decrypt data; data[@salt.size..-1] end
end
|
Rainiugnas/password_manager | spec/lib/cli/input/password_spec.rb | # frozen_string_literal: true
RSpec.describe Password do
let(:message) { 'ask message' }
let(:input) { "input\n" }
let(:password) { Password.new message }
before(:each) do
allow($stdin).to receive(:noecho).and_return input
expect { password }.to output(message).to_stdout
end
describe 'constructo... |
Rainiugnas/password_manager | lib/cli/option.rb | <filename>lib/cli/option.rb
# frozen_string_literal: true
require 'optparse'
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/BlockLength
# rubocop:disable Metrics/AbcSize
module Cli
# Use to parse the ARGV argument.
# The file must be set and one action (encrypt, decrypt, list, show, add, tmp) m... |
Rainiugnas/password_manager | lib/password_manager/crypter/aes.rb | # frozen_string_literal: true
require 'openssl'
require 'digest/sha2'
module PasswordManager
module Crypter
# Handle AES format
class Aes
# Set the password to salt encrypt / decrypt
# @param [String] password
def initialize password
@cipher = OpenSSL::Cipher.new 'AES-256-CBC'
... |
Rainiugnas/password_manager | lib/cli/input/password_confirmation.rb | # frozen_string_literal: true
module Cli
module Input
# Model to retrieve password with confirmation from the input
# @private @attr [Password] value Hold the password value
# @attr_reader [String] error Hold the validation error message (nil if no error)
# @attr_reader [Boolean] success True if the ... |
Rainiugnas/password_manager | spec/lib/cli/input/password_confirmation_spec.rb | # frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
RSpec.describe PasswordConfirmation do
let(:message) { 'ask message' }
let(:input1) { 'input' }
let(:input2) { 'input' }
let(:confirmation) { PasswordConfirmation.new message }
before(:each) do
expect(Password).to receive(:new).with(me... |
Rainiugnas/password_manager | spec/lib/password_manager/site_spec.rb | <gh_stars>0
# frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
RSpec.describe PasswordManager::Site do
let(:name) { 'site name' }
let(:user) { 'user name' }
let(:password) { '<PASSWORD>' }
let(:extra) { { 'extra1' => '1', 'extra2' => '2' } }
let(:site) { described_class.new name, user, pass... |
Rainiugnas/password_manager | lib/password_manager.rb | <reponame>Rainiugnas/password_manager<gh_stars>0
# frozen_string_literal: true
require 'active_support'
require 'active_support/core_ext/object'
require 'password_manager/version'
require 'password_manager/exceptions'
require 'password_manager/crypter'
require 'password_manager/site'
require 'password_manager/conve... |
Rainiugnas/password_manager | lib/cli/storage.rb | <filename>lib/cli/storage.rb
# frozen_string_literal: true
require 'json'
module Cli
# Model to handle file data access.
# @attr [data] data Data read from to file or to write into the file
# @private @attr [data] path Store the path of the file
# @attr_reader [String] error Hold the validation error message ... |
Rainiugnas/password_manager | spec/lib/cli/input/stop_spec.rb | <reponame>Rainiugnas/password_manager<filename>spec/lib/cli/input/stop_spec.rb<gh_stars>0
# frozen_string_literal: true
RSpec.describe Stop do
let(:message) { 'press to continue' }
let(:input) { "input\n" }
let(:stop) { Stop.new message }
before(:each) do
allow($stdin).to receive(:gets).and_return input
... |
Rainiugnas/password_manager | spec/matcher/match_site_array.rb | # frozen_string_literal: true
# Success if all the site in the expected array have
# the same attribute than the site in the actual array
RSpec::Matchers.define :match_site_array do |expected|
match do |actual|
return false if actual.size != expected.size
expected.each_with_index.map do |site, index|
... |
AmatsuZero/homebrew-tap | fppcli.rb | class Fppcli < Formula
desc "CLI for Face++"
homepage "https://github.com/AmatsuZero/FaceppSwift/releases"
url "https://github.com/AmatsuZero/FaceppSwift.git",
:tag => "0.1.8",
:revision => "58c2c8ba5a552bc2a10d7b59944dbf333ba59055"
head "https://github.com/AmatsuZero/FaceppSwift.git"
depends_on :xc... |
smcingvale/dotfiles | vim/install.rb | #!/usr/bin/env ruby
require "fileutils"
require "open-uri"
require "yaml"
# TODO: If .vimrc or a symlink (or other vim dotfiles) already exists,
# prompt the user to over-write.
Dir['*.symlink'].each do |file|
vim_symlink = File.join("#{Dir.home}", ".#{file[0, file.index('.')]}")
unless File.symlink?(vim_symlink... |
hassox/pancake | lib/pancake/mixins/response_helper.rb | module Pancake
module Mixins
module ResponseHelper
def headers
@headers ||= {}
end
def status
@status ||= 200
end
def status=(st)
@status = st
end
def redirect(location, status = 302)
r = Rack::Response.new
r.redirect(location, s... |
hassox/pancake | spec/pancake/middlewares/static_spec.rb | require 'spec_helper'
describe Pancake::Middlewares::Static do
before do
@app = lambda{|e| Rack::Response.new("OK").finish}
class ::FooBar < Pancake::Stack; end
FooBar.roots << File.join(File.expand_path(File.dirname(__FILE__)), "../fixtures/middlewares")
FooBar.push_paths(:public, ["public", "other... |
hassox/pancake | lib/pancake/stack/defaults/tasks/pancake.rake | namespace :pancake do
desc "symlink all public files to the current public directory"
task :symlink_to_public do
puts "Symlinking files to public"
THIS_STACK.stackup
THIS_STACK.symlink_public_files!
puts "Done"
end
end
|
hassox/pancake | spec/pancake/mixins/request_helper_spec.rb | <filename>spec/pancake/mixins/request_helper_spec.rb
require 'spec_helper'
describe Pancake::Mixins::RequestHelper do
before do
class ::FooBar
include Pancake::Mixins::RequestHelper
end
end
after do
clear_constants :FooBar
end
describe "logger" do
before do
@logger = mock("logge... |
hassox/pancake | lib/pancake/hooks/inheritable_inner_classes.rb | module Pancake
module Hooks
module InheritableInnerClasses
def self.extended(base)
base.class_eval do
extlib_inheritable_reader :_inhertiable_inner_classes, :_before_inner_class_inheritance
@_inhertiable_inner_classes = []
@_before_inner_class_inheritance = []
... |
hassox/pancake | lib/pancake/mixins/url.rb | module Pancake
module Url
module Generation
def url(name, opts = {})
konfig = request.env[Pancake::Router::CONFIGURATION_KEY]
konfig.router.generate(name, opts)
end
end # Generation
end # Url
end # Pancake
|
hassox/pancake | lib/pancake/stack/configuration.rb | <filename>lib/pancake/stack/configuration.rb<gh_stars>1-10
module Pancake
class Stack
inheritable_inner_classes :Configuration
class Configuration < Pancake::Configuration::Base
end
# Provides access to the configuration block for the stack.
# If a block is provided, it opens the specific config... |
hassox/pancake | spec/pancake/stack/stack_configuration_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe "pancake stack configuration" do
before(:each) do
Pancake.configuration.stacks.clear
Pancake.configuration.configs.clear
class ::FooStack < Pancake::Stack
end
FooStack.roots << Pancake.get_root(__FILE__)
end
after(:each) do
clear_constants(:... |
hassox/pancake | lib/pancake/middlewares/logger.rb | <reponame>hassox/pancake
require 'logger'
module Pancake
module Middlewares
class Logger
attr_reader :app
def initialize(app)
@app = app
end
def call(env)
env[Pancake::Constants::ENV_LOGGER_KEY] ||= Pancake.logger
@app.call(env)
end
end
end
end
|
hassox/pancake | lib/pancake/errors.rb | <filename>lib/pancake/errors.rb
module Pancake
module Errors
class HttpError < StandardError
extlib_inheritable_accessor :error_name, :code, :description
def name; self.class.name; end
def code; self.class.code; end
alias_method :status, :code
def description; self.class.descripti... |
hassox/pancake | lib/pancake.rb | require 'rubygems'
#require 'hashie'
$:.unshift File.join(File.dirname(__FILE__), "pancake", "vendor", "hashie", "lib")
require 'hashie'
require 'active_support/core_ext/class'
require 'active_support/inflector'
require 'active_support/core_ext/string/inflections'
require 'active_support/ordered_hash'
require 'http_rou... |
hassox/pancake | lib/pancake/mixins/publish/action_options.rb | module Pancake
module Mixins
module Publish
class ActionOptions
attr_reader :params, :formats, :default
CONFIG_OPTIONS = [:provides, :only_provides]
# Generates a new instance of the class. This instance encapsulates the
# options and logic needed to validate the param... |
hassox/pancake | lib/pancake/test/helpers.rb | <gh_stars>1-10
module Pancake
module Test
module Helpers
def clear_constants(*classes)
classes.flatten.each do |klass|
begin
Object.class_eval do
remove_const klass
end
rescue => e
end
end
end # clear_constnat3
... |
hassox/pancake | spec/pancake/mime_types_spec.rb | require 'spec_helper'
describe Pancake::MimeTypes do
before do
Pancake::MimeTypes.reset!
end
it "should have many types" do
Pancake::MimeTypes.types.should be_an(Array)
end
it "should have a type for each mime type defined in Rack::Mime::MIME_TYPES" do
Rack::Mime::MIME_TYPES.each do |ext, type|... |
hassox/pancake | spec/pancake/constants_spec.rb | require 'spec_helper'
describe Pancake::Constants do
it "should have the ENV_LOGGER_KEY constant" do
Pancake::Constants::ENV_LOGGER_KEY.should == "rack.logger"
end
end
|
hassox/pancake | spec/pancake/stack/router_spec.rb | <reponame>hassox/pancake
require 'spec_helper'
describe "stack router" do
before(:all) do
clear_constants "FooApp" ,"INNER_APP", "BarApp", "InnerApp", "InnerFoo", "InnerBar"
end
before(:each) do
::INNER_APP = Proc.new{ |e|
[
200,
{"Content-Type" => "text/plain"},
[
... |
hassox/pancake | spec/pancake/inheritance_spec.rb | require 'spec_helper'
describe "Pancake Inheritance" do
describe "on inherit hook" do
before(:each) do
clear_constants(:MyFoo, :OtherFoo, :FutherFoo, :SomeFoo, :DeeperFoo)
class ::MyFoo
extend Pancake::Hooks::OnInherit
end
::MyFoo.on_inherit do |base, parent|
$inherited_... |
hassox/pancake | lib/pancake/hooks/on_inherit.rb | module Pancake
module Hooks
module OnInherit
def self.extended(base)
base.class_eval do
extlib_inheritable_reader :_on_inherit
@_on_inherit = []
end
end
# Provides an inheritance hook to all extended classes
# Allows ou to hook into the inheritance
... |
hassox/pancake | lib/pancake/mixins/publish.rb | require File.join(File.dirname(__FILE__), "publish", "action_options")
module Pancake
module Mixins
module Publish
def self.extended(base)
base.class_eval do
extlib_inheritable_accessor :actions, :formats
self.actions = {}
self.formats = [:html]
end
end
... |
hassox/pancake | spec/pancake/mixins/publish_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe "Pancake::Controller publish declaration" do
before(:each) do
class ::PancakeTest
extend Pancake::Mixins::Publish
provides :html
publish
def simple_publish; end
publish :id => as(:integer)
def integer_test; end
publish :s... |
hassox/pancake | pancake.gemspec | # -*- encoding: utf-8 -*-
require 'bundler'
Gem::Specification.new do |s|
s.name = 'pancake'
s.version = File.read('VERSION')
s.homepage = %q{http://github.com/hassox/pancake}
s.authors = ["<NAME>"]
s.autorequire = %q{pancake}
s.date = Date.today
s.default_executable = %q{pancake}
s.description = %q{Ea... |
hassox/pancake | lib/pancake/master.rb | <filename>lib/pancake/master.rb
module Pancake
# A simple rack application
OK_APP = lambda{|env| Rack::Response.new("OK", 200, {"Content-Type" => "text/plain"}).finish}
MISSING_APP = lambda{|env| Rack::Response.new("NOT FOUND", 404, {"Content-Type" => "text/plain"}).finish}
extend Middleware
... |
hassox/pancake | lib/pancake/configuration.rb | <gh_stars>1-10
module Pancake
class Configuration
class Base
extlib_inheritable_reader :defaults
@defaults = Hash.new{|h,k| h[k] = {:value => nil, :description => ""}}
# Set a default on the the configuartion
class << self
# Set a default for this configuration class
# P... |
hassox/pancake | lib/pancake/mime_types.rb | <gh_stars>1-10
require 'set'
require 'rack/accept_media_types'
module Pancake
module MimeTypes
# A collection of all the mime types that pancake knows about
#
# @returns [Array<Pancake::MimeTypes::Type>] an array of
# Pancake::MimeTypes::Type objects that pancake knows about. To
# add a new type ... |
hassox/pancake | spec/pancake/fixtures/tasks/root1/tasks/task2.rake | $captures << "root1/tasks/task2.rake"
|
hassox/pancake | spec/pancake/paths_spec.rb | <reponame>hassox/pancake
require 'spec_helper'
describe Pancake::Paths do
def fixture_root
File.expand_path(File.join(File.dirname(__FILE__), "fixtures", "paths"))
end
before(:each) do
remove_consts!
class ::Foo
extend Pancake::Paths
end
end
after(:all) do
remove_consts!
end
... |
hassox/pancake | spec/pancake/mixins/render_spec.rb | require 'spec_helper'
describe Pancake::Mixins::Render do
before do
class ::RenderSpecClass
include Pancake::Mixins::Render
# setup the renderer
roots << File.expand_path(File.join(File.dirname(__FILE__), "..", "fixtures", "render_templates"))
push_paths :views, "/", "**/*"
def se... |
hassox/pancake | spec/pancake/fixtures/tasks/root1/tasks/task1.rake | $captures << "root1/tasks/task1.rake"
|
hassox/pancake | lib/pancake/mixins/stack_helper.rb | <filename>lib/pancake/mixins/stack_helper.rb
module Pancake
module Mixins
module StackHelper
def self.included(base)
base.extlib_inheritable_accessor :_stack_class
base.extend ClassMethods
base.class_eval do
include ::Pancake::Mixins::StackHelper::InstanceMethods
en... |
hassox/pancake | spec/pancake/hooks/on_inherit_spec.rb | require 'spec_helper'
describe "Pancake::Stack inheritance" do
describe "inheritance hooks" do
before(:all) do
$on_inherit_blocks = Pancake::Stack.on_inherit.dup
end
after(:all) do
Pancake::Stack.on_inherit.clear
$on_inherit_blocks.each do |blk|
Pancake::Stack.on_inherit(&blk)
... |
hassox/pancake | lib/pancake/test/matchers.rb | module Pancake
module Test
module Matchers
class MountMatcher
def initialize(expected_app, path)
@expected_app, @path = expected_app, path
end
def matches?(target)
@target = target
@ma = @target::Router.mounted_applications.detect{|m| m.mounted_app == @... |
hassox/pancake | spec/pancake/pancake_spec.rb | require 'spec_helper'
describe "pancake" do
it "should get the correct root directory for a file" do
Pancake.get_root(__FILE__).should == File.expand_path(File.dirname(__FILE__))
end
it "should join the arguments together to form a path" do
Pancake.get_root(__FILE__, "foo").should == File.expand_path(F... |
hassox/pancake | lib/pancake/stack/stack.rb | <reponame>hassox/pancake<filename>lib/pancake/stack/stack.rb
module Pancake
class Stack
attr_accessor :app_name
class_inheritable_array :_after_stack_initialize, :_after_build_stack, :_before_build_stack
self._after_stack_initialize = []
self._after_build_stack = []
self._before_build_stack ... |
hassox/pancake | lib/pancake/core_ext/class.rb | <gh_stars>1-10
class Class
# Taken from extlib but uses a full Marshall.dump rather than just a dup.
# This may not work for some data types. The data must be marshalable to use this method.
#
# Defines class-level inheritable attribute reader. Attributes are available to subclasses,
# each subclass has a co... |
hassox/pancake | lib/pancake/mixins/render/view_context.rb | require 'any_view'
module Pancake
module Mixins
module Render
class ViewContext
# These are included as modules not for modularization, but because super can be called for the module versions
include ::Tilt::CompileSite
include ::AnyView::TiltBase
class << self
def... |
hassox/pancake | lib/pancake/paths.rb | module Pancake
# Pancake::Paths provides a mixin for path management.
# A path consists of a name, and paths + globs, and makes use of the Klass.roots that have been set as
# file roots for each path and glob to be applied to.
# Each name may have many (path + glob)s, so that many root paths may be added to the... |
hassox/pancake | lib/pancake/constants.rb | module Pancake
module Constants
ENV_LOGGER_KEY = "rack.logger"
end
end
|
hassox/pancake | spec/pancake/mixins/render/view_context_spec.rb | require 'spec_helper'
describe Pancake::Mixins::Render::ViewContext do
before do
@masters = [Pancake.master_stack, Pancake.master_templates]
$captures = []
class ::FooBar
include Pancake::Mixins::Render
attr_accessor :params, :data
push_paths :views, "", "**/*"
roots << File.jo... |
hassox/pancake | lib/pancake/defaults/configuration.rb | class Pancake::PancakeConfig < Pancake::Configuration::Base
default :log_path, Proc.new{ "log/pancake_#{Pancake.env}.log"}
default :log_level, :info
default :log_delimiter, " ~ "
default :log_auto_flush, true
default :log_to_file, Proc.new{ Pancake.env == "production" }
default :log_stre... |
hassox/pancake | lib/pancake/stack/router.rb | module Pancake
class Stack
inheritable_inner_classes :Router
class Router < Pancake::Router; end
def self.router
@router ||= begin
if superclass.respond_to?(:router) && superclass.router
r = superclass.router.clone(self::Router)
r.stack = self
else
r = ... |
hassox/pancake | lib/pancake/mixins/render/template.rb | module Pancake
module Mixins
module Render
class Template
class UnamedTemplate < Pancake::Errors::NotFound; end
class NotFound < Pancake::Errors::NotFound; end
attr_reader :name, :path, :renderer, :owner
def initialize(name, owner, path)
@name, @owner, @path... |
hassox/pancake | spec/pancake/mixins/render/template_spec.rb | require 'spec_helper'
describe Pancake::Mixins::Render::Template do
before do
$captures = []
@templates_path = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "fixtures", "render_templates", "templates")
class ::FooBar
include Pancake::Mixins::Render
end
end
after do
cle... |
hassox/pancake | spec/spec_helper.rb | <reponame>hassox/pancake
$TESTING=true
require 'rubygems'
require 'date'
require 'rack'
require 'rack/test'
require 'spec/rake/spectask'
require 'spec'
require 'haml'
require 'json'
ENV['RACK_ENV'] = "test"
$:.unshift File.dirname(__FILE__)
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'pancake'
... |
hassox/pancake | spec/pancake/middleware_spec.rb | <reponame>hassox/pancake
require 'spec_helper'
describe "Pancake::Middleware" do
before(:all) do
$pk_mid = Pancake.middlewares.dup
end
after(:all) do
Pancake.middlewares.replace $pk_mid
end
before(:each) do
Pancake.middlewares.clear
def app
@app
end
def default_env
Rack... |
hassox/pancake | spec/pancake/fixtures/tasks/root2/tasks/task1.rake | $captures << "root2/tasks/task1.rake"
|
hassox/pancake | lib/pancake/middlewares/static.rb | module Pancake
module Middlewares
class Static
attr_accessor :app, :stack
def initialize(app, stack)
@app, @stack = app, stack
unless Pancake::Paths === stack
raise "#{self.class} needs to be initialized with a stack (or something including Pancake::Paths)"
end
... |
hassox/pancake | spec/pancake/stack/stack_spec.rb | require 'spec_helper'
describe "Pancake::Stack" do
before(:each) do
class ::StackSpecStack < Pancake::Stack; end
class ::OtherSpecStack < Pancake::Stack; end
StackSpecStack.roots.clear
end
after(:each) do
clear_constants(:StackSpecStack, :FooSpecStack, :OtherSpecStack)
end
describe "roots" ... |
hassox/pancake | spec/pancake/defaults/configuration_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe "Pancake configuration defaults" do
describe "logging defaults" do
before do
Pancake.root = Pancake.get_root(__FILE__)
end
after do
Pancake.reset_configuration
FileUtils.rm_rf(File.join(Pancake.root, "log"))
end
it "should set the ... |
hassox/pancake | lib/pancake/mixins/request_helper.rb | module Pancake
module Mixins
# Some helpers for requests that come in handy for applications that
# are part of stacks
module RequestHelper
VARS_KEY = 'request.variables'
# A data area that allows you to carry data accross middlewares, controller / views etc.
# Stores the data in sessio... |
hassox/pancake | lib/pancake/router.rb | module Pancake
# Generate a url for any pancake configuration that has a router
#
# @example
# Pancake.url(UserManamgent, :login) # => "/users/login"
# @api public
def self.url(app_name, name_or_opts, opts = {})
config = Pancake.configuration.configs(app_name)
the_router = if config && config.rou... |
hassox/pancake | spec/pancake/mixins/stack_helper_spec.rb | <filename>spec/pancake/mixins/stack_helper_spec.rb<gh_stars>1-10
require 'spec_helper'
describe Pancake::Mixins::StackHelper do
before do
class ::FooStack < Pancake::Stack
class Bar
include Pancake::Mixins::StackHelper
end
end
end
after do
clear_constants :FooStack, :BarStack, :F... |
hassox/pancake | spec/pancake/configuration_spec.rb | <reponame>hassox/pancake<filename>spec/pancake/configuration_spec.rb
require 'spec_helper'
describe "Pancake::Configuration" do
it "should let me make a new configuration" do
conf_klass = Pancake::Configuration.make
conf_klass.should inherit_from(Pancake::Configuration::Base)
end
describe "usage" do
... |
hassox/pancake | lib/pancake/core_ext/object.rb | class Object
extend ::Pancake::Hooks::InheritableInnerClasses
end
# Vendored from http://eigenclass.org/hiki/instance_exec
# 2009-06-02
# Adapted for ruby 1.9 where the method is deinfed on Object
unless Object.method_defined?(:instance_exec)
class Object
# Like instace_eval but allows parameters to be passed.
... |
hassox/pancake | lib/pancake/generators.rb | <reponame>hassox/pancake<gh_stars>1-10
require 'thor'
require 'thor/group'
Dir[File.join(File.dirname(__FILE__), "generators", "*.rb")].each do |f|
require f unless f == 'base.rb'
end
|
hassox/pancake | spec/pancake/middlewares/logger_spec.rb | require 'spec_helper'
describe Pancake::Middlewares::Logger do
before do
Pancake.stack(:logger).use(Pancake::Middlewares::Logger)
class ::PancakeSpecLogger
def self.call(env)
Rack::Response.new("OK").finish
end
end
end
after do
clear_constants :PancakeSpecLogger
FileUtils... |
hassox/pancake | spec/pancake/fixtures/tasks/root2/tasks/task2.rake | $captures << "root2/tasks/task2.rake"
|
hassox/pancake | lib/pancake/defaults/middlewares.rb | Pancake.stack(:logger).use(Pancake::Middlewares::Logger)
|
hassox/pancake | lib/pancake/middleware.rb | module Pancake
# Provides a mixin to use on any class to give it middleware management capabilities.
# This module provides a rich featureset for defining a middleware stack.
#
# Middlware can be set before, or after other middleware, can be tagged / named,
# and can be declared to only be active in certain t... |
hassox/pancake | lib/pancake/mixins/render.rb | <reponame>hassox/pancake
require 'pancake/mixins/render/template'
require 'pancake/mixins/render/view_context'
module Pancake
module Mixins
module Render
class TemplateNotFound < Pancake::Errors::NotFound; end
RENDER_SETUP = lambda do |base|
base.class_eval do
extend Pancake::Mixin... |
andreteodoro/secret_friend | db/migrate/20180122191711_add_date_to_campaign.rb | class AddDateToCampaign < ActiveRecord::Migration[5.0]
def change
add_column :campaigns, :event_date, :datetime
add_column :campaigns, :event_hour, :string
add_column :campaigns, :locale, :string
end
end
|
andreteodoro/secret_friend | spec/factories/member.rb | <filename>spec/factories/member.rb
FactoryGirl.define do
factory :member do
name { FFaker::Lorem.word }
email { FFaker::Internet.email }
campaign
end
end |
andreteodoro/secret_friend | app/mailers/campaign_mailer.rb | class CampaignMailer < ApplicationMailer
def raffle(campaign, member, friend)
@campaign = campaign
@member = member
@friend = friend
mail to: @member.email, subject: "Nosso Amigo Secreto: #{@campaign.title}"
end
end
|
andreteodoro/secret_friend | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
def render_404
redirect_to main_app.root_url
end
end
|
andreteodoro/secret_friend | app/models/campaign.rb | <reponame>andreteodoro/secret_friend
class Campaign < ApplicationRecord
belongs_to :user
has_many :members, dependent: :destroy
before_validation :set_member, on: :create
before_validation :set_status, on: :create
enum status: [:pending, :finished]
validates :title, :description, :user, :status, presence: t... |
andreteodoro/secret_friend | spec/factories/campaign.rb | <reponame>andreteodoro/secret_friend<filename>spec/factories/campaign.rb
FactoryGirl.define do
factory :campaign do
title { FFaker::Lorem.word }
description { FFaker::Lorem.sentence }
user
status { :pending }
locale { "#{FFaker::Address.city}, #{FFaker::Address.street_addre... |
andreteodoro/secret_friend | config/routes.rb | require 'sidekiq/web'
Rails.application.routes.draw do
devise_for :users, :controllers => { registrations: 'registrations' }
#mount Sidekiq::Web => '/sidekiq'
root to: 'pages#home'
resources :campaigns, except: [:new] do
post 'raffle', on: :member
# post 'raffle', on: :collection
end
get 'members/... |
kenjij/firebase-ruby | lib/firebase-ruby.rb | <filename>lib/firebase-ruby.rb
require 'firebase-ruby/logger'
require 'firebase-ruby/database'
require 'firebase-ruby/auth'
|
kenjij/firebase-ruby | lib/firebase-ruby/version.rb | <filename>lib/firebase-ruby/version.rb
module Firebase
Version = '0.3.1'
end
|
kenjij/firebase-ruby | lib/firebase-ruby/auth.rb | <filename>lib/firebase-ruby/auth.rb<gh_stars>1-10
require 'jwt'
require 'firebase-ruby/neko-http'
module Firebase
class Auth
GOOGLE_JWT_SCOPE = 'https://www.googleapis.com/auth/firebase.database https://www.googleapis.com/auth/userinfo.email'
GOOGLE_JWT_AUD = 'https://oauth2.googleapis.com/token'
GOOGLE... |
kenjij/firebase-ruby | lib/firebase-ruby/database.rb | <gh_stars>1-10
require 'firebase-ruby/neko-http'
module Firebase
class Database
FIREBASE_URL_TEMPLATE = 'https://%s.firebaseio.com/'
attr_accessor :auth, :print, :shallow
def initialize()
end
def set_auth_with_key(json: nil, path: nil)
@auth = Auth.new(json: json, path: path)
end
... |
kenjij/firebase-ruby | firebase-ruby.gemspec | $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
require 'firebase-ruby/version'
Gem::Specification.new do |s|
s.name = 'firebase-ruby'
s.version = Firebase::Version
s.authors = ['<NAME>.']
s.email = ['<EMAIL>']
s.summary = %q{Pure simple Ruby based Firebase REST l... |
marketplacer/jquery-rjs | lib/jquery-rjs/on_load_action_view.rb | <gh_stars>1-10
require 'action_view/helpers/jquery_helper'
require 'action_view/helpers/jquery_ui_helper'
require 'action_view/template/handlers/rjs'
require 'jquery-rjs/javascript_helper'
require 'jquery-rjs/rendering'
ActionView::Base.class_eval do
cattr_accessor :debug_rjs
self.debug_rjs = false
end
ActionView... |
marketplacer/jquery-rjs | lib/jquery-rjs.rb | require 'rails'
require 'active_support'
module JqueryRjs
class Engine < Rails::Engine
initializer 'jquery-rjs.initialize' do
ActiveSupport.on_load(:action_controller) do
require 'jquery-rjs/on_load_action_controller'
end
ActiveSupport.on_load(:action_view) do
require 'jquery-r... |
marketplacer/jquery-rjs | test/controller/new_base/render_rjs_test.rb | <gh_stars>1-10
require 'abstract_unit'
module RenderRjs
class BasicController < ActionController::Base
layout "application", :only => :index_respond_to
self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "",
"render_rjs/basic/index.js.rjs" => ... |
marketplacer/jquery-rjs | lib/jquery-rjs/on_load_action_controller.rb | <reponame>marketplacer/jquery-rjs
require 'jquery-rjs/selector_assertions'
require 'jquery-rjs/renderers'
|
panmari/flutterfire | packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb | <filename>packages/firebase_core/firebase_core/ios/firebase_sdk_version.rb<gh_stars>1-10
def firebase_sdk_version!()
'7.3.0'
end
|
eric/github-services | services/basecamp.rb | service :basecamp do |data, payload|
repository = payload['repository']['name']
name_with_owner = File.join(payload['repository']['owner']['name'], repository)
branch = payload['ref'].split('/').last
basecamp = Basecamp.new(data['url'], data['username'], data['password'])
project_id = basec... |
earlino727/byebug | test/commands/display_test.rb | <reponame>earlino727/byebug
require 'test_helper'
module Byebug
#
# Tests displaying values of expressions on every stop.
#
class DisplayTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: d = 0
3:
4: byebug
5:
6: d += 3
... |
earlino727/byebug | .git-hooks/pre_commit/c_cop.rb | <filename>.git-hooks/pre_commit/c_cop.rb<gh_stars>1-10
#
# Custom pre-commit hook to check C-code style
#
module Overcommit
module Hook
module PreCommit
#
# Inherit from base hook
#
class CCop < Base
#
# Implement overcommit's interface
#
def run
m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.