diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/concerns/school_aggregation.rb b/app/controllers/concerns/school_aggregation.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/school_aggregation.rb +++ b/app/controllers/concerns/school_aggregation.rb @@ -7,7 +7,7 @@ cache_key = "#{school.name.parameterize}-aggregated_meter_collection" Rails.cache.fetch(cache_key, expires_in: 3.hours) do meter_collection = MeterCollection.new(school) - AggregateDataService.new(meter_collection).aggregate_heat_and_electricity_meters + AggregateDataService.new(meter_collection).validate_and_aggregate_meter_data meter_collection end end
Use old validate and aggregate for analysis
diff --git a/lib/voluntary_ranking/engine.rb b/lib/voluntary_ranking/engine.rb index abc1234..def5678 100644 --- a/lib/voluntary_ranking/engine.rb +++ b/lib/voluntary_ranking/engine.rb @@ -2,9 +2,13 @@ class Engine < ::Rails::Engine config.autoload_paths << File.expand_path("../..", __FILE__) config.autoload_paths << File.expand_path("../../../app/models/concerns", __FILE__) - + initializer 'configure ember-rails ranking', before: 'ember_rails.setup_vendor' do config.handlebars.templates_root << 'voluntary_ranking/templates' end + + config.to_prepare do + User.send :include, Concerns::Model::User::Ranking + end end -end +end
Include ranking module in user through config.to_prepare.
diff --git a/readme_tracker.gemspec b/readme_tracker.gemspec index abc1234..def5678 100644 --- a/readme_tracker.gemspec +++ b/readme_tracker.gemspec @@ -4,22 +4,24 @@ require 'readme_tracker/version' Gem::Specification.new do |spec| - spec.name = "readme_tracker" + spec.name = 'readme_tracker' spec.version = ReadmeTracker::VERSION - spec.authors = ["willnet"] - spec.email = ["netwillnet@gmail.com"] + spec.authors = ['willnet'] + spec.email = ['netwillnet@gmail.com'] spec.summary = %q{tracking commit of README} spec.description = %q{tracking commit of README} - spec.homepage = "https://github.com/willnet/readme_tracker" - spec.license = "MIT" + spec.homepage = 'https://github.com/willnet/readme_tracker' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" - spec.add_development_dependency "octokit" + spec.add_dependency 'octokit' + spec.add_dependency 'slop' + + spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'rake' + spec.add_development_dependency 'rspec' end
Refactor gemspec and add slop
diff --git a/app/models/chouette/journey_pattern_section.rb b/app/models/chouette/journey_pattern_section.rb index abc1234..def5678 100644 --- a/app/models/chouette/journey_pattern_section.rb +++ b/app/models/chouette/journey_pattern_section.rb @@ -6,4 +6,13 @@ validates :route_section_id, presence: true validates :rank, presence: true, numericality: :only_integer validates :journey_pattern_id, uniqueness: { scope: [:route_section_id, :rank] } + + def self.update_by_journey_pattern_rank(journey_pattern_id, route_section_id, rank) + jps = self.find_or_initialize_by(journey_pattern_id: journey_pattern_id, rank: rank) + if route_section_id.present? + jps.update_attributes(route_section_id: route_section_id) + else + jps.destroy + end + end end
Add method to create by rank
diff --git a/config/initializers/mixpanel.rb b/config/initializers/mixpanel.rb index abc1234..def5678 100644 --- a/config/initializers/mixpanel.rb +++ b/config/initializers/mixpanel.rb @@ -1,3 +1,3 @@-unless [:development, :test].include?(Rails.env.to_sym) +if defined?(Mixpanel) $mixpanel = Mixpanel::Tracker.new('2e87e79bda898d69197d3623c426be35') end
Make the server work properly
diff --git a/spec/integration/error_spec.rb b/spec/integration/error_spec.rb index abc1234..def5678 100644 --- a/spec/integration/error_spec.rb +++ b/spec/integration/error_spec.rb @@ -22,8 +22,10 @@ it 'raises an error with console output' do expect{|b| linter.lint([file], container, options, &b)}.to raise_error( LintTrap::Linter::LintError, - "Encountered error when running linter:\n"\ - "ls: cannot access /home/spin_cycle/this-does-not-exist.rb: No such file or directory\n" + start_with( + "Encountered error when running linter:\n"\ + "ls: cannot access /home/spin_cycle/this-does-not-exist.rb: No such file or directory\n" + ) ) end end
Make error spec work on circle
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,5 +22,8 @@ # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] end end
Add filtred Password in log file
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,6 +22,6 @@ config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) - DEMONET_VERSION = 0.1.0 + DEMONET_VERSION = "0.1.0" end end
Fix SyntaxError in version number
diff --git a/texter.gemspec b/texter.gemspec index abc1234..def5678 100644 --- a/texter.gemspec +++ b/texter.gemspec @@ -1,8 +1,8 @@-# -*- encoding: utf-8 -*- +# encoding: UTF-8 require File.expand_path('../lib/texter/version', __FILE__) Gem::Specification.new do |gem| - gem.authors = ["J. Pablo Fernández"] + gem.authors = ["J. Pablo Fernández"] gem.email = ["pupeno@watuhq.com"] gem.description = %q{Generic interface to send SMS with Ruby} gem.summary = %q{Generic interface to send SMS with Ruby}
Change how encoding is specified.
diff --git a/app/decorators/article/post_decorator.rb b/app/decorators/article/post_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/article/post_decorator.rb +++ b/app/decorators/article/post_decorator.rb @@ -2,22 +2,22 @@ module Article::PostDecorator def byline content_tag(:p, class: 'byline') do - show? ? full_byline : responsive_byline + index? ? responsive_byline : full_byline end end def content - show? ? body : excerpt + index? ? excerpt : body end def display_featured_image - show? ? featured_image : featured_image.thumb + index? ? featured_image.thumb : featured_image end private - def show? - action_name == 'show' + def index? + action_name == 'index' or controller_name == 'columns' end def full_byline
Fix showing excerpt in posts lists
diff --git a/spec/freebsd/ntp_spec.rb b/spec/freebsd/ntp_spec.rb index abc1234..def5678 100644 --- a/spec/freebsd/ntp_spec.rb +++ b/spec/freebsd/ntp_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' + +# Tests to ensure ntp is locked down + +describe file('/etc/ntp.conf') do + it { should be_file } + it { should contain "restrict default kod nomodify notrap nopeer noquery" } + it { should contain "restrict -6 default kod nomodify notrap nopeer noquery" } + it { should contain "restrict 127.0.0.1" } + it { should contain "restrict -6 ::1" } +end +
Add tests to ensure ntp is locked down
diff --git a/06_light_grid.rb b/06_light_grid.rb index abc1234..def5678 100644 --- a/06_light_grid.rb +++ b/06_light_grid.rb @@ -0,0 +1,27 @@+COMMAND = /^(?:turn )?(on|off|toggle) (\d+),(\d+) through (\d+),(\d+)$/ + +def new_grid; Array.new(1000) { Array.new(1000, 0) }; end + +puts ARGF.each_line.with_object([new_grid, new_grid]) { |l, (on_off_grid, bright_grid)| + captures = COMMAND.match(l).captures + command = captures.shift + xmin, ymin, xmax, ymax = captures.map(&method(:Integer)) + + case command + when 'on' + on_off_result = ->(_) { 1 } + bright_result = ->(x) { x + 1 } + when 'off' + on_off_result = ->(_) { 0 } + bright_result = ->(x) { x == 0 ? 0 : x - 1 } + when 'toggle' + on_off_result = ->(x) { 1 - x } + bright_result = ->(x) { x + 2 } + end + + yrange = ymin..ymax + (xmin..xmax).each { |x| + on_off_grid[x][yrange] = on_off_grid[x][yrange].map(&on_off_result) + bright_grid[x][yrange] = bright_grid[x][yrange].map(&bright_result) + } +}.map { |a| a.flatten.sum }
Add day 06: Light Grid
diff --git a/lib/neptune/api.rb b/lib/neptune/api.rb index abc1234..def5678 100644 --- a/lib/neptune/api.rb +++ b/lib/neptune/api.rb @@ -8,6 +8,7 @@ module Neptune module Api NAMES = { + consumer_metadata: ConsumerMetadata, fetch: Fetch, metadata: Metadata, offset: Offset,
Add ConsumerMetadata to Api lookups
diff --git a/app/jobs/send_single_triage_email_job.rb b/app/jobs/send_single_triage_email_job.rb index abc1234..def5678 100644 --- a/app/jobs/send_single_triage_email_job.rb +++ b/app/jobs/send_single_triage_email_job.rb @@ -2,10 +2,16 @@ def perform(id) repo_sub = RepoSubscription.includes(:user, :repo).find(id) IssueAssigner.new(repo_sub.user, [repo_sub]).assign! - if assignment = repo_sub.user.issue_assignments.order(:created_at).eager_load(:repo_subscription) - .where(repo_subscriptions: { repo_id: repo_sub.repo_id }).last + if assignment assignment.update!(delivered: true) UserMailer.send_triage(repo: repo_sub.repo, user: repo_sub.user, assignment: assignment).deliver_later end end + + private + + def assignment + @assignment ||= repo_sub.user.issue_assignments.order(:created_at).eager_load(:repo_subscription) + .where(repo_subscriptions: { repo_id: repo_sub.repo_id }).last + end end
Use private method for assignment definition
diff --git a/lib/polyamorous.rb b/lib/polyamorous.rb index abc1234..def5678 100644 --- a/lib/polyamorous.rb +++ b/lib/polyamorous.rb @@ -8,15 +8,9 @@ OuterJoin = Arel::Nodes::OuterJoin end - if defined?(::ActiveRecord::Associations::JoinDependency) - JoinDependency = ::ActiveRecord::Associations::JoinDependency - JoinAssociation = ::ActiveRecord::Associations::JoinDependency::JoinAssociation - JoinBase = ::ActiveRecord::Associations::JoinDependency::JoinBase - else - JoinDependency = ::ActiveRecord::Associations::ClassMethods::JoinDependency - JoinAssociation = ::ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation - JoinBase = ::ActiveRecord::Associations::ClassMethods::JoinDependency::JoinBase - end + JoinDependency = ::ActiveRecord::Associations::JoinDependency + JoinAssociation = ::ActiveRecord::Associations::JoinDependency::JoinAssociation + JoinBase = ::ActiveRecord::Associations::JoinDependency::JoinBase end require 'polyamorous/tree_node'
Remove unused constant aliases for `ActiveRecord::Associations::ClassMethods::*` `ActiveRecord::Associations::ClassMethods::*` had already been moved to `ActiveRecord::Associations::*` since Rails 3.1. See https://github.com/rails/rails/commit/b171b9e73dcc6a89b1da652da61c5127fe605b51
diff --git a/lib/tic_tac_toe.rb b/lib/tic_tac_toe.rb index abc1234..def5678 100644 --- a/lib/tic_tac_toe.rb +++ b/lib/tic_tac_toe.rb @@ -3,11 +3,11 @@ module TicTacToe # Your code goes here... class Board - def pos coords + def pos index " " end - def move coords, mark + def move index, mark end end
Change variable name passed to methods
diff --git a/lib/wukong/boot.rb b/lib/wukong/boot.rb index abc1234..def5678 100644 --- a/lib/wukong/boot.rb +++ b/lib/wukong/boot.rb @@ -1,6 +1,6 @@ require 'yaml' module Wukong - CONFIG_FILE_LOCATION=File.dirname(__FILE__)+'/../config' + CONFIG_FILE_LOCATION=File.dirname(__FILE__)+'/../../config' CONFIG = { } def self.config_options
Adjust config path for new code location
diff --git a/examples/preapproval/search/search_by_subscription_code.rb b/examples/preapproval/search/search_by_subscription_code.rb index abc1234..def5678 100644 --- a/examples/preapproval/search/search_by_subscription_code.rb +++ b/examples/preapproval/search/search_by_subscription_code.rb @@ -6,12 +6,44 @@ # # P.S: See the boot file example for more details. -credentials = PagSeguro::AccountCredentials.new('user@example.com', 'TOKEN') -subscription = PagSeguro::Subscription.find_by_code('SUBSCRIPTION_CODE', credentials: credentials) +email = 'user@example.com' +token = 'TOKEN' +code = 'CODE' + +credentials = PagSeguro::AccountCredentials.new(email, token) +subscription = PagSeguro::Subscription.find_by_code(code, credentials: credentials) if subscription.errors.empty? puts "Subscription:" - puts "\t#{subscription.inspect}" + puts " code: #{subscription.code}" + puts " name: #{subscription.name}" + puts " date: #{subscription.date}" + puts " tracker: #{subscription.tracker}" + puts " status: #{subscription.status}" + puts " reference: #{subscription.reference}" + puts " last event date: #{subscription.last_event_date}" + puts " charge: #{subscription.charge}" + + if subscription.sender + puts " sender.name: #{subscription.sender.name}" + puts " sender.email: #{subscription.sender.email}" + + if subscription.sender.phone + puts " sender.phone.area_code: #{subscription.sender.phone.area_code}" + puts " sender.phone.number: #{subscription.sender.phone.number}" + end + + if subscription.sender.address + puts " sender.address.street: #{subscription.sender.address.street}" + puts " sender.address.number: #{subscription.sender.address.number}" + puts " sender.address.complement: #{subscription.sender.address.complement}" + puts " sender.address.district: #{subscription.sender.address.district}" + puts " sender.address.city: #{subscription.sender.address.city}" + puts " sender.address.state: #{subscription.sender.address.state}" + puts " sender.address.postal_code: #{subscription.sender.address.postal_code}" + puts " sender.address.country: #{subscription.sender.address.country}" + end + end else puts "Errors:" puts subscription.errors.join("\n")
Add details to search by subscription code
diff --git a/Casks/freecad.rb b/Casks/freecad.rb index abc1234..def5678 100644 --- a/Casks/freecad.rb +++ b/Casks/freecad.rb @@ -2,6 +2,7 @@ version '0.16-6705.acfe417' sha256 '7ddd1dc718b9338bc3581f02f107a80d3dfe3dfe147f7dcd7c5d28af864654f9' + # github.com/FreeCAD/FreeCAD was verified as official when first introduced to the cask url "https://github.com/FreeCAD/FreeCAD/releases/download/0.16/FreeCAD_#{version}-OSX-x86_64.dmg" appcast 'https://github.com/FreeCAD/FreeCAD/releases.atom', checkpoint: 'ac051636765e99376ab15d484b3dd0f938f59f4fa48a627a367a97a44ca5ad86'
Fix `url` stanza comment for FreeCAD.
diff --git a/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb b/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb @@ -1,5 +1,3 @@-require "active_support/cache/mem_cache_store" - module ActiveSupport module Cache class CompressedMemCacheStore < MemCacheStore
Revert "Ensure MemCacheStore is required when using CompressedMemCacheStore since they are lazy load now." This reverts commit dd4181f47dc0f166eb5d3e47a4a0dc1594cc5669.
diff --git a/Casks/osxfuse.rb b/Casks/osxfuse.rb index abc1234..def5678 100644 --- a/Casks/osxfuse.rb +++ b/Casks/osxfuse.rb @@ -2,7 +2,7 @@ version '2.8.3' sha256 'b0f05fa6e74372b73417e89bfd103a46a0b968239f03832755e424bec09051e6' - # sourceforge.net/project/osxfuse was verified as official when first introduced to the cask + # sourceforge.net/sourceforge/osxfuse was verified as official when first introduced to the cask url "http://downloads.sourceforge.net/sourceforge/osxfuse/osxfuse-#{version}.dmg" name 'OSXFUSE' homepage 'https://osxfuse.github.io/'
Fix `url` stanza comment for OSXFUSE.
diff --git a/db/migrate/20180326202229_create_ci_job_trace_chunks.rb b/db/migrate/20180326202229_create_ci_job_trace_chunks.rb index abc1234..def5678 100644 --- a/db/migrate/20180326202229_create_ci_job_trace_chunks.rb +++ b/db/migrate/20180326202229_create_ci_job_trace_chunks.rb @@ -8,7 +8,9 @@ t.integer :job_id, null: false t.integer :chunk_index, null: false t.integer :data_store, null: false - t.text :raw_data + # Mysql needs MEDIUMTEXT type (up to 16MB) rather than TEXT (up to 64KB) + # Because 'raw_data' is always capped by Ci::JobTraceChunk::CHUNK_SIZE, which is 128KB + t.text :raw_data, limit: 16.megabytes - 1 t.foreign_key :ci_builds, column: :job_id, on_delete: :cascade t.index [:job_id, :chunk_index], unique: true
Use MEDIUMTEXT(16MB) type when Mysql is used
diff --git a/lib/message_hub.rb b/lib/message_hub.rb index abc1234..def5678 100644 --- a/lib/message_hub.rb +++ b/lib/message_hub.rb @@ -11,6 +11,15 @@ require 'message_hub/providers/facebook' module MessageHub + ##### + # Usage: + # + # gmail = MessageHub.provider(:gmail) + # gmail.login(:username => "login", :password => "your password") + # gmail.fetch_messages(:since => Time.now) do |message| + # puts "Received: #{message.inspect}" + # end + # def self.provider(name) provider_klass = Object.module_eval("MessageHub::Providers::#{name.capitalize}")
Add a little note explaining how to use it.
diff --git a/lib/proteus/cli.rb b/lib/proteus/cli.rb index abc1234..def5678 100644 --- a/lib/proteus/cli.rb +++ b/lib/proteus/cli.rb @@ -3,8 +3,6 @@ module Proteus class CLI < Thor - package_name "proteus" - desc "init", "Initialize a basic configuration" def init #TODO:
Remove the package_name to support older versions of thor. Don't really need it anyway
diff --git a/stack_queue.rb b/stack_queue.rb index abc1234..def5678 100644 --- a/stack_queue.rb +++ b/stack_queue.rb @@ -0,0 +1,47 @@+require_relative "stack" + +class StackQueue + class UnderflowError < StandardError; end + + def initialize + @stack_1 = Stack.new + @stack_2 = Stack.new + end + + def enqueue(item) + @stack_1.push(item) + end + + def dequeue + fail UnderflowError, "Queue is empty" if empty? + empty_stack_2 + @stack_2.pop + end + + def peek + empty_stack_2 + @stack_2.peek + end + + def empty? + @stack_1.empty? && @stack_2.empty? + end + + def size + @stack_1.size + @stack_2.size + end + + private + + def empty_stack_2 + if @stack_2.empty? + stack_swap + end + end + + def stack_swap + until @stack_1.empty? + @stack_2.push(@stack_1.pop) + end + end +end
Implement queue using two stacks
diff --git a/spec/controllers/availabilities_controller_spec.rb b/spec/controllers/availabilities_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/availabilities_controller_spec.rb +++ b/spec/controllers/availabilities_controller_spec.rb @@ -2,4 +2,33 @@ RSpec.describe AvailabilitiesController, type: :controller do + + before(:each) do + + @user1= User.create!(username: Faker::Internet.user_name, password: "passwords", first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, description: Faker::StarWars.quote, email: Faker::Internet.email, genres: Faker::Book.genre) + @studio1= Studio.create!(name: "Studio1", owner: @user1, full_address: "351 W Hubbard St, Chicago, IL 60654", description: "I hate this test", price: 500, website:"http://wikijamz.herokuapp.com") + @availability1= Availability.create!(start_time: "2016-04-05 15:42:04", end_time: "2016-04-05 18:42:04", studio: @studio1) + end + + def add_availability_to_collection + post :create, availability: {start_time: "2016-04-05 15:42:04", end_time: "2016-04-05 18:42:04"}, studio_id: @studio1.id + end + + describe "create" do + + it "adds an availability to a studio's collection" do + add_availability_to_collection + expect(Availability.last.studio).to eq(@studio1) + end + + it 'finds the right studio based on id' do + add_availability_to_collection + expect(assigns(:studio)).to eq @studio1 + end + + it 'gives a 422 error if given the wrong information' do + post :create, availability: {end_time: "2016-04-05 18:42:04"}, studio_id: @studio1.id + expect(response).to have_http_status(422) + end + end end
Add basic tests for availabilities controller
diff --git a/app/abilities/scraper_ability.rb b/app/abilities/scraper_ability.rb index abc1234..def5678 100644 --- a/app/abilities/scraper_ability.rb +++ b/app/abilities/scraper_ability.rb @@ -9,24 +9,24 @@ sig { params(owner: T.nilable(Owner)).void } def initialize(owner) # Everyone can list all (non private) scrapers - can %i[index show], Scraper, private: false + can :read, Scraper, private: false return unless owner can :data, Scraper, private: false - can :new, Scraper unless SiteSetting.read_only_mode + can :create, Scraper unless SiteSetting.read_only_mode can :watch, Scraper, private: false unless SiteSetting.read_only_mode # user can view scrapers owned by them (even if private) and settings of scrapers they own - can %i[index show data], Scraper, owner_id: owner.id - can %i[destroy edit update create watch], Scraper, owner_id: owner.id unless SiteSetting.read_only_mode + can %i[read data], Scraper, owner_id: owner.id + can %i[destroy update watch], Scraper, owner_id: owner.id unless SiteSetting.read_only_mode # user can view scrapers and settings of scrapers belonging to an org they are a # member of if owner.is_a?(User) owner.organizations.each do |org| - can %i[index show data], Scraper, owner_id: org.id - can %i[destroy edit update create watch], Scraper, owner_id: org.id unless SiteSetting.read_only_mode + can %i[read data], Scraper, owner_id: org.id + can %i[destroy update create watch], Scraper, owner_id: org.id unless SiteSetting.read_only_mode end end
Use cancancan baked-in aliases to simplify further
diff --git a/everything-core.gemspec b/everything-core.gemspec index abc1234..def5678 100644 --- a/everything-core.gemspec +++ b/everything-core.gemspec @@ -23,6 +23,6 @@ spec.add_development_dependency 'bundler', '~> 1.11' spec.add_development_dependency 'rake', '~> 10.5' - spec.add_development_dependency 'rspec', '~> 3.4.0' + spec.add_development_dependency 'rspec', '~> 3.4' end
Update gem's rspec dependency version
diff --git a/cookbooks/checkers/metadata.rb b/cookbooks/checkers/metadata.rb index abc1234..def5678 100644 --- a/cookbooks/checkers/metadata.rb +++ b/cookbooks/checkers/metadata.rb @@ -4,3 +4,5 @@ license 'X11/MIT' description 'Installs all syntax checkers supported by Flycheck' version '0.1.0' + +depends 'apt'
Add missing apt dependency to checkers cookbook
diff --git a/SwiftFlowRecorder.podspec b/SwiftFlowRecorder.podspec index abc1234..def5678 100644 --- a/SwiftFlowRecorder.podspec +++ b/SwiftFlowRecorder.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftFlowRecorder" - s.version = "0.2.0" + s.version = "0.2" s.summary = "Time Travel and Hot Reloading for Swift Flow" s.description = <<-DESC A recording store for Swift Flow. Enables hot-reloading and time travel for Swift Flow apps.
[CocoaPods] Fix Version Number in Podspec
diff --git a/test/test_gen.rb b/test/test_gen.rb index abc1234..def5678 100644 --- a/test/test_gen.rb +++ b/test/test_gen.rb @@ -19,13 +19,13 @@ end def test_gen_should_raise_an_exception_if_the_given_options_are_duplicated - e = assert_raise(RandomToken::RandomTokenError) { RandomToken.gen(8, s: :a, seed: :o) } + e = assert_raise(RandomToken::RandomTokenError) { RandomToken.gen(8, :s => :a, :seed => :o) } assert(e.code == :duplicated_option) end def test_gen_should_raise_an_exception_if_the_given_option_values_are_invalid invalid_value = 'invalid_value' - e = assert_raise(RandomToken::RandomTokenError) { RandomToken.gen(8, c: invalid_value) } + e = assert_raise(RandomToken::RandomTokenError) { RandomToken.gen(8, :c => invalid_value) } assert(e.code == :invalid_option_value) end end
Change hash style to 1.8.7 in tests DESC: [Change] 1. Change hash style to 1.8.7 in tests For testing 1.8.7
diff --git a/spec/chatrix/errors_spec.rb b/spec/chatrix/errors_spec.rb index abc1234..def5678 100644 --- a/spec/chatrix/errors_spec.rb +++ b/spec/chatrix/errors_spec.rb @@ -1,5 +1,5 @@ describe Chatrix::RequestError do - let(:response) { { 'errcode' => 666, 'error' => 'my error' } } + let(:response) { { 'errcode' => 'M_SOME_ERR', 'error' => 'my error' } } let(:error) { Chatrix::RequestError.new response } it 'should set the correct error code' do
Use a string for error code in tests
diff --git a/mediacloth.gemspec b/mediacloth.gemspec index abc1234..def5678 100644 --- a/mediacloth.gemspec +++ b/mediacloth.gemspec @@ -2,7 +2,7 @@ SPEC = Gem::Specification.new do |s| s.name = "mediacloth" - s.version = "0.5" + s.version = "0.6" s.author = "Pluron Inc." s.email = "support@pluron.com" s.homepage = "https://github.com/adymo/mediacloth"
Bump version number to 0.6
diff --git a/spec/system/haproxy_spec.rb b/spec/system/haproxy_spec.rb index abc1234..def5678 100644 --- a/spec/system/haproxy_spec.rb +++ b/spec/system/haproxy_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "haproxy" do - let(:management_uri) { 'http://10.244.16.3:15672' } + let(:management_uri) { "http://#{environment.bosh_manifest.job('haproxy').static_ips.first}:15672" } [0, 1].each do |job_index| context "when the job rmq/#{job_index} is down" do
Read haproxy static_ips from manifest in test [#148579027] Signed-off-by: Diego Lemos <48d75b1e8d05d722a97d5c3ce49024e6a466bebe@pivotal.io>
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,8 +1,6 @@ $:.unshift(File.expand_path("../lib", File.dirname(__FILE__))) -puts "!! REMOVE THIS IN LINE: #{__LINE__} of #{__FILE__}" -$:.unshift("/Users/cyx/Labs/shield/lib") - +require "shield" require "shield/contrib" require "spawn" require "ohm"
Remove the hard coded require.
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -7,8 +7,11 @@ class MiniTest::Unit::TestCase include Mocha::API + def setup + mocha_teardown + end + def teardown mocha_verify - mocha_teardown end end
Fix mocha teardown to not fail all following tests
diff --git a/app/helpers/db_helpers.rb b/app/helpers/db_helpers.rb index abc1234..def5678 100644 --- a/app/helpers/db_helpers.rb +++ b/app/helpers/db_helpers.rb @@ -1,7 +1,7 @@ module DbHelpers def db_concat(*args) env = ENV['RAILS_ENV'] || 'development' - adapter = ActiveRecord::Base.configurations.configs_for(env_name:env)[:adapter].to_sym + adapter = ActiveRecord::Base.configurations.configs_for(env_name: env).first.configuration_hash[:adapter].to_sym args.map! { |arg| arg.class == Symbol ? arg.to_s : arg } case adapter
CONFIG: Update method to get database adapter
diff --git a/lib/did_you_mean/strategies/similar_attribute_finder.rb b/lib/did_you_mean/strategies/similar_attribute_finder.rb index abc1234..def5678 100644 --- a/lib/did_you_mean/strategies/similar_attribute_finder.rb +++ b/lib/did_you_mean/strategies/similar_attribute_finder.rb @@ -27,14 +27,10 @@ end def similar_columns - @similar_columns ||= MethodMatcher.new(column_names, attribute_name).similar_methods + @similar_columns ||= MethodMatcher.new(columns.map(&:name), attribute_name).similar_methods end private - - def column_names - columns.map(&:name) - end def format(name) "%s: %s" % [name, columns.detect{|c| c.name == name }.type]
Remove method that doesn't have to be a method
diff --git a/lib/allowing/wrappers/wrapper.rb b/lib/allowing/wrappers/wrapper.rb index abc1234..def5678 100644 --- a/lib/allowing/wrappers/wrapper.rb +++ b/lib/allowing/wrappers/wrapper.rb @@ -1,10 +1,6 @@-require 'allowing/extensions/string' - module Allowing module Wrappers class Wrapper - using Extensions::String - attr_reader :rule, :validation, :attribute def initialize(rule, validation, attribute = nil)
Remove unused string extensions from Wrapper
diff --git a/lib/piggybak_braintree/engine.rb b/lib/piggybak_braintree/engine.rb index abc1234..def5678 100644 --- a/lib/piggybak_braintree/engine.rb +++ b/lib/piggybak_braintree/engine.rb @@ -1,4 +1,5 @@ require 'piggybak_braintree/payment_decorator' +require 'piggybak_braintree/orders_controller_decorator' module PiggybakBraintree class Engine < ::Rails::Engine
Add require for controller decorator
diff --git a/script/cruise_build.rb b/script/cruise_build.rb index abc1234..def5678 100644 --- a/script/cruise_build.rb +++ b/script/cruise_build.rb @@ -10,9 +10,15 @@ case project_name when "racing_on_rails" - # Nothing else to get + exec("rake cruise") +when "aba" + exec("svn co svn+ssh://butlerpress.com/var/repos/aba/trunk local && rake cruise") when "atra" exec("svn co svn+ssh://butlerpress.com/var/repos/atra/trunk local && rake cruise") +when "obra" + exec("svn co svn+ssh://butlerpress.com/var/repos/obra/trunk local && rake cruise") +when "wsba" + exec("svn co svn+ssh://butlerpress.com/var/repos/wsba/trunk local && rake cruise") else raise "Don't know how to build project named: '#{project_name}'" end
Add rake back for racing_on_rals project. Add all the projects. git-svn-id: 96bd6241e080dd4199045f7177cf3384e2eaed71@1424 2d86388d-c40f-0410-ad6a-a69da6a65d20
diff --git a/script/ram/ws_test2.rb b/script/ram/ws_test2.rb index abc1234..def5678 100644 --- a/script/ram/ws_test2.rb +++ b/script/ram/ws_test2.rb @@ -0,0 +1,9 @@+#!/usr/bin/ruby -w + +require 'xmlrpc/client' + +server = XMLRPC::Client.new2("http://localhost:3030/services/api") + +# Using proxy +ws = server.proxy('assets') +puts ws.get('admin', 'admin', [1])
Test script for fetching file and saving it locally git-svn-id: 035394e0ea20290a56a73539b1ebfcd8236adefd@1322 7bd17f4f-1217-0410-bbc5-bc4367116c30
diff --git a/app/controllers/about_sections_controller.rb b/app/controllers/about_sections_controller.rb index abc1234..def5678 100644 --- a/app/controllers/about_sections_controller.rb +++ b/app/controllers/about_sections_controller.rb @@ -6,7 +6,7 @@ @users = User.regular_staff.with_category.order(:first_name) @categories = @users.map(&:position_category).uniq - @vacancies = Vacancy.published + @vacancies = Vacancy.published.order(:title) @board_members = User.board_members.order(:last_name) @affiliates = User.affiliates.order(:last_name) @programmes = Activity.programmes
Sort vacancies on about page
diff --git a/app/controllers/api/scores_api_controller.rb b/app/controllers/api/scores_api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/scores_api_controller.rb +++ b/app/controllers/api/scores_api_controller.rb @@ -15,8 +15,7 @@ param_group :mode def player name, average, medals, scores = Score.player_scores(params) - respond_with({ name: name, average: average, medals: medals, - records: scores }.to_json) + respond_with name: name, average: average, medals: medals, records: scores end api :GET, '/map/:map', 'Map records' @@ -25,12 +24,12 @@ param :limit, Integer, desc: 'Number of records which will be returned' def map scores = Score.map_scores(params) - respond_with({ records: scores }.to_json) + respond_with records: scores end api :GET, '/maps', 'List of all maps' def maps maps = WorldRecord.distinct(:map).order(:map).pluck(:map) - respond_with(maps: maps) + respond_with maps: maps end end
Remove unnecessary to_json in api controller.
diff --git a/app/controllers/pupils/schools_controller.rb b/app/controllers/pupils/schools_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pupils/schools_controller.rb +++ b/app/controllers/pupils/schools_controller.rb @@ -21,7 +21,8 @@ def activity_setup(school) @activities_count = school.activities.count @first = school.activities.empty? - @suggestion = NextActivitySuggesterWithFilter.new(school, activity_type_filter).suggest_from_activity_history.first + activity_suggester = NextActivitySuggesterWithFilter.new(school, activity_type_filter) + @suggestion = (activity_suggester.suggest_from_programmes + activity_suggester.suggest_from_activity_history + activity_suggester.suggest_from_find_out_mores).first end def equivalence_setup(school)
Use suggestions from programmes first on pupil dash
diff --git a/lib/betty_resource/record.rb b/lib/betty_resource/record.rb index abc1234..def5678 100644 --- a/lib/betty_resource/record.rb +++ b/lib/betty_resource/record.rb @@ -5,9 +5,7 @@ def initialize(args) @model = args[:model] model.properties.each do |property| - define_singleton_method("#{property.name}=") do |val| - attributes[property.name] = val - end + define_setter(property) end end @@ -16,5 +14,13 @@ hash.merge(property.name => nil) end end + + private + + def define_setter(property) + define_singleton_method("#{property.name}=") do |val| + attributes[property.name] = val + end + end end end
Move definition of set method to new method
diff --git a/Casks/marked.rb b/Casks/marked.rb index abc1234..def5678 100644 --- a/Casks/marked.rb +++ b/Casks/marked.rb @@ -1,8 +1,9 @@ cask :v1 => 'marked' do - version :latest - sha256 :no_check + version '2.5.3910' + sha256 'd3c9193fff0c349e0efaf5f14fd9c44d18545044e469d27340ef2c44864f02de' - url 'http://marked2app.com/download/Marked.zip' + # abyss.designheresy.com is the official download host per the appcast feed + url "http://abyss.designheresy.com/marked/Marked#{version}.zip" appcast 'http://abyss.designheresy.com/marked/marked.xml' name 'Marked' homepage 'http://marked2app.com'
Update Marked 2 to version 2.5.3910 This commit updates the version, sha256 and url stanzas. The version is obtained from the appcast feed that was previously included in this cask. Sorry if this is not an approved way to obtain a versioned download URL.
diff --git a/lib/retirement_schemes/classification_count.rb b/lib/retirement_schemes/classification_count.rb index abc1234..def5678 100644 --- a/lib/retirement_schemes/classification_count.rb +++ b/lib/retirement_schemes/classification_count.rb @@ -7,15 +7,7 @@ end def retire?(sw_count) - if disabled? - false - else - sw_count.classifications_count >= @count - end - end - - def disabled? - !!@count.to_s.match(/\Adisabled\z/i) + sw_count.classifications_count >= @count end end end
Remove not-retiring stuff from ClassificationCount
diff --git a/lib/salesforce_bulk/query_result_collection.rb b/lib/salesforce_bulk/query_result_collection.rb index abc1234..def5678 100644 --- a/lib/salesforce_bulk/query_result_collection.rb +++ b/lib/salesforce_bulk/query_result_collection.rb @@ -23,7 +23,8 @@ end def next - # if has next, calls method on client to fetch data and returns new collection instance + # if calls method on client to fetch data and returns new collection instance + SalesforceBulk::QueryResultCollection.new(self.client, self.jobId, self.batchId) end def previous? @@ -32,6 +33,7 @@ def previous # if has previous, calls method on client to fetch data and returns new collection instance + SalesforceBulk::QueryResultCollection.new(self.client, self.jobId, self.batchId) end end
Update next and previous methods to return an empty query result collection object to pass all tests.
diff --git a/lib/json_yaml_assets/engine.rb b/lib/json_yaml_assets/engine.rb index abc1234..def5678 100644 --- a/lib/json_yaml_assets/engine.rb +++ b/lib/json_yaml_assets/engine.rb @@ -16,7 +16,7 @@ end def evaluate(scope, locals = { }, &block) - if /.json.yaml(?:$|\.)/.match(file) + if /.json.ya?ml(?:$|\.)/.match(file) @output ||= MultiJson.dump(YAML.load(data), Template.global_options.clone) else @@ -30,6 +30,7 @@ :after => 'sprockets.environment') do |app| next unless app.assets app.assets.register_engine '.yaml', Template + app.assets.register_engine '.yml', Template Template.global_options = app.config.json_yaml_assets end end
Support .yml extension as well
diff --git a/lib/postqueue/item/inserter.rb b/lib/postqueue/item/inserter.rb index abc1234..def5678 100644 --- a/lib/postqueue/item/inserter.rb +++ b/lib/postqueue/item/inserter.rb @@ -2,7 +2,10 @@ module Postqueue # - # An item class. + # Postqueue::Item inserter modules. + # + # This source file provides multiple implementations to insert Postqueue::Items. + # Which one will be used depends on the "extend XXXInserter" line below. class Item < ActiveRecord::Base module ActiveRecordInserter def insert_item(op:, entity_id:) @@ -11,12 +14,35 @@ end module RawInserter + def insert_sql + "INSERT INTO #{table_name}(op, entity_id) VALUES($1, $2)" + end + + def insert_item(op:, entity_id:) + connection.raw_connection.exec_params(insert_sql, [op, entity_id]) + end + end + + module PreparedRawInserter + def insert_sql + "INSERT INTO #{table_name}(op, entity_id) VALUES($1, $2)" + end + def prepared_inserter_statement - @prepared_inserter_statement ||= begin - name = "postqueue-insert-{table_name}-#{Thread.current.object_id}" - connection.raw_connection.prepare(name, "INSERT INTO #{table_name}(op, entity_id) VALUES($1, $2)") - name - end + @prepared_inserter_statements ||= {} + + # a prepared connection is PER DATABASE connection. It is not shared across + # connections, and it is not per thread, since a Thread might use different + # connections during its lifetime. + connection_id = connection.raw_connection.object_id + @prepared_inserter_statements[connection_id] ||= create_prepared_inserter_statement + end + + # prepares the INSERT statement, and returns its name + def create_prepared_inserter_statement + name = "postqueue-insert-#{table_name}" + connection.raw_connection.prepare(name, insert_sql) + name end def insert_item(op:, entity_id:) @@ -24,7 +50,8 @@ end end - # extend RawInserter - extend ActiveRecordInserter + # extend ActiveRecordInserter # 600µs per item + extend RawInserter # 100µs per item + #extend PreparedRawInserter # 50µs per item end end
Fix for inserting items via prepared queries This commit hopefully fixes inserting via prepared queries. The error seems to have been that a prepared query was used on connections, that did not prepare the query. This commit also adds a raw connection non-prepared queries as well, which is activated by default.
diff --git a/lib/route_downcaser/railtie.rb b/lib/route_downcaser/railtie.rb index abc1234..def5678 100644 --- a/lib/route_downcaser/railtie.rb +++ b/lib/route_downcaser/railtie.rb @@ -1,7 +1,7 @@ module RouteDowncaser class Railtie < Rails::Railtie initializer "add_downcase_route_middleware" do |app| - app.config.middleware.use 'RouteDowncaser::DowncaseRouteMiddleware' + app.config.middleware.use RouteDowncaser::DowncaseRouteMiddleware end end end
Fix middleware class deprecation warning Rails needs an actual class reference instead of just strings, this change removes the following warning: ``` DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change them to actual class references. For example: "RouteDowncaser::DowncaseRouteMiddleware" => RouteDowncaser::DowncaseRouteMiddleware ```
diff --git a/lib/capistrano/foreman.rb b/lib/capistrano/foreman.rb index abc1234..def5678 100644 --- a/lib/capistrano/foreman.rb +++ b/lib/capistrano/foreman.rb @@ -3,7 +3,7 @@ namespace :foreman do desc "Export the Procfile to Ubuntu's upstart scripts" task :export, roles: :app do - run "cd #{release_path} && sudo bundle exec foreman export upstart /etc/init/sites -a #{application} -u #{user} -l #{shared_path}/log" + run "cd #{release_path} && sudo bundle exec foreman export upstart /etc/init -a sites/#{application} -u #{user} -l #{shared_path}/log" end desc "Start the application services"
Fix a bug that caused logs to fail
diff --git a/potatochop.gemspec b/potatochop.gemspec index abc1234..def5678 100644 --- a/potatochop.gemspec +++ b/potatochop.gemspec @@ -17,6 +17,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] gem.add_runtime_dependency 'sinatra' + gem.add_runtime_dependency 'thin' gem.add_runtime_dependency 'haml' gem.add_runtime_dependency 'sass' gem.add_development_dependency 'rspec'
Add Thin as a dependency
diff --git a/rails_zero.gemspec b/rails_zero.gemspec index abc1234..def5678 100644 --- a/rails_zero.gemspec +++ b/rails_zero.gemspec @@ -13,7 +13,7 @@ s.summary = "RailsZero is a static site generator based on Rails" s.description = "RailsZero is a Rails Engine that helps generating static websites out of any Rails application." - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,bin,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 4.0.2"
Include bin path in gem.
diff --git a/3.rb b/3.rb index abc1234..def5678 100644 --- a/3.rb +++ b/3.rb @@ -7,6 +7,6 @@ first_name = gets.chomp.capitalize puts 'Какое Ваше отчество?' middle_name = gets.chomp.capitalize -puts 'What is your surname?' +puts 'Какая Ваша фамилия?' last_name = gets.chomp.capitalize puts "Привет, #{first_name} #{middle_name} #{last_name}"
Change the english text to russian
diff --git a/checkin-service/spec/models/location_spec.rb b/checkin-service/spec/models/location_spec.rb index abc1234..def5678 100644 --- a/checkin-service/spec/models/location_spec.rb +++ b/checkin-service/spec/models/location_spec.rb @@ -1,14 +1,15 @@ require 'spec_helper' describe Location do +let(:store) { Location.new(name: "711") } it 'can be created' do location = create :location expect(location).to_not be_nil end - it 'needs tests to be written!' do - pending('write tests for Location!') + it 'has a name that is a string' do + expect(store.name).to eq("711") end end
Add initial ultra-basic Location model tests
diff --git a/lib/fluent/plugin/fifo.rb b/lib/fluent/plugin/fifo.rb index abc1234..def5678 100644 --- a/lib/fluent/plugin/fifo.rb +++ b/lib/fluent/plugin/fifo.rb @@ -29,26 +29,20 @@ def open m = {:r => 'r+', :w => 'w+'}[@mode] - # p "open %s %s" % [@file_path, m] @pipe = Pipe.open(@file_path, m) end def readline while nil == (idx = @buf.index("\n")) do - # while nil == (tmp = self.read(1)) do tmp = '' - while true - begin - s = @pipe.sysread(0xffff, tmp) - p s - rescue EOFError => e - # reopen - @pipe.close - @pipe.open - end + begin + s = @pipe.sysread(0xffff, tmp) + @buf << s + rescue EOFError => e + # reopen + @pipe.close + @pipe.open end - - @buf << tmp end line = @buf[0, idx + 1]
Use IO.sysread instead of File.read
diff --git a/app/workers/user_set_password_notice_worker.rb b/app/workers/user_set_password_notice_worker.rb index abc1234..def5678 100644 --- a/app/workers/user_set_password_notice_worker.rb +++ b/app/workers/user_set_password_notice_worker.rb @@ -20,7 +20,7 @@ user.password_is_placeholder = false user.save! else - self.class.perform_in(60.minutes, id) + self.class.perform_in(60.minutes, user.id) end end end
Fix rescheduling of password setting worker
diff --git a/lib/acceptance/form_helper.rb b/lib/acceptance/form_helper.rb index abc1234..def5678 100644 --- a/lib/acceptance/form_helper.rb +++ b/lib/acceptance/form_helper.rb @@ -3,12 +3,7 @@ def validated_form_for(*args, &block) form_for(*args, &block) - concat(acceptance_builder.flush_rules, block.binding) - end - - def validated_fields_for(*args, &block) - fields_for(*args, &block) - concat(Acceptance.flush_rules, block.binding) + concat(acceptance_builder.flush_rules) end def acceptance_builder
Remove unsupported validated_fields_for method and binding argument to concat().
diff --git a/lib/mako/html_renderer.rb b/lib/mako/html_renderer.rb index abc1234..def5678 100644 --- a/lib/mako/html_renderer.rb +++ b/lib/mako/html_renderer.rb @@ -2,12 +2,12 @@ class HTMLRenderer include FileOpenUtil - attr_reader :template, :binding, :feed_template + attr_reader :template, :bound, :feed_template def initialize(args) - @template = args.fetch(:template) - @binding = args.fetch(:binding) - @feed_template = File.expand_path('layouts/_feed_container.html.erb', __FILE__) + @template = File.expand_path(File.join('themes', "#{Mako.config.theme}.html.erb"), Dir.pwd) + @bound = args.fetch(:bound) + @feed_template = File.expand_path('../layouts/_feed_container.html.erb', __FILE__) end # Wrapper for ERB renderer. Creates new ERB instance with view template @@ -15,9 +15,7 @@ # # @return [String] def render - ERB.new(load_resource(template)).result(binding.get_binding) do - ERB.new(load_resource(feed_template)).result(binding.get_binding) - end + ERB.new(load_resource(template)).result(bound.get_binding) end # Default file name for rendererd file.
Update render method to work without yield, load template from config
diff --git a/Casks/paintcode.rb b/Casks/paintcode.rb index abc1234..def5678 100644 --- a/Casks/paintcode.rb +++ b/Casks/paintcode.rb @@ -1,5 +1,5 @@ class Paintcode < Cask - url 'http://download.macheist.com/nano4/pc.zip' + url 'http://www.pixelcut.com/paintcode/paintcode.zip' homepage 'http://www.paintcodeapp.com/' version 'latest' sha256 :no_check
Update URL for PaintCode 2.0
diff --git a/lib/github_api/api_factory.rb b/lib/github_api/api_factory.rb index abc1234..def5678 100644 --- a/lib/github_api/api_factory.rb +++ b/lib/github_api/api_factory.rb @@ -0,0 +1,24 @@+# encoding: utf-8 + +require 'github_api/core_ext/hash' + +module Github + class ApiFactory + + # Instantiates a new github api object + def self.new(klass, options={}) + return _create_instance(klass, options) if klass + raise ArgumentError, 'must provied klass to be instantiated' + end + + private + + # Passes configuration options to instantiated class + def self._create_instance(klass, options) + options.symbolize_keys! + instance = Github.const_get(klass.to_sym).new options + Github.api_client = instance + instance + end + end +end # Github
Add api factory for instantiating parts of api.
diff --git a/lib/ruby-swagger/data/mime.rb b/lib/ruby-swagger/data/mime.rb index abc1234..def5678 100644 --- a/lib/ruby-swagger/data/mime.rb +++ b/lib/ruby-swagger/data/mime.rb @@ -2,6 +2,7 @@ class Mime @@types = [ 'text/plain', + 'text/json', 'text/plain; charset=utf-8', 'application/json', 'application/hal+json',
Add text/json as data MIME type
diff --git a/lib/yardstick/yard_ext.rb b/lib/yardstick/yard_ext.rb index abc1234..def5678 100644 --- a/lib/yardstick/yard_ext.rb +++ b/lib/yardstick/yard_ext.rb @@ -1,4 +1,6 @@ module YARD #:nodoc: all + + # Extend docstring with yardstick methods class Docstring include Yardstick::Method end # class Docstring
Add description for extension class
diff --git a/roles/appliwave.rb b/roles/appliwave.rb index abc1234..def5678 100644 --- a/roles/appliwave.rb +++ b/roles/appliwave.rb @@ -2,6 +2,11 @@ description "Role applied to all servers at Appliwave" default_attributes( + :accounts => { + :users => { + :appliwave => { :status => :administrator } + } + }, :hosted_by => "Appliwave", :location => "Croissy-Beaubourg, France" )
Add remote hands account for Appliwave
diff --git a/lib/app/helpers/errors.rb b/lib/app/helpers/errors.rb index abc1234..def5678 100644 --- a/lib/app/helpers/errors.rb +++ b/lib/app/helpers/errors.rb @@ -6,13 +6,11 @@ end def forward_errors - begin - yield - rescue Xapi::ApiError => e - halt 400, {error: e.message}.to_json - rescue Exception => e - halt 500, {error: something_went_wrong}.to_json - end + yield + rescue Xapi::ApiError => e + halt 400, {error: e.message}.to_json + rescue Exception + halt 500, {error: something_went_wrong}.to_json end end end
Clean up error handling method in API
diff --git a/acts_as_purchasable.gemspec b/acts_as_purchasable.gemspec index abc1234..def5678 100644 --- a/acts_as_purchasable.gemspec +++ b/acts_as_purchasable.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = ActsAsPurchasable::VERSION - gem.add_dependency "activesupport", "~> 3.2" + gem.add_dependency "rails", "~> 3.2" gem.add_development_dependency "rspec" gem.add_development_dependency "growl"
Add rails as a dependency to avoid headaches from mocking ActiveRecord and friends.
diff --git a/app/helpers/timeout_helper.rb b/app/helpers/timeout_helper.rb index abc1234..def5678 100644 --- a/app/helpers/timeout_helper.rb +++ b/app/helpers/timeout_helper.rb @@ -1,4 +1,3 @@-require 'terminator' module TimeoutHelper extend LogHelper @@ -11,12 +10,10 @@ # end # def try_within(sec, timeout_message = 'operation') - Terminator.terminate sec do - begin - yield - rescue - logger.error "Timeout when #{timeout_message} after #{sec}s" - end + begin + Timeout::timeout(sec) { yield } + rescue + logger.error "Timeout when #{timeout_message} after #{sec}s" end end
ENHANCE: Replace terminator with Ruby native calls
diff --git a/app/jobs/send-users-online.rb b/app/jobs/send-users-online.rb index abc1234..def5678 100644 --- a/app/jobs/send-users-online.rb +++ b/app/jobs/send-users-online.rb @@ -15,14 +15,14 @@ # open the Rocket.Chat database user collection - rcdb_client = RocketChat.RCDB_Client() + rcdb_client = RocketChatSso.RCDB_Client() if rcdb_client.nil? Rails.logger.error 'ROCKETCHAT-SSO | RC DB not accessible?' return end - rcdb_users_collection = RocketChat.RCDB_Users_Collection( rcdb_client ) + rcdb_users_collection = RocketChatSso.RCDB_Users_Collection( rcdb_client ) if rcdb_users_collection.nil? Rails.logger.error 'ROCKETCHAT-SSO | RC DB users collection missing?' @@ -40,7 +40,7 @@ if not rcdb_online.nil? - rcdb_active_users.each do |user| + rcdb_online.each do |user| users_online_now.push( user[ 'username' ] ) end @@ -54,6 +54,7 @@ # and publish the results + Rails.logger.info 'ROCKETCHAT-SSO | online: ' + users_online_now.to_json MessageBus.publish( '/rocketchat-sso-users-online', users_online_now.as_json ) end
Fix typos after refactor, add a log message for clarity
diff --git a/Framezilla.podspec b/Framezilla.podspec index abc1234..def5678 100644 --- a/Framezilla.podspec +++ b/Framezilla.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Framezilla" - spec.version = "2.9.0" + spec.version = "2.9.1" spec.summary = "Comfortable syntax for working with frames." spec.homepage = "https://github.com/Otbivnoe/Framezilla"
Change the podspec version -> 2.9.1
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -29,12 +29,12 @@ end def render_403( e = nil ) - Rails.logger.info( "403 #{e.inspect}") - Rails.logger.info( "403 #{e.backtrace.inspect}") render_error( 403 ) end def render_error( status ) + self.response_body = nil + respond_to do |format| format.html { render( layout: false, file: Rails.root.join( 'public', 'landing', status.to_s ),
Clear response body before rendering error
diff --git a/lib/ask_awesomely/field/opinion_scale.rb b/lib/ask_awesomely/field/opinion_scale.rb index abc1234..def5678 100644 --- a/lib/ask_awesomely/field/opinion_scale.rb +++ b/lib/ask_awesomely/field/opinion_scale.rb @@ -16,18 +16,18 @@ end def left_side(label) - @state.label ||= Hash.new(nil) - @state.label[:left_side] = label + @state.labels ||= Hash.new(nil) + @state.labels[:left] = label end def middle(label) - @state.label ||= Hash.new(nil) - @state.label[:center] = label + @state.labels ||= Hash.new(nil) + @state.labels[:center] = label end def right_side(label) - @state.label ||= Hash.new(nil) - @state.label[:right] = label + @state.labels ||= Hash.new(nil) + @state.labels[:right] = label end end
Fix opinion scale field names
diff --git a/app/controllers/councillors_controller.rb b/app/controllers/councillors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/councillors_controller.rb +++ b/app/controllers/councillors_controller.rb @@ -11,7 +11,7 @@ end private - def calulatated_absence_percent(councillor) + def calculated_absence_percent(councillor) total_number_motion = Motion.count (councillor.councillor_votes.where(vote: "Skip").count.to_f / total_number_motion) * 100
Fix Name Calculated Absence Percent
diff --git a/db/migrate/20140913170424_create_invoices.rb b/db/migrate/20140913170424_create_invoices.rb index abc1234..def5678 100644 --- a/db/migrate/20140913170424_create_invoices.rb +++ b/db/migrate/20140913170424_create_invoices.rb @@ -2,7 +2,7 @@ def change create_table :invoices do |t| t.integer :amount - t.type :string + t.string :type t.date :due_date t.date :paid_date t.date :received_date
Correct database field in invoice
diff --git a/lib/data_mapper/engine/veritas_engine.rb b/lib/data_mapper/engine/veritas_engine.rb index abc1234..def5678 100644 --- a/lib/data_mapper/engine/veritas_engine.rb +++ b/lib/data_mapper/engine/veritas_engine.rb @@ -6,8 +6,25 @@ # Engine for Veritas class VeritasEngine < self + + # @see Engine#adapter + # + # @example + # uri = "postgres://localhost/test" + # engine = DataMapper::Engine::VeritasEngine.new(uri) + # engine.adapter + # + # @return [Veritas::Adapter::DataObjects] + # + # @api public attr_reader :adapter + # @see Engine#initialize + # + # @return [undefined] + # + # @api private + # # TODO: add specs def initialize(uri) super @@ -15,25 +32,54 @@ @adapter = Veritas::Adapter::DataObjects.new(uri) end - # @api private + # @see Engine#relation_node_class + # + # @return [RelationRegistry::RelationNode::VeritasRelation] + # + # @api public + # # TODO: add specs def relation_node_class RelationRegistry::RelationNode::VeritasRelation end - # @api private + # @see Engine#relation_edge_class + # + # @return [RelationRegistry::RelationEdge] + # + # @api public + # # TODO: add specs def relation_edge_class RelationRegistry::RelationEdge end - # @api private + # @see Engine#base_relation + # + # @param [Symbol] name + # the base relation name + # + # @param [Array<Array(Symbol, Class)>] header + # the base relation header + # + # @return [Veritas::Relation::Base] + # + # @api public + # # TODO: add specs def base_relation(name, header) Veritas::Relation::Base.new(name, header) end - # @api private + # @see Engine#gateway_relation + # + # @param [Veritas::Relation] relation + # the relation to be wrapped in a gateway relation + # + # @return [Veritas::Relation::Gateway] + # + # @api public + # # TODO: add specs def gateway_relation(relation) Veritas::Relation::Gateway.new(adapter, relation)
Add more comprehensive docs for Engine::VeritasEngine
diff --git a/app/workers/recurring/clean_activities.rb b/app/workers/recurring/clean_activities.rb index abc1234..def5678 100644 --- a/app/workers/recurring/clean_activities.rb +++ b/app/workers/recurring/clean_activities.rb @@ -3,7 +3,7 @@ def perform ActiveRecord::Base.connection_pool.with_connection do - Activity.where(:seen => true, :activity_type => ['WON','LOST','COMMENT']).where('created_at < ?', DateTime.now - 60.days).delete_all + Activity.where(:seen => true, :activity_type => ['WON','LOST','COMMENT','PREDICTION_MENTION','COMMENT_MENTION']).where('created_at < ?', DateTime.now - 60.days).delete_all end end end
Clean comment and prediction mention activities after 60 days
diff --git a/telemetry-logger.gemspec b/telemetry-logger.gemspec index abc1234..def5678 100644 --- a/telemetry-logger.gemspec +++ b/telemetry-logger.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'telemetry-logger' - s.version = '0.1.5' + s.version = '0.1.6' s.summary = 'Logging to STDERR with coloring and levels of severity' s.description = ' '
Package version is incremented from patch number 0.1.5 to 0.1.6
diff --git a/week-9/ruby-review-2/oo-basics.rb b/week-9/ruby-review-2/oo-basics.rb index abc1234..def5678 100644 --- a/week-9/ruby-review-2/oo-basics.rb +++ b/week-9/ruby-review-2/oo-basics.rb @@ -0,0 +1,59 @@+# OO Basics: Student + + +# I worked on this challenge [by myself]. +# This challenge took me [#] hours. + + +# Pseudocode + + +# Initial Solution + +class Student + attr_accessor :scores, :first_name + + def initialize(args) #Use named arguments! + #your code here + end +end + +alex = Student.new({first_name: "Alex", scores: [100, 100, 100, 0, 100]}) +catie = Student.new({first_name: "Catie", scores: [100, 100, 90, 89, 80]}) +devin = Student.new({first_name: "Devin", scores: [90, 100, 100, 85, 99]}) +dan = Student.new({first_name: "Dan", scores: [89, 95, 100, 100, 90]}) +maryjane = Student.new({first_name: "Mary Jane", scores: [100, 90, 80, 95, 100]}) + +students = [alex, catie, devin, dan, maryjane] + +# Refactored Solution + + + + + + +# DRIVER TESTS GO BELOW THIS LINE +# Initial Tests: + +p students[0].first_name == "Alex" +p students[0].scores.length == 5 +p students[0].scores[0] == students[0].scores[4] +p students[0].scores[3] == 0 + + +# Additional Tests 1: + +p students[0].average == 80 +p students[0].letter_grade == 'B' + +# Additional Tests 2: + +p linear_search(students, "Alex") == 0 +p linear_search(students, "NOT A STUDENT") == -1 + + + + + +# Reflection
Add file & release 1 for object oriented basics challenge
diff --git a/spec/default.mspec b/spec/default.mspec index abc1234..def5678 100644 --- a/spec/default.mspec +++ b/spec/default.mspec @@ -1,6 +1,6 @@ # vim: filetype=ruby -require 'spec/custom/guards/engine' +require_relative 'custom/guards/engine' class MSpecScript tags_dir = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
Use require_relative when spec is not in the LOAD_PATH
diff --git a/spec/controllers/social_networking/concerns/profile_page/feed_spec.rb b/spec/controllers/social_networking/concerns/profile_page/feed_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/social_networking/concerns/profile_page/feed_spec.rb +++ b/spec/controllers/social_networking/concerns/profile_page/feed_spec.rb @@ -0,0 +1,57 @@+require "spec_helper" + +module SocialNetworking + module Concerns + # Spec for profile page feed functionality. + module ProfilePage + describe Feed do + let(:participant) do + instance_double(::Participant, id: 1) + end + + def items(page) + Feed.new( + participant_id: participant.id, + page: page).page_items + end + + describe "when feed items exist" do + before do + allow(Serializers::NudgeSerializer) + .to receive(:from_collection) + .and_return([ + { createdAtRaw: "" }, + { createdAtRaw: "" } + ]) + allow(Serializers::OnTheMindStatementSerializer) + .to receive(:from_collection) + .and_return([ + { createdAtRaw: "" }, + { createdAtRaw: "" } + ]) + allow(Serializers::SharedItemSerializer) + .to receive(:from_collection) + .and_return([ + { createdAtRaw: "" }, + { createdAtRaw: "" } + ]) + end + + it "returns only 5 items on first request" do + expect(items(0).count).to eq 5 + end + + it "returns the next item(s) on second request" do + expect(items(1).count).to eq 1 + end + end + + describe "when no feed items exist" do + it "returns empty array" do + expect(items(0)).to eq [] + end + end + end + end + end +end
Add Profile Page Feed Spec * Add specs to determine items and count [Finished: #100037354]
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -0,0 +1,47 @@+require 'capistrano_colors' + +# Main +set :application, "" +set :use_sudo, true +set :admin_runner, "" +set :keep_releases, 5 +default_run_options[:pty] = true + +# Stages +set :stage_dir, "app/config/deploy" +set :stages, %w{production staging} +set :default_stage, "production" +require 'capistrano/ext/multistage' + +set :deploy_to, "/home/projects/#{application}/data/" +set (:domain) {"#{domain}"} # domain is defined in the stage config + +role(:web) { domain } # Your HTTP server, Apache/etc +role(:app) { domain } # This may be the same as your `Web` server +role(:db, :primary => true) { domain } # This is where the migrations will run + +# Git +set :repository, `git config remote.origin.url`.strip # fetch the repository from git +set :scm, :git +ssh_options[:forward_agent] = true # http://help.github.com/deploy-with-capistrano/ +set :deploy_via, :remote_cache #only keeps an online cache + +# Symfony 2 +set :model_manager, "doctrine" +set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"] +set :vendors_mode, "install" +set :update_vendors, true +set :dump_assetic_assets, true +set :update_schema, true +set :force_schema, true +set :do_migrations, false +set :setfacl, true + +# Campfire +set :campfire_room, nil + +# Airbrake +set :airbrake_api_key, nil + +# Jenkins +#:set :jenkins_enabled, true
Move the config.rb to this repo
diff --git a/acts_as_executor.gemspec b/acts_as_executor.gemspec index abc1234..def5678 100644 --- a/acts_as_executor.gemspec +++ b/acts_as_executor.gemspec @@ -12,6 +12,6 @@ s.summary = %q{Java Executor framework integration for Rails} s.description = %q{Seamless integration of Java's Executor framework with JRuby on Rails} - s.files = Dir["**/*.rb"] + s.files = Dir["**/*.rb"] + Dir["*.rdoc"] + Dir["LICENSE"] s.require_paths = ["lib"] end
Include RDOC and LICENSE in gemspec.
diff --git a/achecker.gemspec b/achecker.gemspec index abc1234..def5678 100644 --- a/achecker.gemspec +++ b/achecker.gemspec @@ -25,5 +25,5 @@ spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "webmock", "~> 1.18" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" + spec.add_development_dependency "rspec", "~> 3.1" end
Upgrade rspec version to 3.1
diff --git a/core/db/migrate/20161014145148_add_created_at_to_variant.rb b/core/db/migrate/20161014145148_add_created_at_to_variant.rb index abc1234..def5678 100644 --- a/core/db/migrate/20161014145148_add_created_at_to_variant.rb +++ b/core/db/migrate/20161014145148_add_created_at_to_variant.rb @@ -2,7 +2,7 @@ def change add_column :spree_variants, :created_at, :datetime Spree::Variant.reset_column_information - Spree::Variant.where.not(updated_at: nil).update_all('created_at = updated_at') - Spree::Variant.where(updated_at: nil).update_all(created_at: Time.current, updated_at: Time.current) + Spree::Variant.unscoped.where.not(updated_at: nil).update_all('created_at = updated_at') + Spree::Variant.unscoped.where(updated_at: nil).update_all(created_at: Time.current, updated_at: Time.current) end end
Add unscoped method to activerecord query [Variants `act_as_paranoid`](https://github.com/spree/spree/blob/master/core/app/models/spree/variant.rb#L3). This fixes the issue of migration failure if the db has any variants where `deleted_at IS NOT NULL`.
diff --git a/mixlib-versioning.gemspec b/mixlib-versioning.gemspec index abc1234..def5678 100644 --- a/mixlib-versioning.gemspec +++ b/mixlib-versioning.gemspec @@ -23,4 +23,7 @@ # Development dependencies spec.add_development_dependency 'rubocop', '~> 0.18' spec.add_development_dependency 'rspec', '~> 2.14' + + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'rake' end
Add Rake and Bundler to development dependencies
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do root 'secrets#new' - resources :secrets, only: [:create, :new, :show] + resources :secrets, only: [:create, :new, :show], id: /([^\/])+/ end
Fix bug in tokens with a period
diff --git a/modules/users/spec/classes/users_spec.rb b/modules/users/spec/classes/users_spec.rb index abc1234..def5678 100644 --- a/modules/users/spec/classes/users_spec.rb +++ b/modules/users/spec/classes/users_spec.rb @@ -12,6 +12,34 @@ end end +# Get a list of valid users from their manifest files +def user_list + class_dir = File.expand_path("../../../manifests", __FILE__) + Dir.glob("#{class_dir}/*.pp").collect { |user_manifest| + user_manifest.gsub(/^#{class_dir}\/(.+)\.pp$/, '\1') + }.delete_if { |username| + username == 'init' + } +end + +# Get a list of all users who are present in a group class +def users_in_groups + class_dir = File.expand_path("../../../manifests/groups", __FILE__) + group_files = Dir.glob("#{class_dir}/*.pp") + users_in_classes_list = [] + group_files.each do |group_filename| + File.open(group_filename) do |file| + file.each_line do |line| + if line.match(/^ include/) + users_in_classes_list << line.gsub(/^ include users::(.+)\n$/, '\1') + end + end + end + end + + users_in_classes_list +end + # this will throw a parse error if a user's manifest has been removed # but they are still being included in a group class_list.each do |group_class| @@ -19,3 +47,14 @@ it { should contain_class(group_class) } end end + +# Using the list of all manifests, make sure they're included +# in at least one group +group_list = users_in_groups +user_list.each do |username| + describe username do + it 'should be in at least one group' do + group_list.should include(username) + end + end +end
Add a test to ensure that a user manifest is used Previously, it was possible to remove a user from all groups but keep their manifest around. This commit adds a test to ensure that every user manifest is included in at least one group.
diff --git a/files/gitlab-cookbooks/solo.rb b/files/gitlab-cookbooks/solo.rb index abc1234..def5678 100644 --- a/files/gitlab-cookbooks/solo.rb +++ b/files/gitlab-cookbooks/solo.rb @@ -1,4 +1,5 @@ CURRENT_PATH = File.expand_path(File.dirname(__FILE__)) file_cache_path "#{CURRENT_PATH}/cache" -cookbook_path CURRENT_PATH +cookbook_path CURRENT_PATH verbose_logging false +ssl_verify_mode :verify_peer
Add ssl_verify_mode to Chef config This will quiet warnings at the start of each `gitlab-ctl reconfigure` run.
diff --git a/Casks/lektor.rb b/Casks/lektor.rb index abc1234..def5678 100644 --- a/Casks/lektor.rb +++ b/Casks/lektor.rb @@ -2,7 +2,7 @@ version '1.2.1' sha256 'd6d984eddcefcae9397e1fb10d96f2fd61324a9f2a7008cea4edad2ee8743feb' - # github.com/lektor/lektor verified as official when first introduced to the cask + # github.com/lektor/lektor was verified as official when first introduced to the cask url "https://github.com/lektor/lektor/releases/download/#{version}/Lektor-#{version}.dmg" appcast 'https://github.com/lektor/lektor/releases.atom', checkpoint: '1b283900aa1f42ce2a9cb6fe1bfc722729e3b83fea8630c46e61093d8b04a46b'
Fix `url` stanza comment for Lektor.
diff --git a/Casks/second-life.rb b/Casks/second-life.rb index abc1234..def5678 100644 --- a/Casks/second-life.rb +++ b/Casks/second-life.rb @@ -1,7 +1,7 @@ class SecondLife < Cask - url 'http://download.cloud.secondlife.com/Viewer_3/SecondLife_3_6_11_283787.dmg' + url 'http://download.cloud.secondlife.com/Viewer_3/Second_Life_3_6_12_284506_i386.dmg' homepage 'http://secondlife.com/' - version '3.6.11.283787' - sha1 'a90f6b5da1e68f3f60cd3938979a3e9f7c99cc11' + version '3.6.12.284506' + sha1 'fa2132d794bb6e3253de51afeb840d63824d1a38' link 'Second Life Viewer.app' end
Update Second Life to 3.6.12.284506.
diff --git a/config/initializers/export_email_controller.rb b/config/initializers/export_email_controller.rb index abc1234..def5678 100644 --- a/config/initializers/export_email_controller.rb +++ b/config/initializers/export_email_controller.rb @@ -0,0 +1,10 @@+# Re-open ExportEmailController to because out local implementation of a Holding +# has a #call_number method that is a class which deliver_later raises as an error +# when trying to serialize the arguments +ActiveSupport.on_load(:after_initialize) do + ExportEmailController.class_eval do + def call_number(id) + return holding(id).view_data[:call_number].to_s unless holding(id).nil? + end + end +end
Add ExportEmailController post processing to fix text message issue
diff --git a/test/jekyll/tidy_test.rb b/test/jekyll/tidy_test.rb index abc1234..def5678 100644 --- a/test/jekyll/tidy_test.rb +++ b/test/jekyll/tidy_test.rb @@ -20,4 +20,17 @@ assert_equal expected, actual end + + def test_matches_file_globs_correctly + config_override = {"jekyll_tidy" => {"exclude" => ["_posts/**", "**/fail.html", "_only_md/*.md"]} } + + assert Jekyll::Tidy.exclude?("_posts/index.html", config_override) + refute Jekyll::Tidy.exclude?("_pages/index.html", config_override) + + assert Jekyll::Tidy.exclude?("_pages/fail.html", config_override) + refute Jekyll::Tidy.exclude?("fail.html", config_override) + + assert Jekyll::Tidy.exclude?("_only_md/test.md", config_override) + refute Jekyll::Tidy.exclude?("_only_md/test.html", config_override) + end end
Add tests for glob matching
diff --git a/test/unit/config_test.rb b/test/unit/config_test.rb index abc1234..def5678 100644 --- a/test/unit/config_test.rb +++ b/test/unit/config_test.rb @@ -4,12 +4,6 @@ def test_set_ssl_cert_file @config = PaypalAdaptive::Config.new("test", { "ssl_cert_file" => "/path/to/cacert.pem" }) assert_equal "/path/to/cacert.pem", @config.ssl_cert_file - assert_equal nil, @config.ssl_cert_path - end - - def test_default_ssl_cert_file - @config = PaypalAdaptive::Config.new("test", { "ssl_cert_file" => "" }) - assert File.exists?(@config.ssl_cert_file) assert_equal nil, @config.ssl_cert_path end
Remove default config SSL file
diff --git a/src/watir_robot_gui.rb b/src/watir_robot_gui.rb index abc1234..def5678 100644 --- a/src/watir_robot_gui.rb +++ b/src/watir_robot_gui.rb @@ -1,4 +1,7 @@ $LOAD_PATH << File.expand_path(File.dirname(__FILE__)) +# Add local gem repository created from extracted +# JAR archive of gems +ENV['GEM_PATH'] = File.join(File.expand_path(File.dirname(__FILE__)), '../lib/ruby/wr-gems') require 'java' require 'watir_robot_gui/main_frame' @@ -8,7 +11,6 @@ require 'watir_robot_gui/worker/html_button' require 'watir_robot_gui/worker/xml_button' require 'lib/java/miglayout' -require 'lib/ruby/wr-gems' require 'rubygems' require 'robot_remote_server'
Set environment variable to use local gem repo from extracted jar file
diff --git a/core/spec-unit/classes/open_graph_formatter_spec.rb b/core/spec-unit/classes/open_graph_formatter_spec.rb index abc1234..def5678 100644 --- a/core/spec-unit/classes/open_graph_formatter_spec.rb +++ b/core/spec-unit/classes/open_graph_formatter_spec.rb @@ -26,8 +26,8 @@ end it 'overwrites the default values when a GraphObject with the same key gets added' do - default_rules = { foo: 'bar' } - graph_object = mock to_hash: { foo: 'bla' } + default_rules = { key: 'old_value' } + graph_object = mock to_hash: { key: 'new_value' } formatter = described_class.new formatter.stub(:default_rules).and_return(default_rules)
Use old_value new_value for readability
diff --git a/cookbooks/ondemand_base/recipes/ubuntu.rb b/cookbooks/ondemand_base/recipes/ubuntu.rb index abc1234..def5678 100644 --- a/cookbooks/ondemand_base/recipes/ubuntu.rb +++ b/cookbooks/ondemand_base/recipes/ubuntu.rb @@ -1,4 +1,16 @@ #Make sure that this recipe only runs on ubuntu systems if platform?("ubuntu") +include_recipe "ubuntu" +include_recipe "apt" + +# Ubuntu ships with vim-tiny, which lacks many of the basic features found in the vim package +package "vim" + +# Install useful tools +%w{ manpages man-db lsof mtr strace }.each do |pkg| + package pkg end + + +end
Install VIM and some useful tools. This was pulled from Optimize. It's awesome
diff --git a/omniauth-internal.gemspec b/omniauth-internal.gemspec index abc1234..def5678 100644 --- a/omniauth-internal.gemspec +++ b/omniauth-internal.gemspec @@ -1,5 +1,4 @@ # -*- encoding: utf-8 -*- -require File.expand_path('../lib/omniauth-internal/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Jan Graichen"]
Remove require version from gemspec
diff --git a/lib/dimples/document.rb b/lib/dimples/document.rb index abc1234..def5678 100644 --- a/lib/dimples/document.rb +++ b/lib/dimples/document.rb @@ -1,22 +1,17 @@-require 'yaml' +require_relative 'frontmatter' module Dimples class Document - FRONT_MATTER_PATTERN = /^(-{3}\n.*?\n?)^(-{3}*$\n?)/m.freeze - attr_accessor :metadata, :contents, :path, :rendered_contents def initialize(path = nil) @path = path - @metadata = {} if @path - @contents = File.read(path) - - if matches = contents.match(FRONT_MATTER_PATTERN) - @metadata = YAML.load(matches[1], symbolize_names: true) - @contents = matches.post_match.strip - end + @metadata, @contents = Dimples::FrontMatter.parse(File.read(path)) + else + @metadata = {} + @contents = '' end end
Switch to the FrontMatter module
diff --git a/lib/featurer/adapter.rb b/lib/featurer/adapter.rb index abc1234..def5678 100644 --- a/lib/featurer/adapter.rb +++ b/lib/featurer/adapter.rb @@ -10,20 +10,45 @@ @config = config end - def delete(feature) - fail 'implement a delete method' + # Attaches a new matching value to the given feature. + # If the feature doesn't exist, the adapter should create it automatically. + # Feature matching_values must be matched in the order they were added. + # + # @param _feature the name of the feature as will be used when questioning if the feature is #on? + # @param _matching_value the value that will be used to match when calling #on?. Valid values are: + # => - true: it will match any value (ie: the feature enabled globally) + # => - false: the feature is disabled globally + # => - integer: matched when calling #on?, if an integer is passed + # => - regular expression: matched when calling #on?, if regular expression is passed + def add(_feature, _matching_value) + raise 'implement an add method' end - def key(name) - fail 'implement a key method' + # Completely removes a feature from the system. + # If the feature doesn't exist, the adapter should not fail. + def delete(_feature) + raise 'implement a delete method' end - def on?(feature, user_id = nil) - fail 'implement a on? method' + # Returns true if the feature has a matching value attached wich matches the given value. + # + # @param _feature the feature name, as provided when calling #add or #register + # @param _value the value that will be used when matching against the stored matching_value for the given feature + # @return response depends on the _value provided + # => true if _value is nil and the _feature has a matching_value of true + # => true if _value is an integer and the _feature has that exact integer attached as a matching_value + # => true if _value is a string and the _feature has a matching_value which is a regexp that matches _value + # => false in any other case + def on?(_feature, _value = nil) + raise 'implement a on? method' end - def register(name, value = true) - fail 'implement a register? method' + # First deletes the given _feature and then creates it again with only the provided _matching_value attached. + # + # @param _feature the feature to register + # @param _matching_value the new matching_value for the feature that replaces any existing matching_value on it + def register(_feature, _matching_value = true) + raise 'implement a register? method' end end end
Add documentation to base Adapter