diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/gobierto_people/person.rb b/app/models/gobierto_people/person.rb index abc1234..def5678 100644 --- a/app/models/gobierto_people/person.rb +++ b/app/models/gobierto_people/person.rb @@ -7,9 +7,9 @@ belongs_to :admin, class_name: "GobiertoAdmin::Admin" belongs_to :site - has_many :events, class_name: "PersonEvent" - has_many :statements, class_name: "PersonStatement" - has_many :posts, class_name: "PersonPost" + has_many :events, class_name: "PersonEvent", dependent: :destroy + has_many :statements, class_name: "PersonStatement", dependent: :destroy + has_many :posts, class_name: "PersonPost", dependent: :destroy scope :sorted, -> { order(created_at: :desc) }
Make Person resources dependent on destroy
diff --git a/Casks/twitch-desktop.rb b/Casks/twitch-desktop.rb index abc1234..def5678 100644 --- a/Casks/twitch-desktop.rb +++ b/Casks/twitch-desktop.rb @@ -0,0 +1,11 @@+cask 'twitch-desktop' do + version :latest + sha256 'e39c5c748be23cd6bf4e0164aa26575f7d86473994f9d39c13e44b5bd0fbadac' + + # updates.twitchapp.net was verified as official when first introduced to the cask + url 'https://updates.twitchapp.net/mac/Twitch.dmg' + name 'Twitch Desktop App' + homepage 'https://app.twitch.tv/' + + app 'Twitch.app' +end
Add Twitch Desktop App latest Add Twitch Desktop App latest
diff --git a/server/webapp/WEB-INF/rails.new/app/presenters/api_v1/config/pipeline_config_with_minimal_attributes_representer.rb b/server/webapp/WEB-INF/rails.new/app/presenters/api_v1/config/pipeline_config_with_minimal_attributes_representer.rb index abc1234..def5678 100644 --- a/server/webapp/WEB-INF/rails.new/app/presenters/api_v1/config/pipeline_config_with_minimal_attributes_representer.rb +++ b/server/webapp/WEB-INF/rails.new/app/presenters/api_v1/config/pipeline_config_with_minimal_attributes_representer.rb @@ -20,7 +20,7 @@ alias_method :pipeline, :represented link :self do |opts| - opts[:url_builder].apiv1_admin_pipeline_url(name: pipeline.name) + opts[:url_builder].apiv1_admin_pipeline_url(pipeline_name: pipeline.name) end property :name, exec_context: :decorator
Fix tests: Rename param to :pipeline_name Looks like it was left over by changes in beea6428ab23a99dfcf8fc4e63541a6f0fe02ebf
diff --git a/Casks/skitch.rb b/Casks/skitch.rb index abc1234..def5678 100644 --- a/Casks/skitch.rb +++ b/Casks/skitch.rb @@ -1,7 +1,7 @@ class Skitch < Cask - url 'http://cdn1.evernote.com/skitch/mac/release/Skitch-2.0.5.zip' + url 'http://cdn1.evernote.com/skitch/mac/release/Skitch-2.5.2.zip' homepage 'http://evernote.com/skitch/' - version '2.0.5' - sha1 '64d61e76eb8bd2540f84b5d21ee1ac5f93c74a61' + version '2.5.2' + sha1 '2c4dd590d70759ff69f293e1ae00a4b55cca9e37' link 'Skitch.app' end
Update Skitch to v. 2.5.2
diff --git a/Casks/tg-pro.rb b/Casks/tg-pro.rb index abc1234..def5678 100644 --- a/Casks/tg-pro.rb +++ b/Casks/tg-pro.rb @@ -1,11 +1,11 @@ cask :v1 => 'tg-pro' do - version '2.8.5' - sha256 'ddffad55f0c8998323d270649f22f3e7a63ed45f867ba141a4b6df2b76bca6fc' + version '2.8.7' + sha256 '32b622cec40f4cfe0cd5455dd110696b8284524aadd92c552a769c130bbc88e7' url "http://www.tunabellysoftware.com/resources/TGPro_#{version.gsub('.','_')}.zip" name 'TG Pro' appcast 'http://tunabellysoftware.com/resources/sparkle/tgpro/profileInfo.php', - :sha256 => '6377de7a9e67766d24c12c4580337b509d9572552e3def8a8f33af09272942e2' + :sha256 => 'e276cc14d86471bc7c416faefc7e8bcffe94da4458c87c71c2f14287414df5fa' homepage 'http://www.tunabellysoftware.com/tgpro/' license :commercial
Update TG Pro to 2.8.7
diff --git a/embed/ruby/catissue/embed/jbridge.rb b/embed/ruby/catissue/embed/jbridge.rb index abc1234..def5678 100644 --- a/embed/ruby/catissue/embed/jbridge.rb +++ b/embed/ruby/catissue/embed/jbridge.rb @@ -25,13 +25,8 @@ end # load the caRuby annotations if necessary hook.class.ensure_annotations_loaded - # the annotation => hook attribute - attr = annotation.class.proxy_attribute - if attr.nil? then - raise AnnotationError.new("The annotation class #{annotation.class} does not have an attribute that references a #{hook.class.qp}") - end # set the annotation hook reference - annotation.set_attribute(attr, hook) + annotation.hook = hook # create the annotation in the database annotation.create end
Set annotation hook using the hook attribute.
diff --git a/tasks/testng_patch.rake b/tasks/testng_patch.rake index abc1234..def5678 100644 --- a/tasks/testng_patch.rake +++ b/tasks/testng_patch.rake @@ -0,0 +1,47 @@+raise "Patch applied upstream " if Buildr::VERSION.to_s > '1.5.8' + +class Buildr::TestNG < TestFramework::Java + + def run(tests, dependencies) #:nodoc: + cmd_args = [] + cmd_args << '-suitename' << task.project.id + cmd_args << '-sourcedir' << task.compile.sources.join(';') if TestNG.version < '6.0' + cmd_args << '-log' << '2' + cmd_args << '-d' << task.report_to.to_s + exclude_args = options[:excludegroups] || [] + unless exclude_args.empty? + cmd_args << '-excludegroups' << exclude_args.join(',') + end + groups_args = options[:groups] || [] + unless groups_args.empty? + cmd_args << '-groups' << groups_args.join(',') + end + # run all tests in the same suite + cmd_args << '-testclass' << (TestNG.version < '6.0' ? test : tests.join(',')) + + cmd_args += options[:args] if options[:args] + cmd_options = { :properties => options[:properties], :java_args => options[:java_args], + :classpath => dependencies, :name => "TestNG in #{task.send(:project).name}" } + + tmp = nil + begin + tmp = Tempfile.open('testNG') + tmp.write cmd_args.join("\n") + tmp.close + Java::Commands.java ['org.testng.TestNG', "@#{tmp.path}"], cmd_options + ensure + tmp.close unless tmp.nil? + end + # testng-failed.xml contains the list of failed tests *only* + failed_tests = File.join(task.report_to.to_s, 'testng-failed.xml') + if File.exist?(failed_tests) + report = File.read(failed_tests) + failed = report.scan(/<class name="(.*?)">/im).flatten + # return the list of passed tests + return tests - failed + else + return tests + end + end +end +
Patch the TestNG addon to ensure that test failures result in a failed build.
diff --git a/reversal/lib/reversal.rb b/reversal/lib/reversal.rb index abc1234..def5678 100644 --- a/reversal/lib/reversal.rb +++ b/reversal/lib/reversal.rb @@ -19,11 +19,10 @@ module Reversal VERSION = "0.9.0" - class << self - def decompile(iseq) - Reverser.new(iseq).to_ir.to_s - end + def decompile(iseq) + Reverser.new(iseq).to_ir.to_s end + module_function :decompile end module Reversal
Use module functions for easier interop
diff --git a/lib/vagrant-notify/middleware/start_server.rb b/lib/vagrant-notify/middleware/start_server.rb index abc1234..def5678 100644 --- a/lib/vagrant-notify/middleware/start_server.rb +++ b/lib/vagrant-notify/middleware/start_server.rb @@ -10,7 +10,8 @@ if pid = server_is_running?(env) env[:ui].info "Notification server is already running (#{pid})" else - run_server(env) + pid = run_server(env) + env[:ui].info "Notification server fired up (#{pid})" end @app.call(env) @@ -26,7 +27,7 @@ local_data['vagrant-notify']['pid'] = pid local_data.commit - env[:ui].info "Notification server fired up (#{pid})" + pid end def server_is_running?(env)
Move logging code out of method to start server
diff --git a/spec/controllers/admin/orders_controller_spec.rb b/spec/controllers/admin/orders_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/admin/orders_controller_spec.rb +++ b/spec/controllers/admin/orders_controller_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' RSpec.describe Spree::Admin::OrdersController do - context "with authorization" do stub_authorization! @@ -14,11 +13,8 @@ end end - let(:order) { mock_model Spree::Order, complete?: true, total: 100, number: 'R123456789' } - - before do - expect(Spree::Order).to receive_message_chain(:includes, :friendly, :find).and_return order - end + let(:order) { mock_model(Spree::Order, :complete? => true, :total => 100, :number => 'R123456789') } + before { allow(Spree::Order).to receive_messages :find_by_number! => order } context '#reset_digitals' do it 'should reset digitals for an order' do @@ -28,5 +24,4 @@ end end end - end
Revert "Fixed a Spree::Order ActiveRecord stub" This reverts commit dcde059475049a4b933442b9294c4f4090c96b7d which breaks on 2-4-stable.
diff --git a/hero_mapper/config/initializers/constants.rb b/hero_mapper/config/initializers/constants.rb index abc1234..def5678 100644 --- a/hero_mapper/config/initializers/constants.rb +++ b/hero_mapper/config/initializers/constants.rb @@ -0,0 +1,16 @@+CITIES = { "NYC" => [40.730610, -73.935242], + "Boston" => [42.364506, -71.038887], + "DC" => [38.894207, -77.035507], + "Chicago" => [41.881832, -87.623177], + "Indianapolis" => [39.832081, -86.145454], + "LA" => [34.052235, -118.243683], + "SF" => [37.733795, -122.446747], + "Dallas" => [32.897480, -97.040443], + "Denver" => [39.742043, -104.991531], + "Seattle" => [47.608013, -122.335167], + "New Orleans" => [29.951065, -90.071533], + "Orlando" => [28.538336, -81.379234], + "Baltimore" => [39.299236, -76.609383], + "Minneapolis" => [44.986656, -93.258133], + "Cleveland" => [41.505493, -81.681290] + }
Move city locations to initialize
diff --git a/MGBenchmark.podspec b/MGBenchmark.podspec index abc1234..def5678 100644 --- a/MGBenchmark.podspec +++ b/MGBenchmark.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "MGBenchmark" - s.version = "0.1.0" + s.version = "0.1.1" s.summary = "This library provides an easy way to measure execution time in code." s.homepage = "https://github.com/MattesGroeger/MGBenchmark" s.license = 'MIT' s.author = { "Mattes Groeger" => "info@mattes-groeger.de" } - s.source = { :git => "https://github.com/MattesGroeger/MGBenchmark.git", :tag => "0.1.0" } + s.source = { :git => "https://github.com/MattesGroeger/MGBenchmark.git", :tag => "0.1.1" } s.source_files = 'MGBenchmark/**/*.{h,m}' s.requires_arc = true end
Increase version number to 0.1.1
diff --git a/event_store-messaging.gemspec b/event_store-messaging.gemspec index abc1234..def5678 100644 --- a/event_store-messaging.gemspec +++ b/event_store-messaging.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'event_store-messaging' s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library' - s.version = '0.3.0.0' + s.version = '0.3.0.1' s.authors = [''] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*')
Package version is increased from 0.3.0.0 to 0.3.0.1
diff --git a/lib/buoys/link.rb b/lib/buoys/link.rb index abc1234..def5678 100644 --- a/lib/buoys/link.rb +++ b/lib/buoys/link.rb @@ -16,7 +16,7 @@ end def mark_as_current! - options.merge!(class: config[:current_class]) + options[:class] = config[:current_class] @current = true end
Fix `Use options[:class] = config[:current_class] instead of options.merge!(class: config[:current_class]).`
diff --git a/lib/docs/scrapers/symfony.rb b/lib/docs/scrapers/symfony.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/symfony.rb +++ b/lib/docs/scrapers/symfony.rb @@ -26,8 +26,13 @@ Licensed under the MIT License. HTML + version '3.2' do + self.release = '3.2.1' + self.base_url = "http://api.symfony.com/#{version}/" + end + version '3.1' do - self.release = '3.1.2' + self.release = '3.1.8' self.base_url = "http://api.symfony.com/#{version}/" end
Update Symfony documentation (3.2.1, 3.1.8, 3.0.1, 2.8.2, 2.7.9)
diff --git a/app/models/agreement.rb b/app/models/agreement.rb index abc1234..def5678 100644 --- a/app/models/agreement.rb +++ b/app/models/agreement.rb @@ -12,7 +12,12 @@ store_accessor :headcount_responsibilities, :number_of_staff, :staff_engagement_score, :payband_1, :payband_a, :payband_b, :payband_c, :payband_d, :payband_e - scope :editable_by, ->(user) { where('jobholder_id = ? or manager_id = ?', user.id, user.id) } + scope :editable_by, ->(user) { + where( + arel_table[:jobholder_id].eq(user.id). + or(arel_table[:manager_id].eq(user.id)) + ) + } def manager_email=(email) self.manager = User.for_email(email) if email.present?
Use code rather than strings
diff --git a/app/models/developer.rb b/app/models/developer.rb index abc1234..def5678 100644 --- a/app/models/developer.rb +++ b/app/models/developer.rb @@ -5,44 +5,6 @@ after_commit :cache_login! - def self.fetch_by_login(username) - premium = REDIS.sismember('hireables:developers_logins', username) - - if premium - developer = find_by(login: username) - Rails.cache.fetch([username, developer], expires_in: 2.days) do - developer - end - else - self.fetch_from_github(username) - end - end - - def self.fetch_from_github(username) - Rails.cache.fetch(username, expires_in: 2.days) do - request = Github::Api.new("/users/#{username}").fetch - response = Github::Response.new(request) - if response.found? - JSON.parse(request.body, object_class: OpenStruct) - else - raise ActiveRecord::RecordNotFound.new('Not Found') - end - end - end - - def self.fetch_languages_from_github(username) - Rails.cache.fetch([username, 'languages'], expires_in: 2.days) do - request = Github::Api.new("/users/#{username}/repos").fetch - response = Github::Response.new(request) - - if response.found? - response.developer_languages_collection - else - raise ActiveRecord::RecordNotFound.new('Not Found') - end - end - end - private def cache_login!
Remove fetch methods from model
diff --git a/SPDebugMenu.podspec b/SPDebugMenu.podspec index abc1234..def5678 100644 --- a/SPDebugMenu.podspec +++ b/SPDebugMenu.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'SPDebugMenu' - s.version = '0.1' + s.version = '0.2' s.license = 'MIT' s.summary = 'Make your own debug menu with fully customizable actions.' s.homepage = 'https://github.com/sergiou87/SPDebugMenu.git' s.author = { "Sergio Padrino" => "sergio.padrino@gmail.com" } - s.source = { :git => 'https://github.com/sergiou87/SPDebugMenu.git', :tag => '0.1' } + s.source = { :git => 'https://github.com/sergiou87/SPDebugMenu.git', :tag => '0.2' } s.platform = :ios, '6.0' s.source_files = 'SPDebugMenu' s.requires_arc = true
Update podspec file to version 0.2
diff --git a/app/controllers/onboarding/school_details_controller.rb b/app/controllers/onboarding/school_details_controller.rb index abc1234..def5678 100644 --- a/app/controllers/onboarding/school_details_controller.rb +++ b/app/controllers/onboarding/school_details_controller.rb @@ -15,6 +15,7 @@ @school = School.new(school_params) SchoolCreator.new(@school).onboard_school!(@school_onboarding) if @school.persisted? + @school_onboarding.update!(school_name: @school.name) redirect_to new_onboarding_completion_path(@school_onboarding) else render :new @@ -29,6 +30,7 @@ @school = @school_onboarding.school if @school.update(school_params) @school_onboarding.events.create!(event: :school_details_updated) + @school_onboarding.update!(school_name: @school.name) redirect_to new_onboarding_completion_path(@school_onboarding, anchor: 'school-details') else render :edit
Update the onboarding name with the school name
diff --git a/week-4/factorial/my_solution.rb b/week-4/factorial/my_solution.rb index abc1234..def5678 100644 --- a/week-4/factorial/my_solution.rb +++ b/week-4/factorial/my_solution.rb @@ -1,32 +1,21 @@ # Factorial -# I worked on this challenge [by myself, with: ]. +# I worked on this challenge with: Trevor Newcomb. # Pseudocode: -# take your number -# create array of the number, and which changes in the number multiplied by every number below it using (!) to change the array's value - +# Create your method named "factorial" +# define what happens if your input is zero +# otherwise, create an array of all the numbers from your input number down to 1, decreasing by 1 each time +# Mulitply all the numbers in the array together # Your Solution Below def factorial(n) if n == 0 return 1 else - #fact = Array.new(n) { |f| f = (f+2)-1} #(THIS WORKS!) - fact_array = Array.new(n) { |f| f = f+1} #(THIS WORKS!) - #fact = Array.new(n) { |n| f = n+1} #(THIS WORKS!) + fact_array = Array.new(n) { |f| f = f+1} #(THIS WORKS) fact_array.inject(:*) - #x = fact_array.inject(:*) - #p x end end - factorial(10) - - -#def factorial(n) -# until ((n-1)=0) -# -# n*(n-1) -# Your code goes here -#end+ factorial(10)
Clean up factorial ruby file for submission
diff --git a/spec/integration/v2/order_spec.rb b/spec/integration/v2/order_spec.rb index abc1234..def5678 100644 --- a/spec/integration/v2/order_spec.rb +++ b/spec/integration/v2/order_spec.rb @@ -16,12 +16,16 @@ # context "using a single resource" do let(:singular_resource) { build(:v2_order_from_fixture) } + context "fetching a single order" do before :each do stub_request(:get, "#{api_root}/orders/1.json_api").with(headers: {"Accept" => "application/vnd.api+json"}).to_return body: singular_resource.to_json, status: response_status, headers: default_headers end + subject { subject_class.find(1) } + it_should_behave_like "a singular resource with an error response" + it "should return the correct top level object" do expect(subject).to be_a(subject_class) end
Add blank lines for readability
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -1,13 +1,25 @@ require 'spec_helper' -describe 'default recipe on Ubuntu 14.04' do +describe 'mysql_database_test::default recipe on Ubuntu 14.04' do let(:chef_run) do ChefSpec::ServerRunner.new do |node| node.automatic[:lsb][:codename] = 'trusty' - end.converge('database::default') + end.converge('mysql_database_test::default') end it 'converges successfully' do expect { :chef_run }.to_not raise_error end end + +describe 'postgresql_database_test::default recipe on Ubuntu 14.04' do + let(:chef_run) do + ChefSpec::ServerRunner.new do |node| + node.automatic[:lsb][:codename] = 'trusty' + end.converge('postgresql_database_test::default') + end + + it 'converges successfully' do + expect { :chef_run }.to_not raise_error + end +end
Test converge on the test cookbooks
diff --git a/test/system/intern_extern_volunteers_test.rb b/test/system/intern_extern_volunteers_test.rb index abc1234..def5678 100644 --- a/test/system/intern_extern_volunteers_test.rb +++ b/test/system/intern_extern_volunteers_test.rb @@ -10,6 +10,6 @@ visit volunteers_path click_link 'New Volunteer' check 'Register the Volunteer as external?' - assert page.has_select? 'State', selected: 'Active' + assert page.has_select? 'State', selected: 'Accepted' end end
Fix testing for wrong state preselected
diff --git a/lib/soundcloud.rb b/lib/soundcloud.rb index abc1234..def5678 100644 --- a/lib/soundcloud.rb +++ b/lib/soundcloud.rb @@ -15,6 +15,17 @@ end module_function :new + def method_missing(method_name, *args, &block) + return super unless respond_to_missing?(method_name) + Client.send(method_name, *args, &block) + end + module_function :method_missing + + def respond_to_missing?(method_name, include_private=false) + Client.respond_to?(method_name, include_private) + end + module_function :respond_to_missing? + end Soundcloud = SoundCloud
Add back support for get/post/put/delete/head module functions
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -2,8 +2,10 @@ maintainer 'Dennis Hoer' maintainer_email 'dennis.hoer@gmail.com' license 'MIT' -description 'Configures Safari' +description 'Configures Apple Safari' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +source_url 'https://github.com/dhoer/chef-safari' +issues_url 'https://github.com/dhoer/chef-safari/issues' version '0.1.0' supports 'mac_os_x'
Add source and issues url
diff --git a/lib/with_model.rb b/lib/with_model.rb index abc1234..def5678 100644 --- a/lib/with_model.rb +++ b/lib/with_model.rb @@ -6,32 +6,32 @@ module WithModel def with_model(name, options = {}, &block) options = options.dup - scope = options.delete(:scope) { :each } + scope = options.delete(:scope) model = Model.new name, options dsl = Model::DSL.new model dsl.instance_exec(&block) if block - before scope do + before(*scope) do model.create end - after scope do + after(*scope) do model.destroy end end def with_table(name, options = {}, &block) options = options.dup - scope = options.delete(:scope) { :each } + scope = options.delete(:scope) table = Table.new name, options, &block - before scope do + before(*scope) do table.create end - after scope do + after(*scope) do table.destroy end end
Allow before/after to naturally use their own defaults Instead of explicitly specifying that it should be :each. (#18)
diff --git a/lib/scripts/restore_db_from_dump_20160616.rb b/lib/scripts/restore_db_from_dump_20160616.rb index abc1234..def5678 100644 --- a/lib/scripts/restore_db_from_dump_20160616.rb +++ b/lib/scripts/restore_db_from_dump_20160616.rb @@ -0,0 +1,30 @@+# restore data from production +# only contest, products(entrant), document +# and create school + +require 'csv' +require 'logger' + +DUMP_DIR = Rails.root.join('db', 'dump', '20160612') +logger = Logger.new(STDOUT) + +logger.debug 'restore prizes data' +entrants = CSV.table(File.join(DUMP_DIR, 'entrants.csv')) +entrants.each do |entrant| + p = Product.find_by( + contest_id: Contest.find_by(nth: entrant[:contest]).id, + section: entrant[:section], + school_id: School.find_by(name: entrant[:school]).id, + name: entrant[:production], + rank: entrant[:result] + ) + if p && entrant[:prize].present? + entrant[:prize].split(',').each do |prize| + Prize.create!( + product_id: p.id, + name: prize + ) + end + end +end +logger.debug 'finish restore prizes data'
Create script that migration prizes data from db dump
diff --git a/lib/ankirb/anki/deck.rb b/lib/ankirb/anki/deck.rb index abc1234..def5678 100644 --- a/lib/ankirb/anki/deck.rb +++ b/lib/ankirb/anki/deck.rb @@ -7,7 +7,14 @@ @name = name @id = Time.now.to_i @cards = {} - + + #change @cards#to_s to prevent recursive output via parent / child relationship + + class << @cards + def to_s + "#< #{@cards.keys.count} cards>" + end + end end def add_card card
Modify Deck.cards.to_s to prevent recursive log output.
diff --git a/lib/seek/samples/attribute_type_handlers/seek_resource_attribute_type_handler.rb b/lib/seek/samples/attribute_type_handlers/seek_resource_attribute_type_handler.rb index abc1234..def5678 100644 --- a/lib/seek/samples/attribute_type_handlers/seek_resource_attribute_type_handler.rb +++ b/lib/seek/samples/attribute_type_handlers/seek_resource_attribute_type_handler.rb @@ -13,7 +13,7 @@ def convert(value) resource = find_resource(value) - hash = { id: value, type: type } + hash = { id: resource ? resource.id : value, type: type } hash[:title] = resource.title if resource hash end
Stop ID being set to the title, when title is used to look-up SEEK sample
diff --git a/lib/license_finder/tables.rb b/lib/license_finder/tables.rb index abc1234..def5678 100644 --- a/lib/license_finder/tables.rb +++ b/lib/license_finder/tables.rb @@ -2,6 +2,9 @@ require 'sequel' require LicenseFinder::Platform.sqlite_load_path -LicenseFinder::DB = Sequel.connect("#{LicenseFinder::Platform.sqlite_adapter}://#{LicenseFinder.config.artifacts.database_uri}") -Sequel.extension :migration, :core_extensions -Sequel::Migrator.run(LicenseFinder::DB, LicenseFinder::ROOT_PATH.join('../db/migrate')) +module LicenseFinder + DB = Sequel.connect(Platform.sqlite_adapter + "://" + config.artifacts.database_uri) + + Sequel.extension :migration, :core_extensions + Sequel::Migrator.run(DB, ROOT_PATH.join('../db/migrate')) +end
Use module namespace to reduce noise
diff --git a/lib/mios/services/camera1.rb b/lib/mios/services/camera1.rb index abc1234..def5678 100644 --- a/lib/mios/services/camera1.rb +++ b/lib/mios/services/camera1.rb @@ -4,6 +4,14 @@ def self.extended(base) base.instance_variable_set("@camera1_urn", "urn:micasaverde-com:serviceId:Camera1") end + + def url + value_for(@camera1_urn, 'URL') + end + + def full_url + "http://#{self.ip}/#{url}" + end end end end
Add methods to get camera url
diff --git a/lib/cukeq/scm/shell_svn_bridge.rb b/lib/cukeq/scm/shell_svn_bridge.rb index abc1234..def5678 100644 --- a/lib/cukeq/scm/shell_svn_bridge.rb +++ b/lib/cukeq/scm/shell_svn_bridge.rb @@ -0,0 +1,63 @@+require "open3" +require "nokogiri" + +module CukeQ + class Scm + class ShellSvnBridge + + def initialize(url, working_copy) + @url = url + @working_copy = working_copy + end + + def update + ensure_working_copy + Dir.chdir(@working_copy) { execute "svn update --non-interactive" } + current_revision + end + + def current_revision + ensure_working_copy + info[:revision] + end + + private + + def info + data = {} + + xml = Dir.chdir(@working_copy) { execute "svn --xml info" } + doc = Nokogiri::XML(xml) + + data[:revision] = doc.css("info entry commit").first['revision'].to_i + data[:url] = doc.css("url").text + + data + end + + def ensure_working_copy + return if File.directory? @working_copy + + log self.class, :checkout, @url.to_s => @working_copy + execute "svn checkout #{@url} #{@working_copy}" + end + + def execute(cmd) + out, err = nil + + Open3.popen3(cmd) do |stdin, stdout, stderr| + out = stdout.read + err = stderr.read + end + + unless $?.success? + raise SystemCallError, "#{cmd.inspect}, stdout: #{out.inspect}, stderr: #{err.inspect}" + end + + out + end + end # ShellSvnBridge + + SvnBridge = ShellSvnBridge + end # Scm +end # CukeQ
Add ShellSvnBridge for platforms where the svn bindings are not easily installable.
diff --git a/Casks/zotero.rb b/Casks/zotero.rb index abc1234..def5678 100644 --- a/Casks/zotero.rb +++ b/Casks/zotero.rb @@ -1,7 +1,7 @@ class Zotero < Cask - url 'http://download.zotero.org/standalone/4.0.15/Zotero-4.0.15.dmg' + url 'http://download.zotero.org/standalone/4.0.16/Zotero-4.0.16.dmg' homepage 'http://www.zotero.org/' - version '4.0.15' - sha1 'fcc66cc47a14afcb10475533b7cebcf0548d5f36' + version '4.0.16' + sha1 '461752e20adb669471063b5ea1c573037d73ada3' link 'Zotero.app' end
Update Zotero to version 4.0.16
diff --git a/messaging.gemspec b/messaging.gemspec index abc1234..def5678 100644 --- a/messaging.gemspec +++ b/messaging.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' - s.version = '0.29.0.6' + s.version = '0.29.0.7' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 0.29.0.6 to 0.29.0.7
diff --git a/html.rb b/html.rb index abc1234..def5678 100644 --- a/html.rb +++ b/html.rb @@ -6,7 +6,14 @@ class Renderer @@standard_options = { - :block_elements => [ :h1, :p, :blockquote, :pre ] + :block_elements => [ :body, + :h1, :h2, :h3, :h4, :h5, :h6, + :p, + :blockquote, + :pre, + :ul, :ol, :li + :dl, :dt, :dd + ] } def initialize(options=nil)
Add a few more block elements.
diff --git a/lib/oo/haunted_house.rb b/lib/oo/haunted_house.rb index abc1234..def5678 100644 --- a/lib/oo/haunted_house.rb +++ b/lib/oo/haunted_house.rb @@ -30,7 +30,7 @@ while true @rooms.current_room.show(message) message = "" - message += inventory.time + message += @rooms.inventory.time message += p.parse_input(gets) end end
Move inventory and room creation into rooms.
diff --git a/lib/rubeuler/problem.rb b/lib/rubeuler/problem.rb index abc1234..def5678 100644 --- a/lib/rubeuler/problem.rb +++ b/lib/rubeuler/problem.rb @@ -7,18 +7,20 @@ def initialize(options) load_options(:number, :answer, options) raise TypeError, ':answer should be a string' unless @answer.is_a?(String) + raise TypeError, ':number should be an integer' unless @number.is_a?(Fixnum) end def execute! - time = Benchmark.measure { @data = answer }.real + time = timed_answer true_or_false = @data == solution ? true : false return Rubeuler::Result.new(success: true_or_false, problem: @number, data: @data, runtime: time) end private - def answer - instance_eval(@answer.gsub("\n",";")) + def timed_answer + timer_endpoints = ["Benchmark.measure { @data =", "}.real"] + instance_eval(timer_endpoints.join(@answer.gsub("\n",";"))) end def solution
Move Benchmark closer to the code being evaluated (inside the instance_eval)
diff --git a/test/unit/taxon_test.rb b/test/unit/taxon_test.rb index abc1234..def5678 100644 --- a/test/unit/taxon_test.rb +++ b/test/unit/taxon_test.rb @@ -7,9 +7,9 @@ # end test "Child taxa are in same project as parent" do - import_job = import_jobs(:one) + import_job = import_jobs(:import_job1) parent = taxa(:homo) - child = Taxon.find_or_create_with_parent("child", parent, iczn_groups(:species), import_jobs(:one)) + child = Taxon.find_or_create_with_parent("child", parent, iczn_groups(:species), import_job) assert_equal(child.project, import_job.project) end end
Fix bad reference to taxa fixture
diff --git a/lib/fubot/commands/fubot_image.rb b/lib/fubot/commands/fubot_image.rb index abc1234..def5678 100644 --- a/lib/fubot/commands/fubot_image.rb +++ b/lib/fubot/commands/fubot_image.rb @@ -12,7 +12,7 @@ # q = v: '1.0', rsz: '8', q: query, safe: 'active' # q.imgtype = 'animated' if typeof animated is 'boolean' and animated is true # q.imgtype = 'face' if typeof faces is 'boolean' and faces is true - query = "q=#{URI::encode query}&v=1.0&safe=active&rsz=8" + query = "q=#{URI::encode query}&v=1.0&safe=off&rsz=8" open("http://ajax.googleapis.com/ajax/services/search/images?#{query}") do |result| images = JSON.parse(result.read) images = images['responseData']['results']
Disable nsfw filters for image search
diff --git a/test/blank_test.rb b/test/blank_test.rb index abc1234..def5678 100644 --- a/test/blank_test.rb +++ b/test/blank_test.rb @@ -13,7 +13,7 @@ end BLANK = [ EmptyTrue.new, nil, false, '', ' ', " \n\t \r ", ' ', "\u00a0", [], {} ] -NOT = [ EmptyFalse.new, Object.new, true, 0, 1, 'a', [nil], { nil => 0 } ] +NOT = [ EmptyFalse.new, Object.new, true, 0, 1, 'a', [nil], { nil => 0 }, Time.now ] # extracted tests from rails/activesupport # See : https://github.com/rails/rails/blob/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/activesupport/test/core_ext/object/blank_test.rb
Add Time blank test for coverage
diff --git a/spec/unit/facter/mysql_version_spec.rb b/spec/unit/facter/mysql_version_spec.rb index abc1234..def5678 100644 --- a/spec/unit/facter/mysql_version_spec.rb +++ b/spec/unit/facter/mysql_version_spec.rb @@ -8,6 +8,7 @@ describe 'mysql_version' do context 'with value' do before :each do + Facter::Core::Execution.stubs(:which).returns('fake_mysql_path') Facter::Util::Resolution.stubs(:exec).with('mysql --version').returns('mysql Ver 14.12 Distrib 5.0.95, for redhat-linux-gnu (x86_64) using readline 5.1') end it {
Fix facter mysql version unit test
diff --git a/IRLSize.podspec b/IRLSize.podspec index abc1234..def5678 100644 --- a/IRLSize.podspec +++ b/IRLSize.podspec @@ -20,5 +20,5 @@ s.public_header_files = 'Pod/Classes/**/*.h' s.frameworks = 'Foundation', 'UIKit' - s.dependency 'SDVersion', '~> 3.0' + s.dependency 'SDVersion', '~> 3.0.1' end
Fix SDVersion import for Travis.
diff --git a/locales/untranslated.rb b/locales/untranslated.rb index abc1234..def5678 100644 --- a/locales/untranslated.rb +++ b/locales/untranslated.rb @@ -7,10 +7,10 @@ ar: "العربية", de: "Deutsch", en: "English", - es: "Español", - fr: "Français", - hu: "Magyar", - it: "Italiano", + es: "español", + fr: "français", + hu: "magyar", + it: "italiano", ml: "മലയാളം", pt: "Português", ro: "română",
Use lower case unless grammatically required
diff --git a/lib/rabl-rails/nodes/attribute.rb b/lib/rabl-rails/nodes/attribute.rb index abc1234..def5678 100644 --- a/lib/rabl-rails/nodes/attribute.rb +++ b/lib/rabl-rails/nodes/attribute.rb @@ -1,17 +1,20 @@-require 'forwardable' - module RablRails module Nodes class Attribute - extend Forwardable - - def_delegators :@hash, :[]=, :each attr_reader :hash attr_accessor :condition def initialize(hash = {}) @hash = hash end + + def []=(key, value) + @hash[key] = value + end + + def each(&block) + @hash.each(&block) + end end end end
Remove Forwardable in favor of code (making `each` 9% faster yay)
diff --git a/test/tc_relaxng.rb b/test/tc_relaxng.rb index abc1234..def5678 100644 --- a/test/tc_relaxng.rb +++ b/test/tc_relaxng.rb @@ -0,0 +1,39 @@+require "xml" +require 'test/unit' + +class TestRelaxNG < Test::Unit::TestCase + def setup + xp = XML::Parser.new + @doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/shiporder.xml')) + end + + def teardown + @doc = nil + end + + def relaxng + document = XML::Document.file(File.join(File.dirname(__FILE__), 'model/shiporder.rng')) + relaxng = XML::RelaxNG.document(document) + end + + def test_from_doc + assert_instance_of(XML::RelaxNG, relaxng) + end + + def test_valid + assert(@doc.validate_relaxng(relaxng)) + end + + def test_invalid + new_node = XML::Node.new('invalid', 'this will mess up validation') + @doc.root.child_add(new_node) + + messages = Hash.new + assert(!@doc.validate_relaxng(relaxng) do |message, error| + messages[message] = error + end) + + expected = {"Did not expect element invalid there\n" => true} + assert_equal(expected, messages) + end +end
Apply patch 21285 from Morus Walter which adds RelaxNG support.
diff --git a/npm-rails.gemspec b/npm-rails.gemspec index abc1234..def5678 100644 --- a/npm-rails.gemspec +++ b/npm-rails.gemspec @@ -21,8 +21,8 @@ ] spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.9" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "bundler" + spec.add_development_dependency "rake" spec.add_development_dependency "rspec" spec.add_dependency 'rails', '>= 3.2'
Remove version from from bundler dependencie
diff --git a/lib/websocket/server_handshake.rb b/lib/websocket/server_handshake.rb index abc1234..def5678 100644 --- a/lib/websocket/server_handshake.rb +++ b/lib/websocket/server_handshake.rb @@ -1,9 +1,23 @@ module WebSocket class ServerHandshake < Http::Response - def initialize(status = nil, version = "1.1", headers = {}, body = nil, &body_proc) + def initialize(status = 101, version = "1.1", headers = {}, body = nil, &body_proc) @status, @version, @body, @body_proc = status, version, body, body_proc @headers = headers end + + def render(out) + response_header = "#{@version} #{@status} #{@reason}#{CRLF}" + + unless @headers.empty? + response_header << @headers.map do |header, value| + "#{header}: #{value}" + end.join(CRLF) << CRLF + end + + response_header << CRLF + + out << response_header + end end end
Add method to render handshake response
diff --git a/library/logger/fixtures/common.rb b/library/logger/fixtures/common.rb index abc1234..def5678 100644 --- a/library/logger/fixtures/common.rb +++ b/library/logger/fixtures/common.rb @@ -6,7 +6,9 @@ str.gsub(/[A-Z].*\[.*\]/, "").lstrip end - ruby_version_is ''...'2.2' do + # Use defined? so that even with --unguarded this fixture can load + # ruby_version_is ''...'2.2' do + if defined?(Logger::Application) class TestApp < Logger::Application def initialize(appname, log_file=nil) super(appname)
Use defined? in Logger fixtures to avoid issues with --unguarded * --unguarded is for instance used for mspec tag --purge.
diff --git a/app/presenters/queries/expanded_link_set.rb b/app/presenters/queries/expanded_link_set.rb index abc1234..def5678 100644 --- a/app/presenters/queries/expanded_link_set.rb +++ b/app/presenters/queries/expanded_link_set.rb @@ -10,18 +10,7 @@ end def links - @links ||= dependees.merge(dependents).merge(translations) - end - - def web_content_items(target_content_ids) - return [] unless target_content_ids.present? - ::Queries::GetWebContentItems.( - ::Queries::GetEditionIdsWithFallbacks.( - target_content_ids, - locale_fallback_order: locale_fallback_order, - state_fallback_order: state_fallback_order + [:withdrawn] - ) - ) + @links ||= expanded_links.merge(translations) end private
Use LinkExpansion in ExpandedLinkSet Query Presenter This replaces the previous dual direction approaches to link expansion to use a single class that mediates both directions.
diff --git a/app/representers/api/license_representer.rb b/app/representers/api/license_representer.rb index abc1234..def5678 100644 --- a/app/representers/api/license_representer.rb +++ b/app/representers/api/license_representer.rb @@ -1,9 +1,11 @@ # encoding: utf-8 +require 'roar/json/hal' +require 'hal_api/representer/caches' class Api::LicenseRepresenter < Roar::Decorator - include Roar::Representer::JSON::HAL - include Caches + include Roar::JSON::HAL + include HalApi::Representer::Caches property :streamable property :editable
Use HAR base, remove includes
diff --git a/library/rbconfig/rbconfig_spec.rb b/library/rbconfig/rbconfig_spec.rb index abc1234..def5678 100644 --- a/library/rbconfig/rbconfig_spec.rb +++ b/library/rbconfig/rbconfig_spec.rb @@ -23,6 +23,20 @@ File.should.exist?("#{archdir}/etc.#{RbConfig::CONFIG['DLEXT']}") end end + + it "contains no frozen strings" do + s = <<-EOF +require 'rbconfig' +RbConfig::CONFIG.each do |k, v| + if v.frozen? + puts "\#{k} Failure" + end +end +puts 'Done' +EOF + + ruby_exe( s, options: '--enable-frozen-string-literal', escape: true ).should == "Done\n" + end end describe "RbConfig::TOPDIR" do
Add spec for checking rbconfig strings are not frozen.
diff --git a/spree-refinerycms-authentication.gemspec b/spree-refinerycms-authentication.gemspec index abc1234..def5678 100644 --- a/spree-refinerycms-authentication.gemspec +++ b/spree-refinerycms-authentication.gemspec @@ -13,6 +13,6 @@ gem.test_files = gem.files.grep(%r{^spec/}) gem.require_paths = ["lib"] - gem.add_runtime_dependency 'spree', '~> 1.2.0' - gem.add_runtime_dependency 'refinerycms', '~> 2.0.0' + gem.add_runtime_dependency 'spree', '~> 1.2' + gem.add_runtime_dependency 'refinerycms', '~> 2.0' end
Support Spree 1.3 in gemspec
diff --git a/lib/qiita/markdown/embed/code_pen.rb b/lib/qiita/markdown/embed/code_pen.rb index abc1234..def5678 100644 --- a/lib/qiita/markdown/embed/code_pen.rb +++ b/lib/qiita/markdown/embed/code_pen.rb @@ -5,6 +5,7 @@ SCRIPT_URLS = [ "https://production-assets.codepen.io/assets/embed/ei.js", "https://static.codepen.io/assets/embed/ei.js", + "https://cpwebassets.codepen.io/assets/embed/ei.js", ] CLASS_NAME = %w[codepen] DATA_ATTRIBUTES = %w[
Add new codepen embeded script url
diff --git a/vagrant_box_defaults.rb b/vagrant_box_defaults.rb index abc1234..def5678 100644 --- a/vagrant_box_defaults.rb +++ b/vagrant_box_defaults.rb @@ -5,4 +5,4 @@ $SERVER_BOX = "cilium/ubuntu-dev" $SERVER_VERSION= "164" $NETNEXT_SERVER_BOX= "cilium/ubuntu-next" -$NETNEXT_SERVER_VERSION= "32" +$NETNEXT_SERVER_VERSION= "42"
Bump cilium/ubuntu-next version to 42 This includes an updated version of cilium/iproute2 (50a9b6da) and bumps the net-next tree to version 5.4. Signed-off-by: Sebastian Wicki <db043b2055cb3a47b2eb0b5aebf4e114a8c24a5a@isovalent.com>
diff --git a/rvpacker.gemspec b/rvpacker.gemspec index abc1234..def5678 100644 --- a/rvpacker.gemspec +++ b/rvpacker.gemspec @@ -4,18 +4,18 @@ require 'rvpacker/version' Gem::Specification.new do |spec| - spec.name = "rvpacker" + spec.name = 'rvpacker' spec.version = Rvpacker::VERSION - spec.authors = ["Howard Jeng", "Andrew Kesterson"] - spec.email = ["andrew@aklabs.net"] + spec.authors = ["Howard Jeng", "Andrew Kesterson", 'Solistra'] + spec.email = ['solistra@gmx.com'] spec.summary = %q{Pack and unpack RPG Maker data files} - spec.homepage = "https://github.com/akesterson/rvpacker" - spec.license = "MIT" + spec.homepage = "https://github.com/Solistra/rvpacker" + 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"
Update ownership information in gemspec.
diff --git a/event_store-messaging.gemspec b/event_store-messaging.gemspec index abc1234..def5678 100644 --- a/event_store-messaging.gemspec +++ b/event_store-messaging.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'event_store-messaging' s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library' - s.version = '0.1.18' + s.version = '0.2.0' s.authors = [''] s.require_paths = ['lib'] s.files = Dir.glob('{lib}/**/*')
Package version is increased from 0.1.18 to 0.2.0 [breaking change] Writer substitute interface is not entirely compatible with previous version
diff --git a/ruby-measurement.gemspec b/ruby-measurement.gemspec index abc1234..def5678 100644 --- a/ruby-measurement.gemspec +++ b/ruby-measurement.gemspec @@ -14,7 +14,7 @@ gem.license = 'MIT' gem.files = `git ls-files`.split($/) - gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_path = 'lib'
Add space before block braces
diff --git a/TrailsKit.podspec b/TrailsKit.podspec index abc1234..def5678 100644 --- a/TrailsKit.podspec +++ b/TrailsKit.podspec @@ -1,18 +1,18 @@ Pod::Spec.new do |s| - s.name = 'TrailsKit' - s.version = '0.3.0' - s.summary = 'Tools for representing and displaying geographical data for parks and trails.' - s.homepage = 'https://github.com/mmertsock/TrailsKit' - s.author = 'mmertsock' + s.name = "TrailsKit" + s.version = "0.3.0" + s.summary = "Tools for representing and displaying geographical data for parks and trails." + s.homepage = "https://github.com/mmertsock/TrailsKit" + s.author = "mmertsock" s.requires_arc = true - s.ios.deployment_target = '7.0' + s.ios.deployment_target = "7.0" - s.source_files = 'TrailsKit/UI', 'TrailsKit/*.h', 'TrailsKit/Parsers', 'TrailsKit/Geometry' + s.source_files = "TrailsKit/UI", "TrailsKit/*.h", "TrailsKit/Parsers", "TrailsKit/Geometry" - s.ios.frameworks = 'MapKit', 'CoreLocation', 'CoreGraphics' + s.ios.frameworks = "MapKit", "CoreLocation", "CoreGraphics" - s.dependency 'GPXParser' - s.dependency 'NSArray+Functional' + s.dependency "GPXParser" + s.dependency "NSArray+Functional" end
Fix quotes so publishing script works
diff --git a/example/zulip_message_echo.rb b/example/zulip_message_echo.rb index abc1234..def5678 100644 --- a/example/zulip_message_echo.rb +++ b/example/zulip_message_echo.rb @@ -0,0 +1,18 @@+$:.push File.expand_path('../../lib', __FILE__) +require 'zulip' + +### Sends a private message to a new thread is posted to a specified stream + +class ZulipEcho + client = Zulip::Client.new do |config| + config.bot_email_address = "bot@example.com" + config.bot_api_key = "apikey" + end + + client.stream_messages do |message| + if message.stream = "test-stream" + pm_content = "#{message.sender_full_name}, posted to #{message.stream}:\n #{message.subject}: #{message.content}" + client.send_private_message(pm_content, "ryanvergeront@gmail.com") + end + end +end
Add an example useage of the eventual api
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index abc1234..def5678 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -7,4 +7,9 @@ def authorize redirect_to '/login' unless current_user end + + # check if user is admin + def admin? + User.find(session[:user_id]).admin + end end
Add check if user is admin
diff --git a/app/helpers/blogs_helper.rb b/app/helpers/blogs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/blogs_helper.rb +++ b/app/helpers/blogs_helper.rb @@ -18,7 +18,7 @@ else " <div class='delete' id=comment_#{comment.id}> - <span>#{comment.id}楼 来自 <span class='red'>#{comment.name}</span> 的吐槽已删除</span> + <span>#{index + 1}楼 来自 <span class='red'>#{comment.nickname}</span> 的吐槽已删除</span> </div> " end
Fix deleted comments for specific blog 500 server error.
diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index abc1234..def5678 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -5,6 +5,6 @@ end def item_params - params.require(:item).permit(:name, :description, :image, :price, :quantity ) + params.require(:item).permit(:name, :description, :image, :price, :quantity, :category_id ) end end
Include category_id as an allowed param for items
diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb index abc1234..def5678 100644 --- a/app/helpers/pages_helper.rb +++ b/app/helpers/pages_helper.rb @@ -3,7 +3,7 @@ unless page.parent.nil? path_to_page(page.parent) + '/' + page.slug else - root_url + '/' + page.slug + root_url(trailing_slash: true) + page.slug end end end
Make root_url always have trailing slash
diff --git a/spec/apis/voting_spec.rb b/spec/apis/voting_spec.rb index abc1234..def5678 100644 --- a/spec/apis/voting_spec.rb +++ b/spec/apis/voting_spec.rb @@ -27,8 +27,7 @@ expect(question.reload.vote_count).to eq 1 end - it "should reorder questions based on votes" do - + xit "validates so a vote isn't created without user id, etc" do end end
Write pending test for vote validations
diff --git a/spec/hash_branch_spec.rb b/spec/hash_branch_spec.rb index abc1234..def5678 100644 --- a/spec/hash_branch_spec.rb +++ b/spec/hash_branch_spec.rb @@ -1,5 +1,6 @@ require 'spec_helper' require 'compo' +require 'hash_composite_spec' describe Compo::HashBranch do describe '#initialize' do @@ -11,4 +12,6 @@ expect(subject.id).to be_nil end end + + it_behaves_like 'a hash composite' end
Include hash composite examples in HashBranch.
diff --git a/spec/models/post.spec.rb b/spec/models/post.spec.rb index abc1234..def5678 100644 --- a/spec/models/post.spec.rb +++ b/spec/models/post.spec.rb @@ -0,0 +1,28 @@+require "rails_helper" + +RSpec.describe Post, :type => :model do + before(:all) do + user = User.create(name: 'Bob', email: 'bob@dbc.com', password: 'password') + dog = Animal.create(breed_id: 1, name: "doge", color: "gold", additional_notes: "additional notes", age: 3) + post = Post.create(user_id: 1, animal_id: 1, location: 92101, phone: "1234567890", email: "a@a.com") + # cat = User.create(name: 'Bill', email: 'bill@dbc.com', password: 'password', admin: true) + end + + context "existing post" do + it "a post has a user id" do + expect(Post.user_id).to eq 1 + end + it "a post has an animal id" do + expect(Post.first.animal_id).to eq 1 + end + it "a post has an location" do + expect(Post.first.location).to eq 92101 + end + it "a post has a phone number" do + expect(Post.first.phone number).to eq ("1234567890") + end + it "a post has an email" do + expect(Post.first.email).to eq ("a@a.com") + end + end +end
Add tests for post mode
diff --git a/spec/reel/server_spec.rb b/spec/reel/server_spec.rb index abc1234..def5678 100644 --- a/spec/reel/server_spec.rb +++ b/spec/reel/server_spec.rb @@ -37,6 +37,7 @@ with_reel(handler) do http = Net::HTTP.new(endpoint.host, endpoint.port) request = Net::HTTP::Post.new(endpoint.request_uri) + request['connection'] = 'close' request.body = response_body response = http.request(request) response.should be_a Net::HTTPOK
Send Connection: close in test
diff --git a/spec/tic_tac_toe_spec.rb b/spec/tic_tac_toe_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe_spec.rb +++ b/spec/tic_tac_toe_spec.rb @@ -10,4 +10,14 @@ expect(game).to be_an_instance_of TicTacToe::Board end + describe TicTacToe::Board do + + before :each do + @game = TicTacToe::Board.new + end + + it 'has positions' do + @game.pos [1,1] + end + end end
Add failing test about pos method
diff --git a/cookbooks/bcpc-hadoop/recipes/mysql_connector.rb b/cookbooks/bcpc-hadoop/recipes/mysql_connector.rb index abc1234..def5678 100644 --- a/cookbooks/bcpc-hadoop/recipes/mysql_connector.rb +++ b/cookbooks/bcpc-hadoop/recipes/mysql_connector.rb @@ -40,7 +40,7 @@ maven 'mysql-connector-java' do group_id 'mysql' version '5.1.43' - dest '/usr/share/java/mysql-connector-java.jar' + dest '/usr/share/java' action :put timeout 1800 end
Revert the mysql jar install target Prior to #960, the mysql-connector.jar is being installed in /usr/share/java/mysql-connector.jar instead of /usr/share/java/mysql-connector.jar/mysql-connector.jar. This new location causes Oozie and Hive to no find the jar. Fixes #970 and #971
diff --git a/kernel/bootstrap/metaclass.rb b/kernel/bootstrap/metaclass.rb index abc1234..def5678 100644 --- a/kernel/bootstrap/metaclass.rb +++ b/kernel/bootstrap/metaclass.rb @@ -4,7 +4,7 @@ # Do not define #methods as an accessor for @methods, use #method_table instead def method_cache ; @method_cache ; end def name ; @name ; end - def constants_table ; @constants_table ; end + def constants_table ; @constants ; end def parent ; @parent ; end def superclass ; @superclass ; end def instance_fields ; @instance_fields ; end
Fix constants lookup in MetaClasses.
diff --git a/ClusterPrePermissions.podspec b/ClusterPrePermissions.podspec index abc1234..def5678 100644 --- a/ClusterPrePermissions.podspec +++ b/ClusterPrePermissions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ClusterPrePermissions" - s.version = "0.3.0" + s.version = "0.4.0" s.summary = "Cluster's pre-permissions utility to ask users using their own dialog for photos or contacts access, before making the system-based request." s.description = <<-DESC Cluster's reusable pre-permissions utility that lets developers ask the
Update to '0.4.0' for reals
diff --git a/app/models/playlist_item.rb b/app/models/playlist_item.rb index abc1234..def5678 100644 --- a/app/models/playlist_item.rb +++ b/app/models/playlist_item.rb @@ -1,4 +1,6 @@ class PlaylistItem < ActiveRecord::Base + include AuthUtilities + acts_as_category :scope => :playlist, :hidden => :active acts_as_authorization_object
Fix for default item model git-svn-id: 40f48ef6be603b97d118b87e4ef5b23ea6e9fa7c@201 ac1452a4-9358-4c15-a3b0-de1119e254d8
diff --git a/test/integration/users_profile_test.rb b/test/integration/users_profile_test.rb index abc1234..def5678 100644 --- a/test/integration/users_profile_test.rb +++ b/test/integration/users_profile_test.rb @@ -5,6 +5,7 @@ def setup @user = users(:nick) + log_in_as(@user) end test "profile display" do @@ -20,8 +21,23 @@ end end + test "user's groups display" do + long_desc_group = groups(:generic_group) + long_desc_group.update_attributes(description: "l" * 141) + @user.join(long_desc_group) + get groups_user_path(@user) + assert_template 'users/groups' + @user.groups.each do |group| + assert_select 'a[href=?]', group_path(group), text: group.name + if (group.description.length <= 140) + assert_match group.description, response.body + else + assert_match group.description[0..139] + "...", response.body + end + end + end + test "user's events display" do - log_in_as(@user) get events_user_path(@user) assert_template 'users/events' @user.events.each do |event|
Test for the display of a user's groups Note that this test also checks that groups with long descriptions only show the first 140 characters.
diff --git a/lib/tasks/register_q_assessment_results_subscriber.rake b/lib/tasks/register_q_assessment_results_subscriber.rake index abc1234..def5678 100644 --- a/lib/tasks/register_q_assessment_results_subscriber.rake +++ b/lib/tasks/register_q_assessment_results_subscriber.rake @@ -5,9 +5,6 @@ desc 'Register a subscriber bound to queue q_assessment_results' task register_q_assessment_results_subscriber: [:environment] do - puts Doubtfire::Application.config.sm_instance - puts Doubtfire::Application.config.sm_instance.inspect - sm_instance = Doubtfire::Application.config.sm_instance if sm_instance.nil?
REFACTOR: Remove puts statements in rake task
diff --git a/db/migrate/20140524232230_devise_create_users.rb b/db/migrate/20140524232230_devise_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20140524232230_devise_create_users.rb +++ b/db/migrate/20140524232230_devise_create_users.rb @@ -34,7 +34,7 @@ t.timestamps end - # add_index :users, :email, unique: true + add_index :users, :email, unique: true # add_index :users, :reset_password_token, unique: true # add_index :users, :confirmation_token, unique: true # add_index :users, :unlock_token, unique: true
Fix uncommented email index for devise user model
diff --git a/generators/govkit/templates/govkit.rb b/generators/govkit/templates/govkit.rb index abc1234..def5678 100644 --- a/generators/govkit/templates/govkit.rb +++ b/generators/govkit/templates/govkit.rb @@ -2,7 +2,7 @@ GovKit.configure do |config| # Get an API key for Sunlight's Open States project here: # http://services.sunlightlabs.com/accounts/register/ - config.openstates_apikey = 'YOUR_OPENSTATES_API_KEY' + config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY' ##API key for Votesmart # http://votesmart.org/services_api.php @@ -15,5 +15,11 @@ # Api key for OpenCongress # http://www.opencongress.org/api config.opencongress_apikey = 'YOUR_OPENCONGRESS_API_KEY' + + # Technorati API key + config.technorati_apikey = 'YOUR_TECHNORATI_APIKEY' + + # Other things you could set here include alternate URLs for + # the APIs. See GovKit::Configuration for available attributes. end end
Update Rails 2 generate to be in sync w/Rails 3 generator
diff --git a/initforthe-routes.gemspec b/initforthe-routes.gemspec index abc1234..def5678 100644 --- a/initforthe-routes.gemspec +++ b/initforthe-routes.gemspec @@ -15,5 +15,5 @@ s.files = Dir["{lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] - s.add_dependency "rails", "~> 3.2.2" + s.add_dependency "rails", ">= 3.2.2" end
Allow versions of rails greater than 3.2.2
diff --git a/spec/replace_cls_spec.rb b/spec/replace_cls_spec.rb index abc1234..def5678 100644 --- a/spec/replace_cls_spec.rb +++ b/spec/replace_cls_spec.rb @@ -1,11 +1,9 @@ require 'spec_helper' describe ReplaceGemname::ReplaceCls do - subject(:replace_cls) { ReplaceGemname::ReplaceCls.new } describe ".new" do - it "makes a new instance" do expect(replace_cls).to be_a ReplaceGemname::ReplaceCls end
Remove some empty lines in example spec.
diff --git a/spec/unit/schema_spec.rb b/spec/unit/schema_spec.rb index abc1234..def5678 100644 --- a/spec/unit/schema_spec.rb +++ b/spec/unit/schema_spec.rb @@ -17,7 +17,7 @@ schema = rom.schema expect(schema.people.to_a).to eql(rom.postgres.people.to_a) - expect(schema.people.header).to eql([:id, :name]) + expect(schema.people.header.columns).to eql([:id, :name]) end end
Update spec to pass on rom from master
diff --git a/lib/code_hunter/git_blamer.rb b/lib/code_hunter/git_blamer.rb index abc1234..def5678 100644 --- a/lib/code_hunter/git_blamer.rb +++ b/lib/code_hunter/git_blamer.rb @@ -20,7 +20,7 @@ end def invoke - `git blame #{File.realpath(@path)} -L #@line,+1 -l -e -p` + `git blame #{File.realpath(@path)} -L #@line,+1 -l -p` end end end
Remove unnecessary git-blame option `-e` Unfortunately, this is not only unncecessary but also broken in git version less than 1.7.4. Git learned -e option at version 1.7.4
diff --git a/lib/flop/repository/memory.rb b/lib/flop/repository/memory.rb index abc1234..def5678 100644 --- a/lib/flop/repository/memory.rb +++ b/lib/flop/repository/memory.rb @@ -1,18 +1,16 @@ module Flop module Repository class Memory - attr_accessor :features - def initialize - self.features = Hash.new(false) + @features = Hash.new(false) end def get(name) - features[name] + @features[name] end def set(name, value) - features[name] = value + @features[name] = value end end end
Replace `attr_accessor` with instance variable The `features` hash does not have to be accessed from outside the repository class.
diff --git a/lib/gooder_data/session_id.rb b/lib/gooder_data/session_id.rb index abc1234..def5678 100644 --- a/lib/gooder_data/session_id.rb +++ b/lib/gooder_data/session_id.rb @@ -29,9 +29,7 @@ end def encrypt_options - options = { recipients: @options[:good_data_sso_recipient], armor: true, always_trust: true } - options[:password] = @options[:sso_signer_password] if @options[:sso_signer_password] - options + { recipients: @options[:good_data_sso_recipient], armor: true, always_trust: true } end def sign_options @@ -39,7 +37,7 @@ armor: true } options[:signer] = @options[:sso_signer_email] if @options[:sso_signer_email] - options[:password] = @options[:sso_signer_password] if @options[:sso_signer_password] + options[:passphrase] = @options[:sso_signer_password] if @options[:sso_signer_password] options end
Fix password parameter to GPG
diff --git a/lib/heroku/deploy/strategy.rb b/lib/heroku/deploy/strategy.rb index abc1234..def5678 100644 --- a/lib/heroku/deploy/strategy.rb +++ b/lib/heroku/deploy/strategy.rb @@ -11,48 +11,40 @@ module Heroku::Deploy class Strategy def self.build_from_delta(delta, app_data, api) - task_klasses = [ Task::StashGitChanges ] + tasks = [ Task::StashGitChanges.new(self) ] + if false if delta.has_asset_changes? - task_klasses << Task::CompileAssets + tasks << Task::CompileAssets.new(self) else - task_klasses << Task::StealManifest + tasks << Task::StealManifest.new(self) end - task_klasses << Task::CommitManifest + tasks << Task::CommitManifest.new(self) if delta.has_unsafe_migrations? - task_klasses << Task::UnsafeMigration + tasks << Task::UnsafeMigration.new(self) elsif delta.has_migrations? - task_klasses << Task::SafeMigration + tasks << Task::SafeMigration.new(self) + end end - new delta, app_data, api, task_klasses + new delta, app_data, api, tasks end - attr_accessor :delta, :app_data, :api, :task_klasses + attr_accessor :delta, :app_data, :api, :tasks - def initialize(delta, app_data, api, task_klasses) - @delta = delta - @app_data = app_data - @api = api - @task_klasses = task_klasses + def initialize(delta, app_data, api, tasks) + @delta = delta + @app_data = app_data + @api = api + @tasks = tasks end def perform tasks.each &:before_push - Task::PushCode.new(app_data, api).perform + # Task::PushCode.new(app_data, api).perform tasks.each &:after_push - end - - private - - def tasks - @tasks ||= @task_klasses.map { |klass| instantiate_task klass } - end - - def instantiate_task(klass) - klass.new(self) end end end
Create task classes, instead of collecting klasses.
diff --git a/lib/i18n_lazy_scope/helper.rb b/lib/i18n_lazy_scope/helper.rb index abc1234..def5678 100644 --- a/lib/i18n_lazy_scope/helper.rb +++ b/lib/i18n_lazy_scope/helper.rb @@ -3,5 +3,6 @@ def t_scoped(key, **args) t(key, scope: lazy_scope, **args) end + alias_method :ts, :t_scoped end end
Create alias as :ts of :t_scoped method
diff --git a/lib/open_mensa/feed_parser.rb b/lib/open_mensa/feed_parser.rb index abc1234..def5678 100644 --- a/lib/open_mensa/feed_parser.rb +++ b/lib/open_mensa/feed_parser.rb @@ -1,3 +1,5 @@+require 'nokogiri' + module OpenMensa # FeedParser provide methods to parse XML input into an Nokogiri @@ -32,7 +34,7 @@ # a ParserError if data is invalid. # def parse! - @document = XML::Document.parse(data).tap do |doc| + @document = ::Nokogiri::XML::Document.parse(data).tap do |doc| @errors = doc.errors raise ParserError.new("Error while parsing feed data.", errors) unless errors.empty? end
Fix constant lookup exception in FeedParser
diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake index abc1234..def5678 100644 --- a/lib/tasks/publishing_api.rake +++ b/lib/tasks/publishing_api.rake @@ -0,0 +1,7 @@+namespace :publishing_api do + desc "Publish all Policies to the Publishing API" + task publish_policies: :environment do + PolicyArea.all.map(&:save) + Programme.all.map(&:save) + end +end
Add rake task for mass publishing As we continue to iterate on what is sent as part of the ContentItem, we need a way to mass publish all the Policies with the new information. This commit adds a rake task which triggers a save for all PolicyAreas and Programmes, which then publishes them to the PublishingAPI.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -2,7 +2,7 @@ require 'sinatra/base' require_relative 'lib/tictactoe_rules' require_relative 'lib/tictactoe_board' -require_relative 'lib/comp_player' +require_relative 'lib/player_ai' require_relative 'lib/web_game_engine' class TicTacToe < Sinatra::Base @@ -22,7 +22,7 @@ post '/game/move' do rules = TictactoeRules.new - comp_player = CompPlayer.new + comp_player = PlayerAi.new @game = WebGameEngine.new({ttt_board: session[:board], rules: rules, comp_player: comp_player}) @player_input = params[:grid_position]
Move to Playeai for consistency
diff --git a/lib/generators/controller_override.rb b/lib/generators/controller_override.rb index abc1234..def5678 100644 --- a/lib/generators/controller_override.rb +++ b/lib/generators/controller_override.rb @@ -5,13 +5,13 @@ module Rails module Generators class ControllerGenerator - hook_for :decorator, default: true do |generator| + hook_for :decorator, type: :boolean, default: true do |generator| invoke generator, [name.singularize] end end class ScaffoldControllerGenerator - hook_for :decorator, default: true + hook_for :decorator, type: :boolean, default: true end end end
Fix warnings with recent thor versions Otherwise running things like `bin/rails g --help` with `draper` installed leads to warnings like this: ``` Expected string default value for '--decorator'; got true (boolean) ``` See https://github.com/erikhuda/thor/issues/538 for reference.
diff --git a/app/models/bug_entry.rb b/app/models/bug_entry.rb index abc1234..def5678 100644 --- a/app/models/bug_entry.rb +++ b/app/models/bug_entry.rb @@ -3,7 +3,7 @@ def initialize(bz) @bz_id = bz.bz_id - @depends_on_ids = bz.depends_on_ids == "[]" ? "" : bz.depends_on_ids.to_s.split(",") + @depends_on_ids = bz.depends_on_ids == "[]" ? "" : bz.depends_on_ids.to_s.split(",") @pm_acks = display_for_ack(bz.pm_ack) @devel_acks = display_for_ack(bz.devel_ack) @qa_acks = display_for_ack(bz.qa_ack) @@ -14,8 +14,7 @@ end def has_all_acks? - a = [pm_acks, devel_acks, qa_acks, doc_acks, ver_acks] - (a & a).size == 1 + ![pm_acks, devel_acks, qa_acks, doc_acks, ver_acks].include?(" ") end private
Fix has_all_acks? indentation and logic
diff --git a/app/helpers/blog/blogs_helper.rb b/app/helpers/blog/blogs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/blog/blogs_helper.rb +++ b/app/helpers/blog/blogs_helper.rb @@ -14,7 +14,7 @@ end def all_tags - Blog::Tag.all + Blog::Tag.all.sort_by(&:name) end end
Sort 'all tags' by name
diff --git a/app/models/ecm/cms/navigation.rb b/app/models/ecm/cms/navigation.rb index abc1234..def5678 100644 --- a/app/models/ecm/cms/navigation.rb +++ b/app/models/ecm/cms/navigation.rb @@ -7,7 +7,8 @@ # validations validates :locale, inclusion: I18n.available_locales.map(&:to_s), - allow_nil: true + allow_nil: true, + allow_blank: true validates :name, presence: true, uniqueness: { scope: [:locale] }
Fix validations in rails 5.
diff --git a/app/services/receiver_service.rb b/app/services/receiver_service.rb index abc1234..def5678 100644 --- a/app/services/receiver_service.rb +++ b/app/services/receiver_service.rb @@ -3,8 +3,8 @@ # @param Receiver object # @param boolean true false def self.save(receiver) - if !TeamPolicy.can_manage?(receiver.team, receiver.user) || - !TeamPolicy.can_view?(receiver.team, receiver.user) + unless TeamPolicy.can_manage?(receiver.team, receiver.user) && + TeamPolicy.can_view?(receiver.team, receiver.user) raise "UserCannotManageTeam" end
Fix bug wrong receiver condition
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -6,6 +6,12 @@ else flash[:alert] = resource.errors.full_messages.join(", ") end + end + end + + def update + super do + casual_reader_transition(resource.person) if resource.persisted? end end @@ -28,4 +34,14 @@ resource.update_without_password(params) end + def casual_reader_transition(person) + email = person.email + puts "Ayo!" + return if email.blank? + puts "Ayo!" + if TuesdayReader.exists?(:email => email) + tuesday_reader = TuesdayReader.find_by(:email => email) + tuesday_reader.update(:person => person, :email => nil) + end + end end
Include casual reader transition when profile is saved with existing email
diff --git a/jobs/commercial_dashboard.rb b/jobs/commercial_dashboard.rb index abc1234..def5678 100644 --- a/jobs/commercial_dashboard.rb +++ b/jobs/commercial_dashboard.rb @@ -1,5 +1,9 @@+#!/bin/env ruby +# encoding: utf-8 + SCHEDULER.every '1h', :first_at => Time.now do send_event('members', { current: CommercialDashboard.members }) - send_event('age', { current: CommercialDashboard.age }) + send_event('age', { current: CommercialDashboard.age, suffix: " days" }) send_event('old-opportunities', { current: CommercialDashboard.old_opportunities }) + send_event('pipeline', { current: CommercialDashboard.pipeline, prefix: "£" }) end
Add suffix to average age
diff --git a/tasks/linting.rake b/tasks/linting.rake index abc1234..def5678 100644 --- a/tasks/linting.rake +++ b/tasks/linting.rake @@ -1,10 +1,11 @@ desc "Build *corelib* and *stdlib* and lint the result" task :jshint do dir = 'tmp/lint' - + puts + puts "= Checking distributed files..." unless ENV['SKIP_BUILD'] rm_rf dir if File.exist? dir - sh "rake dist DIR=#{dir}" + sh "bundle exec rake dist DIR=#{dir}" end Dir["#{dir}/*.js"].each {|path| @@ -13,4 +14,16 @@ sh "jshint --verbose #{path}" } + puts + puts "= Checking corelib files separately..." + js_paths = [] + Dir['opal/{opal,corelib}/*.rb'].each do |path| + js_path = "#{dir}/#{path.tr('/', '-')}.js" + sh "bundle exec opal -Dignore -cEO #{path} > #{js_path}" + js_paths << js_path + end + js_paths.each do |js_path| + sh "jshint --verbose #{js_path}" + end + sh "jshint --verbose opal/corelib/runtime.js" end
Check every corelib file with jshint
diff --git a/tasks/testing.rake b/tasks/testing.rake index abc1234..def5678 100644 --- a/tasks/testing.rake +++ b/tasks/testing.rake @@ -10,8 +10,7 @@ desc 'Run tests' task :execute_rake_tests do SUPPORTED_RUBIES.each do |r| - # `rvm use #{ r }` - `chruby #{ r }` + `rvm use #{ r }` `bundle exec rake default` end end
Revert "convert from rvm to chruby" This reverts commit 6b78333bcb01e88967e904e11743685a3121c35c.
diff --git a/app/views/layouts/bobcat.rb b/app/views/layouts/bobcat.rb index abc1234..def5678 100644 --- a/app/views/layouts/bobcat.rb +++ b/app/views/layouts/bobcat.rb @@ -21,18 +21,6 @@ end end end - - # Login link and icon - def login(params={}) - (current_user) ? link_to_logout(params) : link_to_login(params) - end - - # Link to logout - def link_to_logout(params={}) - icon_tag(:logout) + - link_to("Log-out #{current_user.firstname}", - logout_url(params), class: "logout") - end end end end
Remove firstname login code for the BobCat layout since it's now bundled in with nyulibraries-assets
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index abc1234..def5678 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,2 +1,10 @@ module SessionsHelper + # Login the given user + def log_in(user) + session[:user_id] = user.id + end + + def current_user + @current_user ||= User.find_by(id: session[:user_id]) + end end
Add session helper methods log_in & current_user
diff --git a/SIGS/app/controllers/user_controller.rb b/SIGS/app/controllers/user_controller.rb index abc1234..def5678 100644 --- a/SIGS/app/controllers/user_controller.rb +++ b/SIGS/app/controllers/user_controller.rb @@ -15,7 +15,9 @@ def create @user = User.new(user_params) if @user.save - #usuario criado com sucesso + flash[:notice] = 'Cadastro efetuado com sucesso!' + else + render :new end end @@ -38,7 +40,6 @@ end end - private def user_params params[:user].permit(:name, :email, :password, :registration, :cpf, :active,
Add error log to create
diff --git a/lib/discordrb/events/bans.rb b/lib/discordrb/events/bans.rb index abc1234..def5678 100644 --- a/lib/discordrb/events/bans.rb +++ b/lib/discordrb/events/bans.rb @@ -1,3 +1,5 @@+require 'discordrb/events/generic' + module Discordrb::Events # Raised when a user is banned class UserBanEvent @@ -16,7 +18,7 @@ end # Event handler for {UserBanEvent} - class UserBanEventHandler + class UserBanEventHandler < EventHandler def matches?(event) # Check for the proper event type return false unless event.is_a? UserBanEvent
Make UserBanEventHandler correctly inherit from EventHandler