Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Update thank_you page attributes correctly
class UpdateLinkUrlOnPagesFromInquiriesNewToContact < ActiveRecord::Migration def self.up Page.find_all_by_link_url('/inquiries/new').each do |page| page.update_attributes({ :link_url => '/contact', :menu_match => "^/(inquiries|contact).*$" }) end Page.find_all_by_menu_match('^...
class UpdateLinkUrlOnPagesFromInquiriesNewToContact < ActiveRecord::Migration def self.up Page.find_all_by_link_url('/inquiries/new').each do |page| page.update_attributes({ :link_url => '/contact', :menu_match => "^/(inquiries|contact).*$" }) end Page.find_all_by_menu_match('^...
Add parens to auth methods
class ApplicationController < ActionController::API #protect_from_forgery with: :null_session before_action :authenticate_user_from_token!, except: [:preflight] respond_to :json def preflight render nothing: true end def authenticate_user_from_token! auth_token = request.headers['Authorization']...
class ApplicationController < ActionController::API #protect_from_forgery with: :null_session before_action :authenticate_user_from_token!, except: [:preflight] respond_to :json def preflight render nothing: true end def authenticate_user_from_token! auth_token = request.headers['Authorization']...
Fix bug: uninitialized constant Util (NameError)
require 'chrono' require 'addressable' require 'aws-sdk' require 'retryable' require 'faraday' require 'html/pipeline' require "kuroko2/engine" require "kuroko2/configuration" module Kuroko2 class << self def logger @logger ||= defined?(Rails) && Rails.env.test? ? Rails.logger : Util::Logger.new($stdout) ...
require 'chrono' require 'addressable' require 'aws-sdk' require 'retryable' require 'faraday' require 'html/pipeline' require "kuroko2/engine" require "kuroko2/configuration" require "kuroko2/util/logger" module Kuroko2 class << self def logger @logger ||= defined?(Rails) && Rails.env.test? ? Rails.logge...
Disable Metrics/MethodLength cop for Airport initializer
module Airports class Airport attr_reader :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :timezone, :dst, :tz_name def initialize(name:, city:, country:, iata:, icao:, latitude:, longitude:, altitude:, timezone:, dst:, tz_name:) @name = name ...
module Airports class Airport attr_reader :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :timezone, :dst, :tz_name # rubocop:disable Metrics/MethodLength def initialize(name:, city:, country:, iata:, icao:, latitude:, longitude:, altitude:, time...
Add missing bracket in the oozie cookbook that failed the ruby check and switch to strings
# # Cookbook Name:: Oozie # Attribute:: default # Author:: Robert Towne(<robert.towne@webtrends.com>) # # Copyright 2012, Webtrends Inc. # # hive cluster attributes default[:oozie][:default][:path] = '/usr/share/oozie' default[:oozie[:default][:version] = '3.2.0' default[:oozie][:default][:download_url] = 'http://rep...
# # Cookbook Name:: Oozie # Attribute:: default # Author:: Robert Towne(<robert.towne@webtrends.com>) # # Copyright 2012, Webtrends Inc. # # hive cluster attributes default['oozie']['default']['path'] = '/usr/share/oozie' default['oozie']['default']['version'] = '3.2.0' default['oozie']['default']['download_url'] = '...
Use the indicative mood consistently
# frozen_string_literal: true module ActiveStorage module Downloading private # Opens a new tempfile and copies blob data into it. Yields the tempfile. def download_blob_to_tempfile # :doc: Tempfile.open("ActiveStorage") do |file| download_blob_to file yield file e...
# frozen_string_literal: true module ActiveStorage module Downloading private # Opens a new tempfile and copies blob data into it. Yields the tempfile. def download_blob_to_tempfile # :doc: Tempfile.open("ActiveStorage") do |file| download_blob_to file yield file e...
Use separate DISPLAY for xvfb-run
describe 'xserver installation' do describe command('Xorg -version') do its(:exit_status) { should eq 0 } end describe command('DISPLAY=:99.0 xset -q') do its(:stdout) { should match(/^Keyboard Control:/) } its(:exit_status) { should eq 0 } end describe command('DISPLAY=:99.0 xvfb-run xdpyinfo')...
describe 'xserver installation' do describe command('Xorg -version') do its(:exit_status) { should eq 0 } end describe command('DISPLAY=:99.0 xset -q') do its(:stdout) { should match(/^Keyboard Control:/) } its(:exit_status) { should eq 0 } end describe command('DISPLAY=:98.0 xvfb-run xdpyinfo')...
Test no warnings are printed on startup
describe 'Squid server' do it 'is listening on port 3128' do expect(port(3128)).to be_listening end end
describe 'Squid server' do it 'is listening on port 3128' do expect(port(3128)).to be_listening end end squid_syntax_check = 'sudo squid -k parse' if os[:family] == 'debian' squid_syntax_check = 'sudo squid3 -k parse' end describe command(squid_syntax_check) do its('exit_status') { should eq 0 } its('st...
Update template to reflect breaking changes in 1.0
class AccessPolicy include AccessGranted::Policy def configure # Example policy for AccessGranted. # For more details check the README at # # https://github.com/chaps-io/access-granted/blob/master/README.md # # Roles inherit from less important roles, so: # - :admin has permissions defi...
class AccessPolicy include AccessGranted::Policy def configure # Example policy for AccessGranted. # For more details check the README at # # https://github.com/chaps-io/access-granted/blob/master/README.md # # Roles inherit from less important roles, so: # - :admin has permissions defi...
Use truncation cleaning strategy only for js tagged specs
require 'simplecov' SimpleCov.start 'rails' do add_group "Decorators", "app/decorators" end ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rails' require 'capybara/rspec' # Requires supporting ruby files wit...
require 'simplecov' SimpleCov.start 'rails' do add_group "Decorators", "app/decorators" end ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rails' require 'capybara/rspec' # Requires supporting ruby files wit...
Add new spec support that uses the backend more.
module WorkerMacros def uses_workers after(:each) do Backend.wait_for_all_workers end end end RSpec.configure do |config| config.extend WorkerMacros, :type => :controller end
module WorkerMacros def use_workers after(:each) do old = Backend.mock Backend.mock = false Backend.wait_for_all_workers Backend.mock = old end end def disable_mocking before :each do Backend.mock = false end after :each do Backend.mock = true end en...
Add test for successful login
require "test_helper" class LogInTest < Capybara::Rails::TestCase include Devise::Test::IntegrationHelpers test "can navigate to log in from landing page" do visit root_path assert_content page, "Brave Payments" click_link('Log In') assert_content page, "Log In" end test "after failed login, ...
require "test_helper" class LogInTest < Capybara::Rails::TestCase include Devise::Test::IntegrationHelpers test "can navigate to log in from landing page" do visit root_path assert_content page, "Brave Payments" click_link('Log In') assert_content page, "Log In" end test "a user with an exist...
Drop support of Ruby < 2.2
module Magick VERSION = '2.16.0' MIN_RUBY_VERSION = '2.0.0' MIN_IM_VERSION = '6.4.9' MIN_WAND_VERSION = '6.9.0' end
module Magick VERSION = '2.16.0' MIN_RUBY_VERSION = '2.2.0' MIN_IM_VERSION = '6.4.9' MIN_WAND_VERSION = '6.9.0' end
Allow to work in Rails without Assets Pipeline
require 'yaml' begin require 'sprockets/railtie' module AutoprefixedRails class Railtie < ::Rails::Railtie rake_tasks do |app| require 'rake/autoprefixer_tasks' Rake::AutoprefixerTasks.new( config(app.root) ) end if config.respond_to?(:assets) config.assets.configure...
require 'yaml' begin require 'sprockets/railtie' module AutoprefixedRails class Railtie < ::Rails::Railtie rake_tasks do |app| require 'rake/autoprefixer_tasks' Rake::AutoprefixerTasks.new( config(app.root) ) if defined? app.assets end if config.respond_to?(:assets) ...
Add workaround for accepting array of values within NameValueList
module Ebay # :nodoc: module Types # :nodoc: # == Attributes # text_node :name, 'Name', :optional => true # text_node :value, 'Value', :optional => true # text_node :source, 'Source', :optional => true class NameValueList include XML::Mapping include Initializer root_element_...
module Ebay # :nodoc: module Types # :nodoc: # == Attributes # text_node :name, 'Name', :optional => true # text_node :value, 'Value', :optional => true # text_node :source, 'Source', :optional => true class NameValueList include XML::Mapping include Initializer root_element_...
Add build group to tests
# encoding: UTF-8 require 'spec_helper' require 'ephemeral/client' describe 'Ephemeral::Client' do it 'expects 3 arguments' do test_client = Ephemeral::Client.new expect{ test_client.build }.to raise_error ArgumentError end it 'returns a hash' do test_client = Ephemeral::Client.new ...
# encoding: UTF-8 require 'spec_helper' require 'ephemeral/client' describe 'Ephemeral::Client' do describe 'build' do it 'expects 3 arguments' do test_client = Ephemeral::Client.new expect{ test_client.build }.to raise_error ArgumentError end it 'returns a hash' do t...
Change to stop limiting string comparison length
# frozen_string_literal: true if ENV['COVERAGE'] || ENV['TRAVIS'] require 'simplecov' require 'coveralls' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ]) SimpleCov.start do command_name 'spec' add_filte...
# frozen_string_literal: true if ENV['COVERAGE'] || ENV['TRAVIS'] require 'simplecov' require 'coveralls' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ]) SimpleCov.start do command_name 'spec' add_filte...
Add some facts to the specs
require 'spec_helper' describe 'relationships::titles' do it { should compile } it { should compile.with_all_deps } it { should contain_file('/etc/svc') } it { should contain_service('svc-title') } it { should contain_file('/etc/svc').that_notifies('Service[svc-name]') } it { should contain_file('/etc/sv...
require 'spec_helper' describe 'relationships::titles' do let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} } it { should compile } it { should compile.with_all_deps } it { should contain_file('/etc/svc') } it { should contain_service('svc-title') } it { should contain_file('/etc/svc').th...
Update has_many args to Rails 4 syntax
Spree.user_class.class_eval do has_many :addresses, :conditions => {:deleted_at => nil}, :order => "updated_at DESC", :class_name => 'Spree::Address' end
Spree.user_class.class_eval do has_many :addresses, -> { where(:deleted_at => nil).order("updated_at DESC") }, :class_name => 'Spree::Address' end
Remove validation for own product
class SuppliersPlugin::DistributedProduct < SuppliersPlugin::BaseProduct named_scope :from_products_joins, :joins => 'INNER JOIN suppliers_plugin_source_products ON ( products.id = suppliers_plugin_source_products.to_product_id ) INNER JOIN products products_2 ON ( suppliers_plugin_source_products.from_product_i...
class SuppliersPlugin::DistributedProduct < SuppliersPlugin::BaseProduct named_scope :from_products_joins, :joins => 'INNER JOIN suppliers_plugin_source_products ON ( products.id = suppliers_plugin_source_products.to_product_id ) INNER JOIN products products_2 ON ( suppliers_plugin_source_products.from_product_i...
Remove mode setting from example app.
dir = File.expand_path(File.dirname(__FILE__)) $:.unshift(dir + '/../lib') $:.unshift(dir) require 'oauth2/provider' OAuth2::Provider.realm = 'Notes App' OAuth2::Provider.mode = 'development' require 'models/connection' require 'models/user' require 'models/note'
dir = File.expand_path(File.dirname(__FILE__)) $:.unshift(dir + '/../lib') $:.unshift(dir) require 'oauth2/provider' OAuth2::Provider.realm = 'Notes App' require 'models/connection' require 'models/user' require 'models/note'
Fix the client uid format
ENV["G5_HUB_ENTRIES_URL"] ||= case Rails.env when "production" then "https://g5-hub.herokuapp.com" when "development" then "http://g5-hub.dev" when "test" then "http://g5-hub.test" end ENV["G5_REMOTE_APP_WEBHOOK_HOST"] ||= case Rails.env when "production" then "herokuapp.com" when "development" then...
ENV["G5_HUB_ENTRIES_URL"] ||= case Rails.env when "production" then "http://hub.g5dxm.com" when "development" then "http://g5-hub.dev" when "test" then "http://g5-hub.test" end ENV["G5_REMOTE_APP_WEBHOOK_HOST"] ||= case Rails.env when "production" then "herokuapp.com" when "development" then "dev" ...
Update HandBrakeCLI Nightly to v6469svn
class HandbrakecliNightly < Cask version '6452svn' sha256 'cce4733a704bab3d0314d8950b98c2cdce4ed47e4e838727f8e996a3f5cfa537' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr' license :gpl binary 'HandBrakeCLI' end
class HandbrakecliNightly < Cask version '6469svn' sha256 '0eb150843aa2a7f2f23ad1c9359478e1843f26fc12d50a0c55a8fc92f0a7d398' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr' license :gpl binary 'HandBrakeCLI' end
Fix crash problem in screen for Vimeo video
class InfoScreen < PM::WebScreen attr_accessor :url def content self.url end def will_appear navigationItem.prompt = '百首読み上げ' end def should_autorotate false end def webView(webView, shouldStartLoadWithRequest: request, navigationType: navigationType) if navigationType == UIWebViewNa...
class InfoScreen < PM::WebScreen attr_accessor :url def content self.url end def will_appear navigationItem.prompt = '百首読み上げ' end def should_autorotate false end def webView(webView, shouldStartLoadWithRequest: request, navigationType: navigationType) if navigationType == UIWebViewNa...
Add framework and change description of podspec
Pod::Spec.new do |s| s.name = "LineKit" s.version = "1.4.1" s.summary = "Share to Naver Line from your apps." s.homepage = "https://github.com/dlackty/LineKit" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Richard Lee" => "dlackty@gmail.com" } s.source ...
Pod::Spec.new do |s| s.name = "LineKit" s.version = "1.4.1" s.summary = "Share to LINE from your apps." s.homepage = "https://github.com/dlackty/LineKit" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Richard Lee" => "dlackty@gmail.com" } s.source ...
Use remote repository for assets precompiling check
set(:skip_assets_precompile) do run_locally("#{source.local.log(current_revision, revision)} --oneline vendor/assets/ app/assets/ | wc -l").to_i == 0 end namespace :deploy do namespace :assets do task :clean, :roles => assets_role, :except => { :no_release => true } do if skip_assets_precompile then ...
# # There are a few requirement for theses tasks to work as intentended : # # - You must set :deploy_via, :remote_cache # - The cached copy was synced previously during deployment # (otherwise real_revision might not be yet fetch on the cached copy) set(:skip_assets_precompile) do cached_copy = File.join(shared_p...
Use Mongoid's rake task to create index
namespace :migrate do task :swap_old_tag_uniqueness_index => :environment do Tag.collection.drop_index('tag_id_1') # this is the generated name for the unique index of tags by tag_id Tag.collection.create_index([ [:tag_id, Mongo::ASCENDING], [:tag_type, Mongo::ASCENDING] ], unique: true) end desc "Sets t...
namespace :migrate do task :swap_old_tag_uniqueness_index => :environment do Tag.collection.drop_index('tag_id_1') # this is the generated name for the unique index of tags by tag_id Rake::Task["db:mongoid:create_indexes"].invoke end desc "Sets the businesslink legacy source on all business proposition c...
Update gir_ffi and gir_ffi-gtk to 0.14.0
# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'atspi_app_driver' s.version = '0.4.0' s.summary = 'Test GirFFI-based applications using Atspi' s.required_ruby_version = '>= 2.2.0' s.authors = ['Matijs van Zuijlen'] s.email = ['matijs@matijs.net'] s.homepage = 'http://www.github.co...
# frozen_string_literal: true Gem::Specification.new do |s| s.name = 'atspi_app_driver' s.version = '0.4.0' s.summary = 'Test GirFFI-based applications using Atspi' s.required_ruby_version = '>= 2.2.0' s.authors = ['Matijs van Zuijlen'] s.email = ['matijs@matijs.net'] s.homepage = 'http://www.github.co...
Add method name to test name.
require 'generator/exercise_cases' class RunLengthEncodingCase < Generator::ExerciseCase def workload indent_lines([ "input = '#{input}'", "output = '#{expected}'", assertion ], 4) end private def assertion if property == 'consistency' 'assert_equal output, ...
require 'generator/exercise_cases' class RunLengthEncodingCase < Generator::ExerciseCase def name super.sub('test_',"test_#{property}_") end def workload indent_lines([ "input = '#{input}'", "output = '#{expected}'", assertion ], 4) end private def assertion if propert...
Add tests for BlogCategories controller
# frozen_string_literal: true require 'test_helper' # # == BlogCategoriesController Test # class BlogCategoriesControllerTest < ActionController::TestCase test 'should get show' do get :show assert_response :success end end
# frozen_string_literal: true require 'test_helper' # # == BlogCategoriesController Test # class BlogCategoriesControllerTest < ActionController::TestCase include Devise::TestHelpers include Rails.application.routes.url_helpers setup :initialize_test # # == Routes / Templates / Responses # test 'should...
Test callback helper without setting up GObject.
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__)) require "gir_ffi/callback_helper" describe GirFFI::CallbackHelper do describe ".map_single_callback_arg" do it "correctly maps a :struct type" do GirFFI.setup :GObject cl = GObject::Closure.new_simple GObject::Closure::Str...
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__)) require "gir_ffi/callback_helper" describe GirFFI::CallbackHelper do describe "::map_single_callback_arg" do it "maps a :struct type by building the type and wrapping the argument in it" do cinfo = get_introspection_data 'GObject...
Disable nginx logging on tile caches
name "tilecache" description "Role applied to all tile cache servers" default_attributes( :accounts => { :groups => { :proxy => { :members => [:tomh, :grant, :matt, :jburgess] } } }, :apt => { :sources => ["nginx"] }, :nginx => { :access_log => nil }, :sysctl => { ...
name "tilecache" description "Role applied to all tile cache servers" default_attributes( :accounts => { :groups => { :proxy => { :members => [:tomh, :grant, :matt, :jburgess] } } }, :apt => { :sources => ["nginx"] }, :nginx => { :access_log => false }, :sysctl => { ...
Fix requiring of all serializers
require 'test/unit' require 'shoulda' require 'maildir' # Require all the serializers serializers = File.join(".", File.dirname(__FILE__), "..","lib","maildir","serializer","*.rb") Dir.glob(serializers).each do |serializer| require serializer end # Require 'ktheory-fakefs' until issues 28, 29, and 30 are resolved i...
require 'test/unit' require 'shoulda' require 'maildir' # Require all the serializers serializers = File.expand_path('../../lib/maildir/serializer/*.rb', __FILE__) Dir.glob(serializers).each do |serializer| require serializer end # Require 'ktheory-fakefs' until issues 28, 29, and 30 are resolved in # defunkt/fakef...
FIX invalid log command on update command
module Bummr class Updater def initialize(outdated_gems) @outdated_gems = outdated_gems end def update_gems puts "Updating outdated gems".green @outdated_gems.each_with_index do |gem, index| update_gem(gem, index) end end def update_gem(gem, index) puts "Up...
module Bummr class Updater include Log def initialize(outdated_gems) @outdated_gems = outdated_gems end def update_gems puts "Updating outdated gems".green @outdated_gems.each_with_index do |gem, index| update_gem(gem, index) end end def update_gem(gem, inde...
Fix user not found bug
require 'lita/adapters/slack/rtm_connection' module Lita module Adapters class Slack < Adapter # Required configuration attributes. config :token, type: String, required: true config :proxy, type: String # Starts the connection. def run return if rtm_connection @rt...
require 'lita/adapters/slack/rtm_connection' module Lita module Adapters class Slack < Adapter # Required configuration attributes. config :token, type: String, required: true config :proxy, type: String # Starts the connection. def run return if rtm_connection @rt...
Add rdoc to development dependencies
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'wptemplates/version' Gem::Specification.new do |spec| spec.name = "wptemplates" spec.version = Wptemplates::VERSION spec.authors = ["Bernhard Häussner"] spec.email ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'wptemplates/version' Gem::Specification.new do |spec| spec.name = "wptemplates" spec.version = Wptemplates::VERSION spec.authors = ["Bernhard Häussner"] spec.email ...
Update pod spec to v1.0.3
Pod::Spec.new do |s| s.name = "KMSWebRTCCall" s.version = "1.0.2" s.summary = "Kurento Media Server iOS Web RTC Call." s.homepage = "https://github.com/sdkdimon/kms-ios-webrtc-call" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Dmit...
Pod::Spec.new do |s| s.name = "KMSWebRTCCall" s.version = "1.0.3" s.summary = "Kurento Media Server iOS Web RTC Call." s.homepage = "https://github.com/sdkdimon/kms-ios-webrtc-call" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Dmit...
Update Visual Studio Code to v0.3.0
cask :v1 => 'visual-studio-code' do version :latest sha256 :no_check url 'http://download.microsoft.com/download/0/D/5/0D57186C-834B-463A-AECB-BC55A8E466AE/VSCode-osx.zip' name 'Visual Studio Code' homepage 'https://code.visualstudio.com/' license :gratis tags :vendor => 'Microsoft' app 'Visual Studio...
cask :v1 => 'visual-studio-code' do version :latest sha256 :no_check url 'http://go.microsoft.com/fwlink/?LinkID=534106' name 'Visual Studio Code' homepage 'https://code.visualstudio.com/' license :gratis tags :vendor => 'Microsoft' app 'Visual Studio Code.app' zap :delete => [ '~...
Add Data Rescue 4.app v4.1
cask :v1 => 'data-rescue' do version '4.1' sha256 '479f91c85e4e87cf4d9b99a1e4c73a132c318a9b98d00d44a77e771c20a428dc' url "https://s3.amazonaws.com/prosoft-engineering/drmac/Data_Rescue_#{version}_US.dmg" name 'Data Rescue 4' homepage 'http://www.prosofteng.com/products/data_rescue.php' license :commercial ...
Use semver for the gem and specify API_VERSION
module MindBody VERSION = "0.5.2.0" end
module MindBody VERSION = "1.0.0.alpha" API_VERSION = "0.5.2.0" end
Fix inspect for operation logger.
module Flipper module Adapters # Public: Adapter that wraps another adapter and stores the operations. # # Useful in tests to verify calls and such. Never use outside of testing. class OperationLogger Operation = Struct.new(:type, :args) OperationTypes = [ :get, :add, ...
module Flipper module Adapters # Public: Adapter that wraps another adapter and stores the operations. # # Useful in tests to verify calls and such. Never use outside of testing. class OperationLogger Operation = Struct.new(:type, :args) OperationTypes = [ :get, :add, ...
Mark RunStat as being added in 0.7.0.
module Nmap # # Represents the runstats of a scan. # class RunStat < Struct.new(:end_time, :elapsed, :summary, :exit_status) # # Converts the stats to a String. # # @return [String] # The String form of the scan. # def to_s "#{self.end_time} #{self.elapsed} #{self.exit_statu...
module Nmap # # Represents the runstats of a scan. # # @since 0.7.0 # class RunStat < Struct.new(:end_time, :elapsed, :summary, :exit_status) # # Converts the stats to a String. # # @return [String] # The String form of the scan. # def to_s "#{self.end_time} #{self.elaps...
Delete existing test packages before testing.
require 'rubygems' require 'bundler/setup' require 'riot' require 'riot/rr' require 'fileutils' $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require 'release_packager' def source_files %w[bin/test lib/test.rb lib/test/stuff.rb README.txt] end def project_path File.expand_path("../test_project", __FILE...
require 'rubygems' require 'bundler/setup' require 'riot' require 'riot/rr' require 'fileutils' $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require 'release_packager' def source_files %w[bin/test lib/test.rb lib/test/stuff.rb README.txt] end def project_path File.expand_path("../test_project", __FILE...
Fix json version in gemspec
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require 'zabbixapi/version' Gem::Specification.new do |s| s.name = "zabbixapi" s.version = ZabbixApi::VERSION s.authors = ["Vasiliev D.V.", "Ivan Evtuhovich"] s.email = %w(vadv.mkn@gmail.com evtuhovich@gmail.com) s.hom...
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require 'zabbixapi/version' Gem::Specification.new do |s| s.name = "zabbixapi" s.version = ZabbixApi::VERSION s.authors = ["Vasiliev D.V.", "Ivan Evtuhovich"] s.email = %w(vadv.mkn@gmail.com evtuhovich@gmail.com) s.hom...
Add comment indicating reasoning for dynamic module inclusion
require 'formatted_text_entry' require 'formatted_text_box_entry' module ResumeGenerator class Header attr_reader :pdf, :data def self.generate(pdf, data) new(pdf, data).generate end def initialize(pdf, data) @pdf = pdf @data = data if data[:at] extend FormattedText...
require 'formatted_text_entry' require 'formatted_text_box_entry' module ResumeGenerator class Header attr_reader :pdf, :data def self.generate(pdf, data) new(pdf, data).generate end def initialize(pdf, data) @pdf = pdf @data = data # Different rendering behaviour needed de...
Fix ambiguous regular expression literal
# Thanks to https://github.com/simonwhitaker/github-fork-ribbon-css require 'rack/dev-mark/theme/base' module Rack module DevMark module Theme class GithubForkRibbon < Base def insert_into(html, env, params = {}) revision = params[:revision] timestamp = params[:timestamp] ...
# Thanks to https://github.com/simonwhitaker/github-fork-ribbon-css require 'rack/dev-mark/theme/base' module Rack module DevMark module Theme class GithubForkRibbon < Base def insert_into(html, env, params = {}) revision = params[:revision] timestamp = params[:timestamp] ...
Update gemspec summary and description
Gem::Specification.new do |s| s.name = "sprockets" s.version = "2.0.0" s.summary = "JavaScript dependency management and concatenation" s.description = "Sprockets is a Ruby library that preprocesses and concatenates JavaScript source files." s.files = Dir["Rakefile", "lib/**/*"] s.add_dependency "hike", "...
Gem::Specification.new do |s| s.name = "sprockets" s.version = "2.0.0" s.summary = "Rack-based asset packaging system" s.description = "Sprockets is a Rack-based asset packaging system that concatenates and serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS." s.files = Dir["Rakefile", "lib/**/*"] ...
Fix account type not being set by default
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable has_many :users_questionnaires, depende...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable has_many :users_questionnaires, depende...
Update the relatedness graph every 15 minutes
set :output, {:error => 'log/cron.error.log', :standard => 'log/cron.log'} job_type :run_script, 'cd :path && RAILS_ENV=:environment script/:task' every 15.minutes do run_script "relatedness.sh" end
Fix source files in podspec
Pod::Spec.new do |spec| spec.name = 'Deferred' spec.version = '0.1.2' spec.summary = 'Promises in Swift' spec.homepage = 'https://github.com/remarkableio/Deferred' spec.license = { :type => 'MIT', :file => 'LICENSE' } spec.author = { 'Giles Van Gruisen' => 'giles@vangruisen.com', } spec.source = { :...
Pod::Spec.new do |spec| spec.name = 'Deferred' spec.version = '0.1.2' spec.summary = 'Promises in Swift' spec.homepage = 'https://github.com/remarkableio/Deferred' spec.license = { :type => 'MIT', :file => 'LICENSE' } spec.author = { 'Giles Van Gruisen' => 'giles@vangruisen.com', } spec.source = { :...
Clean up Pod description whitespace
Pod::Spec.new do |spec| spec.name = 'Snippets' spec.version = '0.1.14' spec.summary = 'Snippets in Swift' spec.description = <<-DESCRIPTION A collection of Swift snippets for enhancing standard Apple frameworks. The snippets have no non-standard dependencies, by design. DESCRIPTION spec.homepage = 'http...
Pod::Spec.new do |spec| spec.name = 'Snippets' spec.version = '0.1.14' spec.summary = 'Snippets in Swift' spec.description = <<-DESCRIPTION.gsub(/\s+/, ' ').chomp A collection of Swift snippets for enhancing standard Apple frameworks. The snippets have no non-standard dependencies, by design. DESCRIPTION ...
Move DataProxy to support dir
module ROM module DataProxy attr_reader :data, :header, :tuple_proc NON_FORWARDABLE = [ :each, :to_a, :to_ary, :kind_of?, :instance_of?, :is_a? ].freeze def self.included(klass) klass.class_eval do extend ClassMethods include Equalizer.new(:data) end end de...
Make Extra Sure We're Not Loading Ruby's Time Class
require 'ruby-progressbar/time' class ProgressBar class Timer attr_accessor :started_at, :stopped_at def initialize(options = {}) self.time = options[:time] || Time.new end def start self.started_at = stopped? ? time.now - (stopped_at - started_at) : time.now self.stopped_at =...
require 'ruby-progressbar/time' class ProgressBar class Timer attr_accessor :started_at, :stopped_at def initialize(options = {}) self.time = options[:time] || ::ProgressBar::Time.new end def start self.started_at = stopped? ? time.now - (stopped_at - started_at) : time.now se...
Correct the name of Mege.Gen
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'megegen/version' Gem::Specification.new do |spec| spec.name = "migration-generator" spec.version = Megegen::VERSION spec.authors = ["Jack Wu"] spec.email = ["...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'megegen/version' Gem::Specification.new do |spec| spec.name = "megegen" spec.version = Megegen::VERSION spec.authors = ["Jack Wu"] spec.email = ["xuwupeng2000...
Change type assembly_district field in schools DB
class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| t.string :dbn t.string :school t.integer :total_enrollment t.float :amount_owed t.string :district_name t.integer :district_no t.string :district_code t.string :assembly_district ...
class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| t.string :dbn t.string :school t.integer :total_enrollment t.float :amount_owed t.string :district_name t.integer :district_no t.string :district_code t.integer :assembly_district ...
Refactor load_sprite_sheet and remove bottom-left/top-right sprites.
class GameLayer < Joybox::Core::Layer scene def on_enter Joybox::Core::SpriteFrameCache.frames.add file_name: "sprites.plist" @sprite_batch = Joybox::Core::SpriteBatch.new file_name: "sprites.png" self << @sprite_batch @sprite_batch << Sprite.new(frame_name: 'boy.png', position: [Screen.half_width...
class GameLayer < Joybox::Core::Layer scene def on_enter load_sprite_sheet @sprite_batch << Sprite.new(frame_name: 'boy.png', position: [Screen.half_width, Screen.half_height]) end def load_sprite_sheet Joybox::Core::SpriteFrameCache.frames.add file_name: "sprites.plist" @sprite_batch = Joybox...
Fix up gemspec; add puma
$:.unshift(File.dirname(__FILE__) + '/lib') require 'chef_zero/version' Gem::Specification.new do |s| s.name = "chef-zero" s.version = ChefZero::VERSION s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = ["README.rdoc", "LICENSE"] s.summary = "Self-contained, easy-setup, fast-start in-...
$:.unshift(File.dirname(__FILE__) + '/lib') require 'chef_zero/version' Gem::Specification.new do |s| s.name = 'chef-zero' s.version = ChefZero::VERSION s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = ['README.rdoc', 'LICENSE'] s.summary = 'Self-contained, easy-setup, fast-start in-...
Add contenders to performance check
require 'pp' require 'benchmark' $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'aurb' Benchmark.bm 7 do |x| x.report 'search' do Aurb.aur.search *:quake end x.report 'upgrade' do Aurb.aur.upgrade *`pacman -Qm`.split(/\n/) end end
require 'pp' require 'benchmark' $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'aurb' Benchmark.bm 20 do |x| x.report 'aurb upgrade' do Aurb.aur.upgrade *`pacman -Qm`.split(/\n/) end x.report 'aurb search' do Aurb.aur.search *:quake end x.report 'slurpy search' d...
Add license abbreviation to gemspec
Gem::Specification.new do |spec| spec.name = 'httpauth' spec.version = '0.2.0' spec.author = "Manfred Stienstra" spec.email = "manfred@fngtpspec.com" spec.homepage = "https://github.com/Manfred/HTTPauth" spec.summary = "HTTPauth is a library supporting the full HTTP Authentication protocol as ...
Gem::Specification.new do |spec| spec.name = 'httpauth' spec.version = '0.2.0' spec.author = "Manfred Stienstra" spec.email = "manfred@fngtpspec.com" spec.homepage = "https://github.com/Manfred/HTTPauth" spec.summary = "HTTPauth is a library supporting the full HTTP Authentication protocol as ...
Change error type in api tests
require "spec_helper" describe Magnum::Client::Connection do let(:connection) { Magnum::Client::Connection.new("token") } describe "invalid endpoint" do before do stub_api(:get, "/foobar", headers: {"X-API-KEY" => "token"}, status: 404, body: fixture("invalid_endpoint.json") ...
require "spec_helper" describe Magnum::Client::Connection do let(:connection) { Magnum::Client::Connection.new("token") } describe "invalid endpoint" do before do stub_api(:get, "/foobar", headers: {"X-API-KEY" => "token"}, status: 404, body: fixture("invalid_endpoint.json") ...
Use a better description in the ChefSpec
require 'spec_helper' describe 'aws::ec2_hints' do let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) } it 'adds the hint file' do expect(chef_run).to create_ohai_hint('ec2').at_compile_time end it 'reloads ohai' do expect(chef_run).to reload_ohai('reload') end end
require 'spec_helper' describe 'aws::ec2_hints' do let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) } it 'creates the ohai hint' do expect(chef_run).to create_ohai_hint('ec2').at_compile_time end it 'reloads ohai' do expect(chef_run).to reload_ohai('reload') end end
Use https url in gemspec
Gem::Specification.new do |s| s.name = 'month' s.version = '1.4.0' s.license = 'MIT' s.platform = Gem::Platform::RUBY s.authors = ['Tim Craft'] s.email = ['mail@timcraft.com'] s.homepage = 'http://github.com/timcraft/month' s.description = 'A little Ruby library for working with months' s.summary = 'S...
Gem::Specification.new do |s| s.name = 'month' s.version = '1.4.0' s.license = 'MIT' s.platform = Gem::Platform::RUBY s.authors = ['Tim Craft'] s.email = ['mail@timcraft.com'] s.homepage = 'https://github.com/timcraft/month' s.description = 'A little Ruby library for working with months' s.summary = '...
Fix permission_denied method so it actually denies permission.
class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_auth_user filter_access_to :all protected def set_auth_user Authorization.current_user = current_user end def permission_denied redirect_to new_user_session_path if current_user.nil? end end
class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_auth_user filter_access_to :all protected def set_auth_user Authorization.current_user = current_user end def permission_denied if current_user.nil? flash.alert = t("permission_denied_sign_in") ...
Remove talk of risky order from shipment spec
require 'spec_helper' describe Spree::Shipment, :type => :model do let(:shipment) { create(:shipment) } subject { shipment.determine_state(shipment.order) } describe "#determine_state_with_signifyd" do context "with a risky order" do before { allow(shipment.order).to receive(:is_risky?).and_return(t...
require 'spec_helper' describe Spree::Shipment, :type => :model do let(:shipment) { create(:shipment) } subject { shipment.determine_state(shipment.order) } describe "#determine_state_with_signifyd" do context "with a canceled order" do before { shipment.order.update_columns(state: 'canceled') } ...
Add request specs for short URL redirects
require 'rails_helper' RSpec.describe "Links", :type => :request do describe "GET /links/news" do it "renders the new template" do get new_link_path expect(response).to render_template(:new) expect(response.status).to be(200) end end end
require 'rails_helper' RSpec.describe "Links", :type => :request do describe "GET /links/news" do it "renders the new template" do get new_link_path expect(response).to render_template(:new) expect(response.status).to be(200) end end describe "GET /l/:short_name" do context "when ...
Add a solution for problem 3
n = 600_851_475_143 d = 2 prime_factors = [] while n > 1 while n % d == 0 n /= d prime_factors << d end d += 1 end p prime_factors
Enable fallback to English translations
require_relative "boot" require "action_controller/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) if !Rails.env.production? || ENV["HEROKU_APP_NAME"...
require_relative "boot" require "action_controller/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) if !Rails.env.production? || ENV["HEROKU_APP_NAME"...
Revert "Bump rom-core to 5.1.3"
# frozen_string_literal: true module ROM module Core VERSION = '5.1.3' end end
# frozen_string_literal: true module ROM module Core VERSION = '5.1.2' end end
Use a service name prefix to remove `sites` folder dependencies
Capistrano::Configuration.instance(:must_exist).load do |configuration| _cset(:foreman_sudo, 'sudo') namespace :foreman do desc "Export the Procfile to Ubuntu's upstart scripts" task :export, roles: :app do run "cd #{current_path} && #{foreman_sudo} bundle exec foreman export upstart /etc/init -a si...
Capistrano::Configuration.instance(:must_exist).load do |configuration| _cset(:foreman_sudo, 'sudo') namespace :foreman do desc "Export the Procfile to Ubuntu's upstart scripts" task :export, roles: :app do run "cd #{current_path} && #{foreman_sudo} bundle exec foreman export upstart /etc/init -a fo...
Split up SQL statements in migration
class ChangeReturnItemPreTaxAmountToAmount < ActiveRecord::Migration def up execute(<<-SQL) UPDATE spree_return_items SET included_tax_total = 0 WHERE included_tax_total IS NULL; UPDATE spree_return_items SET pre_tax_amount = pre_tax_amount + included_tax_total; SQL rename_...
class ChangeReturnItemPreTaxAmountToAmount < ActiveRecord::Migration def up execute(<<-SQL) UPDATE spree_return_items SET included_tax_total = 0 WHERE included_tax_total IS NULL SQL execute(<<-SQL) UPDATE spree_return_items SET pre_tax_amount = pre_tax_amount + included_tax_t...
Package version is increased from 0.2.0.0 to 0.2.0.1
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'error_data' s.version = '0.2.0.0' s.summary = 'Representation of an error as a data structure' s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian...
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'error_data' s.version = '0.2.0.1' s.summary = 'Representation of an error as a data structure' s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian...
Fix version mechanize in gemspec
require './lib/cricos_scrape/version' Gem::Specification.new do |spec| spec.name = 'cricos_scrape' spec.version = CricosScrape::VERSION spec.authors = ['Trung Lê', 'Toàn Lê'] spec.email = ['trung.le@ruby-journal.com', 'ktoanlba@gmail.com'] spec.summary = %q{Cricos Scrape} ...
require './lib/cricos_scrape/version' Gem::Specification.new do |spec| spec.name = 'cricos_scrape' spec.version = CricosScrape::VERSION spec.authors = ['Trung Lê', 'Toàn Lê'] spec.email = ['trung.le@ruby-journal.com', 'ktoanlba@gmail.com'] spec.summary = %q{Cricos Scrape} ...
Set gemspec version to 0.1
# Encoding: UTF-8 Gem::Specification.new do |s| s.author = "Andrew Hadinyoto" s.platform = Gem::Platform::RUBY s.name = 'refinerycms-hooks' s.version = '0.0' s.description = 'Ruby on Rails Hooks extension for Refinery CMS' s.date = '2012-09-26' ...
# Encoding: UTF-8 Gem::Specification.new do |s| s.author = "Andrew Hadinyoto" s.platform = Gem::Platform::RUBY s.name = 'refinerycms-hooks' s.version = '0.1' s.description = 'Ruby on Rails Hooks extension for Refinery CMS' s.date = '2012-09-26' ...
Add api group to SimpleCov
require 'linkedin2' require 'rspec' require 'vcr' require 'pry' require 'byebug' require 'simplecov' SimpleCov.start do add_group "API", "lib/evertrue/api" end VCR.configure do |c| c.cassette_library_dir = 'spec/fixtures/requests' c.hook_into :faraday c.default_cassette_options = { record: :none } c.config...
require 'linkedin2' require 'rspec' require 'vcr' require 'pry' require 'byebug' require 'simplecov' SimpleCov.start do add_group 'API', 'lib/evertrue/api' end VCR.configure do |c| c.cassette_library_dir = 'spec/fixtures/requests' c.hook_into :faraday c.default_cassette_options = { record: :none } c.config...
Use struct accessor instead of instance variable set/get
module MoneyAccessor def self.included(base) base.extend(ClassMethods) end module ClassMethods def money_accessor(*columns) Array(columns).flatten.each do |name| define_method(name) do value = instance_variable_get("@#{name}") value.blank? ? nil : Money.new(value) ...
module MoneyAccessor def self.included(base) base.extend(ClassMethods) end module ClassMethods def money_accessor(*columns) Array(columns).flatten.each do |name| define_method(name) do value = _money_get(name) value.blank? ? nil : Money.new(value) end de...
Use git config --get for obtaining the single config value
GitHub.register :open do if remote = `git config -l`.split("\n").detect { |line| line =~ /remote.origin.url/ } exec "open http://github.com/#{remote.split(':').last.chomp('.git')}" end end GitHub.register :info do |repo,| puts "== Grabbing info for #{repo}" end
GitHub.register :open do if remote = `git config --get remote.origin.url`.chomp exec "open http://github.com/#{remote.split(':').last.chomp('.git')}" end end GitHub.register :info do |repo,| puts "== Grabbing info for #{repo}" end
Simplify engine generator model spec template.
require 'spec_helper' describe ::Refinery::<%= class_name %> do def reset_<%= singular_name %>(options = {}) @valid_attributes = { :id => 1<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>, :<%= title.name %> => "RSpec is great for testing too"<% end %> } @<%= s...
require 'spec_helper' module Refinery describe <%= class_name %> do describe "validations" do subject do FactoryGirl.create(:<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>, :<%= title.name %> => "Refinery CMS"<% end %>) end it...
Include email in UserFieldType picker, so content creators can discern between users with the same fullname
module Plugins module Core class UserCell < Plugins::Core::Cell def dropdown render end private def value data&.[]('user_id') || @options[:default_value] end def render_select @options[:form].select 'data[user_id]', user_data_for_select, {selected: va...
module Plugins module Core class UserCell < Plugins::Core::Cell def dropdown render end private def value data&.[]('user_id') || @options[:default_value] end def render_select @options[:form].select 'data[user_id]', user_data_for_select, {selected: va...
Add logging to show the yum repo definition
test_config = PuppetDBExtensions.config os = test_config[:os_families][database.name] if (test_config[:install_type] == :package) step "Add development repository on PuppetDB server" do case os when :debian apt_url = "#{test_config[:package_repo_url]}/debian" # TODO: this could be (maybe?) por...
test_config = PuppetDBExtensions.config os = test_config[:os_families][database.name] if (test_config[:install_type] == :package) step "Add development repository on PuppetDB server" do case os when :debian apt_url = "#{test_config[:package_repo_url]}/debian" # TODO: this could be (maybe?) por...
Add is_graded to task definition serializer
class TaskDefinitionSerializer < ActiveModel::Serializer attributes :id, :abbreviation, :name, :description, :weight, :target_grade, :target_date, :upload_requirements, :plagiarism_checks, :plagiarism_report_url, :plagiarism_warn_pct, :restrict_status_updates, :group_set_id, :has_task_pdf?, :ha...
class TaskDefinitionSerializer < ActiveModel::Serializer attributes :id, :abbreviation, :name, :description, :weight, :target_grade, :target_date, :upload_requirements, :plagiarism_checks, :plagiarism_report_url, :plagiarism_warn_pct, :restrict_status_updates, :group_set_id, :has_task_pdf?, :has_t...
Add email correct email address
class Contact < MailForm::Base attribute :school_information attribute :name_teacher attribute :email, validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attribute :phone attribute :class_information attribute :motivation attribute :course attribute :course_date attribute :nickname, captcha: true...
class Contact < MailForm::Base attribute :school_information attribute :name_teacher attribute :email, validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attribute :phone attribute :class_information attribute :motivation attribute :course attribute :course_date attribute :nickname, captcha: true...
Introduce a seed for a test `Vdc::Resource`
# 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 Rings' }]) # Ch...
# 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 Rings' }]) # Ch...
Use env instead of request
require "bundler/setup" ENV["RACK_ENV"] ||= "development" Bundler.require(:default, ENV["RACK_ENV"].to_sym) Dotenv.load require "./hook_delivery" configure do MongoMapper.setup({'production' => {'uri' => ENV['MONGOHQ_URL']}}, 'production') end post "/" do puts request.inspect headers = { "X-GitHub-Event" ...
require "bundler/setup" ENV["RACK_ENV"] ||= "development" Bundler.require(:default, ENV["RACK_ENV"].to_sym) Dotenv.load require "./hook_delivery" configure do MongoMapper.setup({'production' => {'uri' => ENV['MONGOHQ_URL']}}, 'production') end post "/" do headers = { "X-GitHub-Event" => env["X-GitHub-Even...
Add spec for using a class allocated with Class.allocate
require File.expand_path('../../../spec_helper', __FILE__) describe "Class#allocate" do it "returns an instance of self" do klass = Class.new klass.allocate.should be_kind_of(klass) end it "returns a fully-formed instance of Module" do klass = Class.allocate klass.constants.should_not == nil ...
require File.expand_path('../../../spec_helper', __FILE__) describe "Class#allocate" do it "returns an instance of self" do klass = Class.new klass.allocate.should be_kind_of(klass) end it "returns a fully-formed instance of Module" do klass = Class.allocate klass.constants.should_not == nil ...
Update migration for image association
class CreateSpinaArticlesTable < ActiveRecord::Migration[5.0] def change create_table :spina_articles do |t| t.string :title t.string :slug t.text :body t.text :teaser t.date :publish_date t.string :author t.integer :draft, default: true t.integer :image_id t....
class CreateSpinaArticlesTable < ActiveRecord::Migration[5.0] def change create_table :spina_articles do |t| t.string :title t.string :slug t.text :body t.text :teaser t.date :publish_date t.string :author t.integer :draft, default: true t.timestamps t.referen...
Add tzinfo gem as development dependency.
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "couch_potato/version" Gem::Specification.new do |s| s.name = "couch_potato" s.summary = %Q{Ruby persistence layer for CouchDB} s.email = "alex@upstre.am" s.homepage = "http://github.com/langalex/couch_potato" s.description = "Rub...
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "couch_potato/version" Gem::Specification.new do |s| s.name = "couch_potato" s.summary = %Q{Ruby persistence layer for CouchDB} s.email = "alex@upstre.am" s.homepage = "http://github.com/langalex/couch_potato" s.description = "Rub...
Add development dependency for 'coffee-rails'
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "emcee/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "emcee" s.version = Emcee::VERSION s.authors = ["Andrew Huth"] s.email = ["andrew@huth.me"] s.home...
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "emcee/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "emcee" s.version = Emcee::VERSION s.authors = ["Andrew Huth"] s.email = ["andrew@huth.me"] s.home...
Change S3 connection persistence to false
AWS::S3::Base.establish_connection!( :access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'] )
AWS::S3::Base.establish_connection!( :access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'], :persistent => false )
Package version is increased from 0.1.2 to 0.1.3
Gem::Specification.new do |s| s.name = "http-protocol" s.version = '0.1.2' s.summary = "HTTP protocol library designed to facilitate custom HTTP clients" s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian-btc/ht...
Gem::Specification.new do |s| s.name = "http-protocol" s.version = '0.1.3' s.summary = "HTTP protocol library designed to facilitate custom HTTP clients" s.description = ' ' s.authors = ['Obsidian Software, Inc'] s.email = 'opensource@obsidianexchange.com' s.homepage = 'https://github.com/obsidian-btc/ht...
Add function to scrape NJTransit site for train info
require 'rubygems' require 'sinatra' get '/' do erb :'index.html' end
require 'rubygems' require 'sinatra' require 'open-uri' require 'nokogiri' URL = 'http://dv.njtransit.com/mobile/tid-mobile.aspx?SID=NY&SORT=A' get '/' do erb :'index.html' end get %r{/(\d{4})$} do |train| "#{train_status(train)}" end def train_status(train_number) doc = Nokogiri::HTML(open(URL, "User-Agent" => ...
Change the timing to return nil
require 'yummydata/http_helper' require 'sparql/client' require 'rdf/turtle' module Yummydata module Criteria module ExecutionTime BASE_QUERY = <<-'SPARQL' ASK{} SPARQL TARGET_QUERY = <<-'SPARQL' SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } } SPARQL def prepare(uri) @cl...
require 'yummydata/http_helper' require 'sparql/client' require 'rdf/turtle' module Yummydata module Criteria module ExecutionTime BASE_QUERY = <<-'SPARQL' ASK{} SPARQL TARGET_QUERY = <<-'SPARQL' SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } } SPARQL def prepare(uri) @cl...
Make table printer take the table object
module Primer class TablePrinter attr_reader :rows, :primes, :cell_width private :rows, :primes, :cell_width def initialize(primes:, rows:) @primes = primes @rows = rows @cell_width = rows.last.last.to_s.size end def print_multiplication_table $stdout.puts(headers) ...
module Primer class TablePrinter attr_reader :table, :cell_width private :table, :cell_width def initialize(table) @table = table @cell_width = table.largest_prime.to_s.size end def print_table $stdout.puts(headers) $stdout.puts('-' * headers.size) print_rows en...
Improve the description a whisker
name 'collectd' maintainer 'Peter Donald' maintainer_email 'peter@realityforge.org' license 'Apache 2.0' description 'Install and configure the collectd monitoring daemon and plugins' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '1.1.5' suppo...
name 'collectd' maintainer 'Peter Donald' maintainer_email 'peter@realityforge.org' license 'Apache 2.0' description 'Install and configure the collectd monitoring daemon and plugin configurations' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version ...
Use official SPDX identifier for the license
name 'sys' maintainer 'GSI HPC department' maintainer_email 'hpc@gsi.de' license 'Apache 2.0' description 'System Software configuration and maintenance' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) if respond_to?(:source_url) source_url 'https://githu...
name 'sys' maintainer 'GSI HPC department' maintainer_email 'hpc@gsi.de' license 'Apache-2.0' description 'System Software configuration and maintenance' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) if respond_to?(:source_url) source_url 'https://githu...
Bump version in preparation for release
# # 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, software # distributed under ...
# # 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, software # distributed under ...
Update Spectacle.app to version 0.8.10
cask :v1 => 'spectacle' do if MacOS.release <= :mountain_lion version '0.8.6' sha256 '3e367d2d7e6fe7d5f41d717d49cb087ba7432624b71ddd91c0cfa9d5a5459b7c' else version '0.8.9' sha256 '11058388f4f3a2f91c7f888d8bf11017e12dea07808895d899c5b8407f679993' appcast 'http://spectacleapp.com/updates/appcas...
cask :v1 => 'spectacle' do if MacOS.release <= :mountain_lion version '0.8.6' sha256 '3e367d2d7e6fe7d5f41d717d49cb087ba7432624b71ddd91c0cfa9d5a5459b7c' else version '0.8.10' sha256 '26e4ccc906a82c5df9d1d462f1b691fce746aea43405b178d3d230fb23551d44' appcast 'http://spectacleapp.com/updates/appca...
Add generic_exception_handler rescue_from to the utils controller
require 'v1/bulk_download' module V1 class UtilsController < ApplicationController before_filter :authenticate #rescue_from Exception, :with => :generic_exception_handler rescue_from Errno::ECONNREFUSED, :with => :connection_refused def contributor_bulk_download_links render :json => BulkDown...
require 'v1/bulk_download' module V1 class UtilsController < ApplicationController before_filter :authenticate rescue_from Exception, :with => :generic_exception_handler rescue_from Errno::ECONNREFUSED, :with => :connection_refused def contributor_bulk_download_links render :json => BulkDownl...
Fix visualizations table by casting the type of the map_id column
# encoding: utf-8 class VisualizationsMigration < Sequel::Migration def up drop_table :visualizations create_table :visualizations do String :id, null: false, primary_key: true String :name, text: true String :description, text: true Integer :map_id,...
# encoding: utf-8 class VisualizationsFixMigration < Sequel::Migration def up Rails::Sequel.connection.run(%Q{ ALTER TABLE visualizations ALTER COLUMN map_id TYPE integer USING map_id::integer }) end #up def down end #down end # VisualizationsFixMigration
Update to use latest devise version
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'grape_devise_token_auth/version' Gem::Specification.new do |spec| spec.name = "grape_devise_token_auth" spec.version = GrapeDeviseTokenAuth::VERSION spec.authors = ["Mi...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'grape_devise_token_auth/version' Gem::Specification.new do |spec| spec.name = "grape_devise_token_auth" spec.version = GrapeDeviseTokenAuth::VERSION spec.authors = ["Mi...
Modify virtual_path in ActionView::Template for TESTING
module Jpmobile class Resolver < ActionView::FileSystemResolver EXTENSIONS = [:locale, :formats, :handlers, :mobile] DEFAULT_PATTERN = ":prefix/:action{_:mobile,}{.:locale,}{.:formats,}{.:handlers,}" def initialize(path, pattern=nil) raise ArgumentError, "path already is a Resolver class" if path.i...
module Jpmobile class Resolver < ActionView::FileSystemResolver EXTENSIONS = [:locale, :formats, :handlers, :mobile] DEFAULT_PATTERN = ":prefix/:action{_:mobile,}{.:locale,}{.:formats,}{.:handlers,}" def initialize(path, pattern=nil) raise ArgumentError, "path already is a Resolver class" if path.i...