repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
cervinka/jira-worklog
lib/jira/worklog/api_client.rb
class APIClient attr_reader :user, :password, :url_base def initialize(url_base, user, password) @user = user @password = password @url_base = url_base end def issues data = request("search?jql=assignee=#{user}") data['issues'].map { |issue| {key: issue['key'], id: issue['id'], summary: i...
hswick/sandoz
lib/sandoz/version.rb
<gh_stars>1-10 module Sandoz VERSION = "0.1.52" end
hswick/sandoz
lib/cli.rb
<filename>lib/cli.rb require 'thor' module Sandoz class Cli < Thor desc "hello", "Say hello" def hello puts "Well, I met a girl called Sandoz\nAnd she taught me many, many things\nGood things, very good things, sweet things." end desc "new", "Take a hit and create a new sandoz project" d...
hswick/sandoz
sandoz.gemspec
# coding: utf-8 require File.expand_path('../lib/sandoz/version', __FILE__) Gem::Specification.new do |s| s.name = 'sandoz' s.version = Sandoz::VERSION s.authors = ["<NAME>"] s.email = ["<EMAIL>"] s.summary = "A gem named Sandoz." s.description = "Ruby p5.js wrapper for...
hswick/sandoz
lib/sandoz/sandoz.rb
<reponame>hswick/sandoz<filename>lib/sandoz/sandoz.rb module Sandoz # https://github.com/processing/p5.js/wiki/p5.js-overview#instantiation--namespace # TODO Add html element argument def defsketch(id, &block) sketch = Proc.new do |p| init(p) block.call end @p5 = `new p5(#{sketch}, #{id})`...
hswick/sandoz
lib/sandoz.rb
<filename>lib/sandoz.rb # require all the files, only if Opal is executing if RUBY_ENGINE == 'opal' require_relative 'sandoz/sandoz.rb' require_relative 'sandoz/version' else # NOT running inside of opal, set things up # so opal can find the files. require 'opal' Opal.append_path File.expand_path('..', __FI...
rcapozzi/brm-jruby
lib/brm_test.rb
<filename>lib/brm_test.rb require 'minitest/autorun' require 'brm-jruby' require 'rainbow' class BrmTest < Minitest::Test @xop_debug = false attr_accessor :ctxp def assert_error_info_result(resp, value) assert(resp.has_key?("PIN_FLD_ERROR_INFO"), "Expect PIN_FLD_ERROR_INFO key") assert_equal(value, resp["PI...
rcapozzi/brm-jruby
lib/brm-jruby.rb
# # JRuby helpers for PCM. # # Custom fields should be defined in Infranet.properties. # infranet.custom.field.package=com.foo # infranet.custom.field.123=XXX_FLD_FOO # then require the foo-flds.jar class BRMJRuby #VERSION = '0.0.1' end require 'jruby' $LOAD_PATH.unshift 'jars' unless $LOAD_PATH.include? 'jars' requ...
rcapozzi/brm-jruby
test/test_brm-jruby.rb
<reponame>rcapozzi/brm-jruby %w( $PIN/HOME/jars lib).each do |path| $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path) puts "INFO: Added to path #{path}" end require 'guard-jruby-minitest' require 'minitest/autorun' require "brm-jruby" class BRMJRubyTest < Minitest::Test def test_flunk # $stderr.pu...
rynelaster/brewery
config.ru
require 'sinatra/base' require 'sinatra/activerecord' require './controllers/ApplicationController' # require './controllers/BreweryController' # require './controllers/LocationContoller' map ('/'){ run ApplicationController }
rynelaster/brewery
controllers/LocationController.rb
class Location < ApplicationController get '/locations' do end end
rynelaster/brewery
controllers/ApplicationController.rb
<reponame>rynelaster/brewery<gh_stars>0 class ApplicationController < Sinatra::Base require 'http' require 'brewery_db' require 'bundler' Bundler.require() register Sinatra::CrossOrigin set :allow_origin, :any set :all_methods, [:get, :post, :options, :put, :patch, :delete] set :allow_credentials, true c...
jutonz/dctl
lib/dctl.rb
<reponame>jutonz/dctl<filename>lib/dctl.rb require "rainbow" require "config" require "dctl/version" require "dctl/main" module Dctl ERROR_COLOR = :red SUCCESS_COLOR = :green CMD_COLOR = :dimgray end
jutonz/dctl
spec/dctl/main_spec.rb
require "spec_helper" require "tempfile" require "thor" RSpec.describe Dctl::Main do describe "#define_custom_commands" do it "defines a command on the passed class" do config = <<~CONFIG org: jutonz project: dctl_rb custom_commands: single: pwd multiple: ["pwd",...
jutonz/dctl
lib/dctl/cli/kubernetes.rb
require "thor" require "dctl/kubernetes" module Dctl::Kubernetes class Cli < Thor class_option :namespace, type: :string, aliases: :n class_option :env, type: :string desc "live-image", "Returns the active image for the given deployment" def live_image(service) puts Dctl::Kubernetes.live_imag...
jutonz/dctl
lib/dctl/main.rb
<filename>lib/dctl/main.rb module Dctl class Main attr_reader :env, :settings def initialize(env: "dev", config: nil) @env = env load_config!(config) end ## # Generate the full tag for the given image, concatenating the org, # project, env, image name, and version. # # Pa...
jutonz/dctl
lib/dctl/kubernetes.rb
<reponame>jutonz/dctl<filename>lib/dctl/kubernetes.rb module Dctl::Kubernetes def self.live_image(service, namespace: nil) # Check if namespace exists if namespace && `kubectl get ns #{namespace}`.empty? error = "Could not find namespace #{namespace}" puts Rainbow(error).fg ERROR_COLOR exit ...
jutonz/dctl
spec/dctl/dctl_spec.rb
<filename>spec/dctl/dctl_spec.rb<gh_stars>1-10 require "spec_helper" RSpec.describe Dctl do it "has a version number" do expect(Dctl::VERSION).not_to be nil end end
p/integrity
init.rb
<filename>init.rb<gh_stars>0 $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__)) begin require ".bundle/environment" rescue LoadError require "bundler/setup" end require "integrity" # Uncomment as appropriate for the notifier you want to use # = Email # require "integrity/notifier/email" # = SES Email # req...
p/integrity
lib/app/app.rb
<filename>lib/app/app.rb require "app/helpers" require 'cgi' module Integrity class App < Sinatra::Base set :root, File.dirname(__FILE__) enable :methodoverride, :static disable :build_all helpers Integrity::Helpers not_found do status 404 show :not_found, :title => "lost, are ...
crate/activerecord-crate-adapter
spec/dummy/app/models/post.rb
<filename>spec/dummy/app/models/post.rb # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Ap...
crate/activerecord-crate-adapter
lib/active_record/connection_adapters/crate/database_statements.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/activerecord-crate-adapter
spec/data_types/object_spec.rb
<filename>spec/data_types/object_spec.rb # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the A...
crate/activerecord-crate-adapter
spec/spec_helper.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/activerecord-crate-adapter
lib/active_record/connection_adapters/crate_adapter.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/activerecord-crate-adapter
lib/active_record/attribute_methods/crate_object.rb
<filename>lib/active_record/attribute_methods/crate_object.rb # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this fi...
crate/activerecord-crate-adapter
activerecord-crate-adapter.gemspec
# coding: utf-8 # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"); # you ...
crate/activerecord-crate-adapter
spec/activerecord/connection_adapters/crate/table_definition_spec.rb
<reponame>crate/activerecord-crate-adapter<filename>spec/activerecord/connection_adapters/crate/table_definition_spec.rb # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional informati...
crate/activerecord-crate-adapter
spec/dummy/app/models/address.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/activerecord-crate-adapter
lib/active_record/connection_adapters/crate/schema_statements.rb
<reponame>crate/activerecord-crate-adapter # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the...
crate/activerecord-crate-adapter
spec/test_server.rb
#!/usr/bin/env ruby # -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Versio...
crate/activerecord-crate-adapter
spec/data_types/array_spec.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/activerecord-crate-adapter
spec/models/post_spec.rb
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
elia/localizer-rails-plugin
localizer.gemspec
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{localizer} s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required...
elia/localizer-rails-plugin
init.rb
# Include hook code here require 'localizer' class ActionController::Base include Localizer::Controller end class ActionController::Routing::RouteSet::Mapper include Localizer::Routes end class ActionView::Base include Localizer::Helper end
elia/localizer-rails-plugin
lib/localizer/routes.rb
<gh_stars>1-10 module Localizer module Routes # Usage: # # include Localizer::Routes # localize_paths map, :index, :about, :contact # localize_path map, :home def localize_path controller, action_name self.with_options :controller => controller, :action => action_name do |si...
elia/localizer-rails-plugin
lib/localizer.rb
# Localizer require 'localizer/config' require 'localizer/routes' require 'localizer/controller' require 'localizer/helper'
elia/localizer-rails-plugin
tasks/localizer_tasks.rake
# desc "Explaining what the task does" # task :localizer do # # Task goes here # end namespace :localizer do desc "Install localizer assets in public folder." task :assets do require 'fileutils' localizer_assets = File.join(File.dirname(__FILE__),'..','localizer','lib','assets') File.cp_r File.join(l...
elia/localizer-rails-plugin
lib/localizer/controller.rb
module Localizer module Controller module InstanceMethods private def set_locale I18n.locale = params[:locale].try(:to_sym) || I18n.default_locale end def locale I18n.locale end end def self.included(controller) # controller.extend ...
elia/localizer-rails-plugin
lib/localizer/config.rb
module Localizer class Config attr_accessor :controllers, :locales end def self.config unless @config @config = Config.new @config.controllers = {} end yield @config if block_given? return @config end def self.localize! *pages options = pages.last.kind_of?(Hash) ...
elia/localizer-rails-plugin
lib/localizer/helper.rb
<filename>lib/localizer/helper.rb module Localizer module Helper def locale params[:locale] || 'it' end def localized_root locale == 'it' ? root_path : local_root_path(locale) end def with_locale locale locale_backup = I18n.locale I18n.locale = locale result = yield...
erikthered/chef-jboss4
recipes/default.rb
# # Cookbook Name:: chef-jboss4 # Recipe:: default # # Copyright (C) 2013 <NAME> # # 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 # # Unles...
erikthered/chef-jboss4
metadata.rb
<reponame>erikthered/chef-jboss4 name "jboss" maintainer "<NAME>" maintainer_email "<EMAIL>" license "Apache 2.0" description "Installs/Configures chef-jboss4" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "0.1.0" depends "ark" depends "java" ...
erikthered/chef-jboss4
attributes/default.rb
<gh_stars>1-10 default['jboss']['url'] = "http://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip" default['jboss']['checksum'] = "48797e150ee7dd6e035290fab86f17a5fe7d174b4980e941b833369b80273620" default['jboss']['version'] = "4.2.3.GA" default['jboss']['user'] = "jboss" default['jboss...
dtk/dtk-common-core
lib/pretty_print_form.rb
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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 # # Unles...
dtk/dtk-common-core
lib/log.rb
<filename>lib/log.rb<gh_stars>0 # # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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.or...
dtk/dtk-common-core
lib/errors/errors.rb
<filename>lib/errors/errors.rb # # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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...
dtk/dtk-common-core
lib/auxiliary.rb
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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 # # Unles...
dtk/dtk-common-core
lib/errors/rest_error.rb
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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 # # Unles...
dtk/dtk-common-core
lib/response.rb
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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 # # Unles...
dtk/dtk-common-core
dtk-common-core.gemspec
# -*- encoding: utf-8 -*- require File.expand_path('../lib/dtk-common-core/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["<NAME>"] gem.email = ["<EMAIL>"] gem.description = %q{DTK Common Core is a shared library used by several DTK components.} gem.summary = %q{Common...
dtk/dtk-common-core
lib/hash_object.rb
# # Copyright (C) 2010-2016 dtk contributors # # This file is part of the dtk project. # # 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 # # Unles...
tarimo-lab/colorfulcamels
db/migrate/20200615024752_create_posts.rb
<filename>db/migrate/20200615024752_create_posts.rb class CreatePosts < ActiveRecord::Migration[5.2] def change create_table :posts do |t| t.text :title t.text :body t.boolean :approved, default: false t.references :user, foreign_key: true t.boolean :anonymous, default: false t...
tarimo-lab/colorfulcamels
app/controllers/home_controller.rb
class HomeController < ApplicationController before_action :check_user def index if @user @posts = Post.approved_all(params[:page]) else @posts = Post.approved_public(params[:page]) end #@popular = @posts.order('likes DESC').first(10) #@latest = @posts.order('id DESC').first(10) e...
tarimo-lab/colorfulcamels
app/models/user.rb
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable has_many :posts has_many :likes validates :first_n...
tarimo-lab/colorfulcamels
app/models/tag.rb
class Tag < ApplicationRecord has_many :taggings has_many :posts, through: :taggings end
tarimo-lab/colorfulcamels
db/seeds.rb
<gh_stars>1-10 # 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 Ri...
tarimo-lab/colorfulcamels
app/models/comment.rb
class Comment < ApplicationRecord belongs_to :user belongs_to :commentable, polymorphic: true has_many :comments, as: :commentable, dependent: :destroy end
tarimo-lab/colorfulcamels
app/controllers/users_controller.rb
<reponame>tarimo-lab/colorfulcamels<filename>app/controllers/users_controller.rb class UsersController < ApplicationController before_action :authenticate_user! before_action :set_current_user def show @posts = Post.approved_all(params[:page]) end end
tarimo-lab/colorfulcamels
config/routes.rb
<reponame>tarimo-lab/colorfulcamels Rails.application.routes.draw do devise_for :users mount ActionCable.server => '/cable' root 'home#index' get 'home/index' get 'home/about' get 'home/search' get 'home/feedback' # Provides default path for signed in users match 'user_root' => 'users#show', vi...
FanchenBao/magic-modules
api/resource/iam_policy.rb
# Copyright 2019 Google Inc. # 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 applicable law or agreed to in writing, so...
FanchenBao/magic-modules
google/yaml_validator.rb
<filename>google/yaml_validator.rb<gh_stars>0 # Copyright 2017 Google Inc. # 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...
FanchenBao/magic-modules
provider/ansible/version_added.rb
<filename>provider/ansible/version_added.rb # Copyright 2019 Google Inc. # 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 b...
FanchenBao/magic-modules
overrides/runner.rb
# Copyright 2018 Google Inc. # 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 applicable law or agreed to in writing, so...
FanchenBao/magic-modules
api/resource/nested_query.rb
<reponame>FanchenBao/magic-modules<gh_stars>1-10 # Copyright 2019 Google Inc. # 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 requi...
FanchenBao/magic-modules
provider/terraform_oics.rb
# Copyright 2017 Google Inc. # 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 applicable law or agreed to in writing, so...
hiroaki-kitagawa/rails-tutorial-local
.history/app/helpers/users_helper_20200818213434.rb
module UsersHelper # 引数で与えられたユーザーのGravatar画像を返す def gravatar_for(user) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) gravatar_url = end end
hiroaki-kitagawa/rails-tutorial-local
.history/app/controllers/relationships_controller_20200825010447.rb
class RelationshipsController < ApplicationController before_action :logged_in_user def create end def destroy end end
hiroaki-kitagawa/rails-tutorial-local
.history/app/controllers/relationships_controller_20200825005932.rb
class RelationshipsController < ApplicationController end
hiroaki-kitagawa/rails-tutorial-local
.history/app/models/relationship_20200824220811.rb
class Relationship < ApplicationRecord end
camilleg/timeliner
movie-soundtrack.rb
<filename>movie-soundtrack.rb #!/usr/bin/env ruby # Compute wavfile from comments in timeliner-recording.txt. Src = 'example/mono/marshal/mixed.wav' SR = 16000 s = `grep ^# timeliner-recording.txt` .split /\n/ cFrame = `grep -v ^# timeliner-recording.txt|wc -l`.to_i def tmp(i) "/run/shm/timeliner/tmp#{i}.wav" end d...
codesnik/rails-recipes
lib/rails-recipes/console.rb
unless Capistrano::Configuration.respond_to?(:instance) abort "rails-recipes requires Capistrano 2" end Capistrano::Configuration.instance(:must_exist).load do namespace :rails do desc "script/console on a remote server" task :console do rails_env = fetch(:rails_env, "production") server = find...
codesnik/rails-recipes
test/rails-recipes_test.rb
<filename>test/rails-recipes_test.rb<gh_stars>1-10 require 'test_helper' class RailsRecipesTest < Test::Unit::TestCase should "probably rename this file and start testing for real" do assert "still won't bother myself with it right now" end end
codesnik/rails-recipes
lib/rails-recipes.rb
<filename>lib/rails-recipes.rb<gh_stars>1-10 require 'capistrano' dir = File.dirname(__FILE__) require File.join(dir, 'rails-recipes', 'console')
Metaphysiker/fatfreedemo
lib/tasks/sync.rake
<gh_stars>0 namespace :sync do task users: :environment do getusers end task societies: :environment do getsocieties end task totalsync: :environment do getusers getsocieties end def getusers url = 'http://localhost:3000/getusers' uri = URI(url) response = Net::HT...
Metaphysiker/fatfreedemo
db/migrate/20100928030607_create_contacts.rb
<gh_stars>0 # frozen_string_literal: true class CreateContacts < ActiveRecord::Migration[4.2] def self.up create_table :contacts, force: true do |t| t.string :uuid, limit: 36 t.references :user t.references :lead t.integer :assigned_to t.integer :reports_to t.integer :philosop...
atomicjolt/starter_app
app/controllers/sessions_controller.rb
<filename>app/controllers/sessions_controller.rb class SessionsController < Devise::SessionsController def destroy super end end
atomicjolt/starter_app
app/controllers/admin_controller.rb
<gh_stars>1-10 class AdminController < ApplicationController layout "admin" def index end end
atomicjolt/starter_app
app/controllers/application_controller.rb
<reponame>atomicjolt/starter_app class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? helper_met...
atomicjolt/starter_app
spec/controllers/api/accounts_controller_spec.rb
<reponame>atomicjolt/starter_app # require 'spec_helper' # describe Api::AccountsController do # before do # @request.host = @account_default.domain # end # describe "GET index" do # context "valid api key" do # it "returns all accounts as json" do # account = FactoryGirl.create(:account) ...
atomicjolt/starter_app
db/seeds.rb
user = CreateAdminService.new.call puts 'CREATED ADMIN USER: ' << user.email # Setup default accounts if Rails.env.production? accounts = [{ code: 'amasynsoftware', name: '<NAME>', domain: 'http://www.amasynsoftware.com', }] else accounts = [{ code: 'amasynsoftware', name: '<NAME>', domai...
atomicjolt/starter_app
app/models/authentication.rb
class Authentication < ActiveRecord::Base belongs_to :user, inverse_of: :authentications validates :provider, presence: true, uniqueness: {scope: [:uid, :user_id, :provider_url]} end
atomicjolt/starter_app
spec/factories/accounts.rb
<reponame>atomicjolt/starter_app FactoryGirl.define do factory :account do code { FactoryGirl.generate(:code) } name { FactoryGirl.generate(:name) } domain { FactoryGirl.generate(:domain) } end end
atomicjolt/starter_app
spec/factories/authentication.rb
<gh_stars>1-10 FactoryGirl.define do factory :authentication do user provider { FactoryGirl.generate(:name) } factory :authentication_facebook do provider 'facebook' uid '12345' username 'myusername' provider_avatar 'http://graph.facebook.com/12345/picture?type=large' end ...
atomicjolt/starter_app
app/models/role.rb
class Role < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :users, :through => :permissions validates :name, :presence => true validates :name, :uniqueness => true scope :by_alpha, -> {order('roles.name ASC')} # roles can be defined as symbols. We want to store them as strin...
atomicjolt/starter_app
config/routes.rb
<reponame>atomicjolt/starter_app class CustomDomain def matches?(request) return false if request.subdomain.length <= 0 || request.subdomain == 'www' true end end Rails.application.routes.draw do root :to => "home#index" devise_for :users, controllers: { sessions: "sessions", registrations: "...
atomicjolt/starter_app
config/unicorn.rb
################################################################################### # # Use this unicorn configuration for deploying to Heroku # worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) timeout 15 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting ...
atomicjolt/starter_app
spec/support/macros.rb
<filename>spec/support/macros.rb def login_user @request.env["devise.mapping"] = Devise.mappings[:user] user = FactoryGirl.create(:user) user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module sign_in user end
atomicjolt/starter_app
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 is the authoritative sou...
atomicjolt/starter_app
app/controllers/users_controller.rb
<reponame>atomicjolt/starter_app class UsersController < ApplicationController before_filter :authenticate_user! load_and_authorize_resource after_action :verify_authorized, except: [:show] def index end def show end def update if @user.update_attributes(secure_params) redirect_to users_pa...
jwedoff/ruby-net-ldap
test/test_auth_adapter.rb
<reponame>jwedoff/ruby-net-ldap require 'test_helper' class TestAuthAdapter < Test::Unit::TestCase class FakeSocket include Net::BER::BERParser def initialize(*args) end end def test_undefined_auth_adapter conn = Net::LDAP::Connection.new(host: 'ldap.example.com', port: 379, :socket_class => Fak...
jwedoff/ruby-net-ldap
test/test_ssl_ber.rb
require_relative 'test_helper' require 'timeout' class TestSSLBER < Test::Unit::TestCase # Transmits str to @to and reads it back from @from. # def transmit(str) Timeout.timeout(1) do @to.write(str) @to.close @from.read end end def setup @from, @to = IO.pipe # The product...
jwedoff/ruby-net-ldap
test/integration/test_bind.rb
require_relative '../test_helper' class TestBindIntegration < LDAPIntegrationTestCase INTEGRATION_HOSTNAME = 'ldap.example.org'.freeze def test_bind_success assert @ldap.bind(BIND_CREDS), @ldap.get_operation_result.inspect end def test_bind_timeout @ldap.host = "10.255.255.1" # non-routabl...
jwedoff/ruby-net-ldap
lib/net/ldap/version.rb
<gh_stars>0 module Net class LDAP VERSION = "0.17.0.1.akajw" end end
jwedoff/ruby-net-ldap
lib/net/ber/ber_parser_nonblock.rb
# Implements nonbocking and timeout handling routines for BER parsing. module Net::BER::BERParserNonblock # Internal: Returns the BER message ID or nil. def read_ber_id ber_timeout_getbyte end private :read_ber_id # Internal: specify the BER socket read timeouts, nil by default (no timeout). attr_acces...
adamgeorgeson/eventq
eventq_aws/spec/integration/aws_eventq_client_spec.rb
require 'spec_helper' RSpec.describe EventQ::Amazon::EventQClient, integration: true do let(:queue_client) do EventQ::Amazon::QueueClient.new({ aws_account_number: EventQ.AWS_ACCOUNT_NUMBER, aws_region: 'eu-west-1' }) end let(:queue_manager) do EventQ::Amazon::QueueManager.new({ client: queue_client })...
adamgeorgeson/eventq
eventq_base/lib/eventq_base/serialization_providers/jruby/oj/serializer.rb
module EventQ module SerializationProviders module JRuby module Oj class Serializer def dump(obj) JSON.dump(AttributeWriter.exec(obj)) end def load(json) raise NotImplementedError.new("[#{self.class}] - #load method has not yet been implemented....
adamgeorgeson/eventq
eventq_base/spec/eventq_base/serialization_providers/jruby/oj/test_item.rb
<reponame>adamgeorgeson/eventq class TestItem attr_accessor :string attr_accessor :number attr_accessor :float attr_accessor :date attr_accessor :datetime attr_accessor :time attr_accessor :hash attr_accessor :array_hash attr_accessor :test_item attr_accessor :array_test_item end
adamgeorgeson/eventq
eventq_base/lib/eventq_base/serialization_providers/jruby/oj/time_writer.rb
<filename>eventq_base/lib/eventq_base/serialization_providers/jruby/oj/time_writer.rb module EventQ module SerializationProviders module JRuby module Oj class TimeWriter < AttributeWriter def valid?(obj) obj.is_a?(Time) end def exec(obj) { ...
adamgeorgeson/eventq
eventq_aws/spec/integration/aws_status_checker_spec.rb
require 'spec_helper' RSpec.describe EventQ::Amazon::StatusChecker, integration: true do let(:queue_client) do EventQ::Amazon::QueueClient.new({ aws_account_number: EventQ.AWS_ACCOUNT_NUMBER, aws_region: 'eu-west-1' }) end let(:queue_manager) do EventQ::Amazon::QueueManager.new({ client: queue_client }...