diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/json_spec.gemspec b/json_spec.gemspec index abc1234..def5678 100644 --- a/json_spec.gemspec +++ b/json_spec.gemspec @@ -20,4 +20,7 @@ s.add_dependency "json", "~> 1.0" s.add_dependency "rspec", "~> 2.0" + + s.add_development_dependency "cucumber", "~> 1.0" + s.add_development_dependency "aruba", "~> 0.4.3" end
Add cucumber and aruba development gem dependencies
diff --git a/adash.gemspec b/adash.gemspec index abc1234..def5678 100644 --- a/adash.gemspec +++ b/adash.gemspec @@ -21,6 +21,5 @@ spec.add_development_dependency "bundler", "~> 1.13" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "launchy", "~> 2.5" end
Remove dependency on rspec from .gemspec
diff --git a/paymentwall.gemspec b/paymentwall.gemspec index abc1234..def5678 100644 --- a/paymentwall.gemspec +++ b/paymentwall.gemspec @@ -5,7 +5,7 @@ s.description = "Paymentwall is the leading digital payments platform for globally monetizing digital goods and services." s.authors = ["Heitor Dolinski"] s.email = 'heitor@paymentwall.com' - s.files = ["lib/paymentwall.rb"] - s.homepage ='http://www.paymentwall.com' + s.files = Dir.glob("lib/**/*") + %w(LICENSE README.md Rakefile) + s.homepage = 'http://www.paymentwall.com' s.license = 'MIT' -end+end
Add all source files to gemspec
diff --git a/poco.podspec b/poco.podspec index abc1234..def5678 100644 --- a/poco.podspec +++ b/poco.podspec @@ -13,7 +13,7 @@ s.requires_arc = false s.vendored_libraries = 'lib/*.a' s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/poco/include"' } - s.public_header_files = s.source_files = + s.private_header_files = s.source_files = 'include/**/*.h', 'include/**/**/*.h', 'include/**/**/**/*.h'
Set header files to private
diff --git a/SwiftHEXColors.podspec b/SwiftHEXColors.podspec index abc1234..def5678 100644 --- a/SwiftHEXColors.podspec +++ b/SwiftHEXColors.podspec @@ -9,5 +9,5 @@ s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.requires_arc = true - s.source_files = "SwiftHEXColors/*.{h,swift}" + s.source_files = "Sources/*.{h,swift}" end
Fix wrong source_files dir in podspec
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -19,7 +19,7 @@ :web => { :status => "online", :database_host => "db", - :readonly_database_host => "db-slave" + :readonly_database_host => "db" } )
Revert "Move thorn-03 back to ramoth" This reverts commit 5fd1960c98c27eb7f727df1556d2803428679312.
diff --git a/lib/formalist/elements/standard/rich_text_area.rb b/lib/formalist/elements/standard/rich_text_area.rb index abc1234..def5678 100644 --- a/lib/formalist/elements/standard/rich_text_area.rb +++ b/lib/formalist/elements/standard/rich_text_area.rb @@ -8,7 +8,22 @@ attribute :box_size, Types::String.enum("single", "small", "normal", "large", "xlarge"), default: "normal" attribute :inline_formatters, Types::Array attribute :block_formatters, Types::Array - attribute :embeddable_forms, Types::Hash + attribute :embeddable_forms, Types::Strict::Hash # TODO: need better typing, perhaps even require a rich object rather than a hash + + # FIXME: it would be tidier to have a reader method for each attribute + def attributes + attrs = super + + # Replace the form objects with their AST + attrs.merge( + embeddable_forms: attrs[:embeddable_forms].map { |key, attrs| + original_attrs = attrs + adjusted_attrs = original_attrs.merge(template: original_attrs[:template].build.to_ast) + + [key, adjusted_attrs] + }.to_h + ) + end end register :rich_text_area, RichTextArea
Convert embeddable forms to blank ASTs when generating RTE AST
diff --git a/ruboty-talk.gemspec b/ruboty-talk.gemspec index abc1234..def5678 100644 --- a/ruboty-talk.gemspec +++ b/ruboty-talk.gemspec @@ -16,7 +16,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "docomoru", ">= 0.0.2" + spec.add_dependency "docomoru", ">= 0.0.3" spec.add_dependency "ruboty", ">= 1.1.0" spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0"
Make it compatible with Ruby 2.0
diff --git a/test/sti_test.rb b/test/sti_test.rb index abc1234..def5678 100644 --- a/test/sti_test.rb +++ b/test/sti_test.rb @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper' -class SluggedModelTest < Test::Unit::TestCase +class STIModelTest < Test::Unit::TestCase context "A slugged model using single table inheritance" do @@ -45,4 +45,4 @@ end -end+end
Fix a typo in an existing test name
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,7 +24,7 @@ def mock_mapper(model_class) klass = Class.new(DataMapper::Mapper) do def inspect - "#<#{self.class.model}Mapper:#{object_id} model=#{self.class.model.inspect}>" + "#<#{self.class.model}Mapper:#{object_id} model=#{self.class.model}>" end end klass.model model_class
Remove previously introduced debug code
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,25 +1,29 @@-require 'rubygems' -require 'rspec' -require 'singleton' require 'simplecov' require 'coveralls' -# Both local SimpleCov and publish to Coveralls.io -SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter -] -SimpleCov.start do - add_filter "/spec/" +# On Ruby 1.9+ use SimpleCov and publish to Coveralls.io +if !RUBY_VERSION.start_with? '1.8' + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + SimpleCov.start do + add_filter "/spec/" + end + + # Remove Docile, which was required by SimpleCov, to require again later + Object.send(:remove_const, :Docile) + $LOADED_FEATURES.reject! { |f| f =~ /\/docile\// } end -test_dir = File.dirname(__FILE__) -$LOAD_PATH.unshift test_dir unless $LOAD_PATH.include?(test_dir) +lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib') +$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir -lib_dir = File.join(File.dirname(test_dir), 'lib') -$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include?(lib_dir) +# Require Docile again, now with coverage enabled on 1.9+ +require 'docile' -require 'docile' +require 'singleton' +require 'rspec' RSpec.configure do |config| config.expect_with :rspec do |c|
Fix SimpleCov statistics, now that it depends on Docile Need to un-require and then re-require Docile after SimpleCov is loaded, so that it can measure test coverage of the library. This is necessary since SimpleCov began to ship with Docile as a dependency.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -32,3 +32,19 @@ Dir[root.join('support/**/*.rb').to_s].each { |file| require file } Dir[root.join('shared/**/*.rb').to_s].each { |file| require file } + +# Namespace holding all objects created during specs +module Test + def self.remove_constants + constants.each(&method(:remove_const)) + end +end + +RSpec.configure do |config| + config.after do + Test.remove_constants + end + + config.disable_monkey_patching! + config.warnings = true +end
Add Test namespace with cleaning to specs
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,3 +31,13 @@ c.syntax = :expect end end + +# Set FOG_MOCK=true to enable Fog Mock mode. +# NB: Your test data will need to reflect the 'initial data structure' in +# https://github.com/fog/fog/blob/master/lib/fog/vcloud_director/compute.rb#L483 +# +# Use FOG_CREDENTIAL=fog_mock in vcloud_tools_tester +# +if ENV['FOG_MOCK'] + Fog.mock! +end
Add support for FOG_MOCK in tests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +minimal = ENV['MINIMAL'] == 'true' require 'pry' require 'simplecov' @@ -12,7 +14,7 @@ require 'objspace' -if ENV['MINIMAL'] +if minimal require 'frozen_record/minimal' else require 'frozen_record' @@ -29,7 +31,7 @@ RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus - config.filter_run_excluding :exclude_minimal if ENV['MINIMAL'] + config.filter_run_excluding :exclude_minimal if minimal config.order = 'random'
Check value of MINIMAL env variable because github sets it "false"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,6 +33,10 @@ config.before do Prequel.clear_tables end + + config.after do + Prequel.clear_session + end end def fit(description, &block)
Clear Prequel session after each spec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,7 @@ mocks.verify_partial_doubles = true end + config.filter_run_when_matching :focus config.shared_context_metadata_behavior = :apply_to_host_groups config.disable_monkey_patching! config.order = :random
Add the ability to focus on particular RSpec examples
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,6 +14,8 @@ require 'support/matchers/index' require 'support/matchers/function' require 'support/aruba' + +puts "Testing against Active Record #{ActiveRecord::VERSION::STRING} with Arel #{Arel::VERSION}" # Rails 5 returns a True/FalseClass AR_TRUE, AR_FALSE = ActiveRecord::VERSION::MAJOR == 4 ? ['t', 'f'] : [true, false]
Print AR and Arel versions when starting tests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,8 +4,7 @@ require 'helpers/document_component_dsl' def fixture(name) - @fixture_cache ||= {} - @fixture_cache[name] ||= File.read(File.expand_path(name, File.expand_path('fixtures', __dir__))) + File.read(File.expand_path(name, File.expand_path('fixtures', __dir__))) end RSpec.configure do |c|
Drop uselessly caching of fixture files
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,6 +24,8 @@ layout = Log4j::PatternLayout.new('[%d] %p %m (%c)%n') appender = Log4j::FileAppender.new(layout, log_file, append = true) Log4j::BasicConfigurator.configure(appender) + else + Log4j::Logger.root_logger.set_level(Log4j::Level::FATAL) end end end
Set log level to FATAL when running tests Can be overridden by setting the env. variable SILENCE_LOGGING to ‘no’.
diff --git a/spec/controllers/confirmations_controller_spec.rb b/spec/controllers/confirmations_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/confirmations_controller_spec.rb +++ b/spec/controllers/confirmations_controller_spec.rb @@ -0,0 +1,28 @@+require 'spec_helper' + +describe ConfirmationsController do + let(:user) { create(:user, confirmed_at: nil) } + + before do + @request.env['devise.mapping'] = Devise.mappings[:user] + end + + context 'user is not signed in' do + it 'confirms and signs in user' do + get :show, confirmation_token: user.confirmation_token + user.reload + expect(user.confirmed?).to eq true + expect(controller.current_user).to eq user + end + end + + context 'user is signed in' do + before { sign_in user } + + it 'confirms user' do + get :show, confirmation_token: user.confirmation_token + user.reload + expect(user.confirmed?).to eq true + end + end +end
Add devise confirmation controller test
diff --git a/stig.gemspec b/stig.gemspec index abc1234..def5678 100644 --- a/stig.gemspec +++ b/stig.gemspec @@ -12,7 +12,7 @@ s.files = `git ls-files`.split("\n") s.extra_rdoc_files = ["README.md"] - s.required_ruby_version = '>= 2.0' + s.required_ruby_version = '>= 1.9.3' s.add_development_dependency "cutest", "~> 1.2" end
Change ruby version requirement to 1.9.3
diff --git a/test/spec.rb b/test/spec.rb index abc1234..def5678 100644 --- a/test/spec.rb +++ b/test/spec.rb @@ -1,5 +1,5 @@ require_relative 'test_init' -Runner.! 'spec/*.rb' do |exclude| +Runner.('spec/*.rb') do |exclude| exclude =~ /_init.rb\z/ end
Replace bang actuator with call actuator.
diff --git a/telos.gemspec b/telos.gemspec index abc1234..def5678 100644 --- a/telos.gemspec +++ b/telos.gemspec @@ -10,7 +10,7 @@ spec.email = ["jan.depoorter@medialaan.be"] spec.summary = %q{Library to communicate with Telos devices} spec.description = %q{A library to communicate with Telos devices over the low-level protocol} - spec.homepage = "" + spec.homepage = "http://github.com/q-music/ruby-telos" spec.license = "Apache-2.0" spec.files = `git ls-files -z`.split("\x0")
Update URL of the gem
diff --git a/halation.gemspec b/halation.gemspec index abc1234..def5678 100644 --- a/halation.gemspec +++ b/halation.gemspec @@ -26,7 +26,7 @@ 'halation', ] - s.add_dependency 'mini_exiftool', '~> 2.7', '>= 2.7.2' + s.add_dependency 'mini_exiftool', '~> 2.10', '>= 2.7.2' s.add_development_dependency 'rake' s.add_development_dependency 'yard'
Increment mini_exiftool to version 2.10.
diff --git a/app/controllers/alexa_interface_controller.rb b/app/controllers/alexa_interface_controller.rb index abc1234..def5678 100644 --- a/app/controllers/alexa_interface_controller.rb +++ b/app/controllers/alexa_interface_controller.rb @@ -9,8 +9,13 @@ render json: create_response(get_location) when "SetCityIntent" city = params["request"]["intent"]["slots"]["city"]["value"] + user_id = params["session"]["user"]["userId"] + user = User.find_or_initialize_by(user_id: user_id) + user.city = city + p user.valid? + user.save response = AlexaRubykit::Response.new() - response.add_speech("hit #{city} intent") + response.add_speech("Set your city to #{user.city}") render json: response.build_response end else
Add logic for creating or updating a user with a city
diff --git a/what_now.gemspec b/what_now.gemspec index abc1234..def5678 100644 --- a/what_now.gemspec +++ b/what_now.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'what_now' - s.version = '0.0.5' + s.version = '0.0.6' s.date = '2014-02-27' s.summary = 'Find todo comments in your code' s.description = 'Executable for finding todo comments on directories'
Change gemspec for version 0.6
diff --git a/Library/Homebrew/os/linux/hardware.rb b/Library/Homebrew/os/linux/hardware.rb index abc1234..def5678 100644 --- a/Library/Homebrew/os/linux/hardware.rb +++ b/Library/Homebrew/os/linux/hardware.rb @@ -11,30 +11,37 @@ def arch_64_bit; :x86_64; end def universal_archs; [].extend ArchitectureListExtension; end + def cpuinfo + @cpuinfo ||= File.read("/proc/cpuinfo") + end + def type - @cpu_type ||= case `uname -m` - when /i[3-6]86/, /x86_64/ - :intel - else - :dunno - end + @type ||= if cpuinfo =~ /Intel|AMD/ + :intel + else + :dunno + end end def family - :dunno + cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i end alias_method :intel_family, :family def cores - `grep -c ^processor /proc/cpuinfo`.to_i + cpuinfo.scan(/^processor/).size end + + def flags + @flags ||= cpuinfo[/^flags.*/, 0].split + end + + %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each { |flag| + define_method(flag + "?") { flags.include? flag } + } + alias_method :is_64_bit?, :lm? def bits is_64_bit? ? 64 : 32 end - - def is_64_bit? - return @is_64_bit if defined? @is_64_bit - @is_64_bit = /64/ === `uname -m` - end end
Linuxbrew: Read CPU flags from /proc/cpuinfo Closes Homebrew/homebrew#29895. Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>
diff --git a/app/controllers/api/drops_controller.rb b/app/controllers/api/drops_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/drops_controller.rb +++ b/app/controllers/api/drops_controller.rb @@ -3,11 +3,11 @@ def index if params[:latitude] && params[:longitude] - places_within_radius = Place.near([params[:latitude], params[:longitude]], 10, units: :km) + radius = params[:radius].presence || 10 + places_within_radius = Place.near([params[:latitude], params[:longitude]], radius, units: :km) @drops = Drop.where(place_id: places_within_radius.map(&:id)) else @drops = Drop.all end end end -
Add logical expression in case no radius param gets passed
diff --git a/app/controllers/api_proxy_controller.rb b/app/controllers/api_proxy_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api_proxy_controller.rb +++ b/app/controllers/api_proxy_controller.rb @@ -7,7 +7,7 @@ def default uri = "/#{params[:url]}" uri += ".#{params[:format]}" if params[:format] - parameters = params.except('controller', 'action', 'url', 'format') + parameters = params.except('controller', 'action', 'url', 'format').to_json response = if request.get? NastyProxy.get uri
Fix formatting of parameters for the proxy api Related to severe problems in IE9 Fixes: #2415
diff --git a/app/workers/rubocop_worker.rb b/app/workers/rubocop_worker.rb index abc1234..def5678 100644 --- a/app/workers/rubocop_worker.rb +++ b/app/workers/rubocop_worker.rb @@ -9,8 +9,9 @@ def perform(project_id, force_run = false) @project = Project.find_by_id!(project_id) - return unless !force_run && project_needs_analyzing? - Project::DownloadAndLint.call(project, logger: logger) + if force_run || project_needs_analyzing? + Project::DownloadAndLint.call(project, logger: logger) + end rescue ActiveRecord::RecordNotFound => e logger.error { e.message } logger.error { "Skipping project_id(#{project_id.inspect}), because of #{e.class.name}" }
Fix and make more readable
diff --git a/app/controllers/responses_controller.rb b/app/controllers/responses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/responses_controller.rb +++ b/app/controllers/responses_controller.rb @@ -38,14 +38,18 @@ def up_vote puts "=" * 50 - puts params + puts session puts "=" * 50 @response = Response.find(params[:id]) - # @response.add_vote + vote = Vote.new( response_id: @response.id, user_id: session[:current_user] ) - render text: @response.votes.count + if vote.save! + render text: @response.votes.count + else + render @response.question + end end
Add create vote backend functionality but cannot grab session hash for user id for vote creation.
diff --git a/app/controllers/responses_controller.rb b/app/controllers/responses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/responses_controller.rb +++ b/app/controllers/responses_controller.rb @@ -27,6 +27,7 @@ @response.destroy respond_to do |format| + format.html{ redirect_to @response.question} format.js { head :ok } end end
Add html format to Response Destroy
diff --git a/app/controllers/user/base_controller.rb b/app/controllers/user/base_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user/base_controller.rb +++ b/app/controllers/user/base_controller.rb @@ -3,4 +3,14 @@ include User::VerificationHelper layout "user/layouts/application" + + private + + def read_only_user_attributes + return [] unless auth_modules_present? + + @read_only_user_attributes ||= current_site.configuration.auth_modules_data.inject([]) do |attributes, auth_module| + attributes | (auth_module.read_only_user_attributes || []) + end + end end
Allow definition of read only user fields from auth modules In config/application.yml, at the auth modules section, for an auth provider a read_only_user_attributes can be defined, with an array of user attributes identifiers which the user won't be able to edit. The attributes identifiers can be both names of attributes defined in the user model or names of custom user fields. The values for these attributes are expected to be assigned by the session or census custom forms provided by the auth provider
diff --git a/Casks/firefox-ja.rb b/Casks/firefox-ja.rb index abc1234..def5678 100644 --- a/Casks/firefox-ja.rb +++ b/Casks/firefox-ja.rb @@ -1,6 +1,6 @@ cask :v1 => 'firefox-ja' do - version '41.0' - sha256 'c58798d56bd2b93e15c5c36feb998530cc33597821f37aaecaa5c41264297517' + version '41.0.1' + sha256 '4f29aa5d53cea3c794ca61b434d4a4c79c278d2b9d3f23c363503c6026c9a785' url "https://download.mozilla.org/?product=firefox-#{version}-SSL&os=osx&lang=ja-JP-mac" name 'Firefox'
Upgrade Firefox (Japanese) to 41.0.1
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -1,28 +1,50 @@ require 'sinatra' require 'httparty' require 'json' +require 'nokogiri' +require 'open-uri' + +URL = "https://coinmarketcap.com/currencies/views/all/" + + +currencies = {} + get '/' do - 'test' + 'Nothing to see here.' end post '/gateway' do - message = params[:text].gsub(params[:trigger_word], '').strip - p message + page = Nokogiri::HTML(open(URL)) + page.css('tbody tr').each do |row| + currency_sym = row.css('.text-left').children.first.text + currencies[currency_sym] = {} + currencies[currency_sym]["name"] = row.css('img').attr('alt').value + currencies[currency_sym]["marketcap"] = row.css('.market-cap').text.strip + currencies[currency_sym]["price"] = row.css('.price').text + end - action, repo = message.split('_').map {|c| c.strip.downcase } - repo_url = "https://api.github.com/repos/#{repo}" - p 'ACTION' - p action - p 'REPO' - p repo_url + p currencies[message] + p currencies[message] + p currencies[message] + p currencies[message] + # message = params[:text].gsub(params[:trigger_word], '').strip + # p message - case action - when 'issues' - resp = HTTParty.get(repo_url) - resp = JSON.parse resp.body - respond_message "There are #{resp['open_issues_count']} open issues on #{repo}" - end + # action, repo = message.split('_').map {|c| c.strip.downcase } + # repo_url = "https://api.github.com/repos/#{repo}" + # p 'ACTION' + # p action + # p 'REPO' + # p repo_url + + # case action + # when 'issues' + # resp = HTTParty.get(repo_url) + # resp = JSON.parse resp.body + # respond_message "There are #{resp['open_issues_count']} open issues on #{repo}" + # end + end def respond_message message
Add nokogiri to bot and create dictionary for symbols.
diff --git a/lib/alchemy/test_support/integration_helpers.rb b/lib/alchemy/test_support/integration_helpers.rb index abc1234..def5678 100644 --- a/lib/alchemy/test_support/integration_helpers.rb +++ b/lib/alchemy/test_support/integration_helpers.rb @@ -6,16 +6,16 @@ # This file is included in spec_helper.rb # module IntegrationHelpers - # Used to stub the current_alchemy_user + # Used to stub the current_user in integration specs # # Pass either a user object or a symbol in the format of ':as_admin'. - # The browser language is set to english ('en') # def authorize_user(user_or_role = nil) - if user_or_role.is_a?(Alchemy.user_class) + case user_or_role + when Symbol, String + user = build(:alchemy_dummy_user, user_or_role) + else user = user_or_role - else - user = build(:alchemy_dummy_user, user_or_role) end allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) end
Fix setting current_user in integration helper Under some circumstances it might be that the Alchemy.user_class has not the same object id as the actual Alchemy.user_class
diff --git a/lib/travis/build/appliances/wait_for_network.rb b/lib/travis/build/appliances/wait_for_network.rb index abc1234..def5678 100644 --- a/lib/travis/build/appliances/wait_for_network.rb +++ b/lib/travis/build/appliances/wait_for_network.rb @@ -13,15 +13,18 @@ local count=1 local url="http://#{app_host}/empty.txt?job_id=${job_id}&repo=${repo}" - while [[ "${count}" -lt 10 ]]; do + set -o xtrace + while [[ "${count}" -lt 20 ]]; do if travis_download "${url}?count=${count}" /dev/null; then echo -e "${ANSI_GREEN}Network availability confirmed.${ANSI_RESET}" + set +o xtrace return fi count=$((count + 1)) sleep 1 done + set +o xtrace echo -e "${ANSI_RED}Timeout waiting for network availability.${ANSI_RESET}" } BASHSNIP
Add some tracing around travis_download because huh??
diff --git a/Casks/brackets.rb b/Casks/brackets.rb index abc1234..def5678 100644 --- a/Casks/brackets.rb +++ b/Casks/brackets.rb @@ -2,6 +2,7 @@ version '1.7' sha256 '1631dd2603f69488171d29776fa6fad09266a6d22b4263b59ef7d1bc39d64ea8' + # github.com/adobe/brackets was verified as official when first introduced to the cask url "https://github.com/adobe/brackets/releases/download/release-#{version}/Brackets.Release.#{version}.dmg" appcast 'https://github.com/adobe/brackets/releases.atom', checkpoint: 'aab65b5d8b065a452af59622b1e46def37290e1abe05600cd3539a60c6a67c96'
Fix `url` stanza comment for Brackets.
diff --git a/Casks/chocolat.rb b/Casks/chocolat.rb index abc1234..def5678 100644 --- a/Casks/chocolat.rb +++ b/Casks/chocolat.rb @@ -3,9 +3,9 @@ sha256 :no_check url 'https://chocolatapp.com/download' - appcast 'http://chocolatapp.com/userspace/appcast/appcast_alpha.php' + appcast 'https://chocolatapp.com/userspace/appcast/appcast_alpha.php' name 'Chocolat' - homepage 'http://chocolatapp.com/' + homepage 'https://chocolatapp.com/' license :commercial app 'Chocolat.app'
Fix homepage and appcast to use SSL in Chocolat Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/Casks/psychopy.rb b/Casks/psychopy.rb index abc1234..def5678 100644 --- a/Casks/psychopy.rb +++ b/Casks/psychopy.rb @@ -1,9 +1,11 @@ cask 'psychopy' do - version '1.82.00' - sha256 '42f980455815d6dd883d125265ed97cecdf4b366608620dadbf12965f40254ad' + version '1.83.03' + sha256 'bfb5d1d07e7df089d3056e6f4fd9ff6847628d4ed7a24f508f7c79190d1bc753' - # sourceforge.net is the official download host per the vendor homepage - url "http://downloads.sourceforge.net/sourceforge/psychpy/StandalonePsychoPy-#{version}-OSX.dmg" + # github.com is the official download host per the vendor homepage + url "https://github.com/psychopy/psychopy/releases/download/#{version}/StandalonePsychoPy-#{version}-OSX_64bit.dmg" + appcast 'https://github.com/psychopy/psychopy/releases.atom', + :sha256 => '84e7f9c46db10e75cab1462602102b57e182c77df92ed703ef75d44625184cef' name 'PsychoPy' homepage 'http://www.psychopy.org/' license :oss
Upgrade PsychoPy to v1.83.03 via official github psychopy moved from sourceforge.net to github.com and updated to latest release 1.83.03 released 15 Dec 2015
diff --git a/db/samples.rb b/db/samples.rb index abc1234..def5678 100644 --- a/db/samples.rb +++ b/db/samples.rb @@ -12,4 +12,6 @@ fixtures = File.join('db/fixtures', "#{File.basename(file, '.*')}.yml") FileUtils.touch(fixtures) ActiveRecord::Fixtures.create_fixtures(*db_args) + # Now that ActiveRecord::Fixtures is happy, let's remove the file + FileUtils.rm(fixtures, force: true) end
Remove build artifact after rake db:sample
diff --git a/app/helpers/emailer_helper.rb b/app/helpers/emailer_helper.rb index abc1234..def5678 100644 --- a/app/helpers/emailer_helper.rb +++ b/app/helpers/emailer_helper.rb @@ -1,16 +1,16 @@ module EmailerHelper include ApplicationHelper - + # returns a plain text short citation def brief_citation(request, options = {}) options[:include_labels] ||= false rv ="" - cite = request.referent.to_citation + cite = request.referent.to_citation title = truncate(cite[:title].strip, :length => 70, :seperator => '...') rv << (cite[:title_label].strip + ": ")if options[:include_labels] rv << title rv << "\n" - if cite[:author] + if cite[:author] rv << "Author: " if options[:include_labels] rv << cite[:author].strip rv << "\n" @@ -21,14 +21,14 @@ rv << "\n" end pub = [] - pub << date_format(cite[:date]) unless cite[:date].blank? + pub << date_format(cite[:date]) unless cite[:date].blank? pub << 'Vol: '+cite[:volume].strip unless cite[:volume].blank? - pub << 'Iss: '+cite[:issue].strip unless cite[:issue].blank? + pub << 'Iss: '+cite[:issue].strip unless cite[:issue].blank? pub << 'p. '+cite[:page].strip unless cite[:page].blank? if pub.length > 0 rv << "Published: " if options[:include_labels] rv << pub.join(' ') end - return rv + return rv end end
Clean up whitespace in emailer helper.
diff --git a/app/models/content/fixture.rb b/app/models/content/fixture.rb index abc1234..def5678 100644 --- a/app/models/content/fixture.rb +++ b/app/models/content/fixture.rb @@ -22,7 +22,7 @@ # - allows specification of Casebooks, Sections and Resources, which have mutually exclusive constraints, using a single fixture format class Content::Fixture < Content::Node has_many :collaborators, class_name: 'Content::Collaborator', dependent: :destroy, inverse_of: :content, foreign_key: :content_id - include Content::Concerns::HasCollaborators + # include Content::Concerns::HasCollaborators belongs_to :casebook, class_name: 'Content::Fixture', optional: true belongs_to :resource, polymorphic: true, inverse_of: :casebooks, optional: true
Comment out include statement which was causing tests to fail.
diff --git a/lib/generators/pundit/install/templates/application_policy.rb b/lib/generators/pundit/install/templates/application_policy.rb index abc1234..def5678 100644 --- a/lib/generators/pundit/install/templates/application_policy.rb +++ b/lib/generators/pundit/install/templates/application_policy.rb @@ -37,5 +37,18 @@ def scope Pundit.policy_scope!(user, record.class) end + + class Scope + attr_reader :user, :scope + + def initialize(user, scope) + @user = user + @scope = scope + end + + def resolve + scope + end + end end
Add Scope class to generator
diff --git a/ValidationNEL.podspec b/ValidationNEL.podspec index abc1234..def5678 100644 --- a/ValidationNEL.podspec +++ b/ValidationNEL.podspec @@ -8,8 +8,8 @@ spec.ios.deployment_target = "8.0" spec.osx.deployment_target = "10.11" -# spec.tvos.deployment_target = "9.0" -# spec.watchos.deployment_target = "2.0" + spec.tvos.deployment_target = "9.0" + spec.watchos.deployment_target = "2.0" spec.requires_arc = true spec.source = { git: "https://github.com/Hxucaa/ValidationNEL.git", tag: "v#{spec.version}", submodules: true }
Enable tvos and watchos as targets for Cocoapod.
diff --git a/lib/cocoatree.rb b/lib/cocoatree.rb index abc1234..def5678 100644 --- a/lib/cocoatree.rb +++ b/lib/cocoatree.rb @@ -3,6 +3,7 @@ require "cocoatree/pods" require "cocoatree/website" require "cocoatree/cache" +require "logger" module Cocoatree def self.root @@ -10,6 +11,6 @@ end def self.github_cache - @github_cache ||= Cache.new 'github_cache' + @github_cache ||= Cache.new 'github_cache', Logger.new(STDOUT) end end
Use logger to STDOUT for github_cache
diff --git a/lib/communist.rb b/lib/communist.rb index abc1234..def5678 100644 --- a/lib/communist.rb +++ b/lib/communist.rb @@ -2,13 +2,21 @@ require 'rack' module Communist + + class CommunistError < StandardError; end + class << self attr_accessor :app_host attr_accessor :default_host + attr_accessor :server_host, :server_port attr_accessor :run_server attr_accessor :app - # Possible options + # Configure Communist options + # + # Communist.configure do |config| + # config.server_host = 'http://localhost' + # end # def configure yield self
Add setters and comment config out.
diff --git a/lib/opal/util.rb b/lib/opal/util.rb index abc1234..def5678 100644 --- a/lib/opal/util.rb +++ b/lib/opal/util.rb @@ -1,6 +1,29 @@ module Opal module Util extend self + + # Used for uglifying source to minify + def uglify(str) + return unless command_installed? :uglifyjs, ' (install with: "npm install -g uglify-js")' + IO.popen("uglifyjs 2> #{null}", 'r+') do |i| + i.puts str + i.close_write + i.read + end + end + + # Gzip code to check file size + def gzip(str) + return unless command_installed? :gzip, ', it is required to produce the .gz version' + IO.popen("gzip -f 2> #{null}", 'r+') do |i| + i.puts str + i.close_write + i.read + end + end + + + private def null if (/mswin|mingw/ =~ RUBY_PLATFORM).nil? @@ -10,28 +33,25 @@ end end - # Used for uglifying source to minify - def uglify(str) - IO.popen('uglifyjs 2> ' + null, 'r+') do |i| - i.puts str - i.close_write - return i.read + # Code from http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby + def which(cmd) + exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] + ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| + exts.each { |ext| + exe = File.join(path, "#{cmd}#{ext}") + return exe if File.executable? exe + } end - rescue Errno::ENOENT, Errno::EPIPE, Errno::EINVAL - $stderr.puts '"uglifyjs" command not found (install with: "npm install -g uglify-js")' nil end - # Gzip code to check file size - def gzip(str) - IO.popen('gzip -f 2> ' + null, 'r+') do |i| - i.puts str - i.close_write - return i.read + INSTALLED = {} + def command_installed?(cmd, install_comment) + INSTALLED.fetch(cmd) do + unless INSTALLED[cmd] = which(cmd) != nil + $stderr.puts %Q("#{cmd}" command not found#{install_comment}) + end end - rescue Errno::ENOENT, Errno::EPIPE, Errno::EINVAL - $stderr.puts '"gzip" command not found, it is required to produce the .gz version' - nil end end end
Fix detection of uglify-js / gzip
diff --git a/lita-dig.gemspec b/lita-dig.gemspec index abc1234..def5678 100644 --- a/lita-dig.gemspec +++ b/lita-dig.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'lita-dig' - spec.version = '0.6.0' + spec.version = '1.0.0' spec.authors = ['Eric Sigler'] spec.email = ['me@esigler.com'] spec.description = 'A Lita handler for resolving DNS records'
Update gem to 1.0 for release
diff --git a/benchmarks/time_processing.rb b/benchmarks/time_processing.rb index abc1234..def5678 100644 --- a/benchmarks/time_processing.rb +++ b/benchmarks/time_processing.rb @@ -0,0 +1,12 @@+#!/usr/bin/env ruby +require "bundler" +Bundler.require(:default) + +require "benchmark" + +# Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) + +Benchmark.bm do |x| + x.report("Time.now: ") { 1_000_000.times { (Time.now.to_f * 1000).floor } } + x.report("get_clocktime:") { 1_000_000.times { Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond) } } +end
Add benchmark on gettime vs Time.now
diff --git a/BHCDatabase/test/integration/enrolments_delete_test.rb b/BHCDatabase/test/integration/enrolments_delete_test.rb index abc1234..def5678 100644 --- a/BHCDatabase/test/integration/enrolments_delete_test.rb +++ b/BHCDatabase/test/integration/enrolments_delete_test.rb @@ -0,0 +1,24 @@+require 'test_helper' + +class EnrolmentDeleteTest < ActionDispatch::IntegrationTest + + def setup + @admin = users(:admin) + @service_user = users(:service_user) + @enrolment = enrolments(:two) + log_in_as(@admin) + end + + # Remove an enrolment and ensure the history is saved + test "delete enrolment test" do + get user_path(@service_user) + assert_difference 'Enrolment.count', -1 do + assert_difference 'Unenrolment.count', 1 do + delete enrolment_path(@enrolment) + end + end + follow_redirect! + assert_not flash.empty? + assert_template 'users/show' + end +end
Add test for unenrolling a user.
diff --git a/yomou.gemspec b/yomou.gemspec index abc1234..def5678 100644 --- a/yomou.gemspec +++ b/yomou.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_runtime_dependency "thor", "~> 0.19" + spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rake", "~> 10.0" end
Add runtime dependency to thor
diff --git a/app/models/product.rb b/app/models/product.rb index abc1234..def5678 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -17,6 +17,12 @@ original ).freeze + SECTIONS_ENUM = { + '競技部門': 0, + '課題部門': 1, + '自由部門': 2 + }.freeze + def section_name SECTIONS[section] end
Define hash that section name to section number
diff --git a/app/models/tagging.rb b/app/models/tagging.rb index abc1234..def5678 100644 --- a/app/models/tagging.rb +++ b/app/models/tagging.rb @@ -19,6 +19,9 @@ validates_existence_of :user_id validates_existence_of :tag_id + # Users shouldn't be able to tag a package multiple times with the same tag. + validates_uniqueness_of :tag_id, :scope => :user_id + # Calculates the total number of packages that has been tagged. # # @return [Fixnum]
Make sure a user can't tag a package multiple times with the same tag name
diff --git a/make-sponsors.rb b/make-sponsors.rb index abc1234..def5678 100644 --- a/make-sponsors.rb +++ b/make-sponsors.rb @@ -0,0 +1,19 @@+require "yaml" +print "Enter the event in YYYY-city format: " +cityname = gets.chomp +config = YAML.load_file("data/events/#{cityname}.yml") +sponsors = config['sponsors'] +sponsors.each {|s| + if File.exist?("data/sponsors/#{s['id']}.yml") + puts "The file for #{s['id']} totally exists already" + else + puts "I need to make a file for #{s['id']}" + puts "What is the sponsor URL?" + sponsor_url = gets.chomp + sponsorfile = File.open("data/sponsors/#{s['id']}.yml", "w") + sponsorfile.write "name: #{s['id']}\n" + sponsorfile.write "url: #{sponsor_url}\n" + sponsorfile.close + puts "It will be data/sponsors/#{s['id']}.yml" + end +}
Create script for generating sponsor files This ruby script basically reads in a city config file and creates the sponsor file associated with it. It will NOT create the images, naturally, but this will make it somewhat easier.
diff --git a/Banana.podspec b/Banana.podspec index abc1234..def5678 100644 --- a/Banana.podspec +++ b/Banana.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Banana" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "A customizable dropdown menu" s.homepage = "https://github.com/Nonouf/Banana" # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
Update pod spec for 0.0.2
diff --git a/Formula/modelgen.rb b/Formula/modelgen.rb index abc1234..def5678 100644 --- a/Formula/modelgen.rb +++ b/Formula/modelgen.rb @@ -2,9 +2,8 @@ desc "Swift CLI to generate Models based on a JSON Schema and a template." homepage "https://github.com/hebertialmeida/ModelGen" url "https://github.com/hebertialmeida/ModelGen.git" - :branch => "master" - # :tag => "0.1.0", - # :revision => "930c017c0a066f6be0d9f97a867652849d3ce448" + :tag => "0.3.0", + :revision => "dda61ca457c805514708537a79fe65a5c7856533" head "https://github.com/hebertialmeida/ModelGen.git" depends_on :xcode => ["9.3", :build]
Update formula for new tag
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,6 +3,7 @@ Rails.application.config.assets.precompile += %w[ email.css *.png + favicon.ico ] Rails.application.config.assets.paths <<
Make sure favicon is available in production Due to a change between Rails 4.2.5 and 4.2.5.1, this was causing an error when running tests.
diff --git a/Casks/clion.rb b/Casks/clion.rb index abc1234..def5678 100644 --- a/Casks/clion.rb +++ b/Casks/clion.rb @@ -16,16 +16,4 @@ '~/Library/Caches/clion12', '~/Library/Logs/clion12', ] - - conflicts_with :cask => 'clion-bundled-jdk' - caveats <<-EOS.undent - #{token} requires Java 6 like any other IntelliJ-based IDE. - You can install it with - - brew cask install caskroom/homebrew-versions/java6 - - The vendor (JetBrains) doesn't support newer versions of Java (yet) - due to several critical issues, see details at - https://intellij-support.jetbrains.com/entries/27854363 - EOS end
Drop caveat and conflicts_with - JetBrains only offer the version of CLion that comes bundled with their JDK
diff --git a/Casks/shimo.rb b/Casks/shimo.rb index abc1234..def5678 100644 --- a/Casks/shimo.rb +++ b/Casks/shimo.rb @@ -7,5 +7,7 @@ homepage 'https://www.feingeist.io/shimo/' license :commercial + auto_updates true + app 'Shimo.app' end
Add auto_updates flag to Shimo
diff --git a/attic/polynomial-c.rb b/attic/polynomial-c.rb index abc1234..def5678 100644 --- a/attic/polynomial-c.rb +++ b/attic/polynomial-c.rb @@ -0,0 +1,35 @@+use_bpm 138 + +chords = [ + chord(:A3, :M, num_octaves: 2), + chord(:A3, :m, num_octaves: 2), +] + +pattern = "12123-12123-123-".ring + +define :mk_bassline do |c| + i = 0 + seq = [] + until i == pattern.length + note = pattern[i] == '-' ? 0 : c[pattern[i].to_i] + release = pattern[i + 1] == '-' ? 1 : 0.35 + seq.push([note, release]) + i += 1 + end + return seq +end + +live_loop :bassline do + with_fx :ixi_techno, phase: 16, cutoff_min: :C6, cutoff_max: :C7 do + with_fx :reverb, room: 0.99, damp: 0.25 do + chords.each do |c| + 2.times do + mk_bassline(c).each do |n| + synth :saw, note: n[0], release: n[1], attack: 0, res: 0.99 if n[0] > 0 + sleep 0.25 + end + end + end + end + end +end
Add polynomial-C bassline (Aphex Twin).
diff --git a/attributes/scripts.rb b/attributes/scripts.rb index abc1234..def5678 100644 --- a/attributes/scripts.rb +++ b/attributes/scripts.rb @@ -1 +1,2 @@-default['et_upload']['api_url'] = "https://api.evertrue.com" +default['et_upload']['api_url'] = 'https://api.evertrue.com' +default['et_upload']['support_email'] = 'jenna@evertrue.com'
Add Jenna as support email contact
diff --git a/test/perf/run_test.rb b/test/perf/run_test.rb index abc1234..def5678 100644 --- a/test/perf/run_test.rb +++ b/test/perf/run_test.rb @@ -16,6 +16,8 @@ run.finish('SuiteName', 'test_something') + assert_equal 1, run.tests.size + test = run.tests.last assert_equal 'SuiteName', test.suite
Check only 1 test is created
diff --git a/saorin.gemspec b/saorin.gemspec index abc1234..def5678 100644 --- a/saorin.gemspec +++ b/saorin.gemspec @@ -22,5 +22,5 @@ spec.add_development_dependency 'rake', '~> 10.4.2' spec.add_development_dependency 'rspec', '~> 2.14.1' spec.add_development_dependency 'rack', '~> 1.5.5' - spec.add_development_dependency 'faraday', '~> 0.9.2' + spec.add_development_dependency 'faraday', '~> 0.17.1' end
Update faraday requirement from ~> 0.9.2 to ~> 0.17.1 Updates the requirements on [faraday](https://github.com/lostisland/faraday) to permit the latest version. - [Release notes](https://github.com/lostisland/faraday/releases) - [Changelog](https://github.com/lostisland/faraday/blob/master/CHANGELOG.md) - [Commits](https://github.com/lostisland/faraday/compare/v0.9.2...v0.17.1) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/connection.gemspec b/connection.gemspec index abc1234..def5678 100644 --- a/connection.gemspec +++ b/connection.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'connection' - s.version = '0.0.4.1' + s.version = '0.0.4.2' s.summary = 'TCP client/server connection library offering both blocking and non/blocking operation' s.description = ' '
Package version is increased from 0.0.4.1 to 0.0.4.2
diff --git a/crawlers/lib/short_crawler.rb b/crawlers/lib/short_crawler.rb index abc1234..def5678 100644 --- a/crawlers/lib/short_crawler.rb +++ b/crawlers/lib/short_crawler.rb @@ -8,7 +8,7 @@ def_delegators :@extractor, :initial_urls, :next_page, :blocks, :news, :comments - PAGES_LIMIT = 50 + PAGES_LIMIT = 100 def all_blocks all_start_pages = initial_urls.map { |url| @agent.get(url) }.flatten
Increase limit for facebook requests
diff --git a/CalculateCalendarLogic.podspec b/CalculateCalendarLogic.podspec index abc1234..def5678 100644 --- a/CalculateCalendarLogic.podspec +++ b/CalculateCalendarLogic.podspec @@ -13,7 +13,8 @@ s.platform = :ios, "8.0" s.source = { :git => "https://github.com/fumiyasac/handMadeCalendarAdvance.git", :tag => "#{s.version}" } s.social_media_url = "https://twitter.com/fumisac" + s.source_files = "CalculateCalendarLogic/*.swift" + s.requires_arc = true s.ios.deployment_target = '8.0' - s.source_files = "CalculateCalendarLogic/*" - s.requires_arc = true + s.osx.deployment_target = '10.10' end
Support for macOS 10.10 or later (only CocoaPods)
diff --git a/lib/thinking_sphinx/search/batch_inquirer.rb b/lib/thinking_sphinx/search/batch_inquirer.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/search/batch_inquirer.rb +++ b/lib/thinking_sphinx/search/batch_inquirer.rb @@ -13,7 +13,9 @@ @results ||= begin @queries.freeze - ThinkingSphinx::Connection.new.query_all *@queries + ThinkingSphinx::Connection.pool.take do |connection| + connection.query_all *@queries + end end end end
Use connection pooling for standard queries.
diff --git a/ci/tasks/check-dns.rb b/ci/tasks/check-dns.rb index abc1234..def5678 100644 --- a/ci/tasks/check-dns.rb +++ b/ci/tasks/check-dns.rb @@ -20,4 +20,16 @@ puts "[PASS] #{domain} basic check ('DOMAIN' variable set & not empty)" whois_nameservers = get_whois_nameservers(domain) -puts "[PASS] #{domain} has whois entry with nameservers" +#whois_nameservers = [ 'ns-aws.nono.com', 'ns-he.nono.com' ] # testing +puts "[PASS] #{domain} has whois entry with nameservers #{whois_nameservers.join(", ")}" + +whois_nameservers.each do |whois_nameserver| + dig = `dig +short ns sslip.io #{whois_nameserver}` + dig_nameservers = dig.split(/\n+/) + if ( whois_nameservers.sort == dig_nameservers.sort ) + puts "[PASS] #{whois_nameserver}'s NS records match whois" + else + puts "[FAIL] #{whois_nameserver}'s NS records do NOT match whois: #{dig_nameservers.join(", ")}" + end + #p "#{whois_nameserver}: #{nameservers}" +end
Check that `whois` matches `dig`
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,5 +20,22 @@ config.blacklisted_tag_types = config_for(:blacklisted_tag_types) config.active_record.belongs_to_required_by_default = false + + # Rotate SHA1 cookies to SHA256 (the new Rails 7 default) + # TODO: Remove this after existing user sessions have been rotated + # https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html#key-generator-digest-class-changing-to-use-sha256 + Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies| + salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt + secret_key_base = Rails.application.secrets.secret_key_base + next if secret_key_base.blank? + + key_generator = ActiveSupport::KeyGenerator.new( + secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1 + ) + key_len = ActiveSupport::MessageEncryptor.key_len + secret = key_generator.generate_key(salt, key_len) + + cookies.rotate :encrypted, secret + end end end
Add cookie rotator to upgrade SHA1 sessions to SHA256
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,5 +26,12 @@ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + + # Set Access-Control-Allow-Origin' header to allow ajax requests from other origins + config.action_dispatch.default_headers = { + 'Access-Control-Allow-Origin' => '*', + 'Access-Control-Request-Method' => '*' + } + end end
Set 'Access-Control-Allow-Origin' header to allow requests from other origins
diff --git a/fastlane-plugin-aws_device_farm.gemspec b/fastlane-plugin-aws_device_farm.gemspec index abc1234..def5678 100644 --- a/fastlane-plugin-aws_device_farm.gemspec +++ b/fastlane-plugin-aws_device_farm.gemspec @@ -10,7 +10,7 @@ spec.email = %q{h.januschka@krone.at} spec.summary = %q{Run UI Tests on AWS Devicefarm} - # spec.homepage = "https://github.com/<GITHUB_USERNAME>/fastlane-plugin-aws_device_farm" + spec.homepage = "https://github.com/hjanuschka/fastlane-plugin-aws_device_farm" spec.license = "MIT" spec.files = Dir["lib/**/*"] + %w(README.md LICENSE)
Add link to GitHub to gemspec file
diff --git a/lib/data_preloading.rb b/lib/data_preloading.rb index abc1234..def5678 100644 --- a/lib/data_preloading.rb +++ b/lib/data_preloading.rb @@ -39,5 +39,8 @@ </script> HTML end + rescue Object => e + Rails.logger.warn { "!!!!!!!!! #{e}\n#{e.backtrace.join("\n")}" } + raise e end end
Add some logging to figure out why this is blowing up.
diff --git a/Casks/crashplan.rb b/Casks/crashplan.rb index abc1234..def5678 100644 --- a/Casks/crashplan.rb +++ b/Casks/crashplan.rb @@ -1,6 +1,6 @@ cask :v1 => 'crashplan' do - version '3.6.3' - sha256 'c3bb61fda36d777395748a6c6946085255e8ffa64c1538c453888e0de8ce2b73' + version '3.7.0' + sha256 '1ecce968c0b198941d98392422fb9ea7f15e6cb0334d670b3f97f796f2a54b1c' url "http://download.crashplan.com/installs/mac/install/CrashPlan/CrashPlan_#{version}_Mac.dmg" homepage 'http://www.crashplan.com/'
Upgrade Crashplan to version 3.7.0
diff --git a/Casks/gitkraken.rb b/Casks/gitkraken.rb index abc1234..def5678 100644 --- a/Casks/gitkraken.rb +++ b/Casks/gitkraken.rb @@ -20,5 +20,6 @@ '~/Library/Caches/com.axosoft.gitkraken', '~/Library/Preferences/com.axosoft.gitkraken.plist', '~/Library/Saved Application State/com.axosoft.gitkraken.savedState', + '~/.gitkraken', ] end
Update GitKraken's zap to clean out app settings
diff --git a/Casks/globalsan.rb b/Casks/globalsan.rb index abc1234..def5678 100644 --- a/Casks/globalsan.rb +++ b/Casks/globalsan.rb @@ -0,0 +1,21 @@+cask 'globalsan' do + version '5.3.0.541' + sha256 'f0fd88aefe931b4ba932ec2f9e7e8d9760668f903812f80c42172a74ce782971' + + # snsftp.com was verified as official when first introduced to the cask + url "http://www.snsftp.com/public/globalsan/globalSAN-#{version}.dmg" + name 'globalSAN iSCSI Initiator' + homepage 'http://www.studionetworksolutions.com/globalsan-iscsi-initiator/' + + pkg 'globalSAN.pkg' + + uninstall script: { + executable: 'Uninstall', + input: ['y'], + } + + zap script: { + executable: 'Uninstall', + input: ['n'], + } +end
Add globalSAN iSCSI Initiator v5.3.0.541
diff --git a/Casks/kitematic.rb b/Casks/kitematic.rb index abc1234..def5678 100644 --- a/Casks/kitematic.rb +++ b/Casks/kitematic.rb @@ -1,6 +1,6 @@ cask :v1 => 'kitematic' do - version '0.7.3' - sha256 'db0a3f8e2d32c0d94a1a44092f5e6af4761a14df7235d906c5bbcacc7b822cb0' + version '0.7.4' + sha256 '6385329bfa1dbdb513509a5f794382032a8d6e9c6b0925ee9df70e2968f0deb6' # github.com is the official download host per the vendor homepage url "https://github.com/kitematic/kitematic/releases/download/v#{version}/Kitematic-#{version}-Mac.zip"
Upgrade Kitematic (Beta).app to v0.7.4
diff --git a/spec/mapquest_spec.rb b/spec/mapquest_spec.rb index abc1234..def5678 100644 --- a/spec/mapquest_spec.rb +++ b/spec/mapquest_spec.rb @@ -2,55 +2,46 @@ describe MapQuest do - let(:mapquest) do - MapQuest.new('xxx') - end + subject { MapQuest } describe '.new' do - it 'should raise error if key is missing' do - expect { MapQuest.new }.to raise_error(ArgumentError) - end + context "without api_key" do - it 'should be instantiated' do - mapquest.should be_an_instance_of MapQuest - end + it 'should raise ArgumentError' do + expect { subject.new }.to raise_error(ArgumentError) + end - it 'should have an api key' do - mapquest.api_key.should_not == nil end end - let(:mapquest) do - MapQuest.new('xxx') - end + describe "instance" do - describe '#geocoding' do + let(:key) { 'xxx' } + subject(:instance) { MapQuest.new(key) } - it 'should instantiate Geocoding' do - MapQuest::Services::Geocoding.should_receive(:new) - mapquest.geocoding + it { should be_an_instance_of MapQuest } + + its(:api_key) { should == key } + its(:response) { should == nil } + + describe '#geocoding' do + subject(:geocoding) { instance.geocoding } + + it { should be_an_instance_of MapQuest::Services::Geocoding } + its(:mapquest) { should == instance } + end - it 'should raise an error if argument is passed' do - expect { mapquest.geocoding("xxx") }.to raise_error(ArgumentError) + describe '#directions' do + subject(:directions) { instance.directions } + + it { should be_an_instance_of MapQuest::Services::Directions } + its(:mapquest) { should == instance } + end end - describe '#directions' do - - it 'should instantiate Directions' do - MapQuest::Services::Directions.should_receive(:new) - mapquest.directions - end - - it 'should raise an error if argument is passed' do - expect { mapquest.directions("xxx") }.to raise_error(ArgumentError) - end - - end - - -end+end
Update MapQuest spec to use `subject` and `it` For brevity and ease of reading I've updated MapQuest spec to lean less on `let` and more on explicit `subject`s and implicit `it` expectations. I've also removed some unnecessary argument-related tests as they were just testing ruby's default parameter handling behaviour.
diff --git a/spec/yaml_ext_spec.rb b/spec/yaml_ext_spec.rb index abc1234..def5678 100644 --- a/spec/yaml_ext_spec.rb +++ b/spec/yaml_ext_spec.rb @@ -1,21 +1,21 @@ require 'spec_helper' describe "YAML" do - it "should autoload classes that are unknown at runtime" do + it "should autoload classes" do lambda { yaml = "--- !ruby/class:Autoloaded::Clazz {}\n" YAML.load(yaml).should == Autoloaded::Clazz }.should_not raise_error end - it "should autoload a struct" do + it "should autoload the class of a struct" do lambda { yaml = "--- !ruby/class:Autoloaded::Struct {}\n" YAML.load(yaml).should == Autoloaded::Struct }.should_not raise_error end - it "should autoload structs that are unknown at runtime" do + it "should autoload the class for the instance of a struct" do lambda { yaml = "--- !ruby/struct:Autoloaded::InstanceStruct {}" YAML.load(yaml).class.should == Autoloaded::InstanceStruct
Make the yaml ext spec descriptions more clear.
diff --git a/app/models/fitbit_goal.rb b/app/models/fitbit_goal.rb index abc1234..def5678 100644 --- a/app/models/fitbit_goal.rb +++ b/app/models/fitbit_goal.rb @@ -3,10 +3,6 @@ @user = user @increment = @user.goal_increment @type = 'steps' - end - - def config - @config ||= YAML.load_file('env.yml') end def increment_daily_goal @@ -25,7 +21,7 @@ end def consumer - @consumer ||= OAuth::Consumer.new config['consumer_key'], config['consumer_secret'], site: 'http://api.fitbit.com', request_token_path: '/oauth/request_token' + @consumer ||= OAuth::Consumer.new ENV['FITBIT_CONSUMER_KEY'], ENV['FITBIT_CONSUMER_SECRET'], site: 'http://api.fitbit.com', request_token_path: '/oauth/request_token' end def get_client_from_token_hash
Use env variables in FitbitGoal
diff --git a/pages/lib/refinery/pages/instance_methods.rb b/pages/lib/refinery/pages/instance_methods.rb index abc1234..def5678 100644 --- a/pages/lib/refinery/pages/instance_methods.rb +++ b/pages/lib/refinery/pages/instance_methods.rb @@ -10,7 +10,7 @@ def error_404(exception=nil) if (@page = ::Refinery::Page.where(:menu_match => "^/404$").includes(:parts).first).present? # render the application's custom 404 page with layout and meta. - render :template => '/refinery/pages/show', :formats => [:html], :status => 404 + render_with_templates?(:status => 404) return false else super
Allow 404 page to have custom view/layout templates.
diff --git a/SwiftLoader.podspec b/SwiftLoader.podspec index abc1234..def5678 100644 --- a/SwiftLoader.podspec +++ b/SwiftLoader.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftLoader" - s.version = "0.2.5" + s.version = "0.4.0" s.summary = "A simple and beautiful activity indicator" s.description = <<-DESC SwiftLoader is a simple and beautiful activity indicator written in Swift.
Update the version to 0.4.0 in pod spec
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -18,7 +18,7 @@ end def markdown(markdown_text, renderer = markdown_renderer) - renderer.render(markdown_text).html_safe + renderer.render(markdown_text).html_safe if markdown_text end private
Fix test where markdown text isn't present
diff --git a/lib/rails-footnotes/notes/env_note.rb b/lib/rails-footnotes/notes/env_note.rb index abc1234..def5678 100644 --- a/lib/rails-footnotes/notes/env_note.rb +++ b/lib/rails-footnotes/notes/env_note.rb @@ -8,11 +8,18 @@ end def content - # Replace HTTP_COOKIE for a link - @env['HTTP_COOKIE'] = '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>' + env_data = @env.to_a.sort.unshift([:key, :value]).map do |k,v| + case k + when 'HTTP_COOKIE' + # Replace HTTP_COOKIE for a link + [k, '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>'] + else + [k, escape(v.to_s)] + end + end # Create the env table - mount_table(@env.to_a.sort.unshift([:key, :value]), :summary => "Debug information for #{title}") + mount_table(env_data) end end end
Stop the unescaped env madness!
diff --git a/deviantart.gemspec b/deviantart.gemspec index abc1234..def5678 100644 --- a/deviantart.gemspec +++ b/deviantart.gemspec @@ -10,7 +10,7 @@ spec.email = ["aycabta@gmail.com"] spec.summary = %q{deviantART API library} - spec.description = %q{deviantART API library} + spec.description = %Q{deviantART API library\n} spec.homepage = "https://github.com/aycabta/deviantart" spec.license = "MIT"
Add newline as line terminator to spec.description
diff --git a/lib/unparser/emitter/flow_modifier.rb b/lib/unparser/emitter/flow_modifier.rb index abc1234..def5678 100644 --- a/lib/unparser/emitter/flow_modifier.rb +++ b/lib/unparser/emitter/flow_modifier.rb @@ -24,7 +24,7 @@ def dispatch conditional_parentheses((parent_type == :or || parent_type == :and) && children.any?) do write(MAP.fetch(node.type)) - emit_arguments + emit_arguments if children.any? end end @@ -35,7 +35,6 @@ # @api private # def emit_arguments - return if children.empty? ws head, *tail = children emit_argument(head)
Break up logic into more equally sized chunks
diff --git a/inherited_resources.gemspec b/inherited_resources.gemspec index abc1234..def5678 100644 --- a/inherited_resources.gemspec +++ b/inherited_resources.gemspec @@ -7,10 +7,9 @@ s.version = InheritedResources::VERSION.dup s.platform = Gem::Platform::RUBY s.summary = "Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important." - s.email = "developers@plataformatec.com.br" s.homepage = "http://github.com/josevalim/inherited_resources" s.description = "Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important." - s.authors = ['José Valim'] + s.authors = ['José Valim', 'Joel Moss'] s.license = "MIT" s.rubyforge_project = "inherited_resources"
Add @joelmoss as author and remove plataformatec email
diff --git a/lib/debug_exceptions_json/rspec/hook.rb b/lib/debug_exceptions_json/rspec/hook.rb index abc1234..def5678 100644 --- a/lib/debug_exceptions_json/rspec/hook.rb +++ b/lib/debug_exceptions_json/rspec/hook.rb @@ -5,7 +5,7 @@ base.instance_eval do after do |example| # For RSpec2 compatibility - if ::RSpec::Core::Version::STRING.split('.').first == "3" + if ::RSpec::Core::Version::STRING.start_with?("3.") || ::RSpec::Core::Version::STRING.start_with?("2.99") example.metadata[:response] = example.instance_exec { respond_to?(:response) && response } else # RSpec2 passes ExampleGroup::Nested_N
Add rspec 2.99 specific logic
diff --git a/lib/scss_lint/linter/debug_statement.rb b/lib/scss_lint/linter/debug_statement.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/debug_statement.rb +++ b/lib/scss_lint/linter/debug_statement.rb @@ -4,11 +4,7 @@ include LinterRegistry def visit_debug(node) - add_lint(node) - end - - def description - '@debug line' + add_lint(node, 'Remove @debug line') end end end
Remove description method from DebugStatement The `description` method is being deprecated. Change-Id: Ie814b691ea39e20a50f57f0cdc3816dbf6e6c835 Reviewed-on: http://gerrit.causes.com/36721 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/app/commands/thredded/at_notification_extractor.rb b/app/commands/thredded/at_notification_extractor.rb index abc1234..def5678 100644 --- a/app/commands/thredded/at_notification_extractor.rb +++ b/app/commands/thredded/at_notification_extractor.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require 'thredded/html_pipeline/at_mention_filter' module Thredded class AtNotificationExtractor def initialize(post)
Remove a `require` from an autoloaded file This is the last change required to remedy #478 for now. Still waiting for the Rails team to respond to https://github.com/rails/rails/issues/27119.
diff --git a/lib/tentd/api/middleware/delete_post.rb b/lib/tentd/api/middleware/delete_post.rb index abc1234..def5678 100644 --- a/lib/tentd/api/middleware/delete_post.rb +++ b/lib/tentd/api/middleware/delete_post.rb @@ -38,7 +38,7 @@ halt!(500, "Internal Server Error") end else - if post.destroy + if post.destroy(delete_options) env['response.status'] = 200 else halt!(500, "Internal Server Error")
Fix deleteing post version without creating delete post
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -8,4 +8,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( main.css users.css meetings.css meetings.js talks.js ruby.svg ruby.ico ) +Rails.application.config.assets.precompile += %w( main.css users.css meetings.css meetings.js speakers.css talks.css talks.js ruby.svg ruby.ico )
Add speaker and talk css to asset initializer
diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb index abc1234..def5678 100644 --- a/config/initializers/errbit.rb +++ b/config/initializers/errbit.rb @@ -1,6 +1,6 @@ Airbrake.configure do |config| config.api_key = ENV['ERRBIT_KEY'] config.host = ENV['ERRBIT_HOST'] - config.port = ENV['ERRBIT_PORT'] + config.port = ENV['ERRBIT_PORT'].to_i config.secure = config.port == 443 end
Convert port to integer for airbrake
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 @@ -11,4 +11,11 @@ 'application' end end + + # See "Gracefully handling InvalidAuthenticityToken exceptions" + # Phase 1 (2nd variation): https://stackoverflow.com/a/36533724/6875981 + def handle_unverified_request + flash[:error] = 'Unverified request. Please retry or clear your cookie!' + redirect_to :back + end end
Add graceful auth token exception handling Source: https://stackoverflow.com/a/36533724/6875981 Phase 1 (2nd variation) Another way to go about is just redirect Alice back to the form which she submitted without any pre-filled values. This approach can be achieved by: 1) ApplicationController - Add this function: ``` def handle_unverified_request flash[:error] = 'Kindly retry.' redirect_to :back end ```
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 @@ -3,9 +3,7 @@ # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - BASIC_AUTH_USERS = { "tahi" => "tahi3000" } - - before_action :basic_auth, if: -> { %w(production staging).include? Rails.env } + http_basic_authenticate_with name: "tahi", password: "tahi3000", if: -> { %w(development production staging).include? Rails.env } before_filter :configure_permitted_parameters, if: :devise_controller? @@ -14,12 +12,6 @@ devise_parameter_sanitizer.for(:sign_up).concat %i(first_name last_name affiliation email username) end - def basic_auth - authenticate_or_request_with_http_digest("Application") do |name| - BASIC_AUTH_USERS[name] - end - end - private def verify_admin! redirect_to(root_path, alert: "Permission denied") unless current_user.admin?
Use high level http_basic_auth to authenticate
diff --git a/test/govuk_headers_test.rb b/test/govuk_headers_test.rb index abc1234..def5678 100644 --- a/test/govuk_headers_test.rb +++ b/test/govuk_headers_test.rb @@ -0,0 +1,18 @@+require_relative "test_helper" +require "gds_api/govuk_headers" + +describe GdsApi::GovukHeaders do + before :each do + Thread.current[:headers] = nil if Thread.current[:headers] + end + + it "supports read/write of headers" do + GdsApi::GovukHeaders.set_header("GDS-Request-Id", "123-456") + GdsApi::GovukHeaders.set_header("Content-Type", "application/pdf") + + assert_equal({ + "GDS-Request-Id" => "123-456", + "Content-Type" => "application/pdf", + }, GdsApi::GovukHeaders.headers) + end +end
Write tests for current GovukHeaders behaviour.
diff --git a/app/overrides/static_admin_banner_link.rb b/app/overrides/static_admin_banner_link.rb index abc1234..def5678 100644 --- a/app/overrides/static_admin_banner_link.rb +++ b/app/overrides/static_admin_banner_link.rb @@ -0,0 +1,5 @@+Deface::Override.new(:virtual_path => "spree/layouts/admin", + :name => "static_admin_banner_link", + :insert_bottom => "[data-hook='admin_tabs']", + :text => "<%= tab(:banners, :icon => 'icon-file') %>", + :disabled => false)
Add banner link to deface
diff --git a/common_spree_dependencies.rb b/common_spree_dependencies.rb index abc1234..def5678 100644 --- a/common_spree_dependencies.rb +++ b/common_spree_dependencies.rb @@ -19,7 +19,7 @@ gem 'guard' gem 'guard-rspec', '~> 0.5.0' gem 'rspec-rails', '~> 2.9.0' - gem 'factory_girl_rails', '~> 3.0.0' + gem 'factory_girl_rails', '~> 1.7.0' gem 'email_spec', '~> 1.2.1' platform :ruby_18 do
Revert "Bump to factory_girl_rails 3.0.0" This reverts commit df3f4b5f219dc1bdd45568fe15a4f8a66db8e77c.
diff --git a/lib/foghub.rb b/lib/foghub.rb index abc1234..def5678 100644 --- a/lib/foghub.rb +++ b/lib/foghub.rb @@ -1,7 +1,7 @@ require 'sinatra' require 'json' require 'fogbugz' -require 'foghub/parser' +require './lib/foghub/parser' class Foghub < Sinatra::Base attr_accessor :instance, :config
Load lif/fogbugz/parser.rb correctly from root
diff --git a/app/models/event.rb b/app/models/event.rb index abc1234..def5678 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,8 +3,13 @@ has_many :eventTags has_many :tags, through: :eventTags - # validates :title, :presence => true - # validates :description, :presence => true - # validates :date, :presence => true - # validates :time, :presence => true + validates :user_id, :title, :description, :datetime, :city, :state, :zip, :location, + :presence => true + validates :zip, length: { is: 5 }, numericality: { only_integer: true } + + def created_by?(user) + return true if self.user == user + return false + end + end
Add Event model method created_by? for view layer usage