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
lacostej/apple-dev
https://github.com/lacostej/apple-dev
bin/generate_apple_dev_center_config.rb
Ruby
mit
91
master
1,777
#!/usr/bin/ruby require 'optparse' require 'ostruct' require 'rubygems' require 'encrypted_strings' require 'yaml' # Set default options. opts = OpenStruct.new opts.login = '' opts.password = '' opts.secret_key = '' opts.teamid = '' opts.teamname = '' # Specify options. options = OptionParser.new do |options| optio...
github
lacostej/apple-dev
https://github.com/lacostej/apple-dev
bin/mobileprovisioning.rb
Ruby
mit
91
master
2,610
#!/usr/bin/ruby require 'rubygems' require 'bundler/setup' require 'optparse' require 'yaml' require 'apple-dev' def ensure_file_specified_and_exists(name, file) raise OptionParser::MissingArgument, name if file.nil? raise OptionParser::InvalidArgument, "'#{file}' #{name} file doesn't exists" if not File.exists?(f...
github
lacostej/apple-dev
https://github.com/lacostej/apple-dev
bin/offline_apple_dev_center.rb
Ruby
mit
91
master
430
#!/usr/bin/ruby require 'rubygems' require 'json' file=ARGV[0] type=ARGV[1] name=ARGV[2] json = File.open(file) { |f| JSON f.read } profiles=json['profiles'] ps = profiles.select{ |p| p['type'] == type and p['name'] == name } if ps.nil? || ps.count == 0 puts "No profile found with name '#{name}' and type '#{type}' ...
github
lacostej/apple-dev
https://github.com/lacostej/apple-dev
bin/apple_dev_center.rb
Ruby
mit
91
master
4,247
#!/usr/bin/ruby require 'rubygems' require 'bundler/setup' require 'optparse' require 'yaml' require 'apple-dev' require 'encrypted_strings' INSTALL_DIR = File.dirname($0) USAGE = "Usage: #{File.basename($0)} [-d [DIR]] [-u login] [-p password] [-t teamid] [-O file] [-C config] [-S secret_key] [-n] [-h] [-f filter] [...
github
lacostej/apple-dev
https://github.com/lacostej/apple-dev
xcode/pbxproj_pp_uuid.rb
Ruby
mit
91
master
2,339
#!/usr/bin/env ruby # # A script to get or set the provisioning profile UUID from a XCode .pbxproj files given its configuration name # require 'rubygems' require 'json' require 'logger' require 'optparse' @log=Logger.new(STDOUT) @log.level = Logger::WARN def ensure_file_specified_and_exists(name, file) raise Optio...
github
lacostej/apple-dev
https://github.com/lacostej/apple-dev
lib/apple-dev.rb
Ruby
mit
91
master
13,627
#require "apple-dev/version" require 'mechanize' require 'json' require 'plist' #require 'logger' # Use this to log mechanize. def debug(s) #puts "DEBUG: #{s}" end module Apple module Dev class Profile attr_accessor :uuid, :blob_id, :type, :name, :appid, :status_xcode, :download_url def to_json(*a) { ...
github
alexivkin/Jekyll-Art-Gallery-Plugin
https://github.com/alexivkin/Jekyll-Art-Gallery-Plugin
jekyll-art-gallery-generator.rb
Ruby
mit
91
master
14,936
# Jekyll art gallery generator plugin # Distribiuted under MIT license with attribution # based on https://github.com/ggreer/jekyll-gallery-generator # require 'rmagick' include Magick include FileUtils $image_extensions = [".png", ".jpg", ".jpeg", ".gif"] unless File.respond_to?(:exists?) class << File alias_...
github
WebGents/open_street_map
https://github.com/WebGents/open_street_map
open_street_map.gemspec
Ruby
mit
91
master
1,133
# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'open_street_map/version' Gem::Specification.new do |spec| spec.name = 'open_street_map' spec.version = OpenStreetMap::VERSION spec.authors = ['JungleCoders', 'Anton Bogdanov'...
github
WebGents/open_street_map
https://github.com/WebGents/open_street_map
lib/open_street_map/client.rb
Ruby
mit
91
master
568
# frozen_string_literal: true require 'httparty' require_relative 'client/request' module OpenStreetMap class Client include HTTParty include OpenStreetMap::Client::Request BASE_URI = 'https://nominatim.openstreetmap.org/' DEFAULT_USER_AGENT = "webgents/open_street_map_gem_#{SecureRandom.urlsafe_ba...
github
WebGents/open_street_map
https://github.com/WebGents/open_street_map
lib/open_street_map/client/request.rb
Ruby
mit
91
master
1,291
# frozen_string_literal: true module OpenStreetMap class Client module Request private # make request to API def call(type, args) url = hostname(args[:hostname]) + type headers = { 'User-Agent' => user_agent(args[:user_agent]) } self.class.get(url, query: generate_body(...
github
WebGents/open_street_map
https://github.com/WebGents/open_street_map
spec/spec_helper.rb
Ruby
mit
91
master
402
# frozen_string_literal: true require 'bundler/setup' require 'open_street_map' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monk...
github
WebGents/open_street_map
https://github.com/WebGents/open_street_map
spec/open_street_map/client/client_spec.rb
Ruby
mit
91
master
2,048
# frozen_string_literal: true RSpec.describe OpenStreetMap::Client do describe '.search' do let(:client) { OpenStreetMap::Client.new } context 'for bad request' do context 'for bad params' do it 'returns hash with error message' do expect(client.search).to_not eq('errors' => 'Bad req...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
cfer.gemspec
Ruby
mit
91
master
1,555
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'cfer/version' Gem::Specification.new do |spec| spec.name = 'cfer' spec.version = Cfer::VERSION spec.authors = ['Sean Edwards'] spec.email = ['stedwards87+cfer...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
Gemfile
Ruby
mit
91
master
261
source 'https://rubygems.org' # Specify your gem's dependencies in cfer.gemspec gemspec group :test do gem 'rspec' gem 'rspec-mocks' gem 'guard-rspec' end group :debug do gem 'pry' gem 'pry-byebug' gem 'pry-rescue' gem 'pry-stack_explorer' end
github
seanedwards/cfer
https://github.com/seanedwards/cfer
examples/vpc.rb
Ruby
mit
91
master
3,873
description 'Stack template for a simple example VPC' # This template creates the following resources for a basic beginning AWS VPC setup: # # 1) A VPC # 2) A route table to control network routing # 3) An Internet gateway to route traffic to the public internet # 4) 3 subnets, one in each of the account's first 3 ava...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
examples/instance.rb
Ruby
mit
91
master
1,756
description 'Example stack template for a small EC2 instance' # NOTE: This template depends on vpc.rb # You can use the `include_template` function to include other ruby files into this Cloudformation template. include_template 'common/instance_deps.rb' # We can define extensions to resources, which extend the basic...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
examples/common/instance_deps.rb
Ruby
mit
91
master
1,386
# By not specifying a default value, a parameter becomes required. # Specify this parameter by adding `--parameters KeyName:<ec2-keyname>` to your CLI options. parameter :KeyName # We define some more parameters the same way we did in the VPC template. # Cfer will fetch the output values from the `vpc` stack we create...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/cfer_spec.rb
Ruby
mit
91
master
6,129
require 'spec_helper' describe Cfer do it 'sets descriptions' do stack = create_stack do description 'test stack' end expect(stack).to have_key :Description expect(stack[:Description]).to eq('test stack') end it 'reads templates from files' do stack = Cfer::stack_from_file('spec/supp...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/cfn_spec.rb
Ruby
mit
91
master
4,994
require 'spec_helper' describe Cfer::Cfn::Client do it 'creates stacks' do stack = create_stack parameters: {:key => 'value'}, fetch_stack: true, times: 2 do parameter :key end cfn = stack.client expect(cfn).to receive(:validate_template) .exactly(1).times .with({template_body: st...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/fn_spec.rb
Ruby
mit
91
master
4,850
require 'spec_helper' FUNCTIONS = Cfer::Core::Functions describe Cfer::Core::Functions do it 'has a working join function' do expect(FUNCTIONS::Fn::join('-', ['a', 'b', 'c'])).to eq 'Fn::Join' => ['-', ['a', 'b', 'c']] expect(FUNCTIONS::Fn.join('-', ['a', 'b', 'c'])).to eq 'Fn::Join' => ['-', ['a', 'b', 'c...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/client_spec.rb
Ruby
mit
91
master
569
require 'spec_helper' describe Cfer::Cfn::Client do it 'fetches parameters' do stack = create_stack { } cfn = stack.client expect(cfn.fetch_parameters).to eq('parameter' => 'param_value', 'unchanged_key' => 'unchanged_value') expect(cfn.fetch_outputs).to eq('value' => 'remote_value') expect(cf...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/spec_helper.rb
Ruby
mit
91
master
1,559
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'pp' require 'aws-sdk-cloudformation' require 'pry' rescue nil Aws.config[:stub_responses] = true def create_stack(options = {}, &block) cfn = options[:client] || Cfer::Cfn::Client.new(stack_name: options[:stack_name] || 'test', region: 'us-east-1')...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
spec/extensions_spec.rb
Ruby
mit
91
master
4,115
require 'spec_helper' Cfer::Core::Resource.extend_resource 'Cfer::CustomResource' do def test_value(val) properties TestValue: val properties TestValue2: val end end Cfer::Core::Resource.before 'Cfer::CustomResource', nice: 10 do properties BeforeValue2: get_property(:BeforeValue) end Cfer::Core::Resou...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer.rb
Ruby
mit
91
master
11,709
require 'active_support/all' require 'aws-sdk-cloudformation' require 'aws-sdk-s3' require 'logger' require 'json' require 'preconditions' require 'rainbow' # Contains extensions that Cfer will dynamically use module CferExt module AWS end end # Contains the core Cfer logic module Cfer DEBUG = false unless def...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/block.rb
Ruby
mit
91
master
3,000
require 'docile' require 'json' require 'yaml' module Cfer # Represents the base class of a Cfer DSL class Block < ActiveSupport::HashWithIndifferentAccess # Evaluates a DSL directly from a Ruby block, calling pre- and post- hooks. # @param args [Array<Object>] Extra arguments to be passed into the block. ...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/console.rb
Ruby
mit
91
master
366
require "pry" require "pry-rescue" module Cfer DEBUG = true end require "cfer/cli" Cfer::LOGGER.level = Logger::DEBUG Cfer::LOGGER.fatal "Showing FATAL logs" Cfer::LOGGER.error "Showing ERROR logs" Cfer::LOGGER.warn "Showing WARN logs" Cfer::LOGGER.info "Showing INFO logs" Cfer::LOGGER.debug "Showing DEBUG logs" ...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/config.rb
Ruby
mit
91
master
1,174
module Cfer class Config < BlockHash def initialize(file = nil, options = nil, &block) @config_file = file deep_merge! options if options instance_eval &block if block end def method_missing(method_sym, *arguments, &block) key = camelize_property(method_sym) case arguments.s...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/cli.rb
Ruby
mit
91
master
7,690
require 'cfer' require 'cri' require 'rainbow' require 'table_print' module Cfer module Cli CFER_CLI = Cri::Command.define do name 'cfer' description 'Toolkit and Ruby DSL for automating infrastructure using AWS CloudFormation' flag nil, 'verbose', 'Runs Cfer with debug output enabled' o...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/core/resource.rb
Ruby
mit
91
master
3,009
module Cfer::Core class Resource < Cfer::BlockHash include Cfer::Core::Hooks class Handle attr_reader :name def initialize(name) @name = name.to_s end def ref Functions::Fn::ref(name) end def method_missing(method) Functions::Fn::get_att(name, met...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/core/hooks.rb
Ruby
mit
91
master
969
module Cfer::Core # Provides support for hooking into resource types, and evaluating code before or after properties are set module Hooks def pre_block eval_hooks self.class.pre_hooks end def post_block eval_hooks self.class.post_hooks end private def eval_hooks(hooks) hooks....
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/core/functions.rb
Ruby
mit
91
master
1,536
# Utility methods to make CloudFormation functions feel more like Ruby module Cfer::Core::Functions def join(sep, *args) {"Fn::Join" => [sep, [ *args ].flatten ]} end def ref(r) {"Ref" => r} end def get_att(r, att) {"Fn::GetAtt" => [r, att]} end def find_in_map(map_name, key1, key2) {"F...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/core/client.rb
Ruby
mit
91
master
472
require 'git' module Cfer::Core class Client attr_reader :git def initialize(options) path = options[:working_directory] || '.' if File.exist?("#{path}/.git") @git = Git.open(path) rescue nil end end def converge raise Cfer::Util::CferError, 'converge not implemented...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/core/stack.rb
Ruby
mit
91
master
8,564
module Cfer::Core # Defines the structure of a CloudFormation stack class Stack < Cfer::Block include Cfer::Core::Functions include Cfer::Core::Hooks # The parameters strictly as passed via command line attr_reader :input_parameters # The fully resolved parameters, including defaults and para...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/cfn/client.rb
Ruby
mit
91
master
12,292
require_relative '../core/client' require 'uri' module Cfer::Cfn class Client < Cfer::Core::Client attr_reader :name attr_reader :stack def initialize(options) super(options) @name = options[:stack_name] @options = options @options.delete :stack_name @cfn = Aws::CloudForma...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/cfn/cfer_credentials_provider.rb
Ruby
mit
91
master
2,140
require 'yaml' module Cfer module Cfn class CferCredentialsProvider < Aws::SharedCredentials private def load_from_path profile = load_profile credentials = Aws::Credentials.new( profile['aws_access_key_id'], profile['aws_secret_access_key'], profile['aw...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/util/error.rb
Ruby
mit
91
master
838
module Cfer::Util require 'highline/import' class CferError < StandardError end class CferValidationError < CferError attr_reader :errors def initialize(errors) @errors = errors super(errors) end end class StackExistsError < CferError end class StackDoesNotExistError < CferErr...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cfer/util/json.rb
Ruby
mit
91
master
1,278
require 'rainbow' require 'json' module Cfer::Util::Json class << self QUOTE = '"' LBRACE = Rainbow('{').green RBRACE = Rainbow('}').green LBRACKET = Rainbow('[').green RBRACKET = Rainbow(']').green COLON = Rainbow(': ').green def format_json(item) case item when Hash format_hash(item) ...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cferext/aws/iam/policy_generator.rb
Ruby
mit
91
master
1,547
require 'docile' module CferExt module AWS module IAM class PolicyGenerator < Cfer::Block def initialize self[:Version] = '2012-10-17' self[:Statement] = [] end def statement(**options, &block) statement = ::Cfer::BlockHash.new(&block) statem...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cferext/aws/iam/policy.rb
Ruby
mit
91
master
865
require 'cferext/aws/iam/policy_generator' Cfer::Core::Resource.extend_resource "AWS::IAM::ManagedPolicy" do include CferExt::AWS::IAM::WithPolicyDocument end Cfer::Core::Resource.extend_resource "AWS::IAM::User" do include CferExt::AWS::IAM::WithPolicies end Cfer::Core::Resource.extend_resource "AWS::IAM::Group...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cferext/aws/kms/key.rb
Ruby
mit
91
master
202
Cfer::Core::Resource.extend_resource "AWS::KMS::Key" do def key_policy(doc = nil, &block) doc = CferExt::AWS::IAM.generate_policy(&block) if doc == nil properties :KeyPolicy => doc end end
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cferext/aws/route53/record_dsl.rb
Ruby
mit
91
master
398
require 'docile' Cfer::Core::Resource.extend_resource "AWS::Route53::RecordSetGroup" do %w{a aaaa cname mx ns ptr soa spf srv txt}.each do |type| define_method type.to_sym do |name, records, options = {}| self[:Properties][:RecordSets] ||= [] self[:Properties][:RecordSets] << options.merge(Type: type...
github
seanedwards/cfer
https://github.com/seanedwards/cfer
lib/cferext/cfer/stack_validation.rb
Ruby
mit
91
master
1,280
Cfer::Core::Stack.extend_stack do def validate_stack!(hash) errors = [] context = [] _inner_validate_stack!(hash, errors, context) raise Cfer::Util::CferValidationError, errors unless errors.empty? end def _inner_validate_stack!(hash, errors = [], context = []) case hash when Hash ...
github
queso/sitemap
https://github.com/queso/sitemap
Rakefile
Ruby
mit
91
master
541
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the sitemap plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the sitemap plugin.' Rake:...
github
queso/sitemap
https://github.com/queso/sitemap
init.rb
Ruby
mit
91
master
410
require 'sitemap' require 'sitemap_fu' ActiveRecord::Base.class_eval do include Queso::Acts::Sitemap end # SitemapsController.view_paths = [File.join(directory, 'app/views')] # SitemapSettingsController.view_paths = [File.join(directory, 'app/views')] # SitemapWidgetsController.view_paths = [File.join(directory, 'ap...
github
queso/sitemap
https://github.com/queso/sitemap
generators/sitemap_migration/sitemap_migration_generator.rb
Ruby
mit
91
master
373
class SitemapMigrationGenerator < Rails::Generator::NamedBase attr_reader :sitemap_table_name def initialize(runtime_args, runtime_options = {}) @sitemap_table_name = 'sitemap' runtime_args << 'add_sitemap_table' if runtime_args.empty? super end def manifest record do |m| m.migration_temp...
github
queso/sitemap
https://github.com/queso/sitemap
generators/sitemap_migration/templates/migration.rb
Ruby
mit
91
master
1,055
class <%= class_name %> < ActiveRecord::Migration def self.up create_table "<%= sitemap_table_name %>_settings", :force => true do |t| t.string :name t.string :description t.string :xml_location t.string :username t.string :password t.boolean :use_index t.timestamps ...
github
queso/sitemap
https://github.com/queso/sitemap
lib/sitemap_fu.rb
Ruby
mit
91
master
846
module Queso module Acts module Sitemap def self.included(base) base.extend ClassMethods end module ClassMethods def has_sitemap after_save :ping_all_search_engines include Queso::Acts::Sitemap::InstanceMethods end ...
github
queso/sitemap
https://github.com/queso/sitemap
config/routes.rb
Ruby
mit
91
master
281
ActionController::Routing::Routes.draw do |map| map.resource :sitemap map.resources :sitemap_settings map.resources :sitemap_widgets map.resources :sitemap_static_links map.individual_sitemap "/sitemap/:id.:format", :controller => "sitemaps", :action => "show_widget" end
github
queso/sitemap
https://github.com/queso/sitemap
app/models/sitemap_widget.rb
Ruby
mit
91
master
650
class SitemapWidget < ActiveRecord::Base def self.priorities [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] end def self.frequencies [["Always", "always"], ["Daily", "daily"], ["Weekly", "weekly"], ["Monthly", "monthly"], ["Yearly", "yearly"]] end def find_children(options = {}) @finder...
github
queso/sitemap
https://github.com/queso/sitemap
app/views/sitemaps/show.xml.builder
Ruby
mit
91
master
1,410
xml.instruct! :"xml-stylesheet", :type=>"text/xsl", :href=>"sitemap.xsl" xml.urlset "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation" => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd", "xmlns" => "http://www.sitemaps.org/schemas/si...
github
queso/sitemap
https://github.com/queso/sitemap
app/views/sitemaps/show_widget.xml.builder
Ruby
mit
91
master
819
xml.instruct! :"xml-stylesheet", :type=>"text/xsl", :href=>"/sitemap/sitemap.xsl" xml.urlset "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation" => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd", "xmlns" => "http://www.sitemaps.org/s...
github
queso/sitemap
https://github.com/queso/sitemap
app/views/sitemaps/index.xml.builder
Ruby
mit
91
master
718
xml.instruct! :"xml-stylesheet", :type=>"text/xsl", :href=>"sitemap.xsl" xml.sitemapindex "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation" => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd", "xmlns" => "http://www.sitemaps.org/sche...
github
queso/sitemap
https://github.com/queso/sitemap
app/controllers/sitemap_plugin_controller.rb
Ruby
mit
91
master
444
class SitemapPluginController < ApplicationController unloadable layout 'sitemap_plugin' before_filter :check_sitemap_auth def check_sitemap_auth settings = SitemapSetting.find(:first) return unless settings && (!settings.username.blank? && !settings.password.blank?) authenticate_or_request_with_...
github
queso/sitemap
https://github.com/queso/sitemap
app/controllers/sitemap_widgets_controller.rb
Ruby
mit
91
master
724
class SitemapWidgetsController < SitemapPluginController unloadable before_filter :find_widget, :only => [:edit, :update, :destroy] def index @widgets = SitemapWidget.find(:all) end def edit end def update if @widget.update_attributes(params[:sitemap_widget]) redirect_to sitemap_wid...
github
queso/sitemap
https://github.com/queso/sitemap
app/controllers/sitemap_static_links_controller.rb
Ruby
mit
91
master
819
class SitemapStaticLinksController < SitemapPluginController unloadable before_filter :find_static_link, :only => [:edit, :update, :destroy] def index @static_links = SitemapStaticLink.find(:all) end def edit end def update if @static_link.update_attributes(params[:sitemap_static_lin...
github
queso/sitemap
https://github.com/queso/sitemap
app/controllers/sitemap_settings_controller.rb
Ruby
mit
91
master
417
class SitemapSettingsController < SitemapPluginController unloadable def index @settings = SitemapSetting.find(:first) || SitemapSetting.create() end def update @settings = SitemapSetting.find(:first) if @settings.update_attributes(params[:sitemap_setting]) redirect_to sitemap_settings_url...
github
queso/sitemap
https://github.com/queso/sitemap
app/controllers/sitemaps_controller.rb
Ruby
mit
91
master
826
class SitemapsController < ActionController::Base unloadable def show @rendering_start_time = Time.now @widgets = SitemapWidget.find(:all) @site = SitemapSetting.find(:first) @static_links = SitemapStaticLink.find(:all) respond_to do |format| format.html format.xml do if @...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
validates_formatting_of.gemspec
Ruby
mit
91
master
1,060
# -*- encoding: utf-8 -*- require File.expand_path('../lib/validates_formatting_of/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Matt Bridges"] gem.email = ["mbridges.91@gmail.com"] gem.description = %q{Common Rails validations wrapped in a gem.} gem.summary = %q{Add...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of.rb
Ruby
mit
91
master
236
require "validates_formatting_of/version" require "validates_formatting_of/method" require "validates_formatting_of/validator" require "validates_formatting_of/model_additions" require "validates_formatting_of/railtie" if defined? Rails
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/model_additions.rb
Ruby
mit
91
master
1,055
require 'active_support/core_ext/hash/reverse_merge' module ValidatesFormattingOf module ModelAdditions # Using validates_formatting_of is as simple as using Rails' built-in # validation methods in models. # # class User < ActiveRecord::Base # validates_formatting_of :email, :using => :email ...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/method.rb
Ruby
mit
91
master
2,454
require 'validates_formatting_of/validation' require 'validates_formatting_of/validation_addition' module ValidatesFormattingOf module Method extend ValidationAddition # This method is very close to allowing what is specified in RFC 5322 and RFC 5321 add :email, %r{\A([^@\s]+)@((?:(?!-)[-a-z0-9]+(?<!-)...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/validation.rb
Ruby
mit
91
master
747
module ValidatesFormattingOf class InvalidRegularExpression < StandardError def initialize(name) super("You must specify a Regexp, a proc, or a lambda for the #{name.inspect} validation.") end end class Validation attr_reader :name, :regex, :message def initialize(name, regexp, message = ...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/validation_addition.rb
Ruby
mit
91
master
769
require 'active_support/core_ext/object/blank' module ValidatesFormattingOf class MissingValidation < StandardError def initialize(method) super("The validation method #{method.to_sym.inspect} has not been defined.") end end module ValidationAddition attr_reader :validations def add(name...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/validator.rb
Ruby
mit
91
master
882
require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/string' require 'active_support/concern' require 'active_model/validator' require 'active_model/validations' module ValidatesFormattingOf module Validations class Validator < ActiveModel::Validations::FormatValidator def...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
lib/validates_formatting_of/railtie.rb
Ruby
mit
91
master
408
# Extend ActiveRecord's methods module ValidatesFormattingOf class Railtie < Rails::Railtie initializer 'validates_formatting_of.model_additions' do ActiveSupport.on_load :active_record do extend ModelAdditions end end initializer 'validates_formatting_of.validations' do ActiveS...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
spec/spec_helper.rb
Ruby
mit
91
master
631
require 'simplecov' if ENV["RUN_SIMPLECOV"] == 'true' SimpleCov.start do load_adapter 'test_frameworks' end end RSpec.configure do |config| config.disable_monkey_patching! end require 'validates_formatting_of' require 'active_model' class TestActiveRecord include ActiveModel::Validations include Vali...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
spec/validates_formatting_of/validation_addition_spec.rb
Ruby
mit
91
master
1,853
require 'validates_formatting_of/validation_addition' require 'its' module ValidatesFormattingOf class TestAdding extend ValidationAddition def self.clear! @validations = nil end end RSpec.describe ValidationAddition do before do TestAdding.clear! TestAdding.add :email, /email...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
spec/validates_formatting_of/validation_spec.rb
Ruby
mit
91
master
1,407
require 'validates_formatting_of/validation' require 'its' module ValidatesFormattingOf RSpec.describe Validation do context "valid validation creation" do let(:validation) { Validation.new(:name, /something/i, "is an invalid value") } subject { validation } its(:name) { is_expected.to eq(:nam...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
spec/validates_formatting_of/validator_spec.rb
Ruby
mit
91
master
13,075
require 'spec_helper' RSpec.describe ValidatesFormattingOf::Validations do describe "with 'sexy' validation style" do describe "email" do class Email < TestActiveRecord attr_accessor :email validates :email, :email => true end it "validates that the email provided is valid" do...
github
mdespuits/validates_formatting_of
https://github.com/mdespuits/validates_formatting_of
spec/validates_formatting_of/model_additions_spec.rb
Ruby
mit
91
master
12,755
require 'spec_helper' RSpec.describe ValidatesFormattingOf::ModelAdditions do describe "email" do class Email < TestActiveRecord attr_accessor :email validates_formatting_of :email end it "validates that the email provided is valid" do expect(Email.new(:email => "example@example.com"))...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
apple_auth.gemspec
Ruby
mit
91
master
2,002
# frozen_string_literal: true require_relative 'lib/apple_auth/base/version' Gem::Specification.new do |spec| spec.name = 'apple_auth' spec.version = AppleAuth::Base::VERSION spec.authors = ['Timothy Peraza, Antonieta Alvarez, Martín Morón'] spec.email = ['timothy@rootstrap.com, a...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/user_identity_spec.rb
Ruby
mit
91
master
2,247
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth::UserIdentity do let(:jwt_sub) { user_identity } let(:jwt_iss) { 'https://appleid.apple.com' } let(:jwt_aud) { 'com.apple_sign_in' } let(:jwt_iat) { Time.now } let(:jwt_exp) { jwt_iat + 5.minutes } let(:private_key) { OpenSSL::PK...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/token_spec.rb
Ruby
mit
91
master
1,810
# frozen_string_literal: true require 'ostruct' RSpec.describe AppleAuth::Token do subject(:token_service) { described_class.new(code) } context '#authenticate!' do context 'when parameters are valid' do let(:code) { 'valid_code' } before do AppleAuth.config.apple_client_id = 'client_id'...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/spec_helper.rb
Ruby
mit
91
master
598
# frozen_string_literal: true require 'rspec' require 'action_controller/railtie' require 'generator_spec' require 'bundler/setup' require 'webmock/rspec' require 'simplecov' SimpleCov.start do add_filter '/spec/' end require './lib/apple_auth' require 'apple_auth/base' RSpec.configure do |config| # Enable fla...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/server_identity_spec.rb
Ruby
mit
91
master
2,266
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth::ServerIdentity do let(:jwt_iss) { 'https://appleid.apple.com' } let(:jwt_aud) { 'com.apple_sign_in' } let(:jwt_iat) { Time.now.to_i } let(:private_key) { OpenSSL::PKey::RSA.generate(2048) } let(:jwk) { JWT::JWK.new(private_key) } ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/config_spec.rb
Ruby
mit
91
master
1,609
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth do let(:apple_client_id) { 'mocked_client_id' } let(:apple_private_key) { 'mocked_private_key' } let(:apple_key_id) { 'mocked_key_id' } let(:apple_team_id) { 'mocked_team_id' } let(:redirect_uri) { 'https://example.com/redirect_uri...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/helpers/jwt_server_conditions_spec.rb
Ruby
mit
91
master
2,357
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth::JWTServerConditions do let(:jwt_sub) { '820417.faa325acbc78e1be1668ba852d492d8a.0219' } let(:jwt_iss) { 'https://appleid.apple.com' } let(:jwt_aud) { 'com.apple_auth' } let(:jwt_iat) { Time.now.to_i } let(:jwt) do { iss:...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/helpers/jwt_conditions_spec.rb
Ruby
mit
91
master
3,195
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth::JWTConditions do let(:user_identity) { '1234.5678.910' } let(:jwt_sub) { user_identity } let(:jwt_iss) { 'https://appleid.apple.com' } let(:jwt_aud) { 'com.apple_auth' } let(:jwt_iat) { Time.now.to_i } let(:jwt_exp) { (jwt_iat +...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/generators/config_generator_spec.rb
Ruby
mit
91
master
323
# frozen_string_literal: true require 'spec_helper' RSpec.describe AppleAuth::Generators::ConfigGenerator, type: :generator do destination File.expand_path('tmp', __dir__) it 'creates the config file' do run_generator expect(File).to exist('spec/generators/tmp/config/initializers/apple_auth.rb') end e...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
spec/generators/apple_auth_controller_spec.rb
Ruby
mit
91
master
367
# frozen_string_literal: true RSpec.describe AppleAuth::Generators::AppleAuthControllerGenerator, type: :generator do destination File.expand_path('tmp', __dir__) before do prepare_destination end it 'creates the controller file' do run_generator expect(File).to exist('spec/generators/tmp/app/co...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth.rb
Ruby
mit
91
master
907
# frozen_string_literal: true # Rails Core require 'active_support/core_ext/hash' require 'rails/generators' # Ruby Core require 'base64' require 'json' require 'net/http' # Gems require 'jwt' require 'oauth2' # Files require 'apple_auth/config' require 'apple_auth/helpers/conditions/jwt_validation_error' require ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/generators/apple_auth/config/config_generator.rb
Ruby
mit
91
master
300
# frozen_string_literal: true module AppleAuth module Generators class ConfigGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) def copy_config_file copy_file 'config.rb', 'config/initializers/apple_auth.rb' end end end end
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/generators/apple_auth/config/templates/config.rb
Ruby
mit
91
master
379
# frozen_string_literal: true AppleAuth.configure do |config| # config.apple_client_id = <Your client_id in your Apple Developer account> # config.apple_private_key = <Your private key provided by Apple> # config.apple_key_id = <Your kid provided by Apple> # config.apple_team_id = <Your team id provided by App...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/generators/apple_auth/apple_auth_controller/apple_auth_controller_generator.rb
Ruby
mit
91
master
485
# frozen_string_literal: true module AppleAuth module Generators class AppleAuthControllerGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) argument :scope, required: false, default: '' def copy_apple_auth_controller_file @scope_prefix = scope.blank...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/generators/apple_auth/apple_auth_controller/templates/apple_auth_controller.rb
Ruby
mit
91
master
1,976
# frozen_string_literal: true class <%= @scope_prefix %>AppleAuthController < DeviseTokenAuth::SessionsController protect_from_forgery with: :null_session skip_before_action :verify_authenticity_token before_action :skip_session_storage before_action :check_json_request def create apple_params = apple_v...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/config.rb
Ruby
mit
91
master
377
# frozen_string_literal: true module AppleAuth class << self def configure yield config end def reset_configuration @config = Config.new end def config @config ||= Config.new end end class Config attr_accessor :apple_client_id, :apple_private_key, :apple_key_id, ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/user_identity.rb
Ruby
mit
91
master
384
# frozen_string_literal: true module AppleAuth class UserIdentity attr_reader :user_identity, :jwt def initialize(user_identity, jwt) @user_identity = user_identity @jwt = jwt end def validate! token_data = JWTDecoder.new(jwt).call JWTConditions.new(user_identity, token_dat...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/server_identity.rb
Ruby
mit
91
master
309
# frozen_string_literal: true module AppleAuth class ServerIdentity attr_reader :jwt def initialize(jwt) @jwt = jwt end def validate! token_data = JWTDecoder.new(jwt).call JWTServerConditions.new(token_data).validate! token_data.symbolize_keys end end end
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/token.rb
Ruby
mit
91
master
2,292
# frozen_string_literal: true module AppleAuth class Token APPLE_AUD = 'https://appleid.apple.com' APPLE_CONFIG = AppleAuth.config APPLE_CODE_TYPE = 'authorization_code' APPLE_ALG = 'ES256' def initialize(code) @code = code end # :reek:FeatureEnvy def authenticate! acces...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/jwt_decoder.rb
Ruby
mit
91
master
860
# frozen_string_literal: false module AppleAuth class JWTDecoder APPLE_KEY_URL = 'https://appleid.apple.com/auth/keys'.freeze attr_reader :jwt def initialize(jwt) @jwt = jwt end def call decoded.first end private def decoded key_hash = apple_key_hash(jwt) ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/jwt_server_conditions.rb
Ruby
mit
91
master
716
# frozen_string_literal: false module AppleAuth class JWTServerConditions include Conditions CONDITIONS = [ AudCondition, IatCondition, IssCondition ].freeze attr_reader :decoded_jwt def initialize(decoded_jwt) @decoded_jwt = decoded_jwt end def validate! ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/jwt_conditions.rb
Ruby
mit
91
master
969
# frozen_string_literal: false module AppleAuth class JWTConditions include Conditions CONDITIONS = [ AudCondition, ExpCondition, IatCondition, IssCondition ].freeze attr_reader :user_identity, :decoded_jwt def initialize(user_identity, decoded_jwt) @user_identity...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/conditions/aud_condition.rb
Ruby
mit
91
master
343
# frozen_string_literal: true module AppleAuth module Conditions class AudCondition def initialize(jwt) @aud = jwt['aud'] end def validate! return true if @aud == AppleAuth.config.apple_client_id raise JWTValidationError, 'jwt_aud is different to apple_client_id' ...
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/conditions/exp_condition.rb
Ruby
mit
91
master
304
# frozen_string_literal: true module AppleAuth module Conditions class ExpCondition def initialize(jwt) @exp = jwt['exp'].to_i end def validate! return true if @exp > Time.now.to_i raise JWTValidationError, 'Expired jwt_exp' end end end end
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/conditions/iat_condition.rb
Ruby
mit
91
master
317
# frozen_string_literal: true module AppleAuth module Conditions class IatCondition def initialize(jwt) @iat = jwt['iat'].to_i end def validate! return true if @iat <= Time.now.to_i raise JWTValidationError, 'jwt_iat is greater than now' end end end end
github
rootstrap/apple_auth
https://github.com/rootstrap/apple_auth
lib/apple_auth/helpers/conditions/iss_condition.rb
Ruby
mit
91
master
368
# frozen_string_literal: true module AppleAuth module Conditions class IssCondition APPLE_ISS = 'https://appleid.apple.com' def initialize(jwt) @iss = jwt['iss'] end def validate! return true if @iss.include?(APPLE_ISS) raise JWTValidationError, 'jwt_iss is diff...
github
civiccc/buffet
https://github.com/civiccc/buffet
buffet.gemspec
Ruby
mit
91
master
861
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'buffet/version' Gem::Specification.new do |s| s.name = 'buffet' s.version = Buffet::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Causes Engineering'] s.email = ['eng@causes.com', 'grant@causes.co...
github
civiccc/buffet
https://github.com/civiccc/buffet
lib/buffet.rb
Ruby
mit
91
master
1,677
require 'fileutils' require 'find' require 'logger' require 'pathname' module Buffet autoload :CommandRunner, 'buffet/command_runner' autoload :Master, 'buffet/master' autoload :Project, 'buffet/project' autoload :Runner, 'buffet/runner' autoload :Settings, 'buffet/settings' autoload :Slave, 'buffet/slave'...
github
civiccc/buffet
https://github.com/civiccc/buffet
lib/buffet/project.rb
Ruby
mit
91
master
505
module Buffet class Project attr_accessor :name attr_reader :directory def initialize directory @name = File.basename directory @directory = File.expand_path directory end def directory_on_slave "#{Buffet.workspace_dir}/#{name}" end def support_dir_on_slave "#{...
github
civiccc/buffet
https://github.com/civiccc/buffet
lib/buffet/command_runner.rb
Ruby
mit
91
master
523
require 'logger' require 'wopen3' module Buffet class CommandRunner def initialize logger = Logger.new(STDOUT) @logger = logger end def run *command start_time = Time.now result = Wopen3.system *command end_time = Time.now @logger.info "\n" + "command: #{command.joi...