source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/environments/development.rb
Ruby
mit
19
master
1,502
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/environments/test.rb
Ruby
mit
19
master
1,740
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suit...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/initializers/simple_form.rb
Ruby
mit
19
master
6,380
# Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the # wrapper, change the order or even add your own to the # stack. The options given below are used to...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/initializers/twilio.rb
Ruby
mit
19
master
214
puts "***** Twilio is not configured *****" if ENV["TWILIO_TOKEN"].nil? || ENV["TWILIO_SID"].nil? Twilio.configure do |config| config.account_sid = ENV["TWILIO_SID"] config.auth_token = ENV["TWILIO_TOKEN"] end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/initializers/devise.rb
Ruby
mit
19
master
12,693
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmat...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
lib/tasks/db.rake
Ruby
mit
19
master
234
namespace :db do desc 'Generates tokens for any Classifieds that are without a token' task :generate_tokens => :environment do Classified.where(:url_token => nil).update_all(url_token: SecureRandom.hex[3,7].upcase) end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/seeds.rb
Ruby
mit
19
master
627
# 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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/schema.rb
Ruby
mit
19
master
4,107
# 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...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141019112053_create_classified_skills.rb
Ruby
mit
19
master
232
class CreateClassifiedSkills < ActiveRecord::Migration def change create_table :classified_skills do |t| t.references :classified, index: true t.references :skill, index: true t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141018181636_create_classifieds.rb
Ruby
mit
19
master
273
class CreateClassifieds < ActiveRecord::Migration def change create_table :classifieds do |t| t.integer :member_id t.string :description t.integer :skill_id t.boolean :face_to_face t.boolean :remote t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141019102719_create_interests.rb
Ruby
mit
19
master
207
class CreateInterests < ActiveRecord::Migration def change create_table :interests do |t| t.string :name t.boolean :verified t.integer :added_by t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141018091117_create_members.rb
Ruby
mit
19
master
297
class CreateMembers < ActiveRecord::Migration def change create_table :members do |t| t.string :full_name t.string :username t.string :email t.string :gender t.text :about t.integer :expertise t.boolean :mentor t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141019193710_create_messages.rb
Ruby
mit
19
master
276
class CreateMessages < ActiveRecord::Migration def change create_table :messages do |t| t.references :member, index: true t.references :classified, index: true t.text :text t.references :message, index: true t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141018144305_add_devise_to_members.rb
Ruby
mit
19
master
1,701
class AddDeviseToMembers < ActiveRecord::Migration def self.up change_table(:members) do |t| ## Database authenticatable t.change :email, :string, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141019102924_create_member_interests.rb
Ruby
mit
19
master
203
class CreateMemberInterests < ActiveRecord::Migration def change create_table :member_interests do |t| t.integer :member_id t.integer :interest_id t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
db/migrate/20141019160312_create_verifiers.rb
Ruby
mit
19
master
249
class CreateVerifiers < ActiveRecord::Migration def change create_table :verifiers do |t| t.references :member, index: true t.string :mobile t.string :code t.timestamp :verified_at t.timestamps end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/rails_helper.rb
Ruby
mit
19
master
2,517
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby f...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/spec_helper.rb
Ruby
mit
19
master
4,092
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause this # file to always be loaded, without a need to explicitly require ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/features/mentor_profile_complete_spec.rb
Ruby
mit
19
master
547
require 'rails_helper' feature 'Viewing mentors' do let!(:member) { create(:complete_member) } before do create(:member, mentor: true, username: 'incompleteuser') create(:complete_member, mentor: true, username: 'completeuser') end scenario 'Only mentors with complete profiles are visible' do log...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/factories/members.rb
Ruby
mit
19
master
420
FactoryGirl.define do factory :member do sequence(:email) { |n| "person#{n}@example.com" } password { 'password' } factory :complete_member do confirmed_at { Time.now } full_name { Faker::Name.name } username { Faker::Internet.user_name } about ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/support/factory_girl.rb
Ruby
mit
19
master
219
RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.before(:suite) do begin DatabaseCleaner.start FactoryGirl.lint ensure DatabaseCleaner.clean end end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/support/session_helpers.rb
Ruby
mit
19
master
211
module SessionHelpers def login_with( email, password ) visit new_member_session_path fill_in 'member_email', with: email fill_in 'member_password', with: password click_on 'Log in' end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
spec/models/member_spec.rb
Ruby
mit
19
master
696
require 'rails_helper' describe Member do let!(:incomplete_profile) { create(:member) } let!(:complete_profile) { create(:complete_member) } describe '.with_complete_profile' do it 'returns only members with complete profiles' do expect(Member.with_complete_profile).to match_array [complete...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/verifications_controller.rb
Ruby
mit
19
master
911
class VerificationsController < ApplicationController def show @verifier = current_member.verifier || Verifier.new end def create @verifier = current_member.verifier || current_member.create_verifier(verifier_params) client.messages.create( from: ENV["TWILIO_NO"], to: @verifier.mobile, ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/mentors_controller.rb
Ruby
mit
19
master
253
class MentorsController < ApplicationController before_filter :logged_in? def index @mentors = Member.mentors.with_complete_profile.where.not(id: current_member.id) end def show @member = Member.find_by_username(params[:id]) end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/omniauth_callbacks_controller.rb
Ruby
mit
19
master
523
class OmniauthCallbacksController < Devise::OmniauthCallbacksController include Concerns::DeviseOverrides def github @member = Member.from_omniauth(request.env["omniauth.auth"], cookies[:mentor]) if @member.persisted? sign_in_and_redirect @member, :event => :authentication set_flash_message(:n...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/application_controller.rb
Ruby
mit
19
master
309
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 def logged_in? redirect_to root_path, notice: "Please login first" unless member_signed_in? end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/profiles_controller.rb
Ruby
mit
19
master
649
class ProfilesController < ApplicationController before_filter :logged_in? before_filter :set_current_member def new end def edit end def show @member end def update @member.update(profile_params) if @member.valid? @member.save if @member.mentor redirect_to new_mem...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/dashboard_controller.rb
Ruby
mit
19
master
230
class DashboardController < ApplicationController before_filter :set_member, only: [:index] before_filter :logged_in? layout 'application' def index end private def set_member @member = current_member end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/classifieds_controller.rb
Ruby
mit
19
master
1,887
class ClassifiedsController < ApplicationController before_filter :set_member, only: [:new, :create, :preview, :edit, :update, :confirm, :personal, :show] before_filter :set_classified, only: [:edit, :update] before_filter :set_classified_token, only: [:show] before_filter :logged_in?, except: [:show] def ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/messages_controller.rb
Ruby
mit
19
master
1,735
class MessagesController < ApplicationController before_filter :logged_in? before_filter :set_classified, only: [:new, :create] before_filter :setup_message, only: [:create, :create_message ] before_filter :set_message, only: [:destroy, :show] def new @message = @classified.messages.build end def c...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/members_controller.rb
Ruby
mit
19
master
570
class MembersController < ApplicationController def new cookies[:mentor] = false redirect_to new_member_registration_path end def new_mentor cookies[:mentor] = true redirect_to new_member_registration_path end # step one initial post def create @member = Member.create(member_params)...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/interests_controller.rb
Ruby
mit
19
master
528
class InterestsController < ApplicationController before_filter :set_member, only: [:create] def create @interest = @member.added_interests.create(interest_params) # render 'skills/new' if @interest.valid? render :json => {:status => "OK", :name => @interest.name, :id => @interest.id} else ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/skills_controller.rb
Ruby
mit
19
master
718
class SkillsController < ApplicationController before_filter :logged_in? before_filter :set_member, only: [:new, :create] def new @skills = Skill.all @interests = Interest.new end def create @member.skill_ids = member_skills_params[:skill_ids] @member.interest_ids = member_interest_params[:i...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/concerns/devise_overrides.rb
Ruby
mit
19
master
741
module Concerns::DeviseOverrides extend ActiveSupport::Concern included do include InstanceMethods end module InstanceMethods def after_sign_up_path_for(resource) new_member_profile_path end def after_sign_in_path_for(resource) unless resource.profile_complete? flash[:aler...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/controllers/members/registrations_controller.rb
Ruby
mit
19
master
1,188
class Members::RegistrationsController < Devise::RegistrationsController include Concerns::DeviseOverrides before_action :configure_permitted_parameters def create build_resource(sign_up_params) resource.mentor = cookies[:mentor] || false resource_saved = resource.save yield resource if block_g...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/models/verifier.rb
Ruby
mit
19
master
285
class Verifier < ActiveRecord::Base attr_reader :authentication_code belongs_to :member before_save :generate_code def confirm! self.update_attribute :verified_at, Time.now end private def generate_code self.code ||= rand(10 ** 10).to_s.rjust(6,'0') end end
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/models/member.rb
Ruby
mit
19
master
2,308
class Member < ActiveRecord::Base require 'digest/md5' # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/models/classified.rb
Ruby
mit
19
master
997
class Classified < ActiveRecord::Base has_many :classified_skills has_many :skills, through: :classified_skills has_many :messages belongs_to :member before_save :add_url_token def self.search(params) search_clause = [] if !params[:location].blank? search_clause << "members.location like '...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
app/mailers/message_mailer.rb
Ruby
mit
19
master
441
class MessageMailer < ActionMailer::Base default from: 'no-reply@mentoring.io' def notify(member, message) @message = message @member = member mail(mail_args(member, "You have a new message")) do |format| format.html end end helper do def full_url_for path "#{@host}#{path}" ...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
Guardfile
Ruby
mit
19
master
1,749
# A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) ## Uncomment to clear the screen before every task # clearing :on ## Guard internally checks for changes in the Guardfi...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
easyzpl.gemspec
Ruby
mit
19
master
1,225
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'easyzpl/version' Gem::Specification.new do |spec| spec.name = 'easyzpl' spec.version = Easyzpl::VERSION spec.authors = ['Matthew Grigajtis'] spec.email = ['ma...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
spec/easyzpl/label_spec.rb
Ruby
mit
19
master
3,224
require 'spec_helper' describe 'Testing easyzpl Gem' do context 'When creating an empty label' do it 'should output a blank label' do label = Easyzpl::Label.new(dots: 203) expect(label.to_s).to eq('^XA^PQ1^XZ') end end context 'When creating an empty label with defaults set' do it 'shou...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
spec/easyzpl/stored_label_spec.rb
Ruby
mit
19
master
432
require 'spec_helper' describe 'Testing easyzpl Gem' do context 'When accessing the stored template' do it 'should output a label with only two fields of data that are passed into a saved template' do label = Easyzpl::StoredLabel.new('Template1') label.add_field('ZEBRA') label.add_field('ZEBRA...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
spec/easyzpl/label_template_spec.rb
Ruby
mit
19
master
605
require 'spec_helper' describe 'Testing easyzpl Gem' do context 'When creating a stored template' do it 'should output a label template with one variable text field and one variable barcode' do label = Easyzpl::LabelTemplate.new('Template1', dots: 203) label.home_position(30, 30) label.draw_bo...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
test/inventory.rb
Ruby
mit
19
master
1,325
require 'rubygems' require 'easyzpl' # There are 72 dots in an inch (usually) # In the case of our printer, there are 300 dots = 300 # The dimensions of the label label_width = 2 label_height = 1 label_fields_orientation = :landscape # Generate the new label label = Easyzpl::Label.new( dot...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
lib/easyzpl/label.rb
Ruby
mit
19
master
10,634
require 'prawn' require 'barby' require 'barby/barcode/code_39' require 'barby/outputter/prawn_outputter' # This module is a wrapper for writing confusing ZPL and ZPL2 code module Easyzpl # This is the label object class Label attr_accessor :invert attr_accessor :label_data attr_accessor :quantity ...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
lib/easyzpl/label_template.rb
Ruby
mit
19
master
6,361
require_relative 'label' require 'prawn' require 'barby' require 'barby/barcode/code_39' require 'barby/outputter/prawn_outputter' # This module is a wrapper for writing confusing ZPL and ZPL2 code module Easyzpl # This is the label template object # This gets uploaded and saved on the printer class LabelTemplat...
github
mgrigajtis/easyzpl
https://github.com/mgrigajtis/easyzpl
lib/easyzpl/stored_label.rb
Ruby
mit
19
master
1,042
require_relative 'label' # This module is a wrapper for writing confusing ZPL and ZPL2 code module Easyzpl # This is the stored label object class StoredLabel < Easyzpl::Label attr_accessor :variable_fields_count # Called when the new method is invoked def initialize(name) return if name.nil? ...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
rakefile
Ruby
mit
19
master
1,554
require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |s| s.name = "xrefresh-server" s.summary = "XRefresh filesystem monitor for OSX" s.email = "antonin@hildebrand.cz" s.homepage = "http://github.com/darwin/xrefresh-server" s.description = "XRefresh is browser refresh automation for web...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
xrefresh-server.gemspec
Ruby
mit
19
master
1,550
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{xrefresh-server} s.version = "0.3.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Antonin Hildebrand"] s.date = %q{2009-07-27} s.default_executable = %q{xrefresh-ser...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
lib/xrefresh-server.rb
Ruby
mit
19
master
2,001
include Term::ANSIColor # http://kpumuk.info/ruby-on-rails/colorizing-console-ruby-script-output/ if PLATFORM =~ /win32/ then include Win32::Console::ANSI end module XRefreshServer VERSION = File.read(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'VERSION')) AGENT = "OSX xrefresh-server" CONF...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
lib/xrefresh-server/server.rb
Ruby
mit
19
master
1,496
require 'gserver' module XRefreshServer class Server < GServer attr_accessor :clients def initialize(port, host, max_connections, *args) super @clients = Set.new @last_client_id = 0 OUT.puts "#{green('Started server')} on #{blue("#{host}:#{port}")} (max #{max_connections} clients)" ...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
lib/xrefresh-server/client.rb
Ruby
mit
19
master
1,285
module XRefreshServer # client representation on server side class Client attr_accessor :id, :dead, :type, :agent def initialize(id, socket) @id = id @socket = socket @dead = false @type = '?' @agent = '?' end def name green("#{@type}(#{@id})") end def...
github
darwin/xrefresh-server
https://github.com/darwin/xrefresh-server
lib/xrefresh-server/monitor.rb
Ruby
mit
19
master
2,041
require 'directory_watcher' module XRefreshServer class Monitor def initialize(server, config) @config = config @server = server @buckets = Hash.new end def schedule # map DirectoryWatcher events to xrefresh events (dw does not have rename) event_map = {:added => "created",...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
Rakefile
Ruby
mit
19
master
11,311
require "fileutils" require "tmpdir" S3_BUCKET_NAME = "heroku-buildpack-ruby" VENDOR_URL = "https://s3.amazonaws.com/#{S3_BUCKET_NAME}" def s3_tools_dir File.expand_path("../support/s3", __FILE__) end def s3_upload(tmpdir, name) sh("#{s3_tools_dir}/s3 put #{S3_BUCKET_NAME} #{name}.tgz #{tmpdir}/#{name}.tgz...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/base_custom.rb
Ruby
mit
19
master
579
class BaseCustom attr_reader :build_path, :cache_path def initialize(*args) @build_path = args.first @cache_path = args.last || "#{build_path}/tmp/custom-source" return self end def run_stdout(command) %x{ #{command} 2>/dev/null } end def write_stdout(string) puts "-----> #{string}" e...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack.rb
Ruby
mit
19
master
539
require "pathname" # General Language Pack module module LanguagePack # detects which language pack to use # @param [Array] first argument is a String of the build directory # @return [LanguagePack] the {LanguagePack} detected def self.detect(*args) Dir.chdir(args.first) pack = [ Rails3, Rails2, Rack...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack/ruby.rb
Ruby
mit
19
master
19,254
require "tmpdir" require "rubygems" require "language_pack" require "language_pack/base" # base Ruby Language Pack. This is for any base ruby app. class LanguagePack::Ruby < LanguagePack::Base BUILDPACK_VERSION = "v40" LIBYAML_VERSION = "0.1.4" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_V...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack/rack.rb
Ruby
mit
19
master
951
require "language_pack" require "language_pack/ruby" # Rack Language Pack. This is for any non-Rails Rack apps like Sinatra. class LanguagePack::Rack < LanguagePack::Ruby # detects if this is a valid Rack app by seeing if "config.ru" exists # @return [Boolean] true if it's a Rack app def self.use? super && ...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack/rails3.rb
Ruby
mit
19
master
2,704
require "language_pack" require "language_pack/rails2" # Rails 3 Language Pack. This is for all Rails 3.x apps. class LanguagePack::Rails3 < LanguagePack::Rails2 # detects if this is a Rails 3.x app # @return [Boolean] true if it's a Rails 3.x app def self.use? super && File.exists?("config/application...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack/rails2.rb
Ruby
mit
19
master
2,097
require "fileutils" require "language_pack" require "language_pack/rack" # Rails 2 Language Pack. This is for any Rails 2.x apps. class LanguagePack::Rails2 < LanguagePack::Ruby # detects if this is a valid Rails 2 app # @return [Boolean] true if it's a Rails 2 app def self.use? super && File.exist?("config...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/language_pack/base.rb
Ruby
mit
19
master
6,036
require "language_pack" require "pathname" require "yaml" require "digest/sha1" Encoding.default_external = Encoding::UTF_8 if defined?(Encoding) # abstract class that all the Ruby based Language Packs inherit from class LanguagePack::Base VENDOR_URL = "https://s3.amazonaws.com/heroku-buildpack-ruby" attr_reader...
github
millie/heroku-buildpack-ruby-pdftk
https://github.com/millie/heroku-buildpack-ruby-pdftk
lib/custom/pdftk.rb
Ruby
mit
19
master
760
class Pdftk < BaseCustom def path "#{build_path}/vendor/#{name}" end def name "pdftk" end def source_url "http://s3.amazonaws.com/source_url_here" end def used? File.exist?("#{build_path}/bin/pdftk") && File.exist?("#{build_path}/bin/lib/libgcj.so.12") end def compile write_stdout ...
github
dyohi/formtastic_calendar_date_select
https://github.com/dyohi/formtastic_calendar_date_select
formtastic_calendar_date_select.gemspec
Ruby
mit
19
master
2,214
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{formtastic_calendar_date_select} s.version = "0.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= s.authors = ["David Oshiro"] s.date = %q{2010-01-13} s.description = %q{A plugi...
github
dyohi/formtastic_calendar_date_select
https://github.com/dyohi/formtastic_calendar_date_select
Rakefile
Ruby
mit
19
master
594
require 'rubygems' require 'rake' require 'echoe' Echoe.new('formtastic_calendar_date_select', '0.1.1') do |p| p.description = "A plugin for formtastic to integrate calendar_date_select date/time picker" p.url = "http://github.com/dyohi/formtastic_calendar_date_select" p.author = "David Oshiro" p.email = "david@da...
github
dyohi/formtastic_calendar_date_select
https://github.com/dyohi/formtastic_calendar_date_select
lib/formtastic_calendar_date_select.rb
Ruby
mit
19
master
278
module DavidOshiro module Formtastic module CalendarDateSelect protected def calendar_input(method, options = {}) self.label(method, options_for_label(options)) + self.calendar_date_select(method, strip_formtastic_options(options)) end end end end
github
LeipeLeon/capistrano-git-tags
https://github.com/LeipeLeon/capistrano-git-tags
capistrano-git-tags.gemspec
Ruby
mit
19
master
689
Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = "capistrano-git-tags" s.version = "0.0.2" s.summary = "Tag your deployed commit to git" s.description = <<-EOF With every commit tag the local and remote branch with a tag EOF s.files = ["CHANGELOG.rdoc", "lib/c...
github
LeipeLeon/capistrano-git-tags
https://github.com/LeipeLeon/capistrano-git-tags
lib/capistrano/git/tags.rb
Ruby
mit
19
master
1,569
unless Capistrano::Configuration.respond_to?(:instance) abort "capistrano/git/tags requires Capistrano 2" end require 'capistrano' Capistrano::Configuration.instance.load do after "deploy:restart", "git:tags:push_deploy_tag" before "deploy:cleanup", "git:tags:cleanup_deploy_tag" namespace :git do name...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
daemonizer.gemspec
Ruby
mit
19
develop
1,142
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "daemonizer/version" Gem::Specification.new do |s| s.name = "daemonizer" s.version = Daemonizer::VERSION s.authors = ["Gleb Pomykalov"] s.email = ["glebpom@gmail.com"] s.homepage = "http://github.com/glebpo...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
Rakefile
Ruby
mit
19
develop
548
require "bundler/gem_tasks" require 'rspec/core/rake_task' RSpec::Core::RakeTask.new do |t| t.rspec_opts = %w(-fs --color) t.ruby_opts = %w(-w) end desc "Run all specs with rcov" RSpec::Core::RakeTask.new(:rcov => :spec) do |t| t.rcov = true t.rcov_opts = %w{--exclude gems\/,spec\/} end task :spec => :chec...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer.rb
Ruby
mit
19
develop
2,635
require 'daemonizer/version' require 'rubygems' require 'yaml' require 'erb' require 'pathname' require 'logger' require 'simple-statistics' module Daemonizer def self.root=(value) @@root = value end def self.root if defined?(@@root) @@root else File.dirname(daemonfile) end end ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/autoload.rb
Ruby
mit
19
develop
697
module Daemonizer # @private def self.__p(*path) File.join(File.dirname(File.expand_path(__FILE__)), *path) end autoload :Config, __p('config') autoload :Dsl, __p('dsl') autoload :Errors, __p('errors') autoload :CLI, __p('cli') autoload :Daemonize, __p('daemoniz...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/option.rb
Ruby
mit
19
develop
929
module Daemonizer class Option class OptionError < StandardError; end def initialize(option, value, auto_eval = false) @option = option @value = value @auto_eval = auto_eval if @auto_eval && !@value.is_a?(Proc) raise OptionError, "auto_apply can be used only with callable opti...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/handler.rb
Ruby
mit
19
develop
847
module Daemonizer class Handler attr_accessor :worker_id attr_accessor :workers_count attr_accessor :logger def initialize(handler_options = {}) @handler_options = handler_options end def prepare(starter, &block) if block_given? yield end starter.call ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/cli.rb
Ruby
mit
19
develop
3,941
require 'thor' require 'rubygems/config_file' module Daemonizer class CLI < Thor check_unknown_options! method_option :daemonfile, :type => :string, :aliases => "-D", :banner => "Path to Daemonfile" def initialize(*) super Daemonizer.daemonfile = options[:daemonfile] || "Daemonfile" end...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/dsl.rb
Ruby
mit
19
develop
2,671
class Daemonizer::Dsl class DslError < StandardError; end def self.evaluate(daemonfile, daemonfile_name = 'Daemonfile') builder = new builder.instance_eval(daemonfile, daemonfile_name.to_s, 1) builder end def configs @configs end def process result = {} @configs.each do |k,v| ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/worker_pool.rb
Ruby
mit
19
develop
2,210
module Daemonizer class WorkerPool MONITOR_VALUE = [:vm_size, :private_dirty_rss, :rss] attr_reader :name attr_reader :stats def initialize(name, pm, &blk) @name = name @pm = pm @worker_block = blk @workers = [] @stats = ::SimpleStatistics::DataSet.new end def ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/process_manager.rb
Ruby
mit
19
develop
2,487
module Daemonizer class ProcessManager def initialize(config) @shutdown = false @config = config end def start_workers(&blk) raise ArgumentError, "Need a worker block!" unless block_given? Daemonizer.logger.info "starting all workers" @pool = WorkerPool.new(@config.pool, se...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/config.rb
Ruby
mit
19
develop
3,275
module Daemonizer class Config VALID_LOG_LEVELS = [:debug, :info, :warn, :error, :fatal] class ConfigError < StandardError; end attr_reader :pool, :handler def initialize(pool, options) @pool = pool @options = options init_defaults validate initialize_handler @h...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/engine.rb
Ruby
mit
19
develop
2,843
module Daemonizer class Engine attr_reader :config def initialize(config) @config = config Daemonizer.logger_context = "#{Process.pid}/monitor" end def run_callback(callback, *args) if callbacks = @config.callbacks[callback.to_sym] and callbacks.any? Daemonizer.logger.info ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/stats.rb
Ruby
mit
19
develop
8,489
#!/usr/bin/env ruby # Phusion Passenger - http://www.modrails.com/ # Copyright (c) 2008, 2009 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Softwar...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/daemonize.rb
Ruby
mit
19
develop
1,711
module Daemonizer module Daemonize def self.read_pid(pid_file) File.open(pid_file) do |f| f.gets.to_i end rescue Errno::ENOENT 0 end def self.check_pid(pid_file) pid = read_pid(pid_file) return false if pid.zero? if defined?(::JRuby) system "kill -0...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
lib/daemonizer/worker.rb
Ruby
mit
19
develop
2,760
module Daemonizer class Worker attr_reader :name attr_reader :process_name attr_reader :pid def initialize(name, pm, worker_id, &blk) raise ArgumentError, "Need a worker block!" unless block_given? @name = name @pm = pm @worker_block = blk @worker_id = worker_id @...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/spec_helper.rb
Ruby
mit
19
develop
1,039
#$:.unshift File.expand_path('..', __FILE__) $:.unshift File.expand_path('../../lib', __FILE__) require 'daemonizer' require 'fileutils' require 'rubygems' require 'rspec' require 'open3' Dir["#{File.expand_path('support', File.dirname(__FILE__))}/*.rb"].each do |file| require file end $debug = false $show_err ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/common/forking_spec.rb
Ruby
mit
19
develop
732
require "spec_helper" describe "daemonzier after start" do before :each do @pid_files = simple_daemonfile( :name => :test1, :pid_file =>"#{tmp_dir}/test1.pid", :on_start => "loop { sleep 1 }", :workers => 3, :poll_period => 1) daemonizer :star...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/settings/options_spec.rb
Ruby
mit
19
develop
4,130
require "spec_helper" class OptionsSpecHandler < SpecHandler; end describe "set_option in Daemonfile" do it "should initialize simple setting correctly" do Daemonizer::Option.expects(:new).with(:simple, "simple_value").once Daemonizer::Dsl.evaluate(<<-G) pool :test do set_option :simple, "simp...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/settings/pools_spec.rb
Ruby
mit
19
develop
1,209
require "spec_helper" describe "Evaluating pool settings through dsl" do before :each do @dsl = Daemonizer::Dsl.evaluate(<<-EOF) poll_period 10 pool "pool1" do workers 1 not_cow_friendly end pool "pool2" do workers 2 poll_period 2 end EOF @...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/settings/callbacks_spec.rb
Ruby
mit
19
develop
3,189
require "spec_helper" class CallbacksSpecHandler < SpecHandler class <<self attr_accessor :call_on_prepare attr_accessor :call_on_start end def start self.class.call_on_start && self.class.call_on_start.call super end def prepare(starter, &block) self.class.call_on_prepare && self.class...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/cli/started_spec.rb
Ruby
mit
19
develop
2,887
require "spec_helper" describe "with Daemonfile and daemonzier is already started " do before :each do @pid_files = simple_daemonfile({:name => :test1, :pid_file =>"#{tmp_dir}/test1.pid"}, {:name => :test2, :pid_file => "#{tmp_dir}/test2.pid"}) daemonizer "start" end after :each do daemonizer "stop...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/cli/not_started_spec.rb
Ruby
mit
19
develop
3,205
require "spec_helper" describe "with Daemonfile and daemonzier is not started " do before :each do @pid_files = simple_daemonfile({:name => :test1, :pid_file =>"#{tmp_dir}/test1.pid"}, {:name => :test2, :pid_file => "#{tmp_dir}/test2.pid"}) end describe "on call 'stats'" do before(:each) do daemo...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/cli/debugging_spec.rb
Ruby
mit
19
develop
1,008
require "spec_helper" describe "with Daemonfile and daemonzier is in 'debug' mode" do before :each do @pid_files = simple_daemonfile( :name => :test1, :pid_file =>"#{tmp_dir}/test1.pid", :on_prepare => "Daemonizer.logger.info \"test1: executed prepare\"", :on_...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/support/path.rb
Ruby
mit
19
develop
249
module Spec module Path def gem_root File.expand_path('../../..', __FILE__) end def tmp_dir File.join(gem_root, '/tmp') end def app_root File.join(tmp_dir, "application") end extend self end end
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/support/daemonfile_factory.rb
Ruby
mit
19
develop
610
module Spec module DaemonfileFactory def simple_daemonfile(*pools) code = "" pid_files = pools.map do |pool| if pool[:exit_on_start] end code << <<EOF pool :#{pool[:name]} do workers #{pool[:workers] || 1} poll_period #{pool[:poll_period] || 1} log_file "test.log" pid_f...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/support/helpers.rb
Ruby
mit
19
develop
1,667
module Spec module Helpers def reset! kill_if_running! FileUtils.rm_rf(app_root) FileUtils.mkdir_p(app_root) end def in_app_root(&blk) Dir.chdir(app_root, &blk) end def daemonizer(cmd) sys_exec File.join(gem_root, 'bin/daemonizer') + " " + cmd.to_s end def ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/support/processes.rb
Ruby
mit
19
develop
413
module Spec module Processes def children_count(parent_pid) children_pids(parent_pid).count end def children_pids(parent_pid) `ps -lx`.lines.to_a[1..-1].map do |l| _, pid, ppid, = l.lstrip.split(/\s{1,}/) ppid.to_i == parent_pid.to_i ? pid : nil end.compact.uniq end ...
github
glebpom/daemonizer
https://github.com/glebpom/daemonizer
spec/support/ruby_ext.rb
Ruby
mit
19
develop
402
class IO def read_available_bytes(chunk_size = 1024, select_timeout = 5) buffer = [] return "" if closed? || eof? # IO.select cannot be used here due to the fact that it # just does not work on windows while true begin buffer << self.readpartial(chunk_size) sleep 0.1 r...
github
juliancheal/code-extractor
https://github.com/juliancheal/code-extractor
code-extractor.gemspec
Ruby
mit
19
master
1,023
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "code_extractor/version" Gem::Specification.new do |spec| spec.name = "code-extractor" spec.version = CodeExtractor::VERSION spec.authors = ["Julian Cheal"] spec.summary = "Ext...
github
juliancheal/code-extractor
https://github.com/juliancheal/code-extractor
Rakefile
Ruby
mit
19
master
759
# ----------------------------------------------- # # Build # # ----------------------------------------------- # require "rubygems/package_task" code_extractor_gemspec = eval File.read("code-extractor.gemspec") Gem::PackageTask.new(code_extractor_gemspec).define # -------...
github
juliancheal/code-extractor
https://github.com/juliancheal/code-extractor
test/test_helper.rb
Ruby
mit
19
master
7,350
$LOAD_PATH.unshift File.expand_path(File.join("..", "..", "lib"), __FILE__) require 'code_extractor' require 'yaml' require 'fileutils' require 'pathname' require 'rugged' require 'minitest/autorun' TEST_DIR = File.expand_path "..", __FILE__ TEST_SANDBOX = File.join TEST_DIR, "tmp", "sandbox" FileUtils.mkdir_p ...