diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,35 +1,38 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| - # Configure all nodes in nodeset - install_server_packages = %( + manifest = <<-PUPPET if $facts['os']['name'] == 'CentOS' { package { 'epel-release': ensure => present, } } - $package_name = $facts['os']['family'] ? { + $netcat_package_name = $facts['os']['family'] ? { 'Debian' => 'netcat-openbsd', 'RedHat' => 'nc', default => 'netcat', } - package { $package_name: - ensure => present, - } - ) - apply_manifest_on(hosts_as('vpnserver'), install_server_packages, catch_failures: true) - install_client_packages = %( - if $facts['os']['name'] == 'CentOS' { - package { 'epel-release': + node /^vpnserver\./ { + package { $package_name: ensure => present, } } - package { ['tar','openvpn'] : - ensure => present, + node /^vpnclienta\./ { + package { ['tar','openvpn'] : + ensure => present, + } } - ) - apply_manifest_on(hosts_as('vpnclienta'), install_client_packages, catch_failures: true) + + # CentOS 6 in docker doesn't get a hostname - install all packages + node /^localhost\./ { + package { ['tar', 'openvpn', $netcat_package_name]: + ensure => present, + } + } + + PUPPET + apply_manifest_on(host, manifest, catch_failures: true) end
Unify node setup in acceptance helper
diff --git a/qa/qa/page/admin/settings/repository_storage.rb b/qa/qa/page/admin/settings/repository_storage.rb index abc1234..def5678 100644 --- a/qa/qa/page/admin/settings/repository_storage.rb +++ b/qa/qa/page/admin/settings/repository_storage.rb @@ -10,21 +10,11 @@ end def enable_hashed_storage - within_repository_storage do - check 'Create new projects using hashed storage paths' - end + check 'Create new projects using hashed storage paths' end def save_settings - within_repository_storage do - click_button 'Save changes' - end - end - - def within_repository_storage - page.within('.as-repository-storage') do - yield - end + click_button 'Save changes' end end end
Remove unnecessary section looking in admin settings qa Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/lib/app.rb b/lib/app.rb index abc1234..def5678 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -4,7 +4,7 @@ require 'incoming/dallas/models' require 'omniauth/strategies/dallas' -require 'omniauth-dropbox' +require 'omniauth-dropbox2' DataMapper::Logger.new($stdout, (ENV['DATAMAPPER_LOG_LEVEL'] || :info).to_sym) DataMapper.setup(:default, ENV['POSTGRES_URL'])
Fix require for dropbox2 auth
diff --git a/lib/etl.rb b/lib/etl.rb index abc1234..def5678 100644 --- a/lib/etl.rb +++ b/lib/etl.rb @@ -0,0 +1,49 @@+############################################################################### +# Copyright (C) 2015 Chuck Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +############################################################################### + +require 'psych' +require 'sequel' + +ENV["ETL_ENV"] ||= 'development' + +module ETL + def ETL.root + File.expand_path('../..', __FILE__) + end + + def ETL.log_file + "#{ETL.root}/log/#{ENV['ETL_ENV']}.log" + end + + # returns array of DBs parsed from config file + def ETL.db_config + if ETL.respond_to?("db_config_file") + fname = ETL.db_config_file + else + fname = "#{ETL.root}/config/database.yml" + end + Psych.load_file(fname) + end +end + +# Set up the database connection that's needed for Sequel models +# Also we can use the DB constant in the rest of the code +dbconfig = ETL.db_config[ENV["ETL_ENV"]] +DB = Sequel::Model.db = Sequel.connect(dbconfig) + +# Now include the rest of code needed for ETL system +require 'etl/core'
Add top-level include file that parses config and sets up Sequel modules.
diff --git a/mrbgem.rake b/mrbgem.rake index abc1234..def5678 100644 --- a/mrbgem.rake +++ b/mrbgem.rake @@ -3,6 +3,9 @@ MRuby::Gem::Specification.new('mruby-jpeg') do |spec| spec.license = 'MIT' spec.authors = 'Carson McDonald' + spec.version = '0.1.0' + spec.description = 'mruby wrapper for libjpeg.' + spec.homepage = 'https://github.com/carsonmcdonald/mruby-jpeg' spec.linker.libraries << 'jpeg'
Add version and description to spec.
diff --git a/Formula/android-ndk.rb b/Formula/android-ndk.rb index abc1234..def5678 100644 --- a/Formula/android-ndk.rb +++ b/Formula/android-ndk.rb @@ -11,7 +11,17 @@ def install bin.mkpath prefix.install Dir['*'] - %w[ ndk-build ndk-gdb ndk-stack ].each { |app| ln_s prefix+app, bin+app } + + # Create a dummy script to launch the ndk apps + ndk_exec = prefix+'ndk-exec.sh' + (ndk_exec).write <<-EOS.undent + #!/bin/sh + BASENAME=`basename $0` + EXEC="#{prefix}/$BASENAME" + test -f "$EXEC" && exec "$EXEC" "$@" + EOS + (ndk_exec).chmod 0755 + %w[ ndk-build ndk-gdb ndk-stack ].each { |app| ln_s ndk_exec, bin+app } end def caveats; <<-EOS
Fix Android NDK packaging for execs Instead of symlinking the execs themselves, launch a script with the hard-coded path. This is similar to how adb works in the android-sdk. Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
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 = '1.2.0.1' + s.version = '1.3.0.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 1.2.0.1 to 1.3.0.0
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 = 'messaging' - s.version = '0.6.1.0' + s.version = '0.6.2.0' s.summary = 'Messaging primitives for Eventide' s.description = ' '
Package version is increased from 0.6.1.0 to 0.6.2.0
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.9.1.0' + s.version = '0.9.2.0' s.summary = 'Messaging primitives for Eventide' s.description = ' '
Package version is increased from 0.9.1.0 to 0.9.2.0
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.25.0.0' + s.version = '0.25.0.1' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 0.25.0.0 to 0.25.0.1
diff --git a/mailer.rb b/mailer.rb index abc1234..def5678 100644 --- a/mailer.rb +++ b/mailer.rb @@ -25,7 +25,7 @@ @message_text, @message_url = message_text, message_url mail(:to => to, :bcc => "contact@openaustralia.org", :from => "noreply@openaustraliafoundation.org.au", - :subject => "A Citizen is contacting you via Twitter using Tweet My Council") + :subject => message_text) end end
Make the tweet post the actual subject contents
diff --git a/HysteriaPlayer.podspec b/HysteriaPlayer.podspec index abc1234..def5678 100644 --- a/HysteriaPlayer.podspec +++ b/HysteriaPlayer.podspec @@ -5,7 +5,7 @@ s.homepage = 'https://github.com/StreetVoice/HysteriaPlayer' s.license = 'MIT' s.author = { 'Stan Tsai' => 'feocms@gmail.com' } - s.source = { :git => 'https://github.com/StreetVoice/HysteriaPlayer.git'} + s.source = { :git => 'https://github.com/StreetVoice/HysteriaPlayer.git', :branch=> 'master'} s.platform = :ios, '6.0' s.source_files = 'HysteriaPlayer/**/*.{h,m}' s.resources = 'HysteriaPlayer/point1sec.{mp3}'
Update podspec refers to master branch
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index abc1234..def5678 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -7,16 +7,8 @@ $:.unshift("#{root}/activerecord/lib") end - require 'test/unit' - -begin - require 'mocha' -rescue LoadError - $stderr.puts 'Loading rubygems' - require 'rubygems' - require 'mocha' -end +require 'mocha' ENV['NO_RELOAD'] = '1' require 'active_support'
Remove automatic rubygems loading from AS test runner
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -14,7 +14,7 @@ get :index - expect(assigns(:aretefact)) + expect(assigns(:artefact)).to be_present end describe "caching" do
Fix spelling of `artefact`, and actually test it This test wasn't doing anything before this change, as we weren't validating the assignment of the variable (which wasn't spelled right anyway).
diff --git a/spec/controllers/experiments_controller_spec.rb b/spec/controllers/experiments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/experiments_controller_spec.rb +++ b/spec/controllers/experiments_controller_spec.rb @@ -1,6 +1,18 @@ require 'rails_helper' describe ExperimentsController do + let(:experiment) { Experiment.create( title: "this is the title", + summary: "this is the summary", + abstract: "this is the abstract", + introduction: "this is the introduction", + hypothesis: "this is the hypothesis", + methods: "these are the methods", + observations: "these are the observations", + results: "these are the results", + conclusion: "this is the conclusion", + staff_needed: 2, + contact_info: "this is the contact info", + owner_id: 1 )} describe '#index' do it 'renders a list of articles' do @@ -8,4 +20,7 @@ end end + describe 'GET #show' do + end + end
Add experiment to rspec for experiment controller
diff --git a/spec/lib/pg_search/configuration/column_spec.rb b/spec/lib/pg_search/configuration/column_spec.rb index abc1234..def5678 100644 --- a/spec/lib/pg_search/configuration/column_spec.rb +++ b/spec/lib/pg_search/configuration/column_spec.rb @@ -0,0 +1,29 @@+require "spec_helper" + +describe PgSearch::Configuration::Column do + describe "#full_name" do + with_model :Model do + table do |t| + t.string :name + end + end + + it "returns the fully-qualified table and column name" do + column = described_class.new("name", nil, Model) + column.full_name.should == %Q{#{Model.quoted_table_name}."name"} + end + end + + describe "#to_sql" do + with_model :Model do + table do |t| + t.string :name + end + end + + it "returns an expression that casts the column to text and coalesces it with an empty string" do + column = described_class.new("name", nil, Model) + column.to_sql.should == %Q{coalesce(#{Model.quoted_table_name}."name"::text, '')} + end + end +end
Add unit test coverage for Column
diff --git a/rails/script/update.rb b/rails/script/update.rb index abc1234..def5678 100644 --- a/rails/script/update.rb +++ b/rails/script/update.rb @@ -11,9 +11,9 @@ echo 'created tmp dir'; echo 'cloning rails'; git clone git://github.com/rails/rails.git; - cp ./rails/actionpack/lib/action_view/locale/en-US.yml #{curr_dir}/rails/rails/action_view.yml; - cp ./rails/activerecord/lib/active_record/locale/en-US.yml #{curr_dir}/rails/rails/active_record.yml; - cp ./rails/activesupport/lib/active_support/locale/en-US.yml #{curr_dir}/rails/rails/active_support.yml; + cp ./rails/actionpack/lib/action_view/locale/en.yml #{curr_dir}/rails/rails/action_view.yml; + cp ./rails/activerecord/lib/active_record/locale/en.yml #{curr_dir}/rails/rails/active_record.yml; + cp ./rails/activesupport/lib/active_support/locale/en.yml #{curr_dir}/rails/rails/active_support.yml; cd ..; rm -rf rails-i18n; )
Update default rails translations fetching script due to locale naming changes
diff --git a/spec/features/jobs/job_new_spec.rb b/spec/features/jobs/job_new_spec.rb index abc1234..def5678 100644 --- a/spec/features/jobs/job_new_spec.rb +++ b/spec/features/jobs/job_new_spec.rb @@ -3,17 +3,11 @@ # I want to create a new job # So other people can see it feature "Create a new job", :devise do - # Scenario: Visitor can create a job - # Given I am a visitor - # When I visit a new job - # I fill all the required information - # And I submit - # Then I see the success message - scenario "visitor can create a job" do - company = FactoryGirl.create(:company) - job_type = FactoryGirl.create(:job_type) - category = FactoryGirl.create(:category) + let!(:company) { FactoryGirl.create(:company) } + let!(:job_type) { FactoryGirl.create(:job_type) } + let!(:category) { FactoryGirl.create(:category) } + before do visit new_job_path select company.title, from: "job[company_id]" @@ -21,7 +15,9 @@ fill_in "Seu e-mail", with: Faker::Internet.email find(".goto_step3").click + end + scenario "visitor can create a job successfully" do fill_in "Titulo da vaga", with: Faker::Name.name choose category.title @@ -30,4 +26,9 @@ click_button "Publicar" expect(page).to have_content "a vaga foi salva com sucesso" end + + scenario "visitor cannot create a job without providing required info" do + click_on "Publicar" + expect(page).to have_content(/não pode ficar em branco/) + end end
Improve job create feature test
diff --git a/lib/parsley_simple_form/constraints/basics/type_constraint.rb b/lib/parsley_simple_form/constraints/basics/type_constraint.rb index abc1234..def5678 100644 --- a/lib/parsley_simple_form/constraints/basics/type_constraint.rb +++ b/lib/parsley_simple_form/constraints/basics/type_constraint.rb @@ -13,8 +13,9 @@ end def html_attributes - type = TYPE_MAP[type] unless TYPE_MAP[type].nil? - {"data-type-#{type}-message".to_sym => I18n::translate("form_validation.message.#{type}")} + mapped_type = type + mapped_type = TYPE_MAP[type] unless TYPE_MAP[type].nil? + {"data-type-#{mapped_type}-message".to_sym => I18n::translate("form_validation.message.#{mapped_type}")} end private
Fix bug for non-mapped types
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -7,6 +7,9 @@ end def system_health + # send metric to AWS for the number of delayed jobs currently running + PutMetricDataService.new.put_metric('DelayedJobsRunning', 'Count', Delayed::Job.count) + # return 500 if delayed job been locked for at least 8 hours if Delayed::Job.where('locked_at < ?', DateTime.now-8.hours).count > 0 redirect_to '/500'
[TTPLAT-1024] Set up metrics for delayed job queue length.
diff --git a/app/models/grade_span_expectation.rb b/app/models/grade_span_expectation.rb index abc1234..def5678 100644 --- a/app/models/grade_span_expectation.rb +++ b/app/models/grade_span_expectation.rb @@ -4,6 +4,8 @@ belongs_to :assessment_target has_many :unifying_themes, :through => :assessment_target acts_as_replicatable + + default_scope :conditions => "grade_span LIKE '%9-11%'" include Changeable
Use default scope in gse model to limit searches to grades 9-11
diff --git a/Casks/intellij-idea.rb b/Casks/intellij-idea.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea.rb +++ b/Casks/intellij-idea.rb @@ -1,6 +1,6 @@ class IntellijIdea < Cask - version '13.1.4b' - sha256 'e72c5c2e41a0de9fd7b81093bc3d9e4357e02200dbd209fa9384ddfa4cc52e08' + version '13.1.5' + sha256 'd6ba0c3e4c672d6685dec5c866966953fd7f1edc231040e00234af42f140a1da' url "http://download.jetbrains.com/idea/ideaIU-#{version}.dmg" homepage 'https://www.jetbrains.com/idea/index.html'
Update IntelliJ IDEA to 13.1.5
diff --git a/0_code_wars/directions_reduction.rb b/0_code_wars/directions_reduction.rb index abc1234..def5678 100644 --- a/0_code_wars/directions_reduction.rb +++ b/0_code_wars/directions_reduction.rb @@ -0,0 +1,59 @@+# http://www.codewars.com/kata/550f22f4d758534c1100025a/train/ruby +# --- iteration 1 --- +REDUCEABLE_OPTS = [["EAST","WEST"], ["WEST","EAST"], ["NORTH","SOUTH"], ["SOUTH","NORTH"]] + +def dirReduc(dirs) while reduceable?(dirs) do + dirs = reduce_pair(dirs) + end + dirs +end + +def reduceable?(dirs) dirs.each_cons(2).with_index do |sl, i| + if REDUCEABLE_OPTS.include?(sl) + return true + end + end + false +end + +def reduce_pair(dirs) dirs.each_cons(2).with_index do |sl, i| + if REDUCEABLE_OPTS.include?(sl) + dirs.delete_at(i) + dirs.delete_at(i) + return dirs + end + end +end + +# --- iteration 2 --- +def dirReduc(dirs) + loop do + dirs_old = dirs.dup + dirs = reduce_pair(dirs) + break if dirs_old == dirs + end + dirs +end + +def reduce_pair(dirs) + dirs.each_cons(2).with_index do |sl, i| + if [["EAST","WEST"], ["WEST","EAST"], ["NORTH","SOUTH"], ["SOUTH","NORTH"]].include?(sl) + 2.times{ dirs.delete_at(i) } + return dirs + end + end + dirs +end + +# --- ieration 3 --- +OPPOSITES = { "EAST" => "WEST", + "WEST" => "EAST", + "NORTH" => "SOUTH", + "SOUTH" => "NORTH" + } + +def dirReduc(dirs) + dirs.each_with_object([]) do |dir, path| + OPPOSITES[dir] == (path.last) ? path.pop : path.push(dir) + end +end
Add code wars (5) - directions reduction
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,2 +1,6 @@ class AdminController < ApplicationController + before_action :authorize_admin + def authorize_admin + redirect_to "/", alert: "Access denied" unless user_signed_in? && current_user.admin? + end end
Check if admin before loading the admin page
diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb index abc1234..def5678 100644 --- a/app/controllers/index_controller.rb +++ b/app/controllers/index_controller.rb @@ -5,14 +5,8 @@ # All of these endpoints should use https://www.inaturalist.org as the base URL, particularly endpoints that require auth. get '/' do - p "TAXAAAAAA GET" - p @taxa - erb :index -end - -post '/results' do - url = "https://www.inaturalist.org/observations.json?q=#{params['q']}" - response = RestClient.get(url) + # url = "https://www.inaturalist.org/observations.json?q=#{params['q']}" + response = RestClient.get("https://www.inaturalist.org/observations.json") parsed_response = JSON.parse(response,:symbolize_names => true) @taxa = [] @@ -20,9 +14,25 @@ @taxa << creature_hash[:taxon] end - p "TAXAAAAA POST" - p @taxa.length - - redirect '/' + # @taxa.each do |t| + # if !t.nil? + # p "*************************" + # p t[:rank] + # end + # end + erb :index end + +# post '/results' do +# url = "https://www.inaturalist.org/observations.json?q=#{params['q']}" +# response = RestClient.get(url) +# parsed_response = JSON.parse(response,:symbolize_names => true) +# +# @taxa = [] +# parsed_response.each do |creature_hash| +# @taxa << creature_hash[:taxon] +# end +# +# redirect '/' +# end
Update get request to hit the API
diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -47,6 +47,7 @@ authorize Team.first @team = BusinessUnit.new(new_team_params) + @team.role = 'responder' if @team.save flash[:notice] = 'Team created' redirect_to team_path(@team.parent_id)
Add Team property responder when creating Business Unit
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,7 +13,7 @@ end def update - if current_user.update_without_password(user_params) + if current_user.update_attributes(user_params) flash[:notice] = "User information updated" redirect_to edit_user_registration_path(current_user) else
Use update_attributes instead of update_without_password because strong parameters already filter out any possible password params.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,8 @@ class UsersController < ApplicationController before_action :authenticate_user!, :admin_only!, only: [:index, :show, :edit] before_filter :count_visits + + STANDARD_CURRICULUM_PROJECT_IDS = [] def index @users = User.all @@ -40,6 +42,9 @@ def artroom redirect_to thanks_path unless @visits.to_i > 1 redirect_to '/users/sign_in' unless current_user.present? + if current_user.present? + @standard_curriculum = get_standard_curriculum + end end private @@ -53,4 +58,7 @@ params.require(:user).permit(:role, :email, :password, :password_confirmation, :current_password) end + def get_standard_curriculum + STANDARD_CURRICULUM_PROJECT_IDS.map { |id| Project.find_by_id(id) } + end end
Set standard curriculum in artroom controller action
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -19,8 +19,8 @@ def current # look into eager loading @user = current_user - @parcels = @user.parcels.where(delivered: false) - @trips = @user.trips.where(completed: false) + @parcels = @user.parcels.where(delivered: false).order(updated_at: :desc) + @trips = @user.trips.where(completed: false).order(updated_at: :desc) @notifications = @user.mailbox.notifications @conversations = @user.mailbox.inbox @num_messages = @conversations.count
Add date sort to parcels and trips in users controller
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,4 +13,9 @@ users_repo.toggle_admin(params[:id]) redirect_to users_url, notice: "User's permissions has been changed." end + + def toggle_paused + users_repo.toggle_paused(params[:id]) + redirect_to users_url, notice: "User has been paused." + end end
Add toggle_paused method to UsersController
diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -29,7 +29,7 @@ end if model - @votable = model.find(params[:votable_id]) + @votable = model.find_by_id(params[:votable_id]) end end
Handle bad votable ID without exception
diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -22,6 +22,15 @@ redirect_to question_path(@question) end + def upvote + @vote = @answer.votes.where(user_id: current_user).first_or_create() + @vote.upvote + @vote.save + @question = Question.find(@answer.question_id) + @answers = @question.answers + redirect_to question_path(@question) + + end private def set_answer @answer = Answer.find(params[:answer_id])
Add upvote action to VotesController
diff --git a/DFImageManager.podspec b/DFImageManager.podspec index abc1234..def5678 100644 --- a/DFImageManager.podspec +++ b/DFImageManager.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "DFImageManager" - s.version = "0.0.12" - s.summary = "Complete solution for fetching, caching and adjusting images" + s.version = "0.0.13" + s.summary = "Complete solution for fetching, preheating, caching and adjusting images" s.homepage = "https://github.com/kean/DFImageManager" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Alexander Grebenyuk" => "grebenyuk.alexander@gmail.com" }
Increase podspec version to 0.0.13
diff --git a/spec/controllers/magazines_controller_index_bench_spec.rb b/spec/controllers/magazines_controller_index_bench_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/magazines_controller_index_bench_spec.rb +++ b/spec/controllers/magazines_controller_index_bench_spec.rb @@ -0,0 +1,18 @@+# frozen_string_literal: true +RSpec.describe MagazinesController, type: :controller, bench: true do + before do + ApplicationRecord.transaction do + 3.times do + magazine = create_force(:magazine, source: nil) + episode = create_list(:episode, 60, magazine: magazine) + 0.upto(300) do |i| + create_force(:page, magazine: magazine, episode: episode[i % 5], content: nil) + end + end + end + end + + it do + expect { get :index }.to perform_under(1500).ms.and_sample(3) + end +end
:rotating_light: Add performance test for /api/magazines
diff --git a/spec/controllers/site_controller_spec.rb b/spec/controllers/site_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/site_controller_spec.rb +++ b/spec/controllers/site_controller_spec.rb @@ -10,7 +10,7 @@ it "GET search" do get :search, {search: "git-init"} expect(assigns(:term)).to eq("git-init") - expect(response).to render_template("shared/search") + expect(response).to render_template("shared/_search") end it "GET search_results" do
Fix partial name for render_template expectation
diff --git a/lib/appointment_ticket.rb b/lib/appointment_ticket.rb index abc1234..def5678 100644 --- a/lib/appointment_ticket.rb +++ b/lib/appointment_ticket.rb @@ -10,7 +10,7 @@ client.tickets.create( type: 'task', group_id: ZENDESK_ONLINE_BOOKING_GROUP, - subject: 'Online Booking Request', + subject: 'Pension Wise appointment request', requester: requester, comment: comment) end
Include service in appointment ticket subject
diff --git a/sentry-raven.gemspec b/sentry-raven.gemspec index abc1234..def5678 100644 --- a/sentry-raven.gemspec +++ b/sentry-raven.gemspec @@ -16,7 +16,7 @@ gem.license = 'Apache-2.0' gem.required_ruby_version = '>= 1.9.0' - gem.add_dependency "faraday", ">= 0.7.6", "<= 0.9.x" + gem.add_dependency "faraday", ">= 0.7.6", "< 0.10.x" gem.add_development_dependency "rake" gem.add_development_dependency "rubocop"
Fix error in previous commit - need to support 0.9.x
diff --git a/test/html_filters/task_list_test.rb b/test/html_filters/task_list_test.rb index abc1234..def5678 100644 --- a/test/html_filters/task_list_test.rb +++ b/test/html_filters/task_list_test.rb @@ -27,4 +27,26 @@ assert_html_eq(mato.process(input).render_html, output) end + + def test_empty_task_list + # NOTE: The following markdown has trailing spaces on purpose. + # Do NOT remove them! + input = <<~'MARKDOWN' + * [ ] + * [x] + * [ ] + * [x] + MARKDOWN + + output = <<~'HTML' + <ul> + <li>[ ]</li> + <li>[x]</li> + <li>[ ]</li> + <li>[x]</li> + </ul> + HTML + + assert_html_eq(mato.process(input).render_html, output) + end end
Add test for empty task list
diff --git a/spec/support/checks/extend_test_check.rb b/spec/support/checks/extend_test_check.rb index abc1234..def5678 100644 --- a/spec/support/checks/extend_test_check.rb +++ b/spec/support/checks/extend_test_check.rb @@ -4,8 +4,8 @@ class MyCheck < ExtendCheck def pattern - '' + 'NilClass' end end end -end+end
Fix syntactically invalid Machete pattern in a check used in specs The invalid pattern caused the following spec failure: 1) Command line interface strict when given --strict argument Failure/Error: it { assert_partial_output "strict checked", all_stdout } expected "" to include "strict checked" # ./spec/scanny/cli_spec.rb:120:in `__script__' # kernel/common/eval19.rb:45:in `instance_eval' # kernel/bootstrap/array19.rb:18:in `map' # kernel/bootstrap/array19.rb:18:in `map' # kernel/bootstrap/array19.rb:18:in `map' # kernel/bootstrap/array19.rb:18:in `map' # kernel/loader.rb:708:in `run_at_exits' # kernel/loader.rb:728:in `epilogue' # kernel/loader.rb:866:in `main'
diff --git a/lib/http/response/body.rb b/lib/http/response/body.rb index abc1234..def5678 100644 --- a/lib/http/response/body.rb +++ b/lib/http/response/body.rb @@ -9,7 +9,7 @@ include Enumerable def_delegator :to_s, :empty? - def initialize(client, encoding) + def initialize(client, encoding = Encoding::BINARY) @client = client @streaming = nil @contents = nil
Set default HTTP::Response::Body encoding to Encoding::BINARY Otherwise we break Webmock
diff --git a/core/db/migrate/20140120135026_remove_facts_without_site.rb b/core/db/migrate/20140120135026_remove_facts_without_site.rb index abc1234..def5678 100644 --- a/core/db/migrate/20140120135026_remove_facts_without_site.rb +++ b/core/db/migrate/20140120135026_remove_facts_without_site.rb @@ -1,11 +1,11 @@ class RemoveFactsWithoutSite < Mongoid::Migration def self.up - Fact.all.to_a - .keep_if{|f| !f.site || !f.site.url || f.site.url.blank?)} - .each do |fact| + Fact.all.ids.each do |fact_id| + fact = Fact[fact_id] - Resque.enqueue ReallyRemoveFact, fact.id - + unless f.site and f.site.url and not f.site.url.blank? + Resque.enqueue ReallyRemoveFact, fact_id + end end end
Use Fact.ids and don't use keep_if
diff --git a/test/controllers/attachments_controller_test.rb b/test/controllers/attachments_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/attachments_controller_test.rb +++ b/test/controllers/attachments_controller_test.rb @@ -18,6 +18,7 @@ setup do sign_in users(:alice) + Tenant.current_domain = Tenant.first.domain @attachment = attachments(:default_page) @attachment.update_attributes!({ file: fixture_file_upload('attachments/default-testpage.pdf', 'application/pdf')
Fix race condition when tenant is not set in tests
diff --git a/lib/quick_travel/party.rb b/lib/quick_travel/party.rb index abc1234..def5678 100644 --- a/lib/quick_travel/party.rb +++ b/lib/quick_travel/party.rb @@ -2,8 +2,8 @@ class Party < Adapter LOGIN_URL = '/login.json' - attr_accessor :phone, :mobile, :email # if has a contact - attr_accessor :post_code, :country_id # if has an address + attr_reader :phone, :mobile, :email # if has a contact + attr_reader :post_code, :country_id # if has an address def initialize(hash = {}) super
Make these readers (but maybe they aren't even needed)
diff --git a/lib/stripe/list_object.rb b/lib/stripe/list_object.rb index abc1234..def5678 100644 --- a/lib/stripe/list_object.rb +++ b/lib/stripe/list_object.rb @@ -6,7 +6,7 @@ end def all(filters={}) - response, api_key = Stripe.request(:get, url, api_key, filters) + response, api_key = Stripe.request(:get, url, @api_key, filters) Util.convert_to_stripe_object(response, api_key) end
Fix confusion in ListObject around where api_key was coming from Fixes #69
diff --git a/prepare.rb b/prepare.rb index abc1234..def5678 100644 --- a/prepare.rb +++ b/prepare.rb @@ -9,7 +9,8 @@ FileUtils.rm_r("#{prepared_dir}", :verbose => true) FileUtils.cp_r("./", "#{prepared_dir}", :verbose => true) FileUtils.rm_r(Dir.glob("#{prepared_dir}/**/*.{psd}"), :verbose => true) -FileUtils.rm_r(["#{prepared_dir}/.git", "#{prepared_dir}/promos", "#{prepared_dir}/.gitignore", "#{prepared_dir}/prepare.rb"], :verbose => true) +FileUtils.rm(Dir.glob("#{prepared_dir}/**/.DS_Store"), :verbose => true) +FileUtils.rm_r(["#{prepared_dir}/.git", "#{prepared_dir}/promos", "#{prepared_dir}/.gitignore", "#{prepared_dir}/prepare.rb", "#{prepared_dir}/tests"], :verbose => true) Dir.glob("#{prepared_dir}/**/*.{js}").each do |file| new_name = File.dirname(file) + "/" + File.basename(file, ".js") + "_" + version + ".js"
Delete .DS_Store files and tests directory.
diff --git a/testing/lib/refinery/testing/controller_macros/methods.rb b/testing/lib/refinery/testing/controller_macros/methods.rb index abc1234..def5678 100644 --- a/testing/lib/refinery/testing/controller_macros/methods.rb +++ b/testing/lib/refinery/testing/controller_macros/methods.rb @@ -2,29 +2,34 @@ module Testing module ControllerMacros module Methods - def get(action, *args) - process_refinery_action(action, 'GET', *args) + def get(action, options = {}) + process_refinery_action(action, 'GET', options) end # Executes a request simulating POST HTTP method and set/volley the response - def post(action, *args) - process_refinery_action(action, 'POST', *args) + def post(action, options = {}) + process_refinery_action(action, 'POST', options) end # Executes a request simulating PUT HTTP method and set/volley the response - def put(action, *args) - process_refinery_action(action, 'PUT', *args) + def put(action, options = {}) + process_refinery_action(action, 'PUT', options) + end + + # Executes a request simulating PUT HTTP method and set/volley the response + def patch(action, options = {}) + process_refinery_action(action, 'PATCH', options) end # Executes a request simulating DELETE HTTP method and set/volley the response - def delete(action, *args) - process_refinery_action(action, 'DELETE', *args) + def delete(action, options = {}) + process_refinery_action(action, 'DELETE', options) end private - def process_refinery_action(action, http_method = 'GET', *args) - process(action, http_method, *args, :use_route => :refinery) + def process_refinery_action(action, http_method = 'GET', options) + process(action, http_method, options.merge(:use_route => :refinery)) end end end
Change *args splat to options hash because we need a hash instead of array.
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -18,6 +18,10 @@ @group = Group.new(groups_params) if @group.save + # Write a new relationship to the membership join table + # to add the creator as a group member and admin + + Membership.create(group_id: @group, member_id: current_user, admin: true) @group.members << current_user redirect_to '/groups/index' else
Add Group Creator to group as admin.
diff --git a/app/decorators/category_decorator.rb b/app/decorators/category_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/category_decorator.rb +++ b/app/decorators/category_decorator.rb @@ -14,7 +14,9 @@ end def div_color - unless model.color.blank? + if model.color.blank? + content_tag(:span, 'Pas de couleur') + else content_tag(:div, '', style: "background-color: #{model.color}; width: 35px; height: 20px;") end end
Add message when no color chosen
diff --git a/app/models/spree/stock/quantifier.rb b/app/models/spree/stock/quantifier.rb index abc1234..def5678 100644 --- a/app/models/spree/stock/quantifier.rb +++ b/app/models/spree/stock/quantifier.rb @@ -11,6 +11,8 @@ end def total_on_hand + # Associated stock_items no longer exist if the variant has been soft-deleted. A variant + # may still be in an active cart after it's deleted, so this will mark it as out of stock. return 0 if @variant.deleted? stock_items.sum(&:count_on_hand)
Add explanatory comment on soft-deleted variant stock logic
diff --git a/app/presenters/govspeak_presenter.rb b/app/presenters/govspeak_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/govspeak_presenter.rb +++ b/app/presenters/govspeak_presenter.rb @@ -15,7 +15,7 @@ private def interpolate_fact_values(string) - return string if !string.match(EMBEDDED_FACT_REGEXP) + return string unless string.match(EMBEDDED_FACT_REGEXP) string.gsub(EMBEDDED_FACT_REGEXP) do |match| if fact = $fact_cave.fact($1)
Use `unless` instead of if negate
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -12,5 +12,5 @@ end unless ENV['CUSTOM_DEVICE_SET_PATH'] == 'false' - SimCtl.device_set_path = Dir.mktmpdir + SimCtl.device_set_path = Dir.mktmpdir 'foo bar' end
Test device set path with spaces
diff --git a/app/value_objects/contacts_search.rb b/app/value_objects/contacts_search.rb index abc1234..def5678 100644 --- a/app/value_objects/contacts_search.rb +++ b/app/value_objects/contacts_search.rb @@ -8,14 +8,15 @@ end def search_name - search.where "title LIKE :name OR description LIKE :name", name: "%#{name}%" + search.where("contacts.title LIKE :name OR contacts.description LIKE :name", name: "%#{name}%") end def search_department_id - search.where department_id: department_id + search.where(department_id: department_id) end def search_contact_group_id - search.where "`contact_memberships`.`contact_group_id` = ?", contact_group_id + search.where("contact_memberships.contact_group_id = ?", contact_group_id). + references(:contact_memberships) end end
Fix deprication warning, and issue with ambiguous fields
diff --git a/app/controllers/door/log_entries_controller.rb b/app/controllers/door/log_entries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/door/log_entries_controller.rb +++ b/app/controllers/door/log_entries_controller.rb @@ -21,7 +21,11 @@ # TODO: Move to token-based authentication when there is support for it in # Pesho def authorize_client! - ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip - head :unauthorized unless ip == Rails.application.config.door_status_manager.host + ip = request.remote_ip + + unless ip == Rails.application.config.door_status_manager.host + Rails.logger.warn "#{ip} is not authorized to perform this action." + head :unauthorized + end end end
Determine the remote IP only by request.remote_ip Also log any unauthorized attempts.
diff --git a/app/lib/manual_update_type.rb b/app/lib/manual_update_type.rb index abc1234..def5678 100644 --- a/app/lib/manual_update_type.rb +++ b/app/lib/manual_update_type.rb @@ -26,8 +26,8 @@ manual. sections. select(&:needs_exporting?). - all? { |d| - d.minor_update? && d.has_ever_been_published? + all? { |s| + s.minor_update? && s.has_ever_been_published? } end end
Rename local variable d -> s in ManualUpdateType This must've been missed when we renamed `SpecialistDocument` to `Section`. Presumably `d` is short for `document`; `s` is short for `section`.
diff --git a/kata/04.rb b/kata/04.rb index abc1234..def5678 100644 --- a/kata/04.rb +++ b/kata/04.rb @@ -0,0 +1,92 @@+module Kata04 + + class Weather + + # line 1: header + # line 2: separator + # lines 3-31: observations + # line 32: summary + def lines + @lines ||= File.readlines 'kata/data/weather.dat' + end + + def observations + lines[2..30] + end + + # cols 1-5 + def day + extract_values(0..4, &:to_i) + end + + # cols 6-11 + def max_temp + extract_values(5..10, &:to_i) + end + + # cols 12-17 + def min_temp + extract_values(11..16, &:to_i) + end + + def extract_values(cols, &conversion) + observations.map do |l| + conversion.call(l[cols].strip) + end + end + + end + +end + +w = Kata04::Weather.new +min = [w.day, w.min_temp, w.max_temp].transpose.map do |day, min, max| + [day, max - min] +end.min{|a,b| b[1] <=> a[1]} +puts "Minimum temperature spread (#{min[1]}) on day #{min[0]}" + +module Kata04 + + class Football + + # line 1: header + # lines 2-18,20-22: observations + # line 19: separator + def lines + @lines ||= File.readlines 'kata/data/football.dat' + end + + def observations + lines[(1..17)] + lines[19..22] + end + + # cols 8-23 + def name + extract_values(7..22, &:to_s) + end + + # cols 44-47 + def for_goals + extract_values(43..46, &:to_i) + end + + # cols 51-54 + def against_goals + extract_values(50..53, &:to_i) + end + + def extract_values(cols, &conversion) + observations.map do |l| + conversion.call(l[cols].strip) + end + end + + end + +end + +f = Kata04::Football.new +min = [f.name, f.for_goals, f.against_goals].transpose.map do |name, f, a| + [name, f - a] +end.min{|a,b| b[1] <=> a[1]} +puts "Team with best goal balance (#{min[1]}) is #{min[0]}"
Add Kata 4 - before DRY
diff --git a/app/models/data_model/gene.rb b/app/models/data_model/gene.rb index abc1234..def5678 100644 --- a/app/models/data_model/gene.rb +++ b/app/models/data_model/gene.rb @@ -16,16 +16,16 @@ def potentially_druggable_genes #return Go or other potentially druggable categories - citation_ids = DataModel::Source.potentially_druggable_sources.map{|c| c.id} - genes.select{|g| citation_ids.include?(g.citation.id)} + source_ids = DataModel::Source.potentially_druggable_sources.map{|s| s.id} + genes.select{|g| source_ids.include?(g.citation.id)} end def display_name - alternate_names = Maybe(genes).map{|g| g.gene_alternate_names}.flatten.select{|a| a.nomenclature == 'Gene Description'} + alternate_names = Maybe(genes).map{|g| g.gene_claim_aliases}.flatten.select{|a| a.nomenclature == 'Gene Description'} if alternate_names.empty? name else - [name, ' (', alternate_names[0].alternate_name, ')'].join("") + [name, ' (', alternate_names[0].alias, ')'].join("") end end
Update DataModel::Gene to use the new schema changes
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/test_sandbox.rb +++ b/Library/Homebrew/test/test_sandbox.rb @@ -4,25 +4,25 @@ class SandboxTest < Homebrew::TestCase def setup skip "sandbox not implemented" unless Sandbox.available? + @sandbox = Sandbox.new + @dir = Pathname.new(Dir.mktmpdir) + @file = @dir/"foo" + end + + def teardown + @dir.rmtree end def test_allow_write - s = Sandbox.new - testpath = Pathname.new(TEST_TMPDIR) - foo = testpath/"foo" - s.allow_write foo - s.exec "touch", foo - assert_predicate foo, :exist? - foo.unlink + @sandbox.allow_write @file + @sandbox.exec "touch", @file + assert_predicate @file, :exist? end def test_deny_write - s = Sandbox.new - testpath = Pathname.new(TEST_TMPDIR) - bar = testpath/"bar" shutup do - assert_raises(ErrorDuringExecution) { s.exec "touch", bar } + assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file } end - refute_predicate bar, :exist? + refute_predicate @file, :exist? end end
Manage sandbox test resources in setup/teardown
diff --git a/app/controllers/audits_controller.rb b/app/controllers/audits_controller.rb index abc1234..def5678 100644 --- a/app/controllers/audits_controller.rb +++ b/app/controllers/audits_controller.rb @@ -3,8 +3,8 @@ # GET /audits.json def index if params[:start_date] and params[:end_date] - @start_date = Date.civil(params[:start_date][:year].to_i, params[:start_date][:month].to_i, params[:start_date][:day].to_i) - @end_date = Date.civil(params[:end_date][:year].to_i, params[:end_date][:month].to_i, params[:end_date][:day].to_i) + @start_date = parse_date params[:start_date] + @end_date = parse_date params[:end_date] @audits = Audit.where("created_at >= :start_date AND created_at <= :end_date", start_date: @start_date, end_date: @end_date) else @audits = Audit.all @@ -24,4 +24,10 @@ }} end end + + private + + def parse_date data + return Date.civil(data[:year].to_i, data[:month].to_i, data[:day].to_i) + end end
Simplify the date parsing in audits controller. Former-commit-id: 0dfce56b42f22a8c9f3d57ae9860beff08bc0cb3
diff --git a/app/controllers/organs_controller.rb b/app/controllers/organs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/organs_controller.rb +++ b/app/controllers/organs_controller.rb @@ -33,6 +33,7 @@ respond_to do |format| format.html format.json { render :json => Organ.find(params[:id]) } + format.fragment { render "show.html", layout: false } end end
Add fragment support to organ controller show
diff --git a/app/controllers/twilio_controller.rb b/app/controllers/twilio_controller.rb index abc1234..def5678 100644 --- a/app/controllers/twilio_controller.rb +++ b/app/controllers/twilio_controller.rb @@ -1,4 +1,7 @@ class TwilioController < ApplicationController + # skip the csrf verification because this endpoint should be hit by twilio + skip_before_action(:verify_authenticity_token) + def new_message body = JSON.decode(request.body)
Disable csrf check for twilio controller
diff --git a/app/dashboards/dashboard_manifest.rb b/app/dashboards/dashboard_manifest.rb index abc1234..def5678 100644 --- a/app/dashboards/dashboard_manifest.rb +++ b/app/dashboards/dashboard_manifest.rb @@ -10,9 +10,9 @@ # Dashboards returned from this method must be Rails models for Administrate # to work correctly. DASHBOARDS = [ - :users, + :choirs, :categories, - :choirs + :users ] # `ROOT_DASHBOARD`
Change resource listing at sidebar of administrate
diff --git a/_plugins/url_encode.rb b/_plugins/url_encode.rb index abc1234..def5678 100644 --- a/_plugins/url_encode.rb +++ b/_plugins/url_encode.rb @@ -0,0 +1,13 @@+# From https://stackoverflow.com/questions/15976495/how-to-url-encode-in-jekyll-liquid/17769287#17769287 +require 'liquid' +require 'uri' + +# Percent encoding for URI conforming to RFC 3986. +# Ref: http://tools.ietf.org/html/rfc3986#page-12 +module URLEncoding + def url_encode(url) + return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) + end +end + +Liquid::Template.register_filter(URLEncoding)
Fix badly encoded subject in mailto templates
diff --git a/sfn-parameters.gemspec b/sfn-parameters.gemspec index abc1234..def5678 100644 --- a/sfn-parameters.gemspec +++ b/sfn-parameters.gemspec @@ -10,6 +10,6 @@ s.description = 'SparkleFormation Parameters Callback' s.license = 'Apache-2.0' s.require_path = 'lib' - s.add_dependency 'sfn', '>= 1.0.0', '< 4.0' + s.add_dependency 'sfn', '>= 3.0', '< 4.0' s.files = Dir['{lib,bin,docs}/**/*'] + %w(sfn-parameters.gemspec README.md CHANGELOG.md LICENSE) end
Update minumum constraint to ensure properly functioning compile param usage via config
diff --git a/apps/web/views/tasks/index.rb b/apps/web/views/tasks/index.rb index abc1234..def5678 100644 --- a/apps/web/views/tasks/index.rb +++ b/apps/web/views/tasks/index.rb @@ -20,7 +20,7 @@ def task_statuses { - 'in progress' => 'In progress', + 'in progress' => 'Open', 'assigned' => 'Assigned', 'closed' => 'Closed', 'done' => 'Finished'
Use better name instead 'in progress' for task attribute
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index abc1234..def5678 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -1,4 +1,6 @@ class StaticController < ApplicationController + skip_before_action :require_login, only: :contact_us + def non_supported end
Make Contact Us page accessible when not logged in.
diff --git a/lib/cb/Utils/string.rb b/lib/cb/Utils/string.rb index abc1234..def5678 100644 --- a/lib/cb/Utils/string.rb +++ b/lib/cb/Utils/string.rb @@ -7,4 +7,4 @@ self.sub!(/^[a-z\d]*/) { $&.capitalize } self.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$2.capitalize}" }.gsub('/', '::') end -end+end
Add newline to file (shouldn't make a difference)
diff --git a/site-cookbooks/dna/recipes/dotfiles.rb b/site-cookbooks/dna/recipes/dotfiles.rb index abc1234..def5678 100644 --- a/site-cookbooks/dna/recipes/dotfiles.rb +++ b/site-cookbooks/dna/recipes/dotfiles.rb @@ -3,11 +3,12 @@ # # Download dotfiles # -git "Download wilr/dotfiles" do - repository "http://github.com/wilr/dotfiles.git" +git "Download dnadesign/dotfiles" do + repository "http://github.com/dnadesign/dotfiles.git" destination "#{node['sprout']['home']}/Scripts/dotfiles" action :sync user node['current_user'] + not_if { ::File.exists?("#{node['sprout']['home']}/Scripts/dotfiles") } end #
Use DNA dot files rather than my personal one at this stage
diff --git a/lib/dm-tags/tagging.rb b/lib/dm-tags/tagging.rb index abc1234..def5678 100644 --- a/lib/dm-tags/tagging.rb +++ b/lib/dm-tags/tagging.rb @@ -10,6 +10,8 @@ belongs_to :tag def taggable - eval("#{taggable_type}.get!(#{taggable_id})") if taggable_type and taggable_id + if taggable_type and taggable_id + Object.const_get(taggable_type).send(:get!, taggable_id) + end end end
[dm-tags] Remove eval and use send, as it's safer
diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -1,6 +1,10 @@ # encoding: utf-8 class AttachmentUploader < CarrierWave::Uploader::Base + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + def extension_white_list %w(jpg jpeg gif png pdf xlsx docx xls doc txt) end
Add s3 storage dir structure
diff --git a/app/models/business.rb b/app/models/business.rb index abc1234..def5678 100644 --- a/app/models/business.rb +++ b/app/models/business.rb @@ -1,4 +1,5 @@ class Business < ActiveRecord::Base + Elasticsearch::Model.client = Elasticsearch::Client.new url: ENV['BONSAI_URL'], log: true include Elasticsearch::Model include Elasticsearch::Model::Callbacks
Add connection params for elasticsearch to model as troubleshoot
diff --git a/spec/factories/subscription_factory.rb b/spec/factories/subscription_factory.rb index abc1234..def5678 100644 --- a/spec/factories/subscription_factory.rb +++ b/spec/factories/subscription_factory.rb @@ -1,5 +1,9 @@ FactoryGirl.define do factory :subscription, class: Spree::Subscription do + before(:create) do + create(:product) if Spree::Product.unsubscribable.count == 0 + end + user { create :user } address { create :address } subscription_product { create :subscription_product }
Fix failing test * Create a product before create a subscription factory
diff --git a/spec/models/method_parens_rule_spec.rb b/spec/models/method_parens_rule_spec.rb index abc1234..def5678 100644 --- a/spec/models/method_parens_rule_spec.rb +++ b/spec/models/method_parens_rule_spec.rb @@ -26,4 +26,18 @@ expect(%(def valid ruby)).to violate(MethodParensRule) end end + + context 'not a method definition' do + it 'is not violated for ranges' do + expect(%{(1..10)}).not_to violate(MethodParensRule) + end + + it 'is not violated for method calls' do + expect(%{pass(message)}).not_to violate(MethodParensRule) + end + + it 'is not violated for an unassuming line of ruby' do + expect(%(x == y)).not_to violate(MethodParensRule) + end + end end
Test MethodParensRule against non-method definitions
diff --git a/app/models/specfile.rb b/app/models/specfile.rb index abc1234..def5678 100644 --- a/app/models/specfile.rb +++ b/app/models/specfile.rb @@ -18,6 +18,6 @@ specfile.srpm_id = srpm.id specfile.branch_id = branch.id specfile.spec = spec - specfile.save + specfile.save! end end
Raise exception of Specfile record can't be saved
diff --git a/app/models/spitcast.rb b/app/models/spitcast.rb index abc1234..def5678 100644 --- a/app/models/spitcast.rb +++ b/app/models/spitcast.rb @@ -10,6 +10,7 @@ def parse_response(spot, request, responses) responses.each do |response| + next unless response.gmt record = unscoped.where(spot: spot, timestamp: Time.zone.parse(response.gmt) + Time.zone.utc_offset).first_or_initialize record.api_request = request record.height = response.size_ft
Fix for Spitcast forecast data with no timestamp
diff --git a/lib/pry-remote-auto.rb b/lib/pry-remote-auto.rb index abc1234..def5678 100644 --- a/lib/pry-remote-auto.rb +++ b/lib/pry-remote-auto.rb @@ -26,6 +26,7 @@ sleep 1 system 'osascript', '-e', 'tell application "Terminal" to do script "' + cmd + '"' + system 'osascript', '-e', 'tell application "Terminal" to activate' end remote_pry_without_auto_launch(*args) end
Bring Terminal window to foreground
diff --git a/lib/queue_publisher.rb b/lib/queue_publisher.rb index abc1234..def5678 100644 --- a/lib/queue_publisher.rb +++ b/lib/queue_publisher.rb @@ -7,6 +7,9 @@ end attr_reader :exchange, :channel + + class PublishFailedError < StandardError + end def send_message(item) return if @noop @@ -20,7 +23,7 @@ success = channel.wait_for_confirms if !success Airbrake.notify_or_ignore( - Exception.new("Publishing message failed"), + PublishFailedError.new("Publishing message failed"), parameters: { routing_key: routing_key, message_body: hash, @@ -35,6 +38,8 @@ connection = Bunny.new(@options) connection.start @channel = connection.create_channel + + # Enable publisher confirms, so we get acks back after publishes. channel.confirm_select # passive parameter ensures we don't create the exchange.
Use a custom exception for publish failure This should make it easier to filter in errbit, and be a bit cleaner.
diff --git a/lib/rivendell/tools.rb b/lib/rivendell/tools.rb index abc1234..def5678 100644 --- a/lib/rivendell/tools.rb +++ b/lib/rivendell/tools.rb @@ -26,8 +26,10 @@ end def self.script(opts, global_opts) + require 'logger' + logger = Logger.new($stdout) arguments = opts[:arguments] - eval File.read(opts[:script]) + eval File.read(opts[:script]), nil, opts[:script], 0 end end
Add a logger for script
diff --git a/lib/sagepayadminapi.rb b/lib/sagepayadminapi.rb index abc1234..def5678 100644 --- a/lib/sagepayadminapi.rb +++ b/lib/sagepayadminapi.rb @@ -1,5 +1,3 @@-require_relative "./sagepayadminapi/version" - class SagePayAdminAPI VERSION = '0.0.2'
Remove require version from class file.
diff --git a/spec/unit/resource/cron_access_spec.rb b/spec/unit/resource/cron_access_spec.rb index abc1234..def5678 100644 --- a/spec/unit/resource/cron_access_spec.rb +++ b/spec/unit/resource/cron_access_spec.rb @@ -21,7 +21,7 @@ let(:resource) { Chef::Resource::CronAccess.new("bob") } it "has a default action of [:deny]" do - expect(resource.action).to eql([:deny]) + expect(resource.action).to eql([:allow]) end it "accepts create or delete for action" do
Fix the default action in the cron_access spec Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/views/users/show.html.erb_spec.rb b/spec/views/users/show.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/users/show.html.erb_spec.rb +++ b/spec/views/users/show.html.erb_spec.rb @@ -1,5 +1,10 @@ require 'spec_helper' describe "users/show.html.erb" do - pending "add some examples to (or delete) #{__FILE__}" + it 'should have a username' do + user = stub_model(User, :username => 'berg_katze') + assign(:user, user) + render template: 'users/show' + rendered.should have_text("berg_katze's profile") + end end
Test for username in view spec
diff --git a/lib/starscope/datum.rb b/lib/starscope/datum.rb index abc1234..def5678 100644 --- a/lib/starscope/datum.rb +++ b/lib/starscope/datum.rb @@ -15,10 +15,8 @@ fqn[0...-1].reverse.each do |test| if test.to_sym == @scope[i] score += 5 - elsif Regexp.new(test).match(@scope[i]) - score += 3 elsif Regexp.new(test, Regexp::IGNORECASE).match(@scope[i]) - score += 1 + score += 2 end i -= 1 end
Simplify match scoring a bit
diff --git a/lib/tasks/crawler.rake b/lib/tasks/crawler.rake index abc1234..def5678 100644 --- a/lib/tasks/crawler.rake +++ b/lib/tasks/crawler.rake @@ -1,7 +1,6 @@ namespace :crawler do - desc 'Spider the site route pages' - task :routes => :environment do + def connect_to_site require 'net/http' require 'uri' include ActionController::UrlWriter @@ -10,20 +9,51 @@ puts "HOST: #{url.host}" puts "PORT: #{url.port}" Net::HTTP.start(url.host, url.port) do |http| + yield http + end + end + + def make_request(http, path) + puts path + req = Net::HTTP::Get.new(path) + if MySociety::Config.get('APP_STATUS', 'live') == 'closed_beta' + beta_username = MySociety::Config.get('BETA_USERNAME', 'username') + unless ENV['PASSWORD'] + usage_message "usage: This task requires PASSWORD=[beta testing password]" + end + beta_password = ENV['PASSWORD'] + req.basic_auth beta_username, beta_password + end + response = http.request(req) + puts response.code + end + + desc 'Spider the site route pages' + task :routes => :environment do + connect_to_site do |http| Route.find_each(:include => 'region') do |route| path = route_path(route.region, route) - puts path - req = Net::HTTP::Get.new(path) - if MySociety::Config.get('APP_STATUS', 'live') == 'closed_beta' - beta_username = MySociety::Config.get('BETA_USERNAME', 'username') - unless ENV['PASSWORD'] - usage_message "usage: This task requires PASSWORD=[beta testing password]" - end - beta_password = ENV['PASSWORD'] - req.basic_auth beta_username, beta_password - end - response = http.request(req) - puts response.code + make_request(http, path) + end + end + end + + desc 'Spider the site stop pages' + task :stops => :environment do + connect_to_site do |http| + Stop.find_each(:include => 'locality') do |stop| + path = stop_path(stop.locality, stop) + make_request(http, path) + end + end + end + + desc 'Spider the site stop area pages' + task :stop_areas => :environment do + connect_to_site do |http| + StopArea.find_each(:include => 'locality') do |stop_area| + path = stop_area_path(stop_area.locality, stop_area) + make_request(http, path) end end end
Add stop and stop area crawling
diff --git a/lib/tasks/demoviz.rake b/lib/tasks/demoviz.rake index abc1234..def5678 100644 --- a/lib/tasks/demoviz.rake +++ b/lib/tasks/demoviz.rake @@ -0,0 +1,15 @@+namespace :demoviz do + desc "Clear stale demo visualizations" + task clear: :environment do + Visualization.where("updated_at < ?", 6.hours.ago).destroy_all(author: demo_user) + end + + desc "Remove all demo visualizations" + task purge: :environment do + Visualization.destroy_all(author: demo_user) + end +end + +def demo_user + User.find_by(name: 'demo') +end
Add rake tasks to cleanup demo visualizations
diff --git a/lib/tasks/spec_db.rake b/lib/tasks/spec_db.rake index abc1234..def5678 100644 --- a/lib/tasks/spec_db.rake +++ b/lib/tasks/spec_db.rake @@ -7,11 +7,7 @@ failed = false databases.each do |database| - failed = true unless test_against database - end - - if failed - fail "## Error: At least one of the specs above failed" + test_against database end end @@ -33,13 +29,13 @@ cp sample, custom - result = nil + succeeded = nil begin Rails.root.chdir do puts puts "## Database: #{kind}" - result = system "bundle --quiet && rake db:create:all db:migrate db:test:prepare spec" + succeeded = system "bundle --quiet && rake db:create:all db:migrate db:test:prepare spec" end ensure rm custom @@ -49,7 +45,9 @@ end end - return result + unless succeeded + raise "Tests failed against database '#{kind}'" + end end end end
Rework `rake db:spec` to fail immediately on errors.
diff --git a/test/mem_model/test_rooted_base.rb b/test/mem_model/test_rooted_base.rb index abc1234..def5678 100644 --- a/test/mem_model/test_rooted_base.rb +++ b/test/mem_model/test_rooted_base.rb @@ -18,10 +18,22 @@ refute Account.exists? 314159 end - def test_exists - refute Account.exists? @account.id - @account.save - assert Account.exists? @account.id + if MemModel.maglev? + + def test_maglev_exists + assert_raises TransactionError, 'The test Account class is transient' do + @account.save + end + end + + else + + def test_mri_exists + refute Account.exists? @account.id + @account.save + assert Account.exists? @account.id + end + end def test_root_container
Add separate Maglev and MRI RootedBase test for now
diff --git a/lib/tictactoe_board.rb b/lib/tictactoe_board.rb index abc1234..def5678 100644 --- a/lib/tictactoe_board.rb +++ b/lib/tictactoe_board.rb @@ -2,22 +2,22 @@ class TictactoeBoard - attr_accessor :board, :turn + attr_accessor :board_arr, :turn attr_reader :valid_slots - def initialize (board = Array.new(9, " "), turn = "X") - @board = board + def initialize (board_arr = Array.new(9, " "), turn = "X") + @board_arr = board_arr @turn = turn end def move(input) - played_move = TictactoeBoard.new(@board.dup, whose_turn("O", "X")) - played_move.board[input.to_i] = turn + played_move = TictactoeBoard.new(@board_arr.dup, whose_turn("O", "X")) + played_move.board_arr[input.to_i] = turn played_move end def valid_slots - @board.each_with_index.map{|symbol, index| index if symbol==" "}.reject{|slots| slots == nil } + @board_arr.each_with_index.map{|symbol, index| index if symbol==" "}.reject{|slots| slots == nil } end def whose_turn(x, o)
Change variable name to board_arr
diff --git a/irc_tools.gemspec b/irc_tools.gemspec index abc1234..def5678 100644 --- a/irc_tools.gemspec +++ b/irc_tools.gemspec @@ -10,7 +10,7 @@ spec.email = ["markglenfletcher@googlemail.com"] spec.summary = %q{TODO} spec.description = %q{TODO} - spec.homepage = "TODO" + spec.homepage = "https://github.com/markglenfletcher/irc_tools" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add github repo url to gemspec
diff --git a/veritas-arango-adapter.gemspec b/veritas-arango-adapter.gemspec index abc1234..def5678 100644 --- a/veritas-arango-adapter.gemspec +++ b/veritas-arango-adapter.gemspec @@ -14,6 +14,7 @@ s.require_paths = %w(lib) s.extra_rdoc_files = %w(README.md) + s.add_dependency('aql', '~> 0.0.1') s.add_dependency('backports', '~> 2.7.0') s.add_dependency('adamantium', '~> 0.0.5') s.add_dependency('equalizer', '~> 0.0.3')
Add aql ~> 0.0.1 dependency
diff --git a/test/features/deals/search_deals_test.rb b/test/features/deals/search_deals_test.rb index abc1234..def5678 100644 --- a/test/features/deals/search_deals_test.rb +++ b/test/features/deals/search_deals_test.rb @@ -8,4 +8,11 @@ page.text.must_include "Widgets" page.text.wont_include "Seahawks Suite for Panthers Game" end + + scenario "only returns published and non-private results" do + visit root_path + fill_in "search", with: "Seahawks" + click_on "Search" + page.text.wont_include "Seahawks" + end end
Test to check if only published and public search results are returned.
diff --git a/lib/active_admin/seo/view_helpers.rb b/lib/active_admin/seo/view_helpers.rb index abc1234..def5678 100644 --- a/lib/active_admin/seo/view_helpers.rb +++ b/lib/active_admin/seo/view_helpers.rb @@ -12,13 +12,13 @@ title = seo_metas.map(&:title).find(&:present?) buffer << content_tag(:title, title) if title - %w(description keywords og_title og_type og_url og_description og_site_name).each do |field| + %w(description keywords og_title og_type og_url og_description og_site_name og_image).each do |field| value = seo_metas.map(&field.to_sym).find(&:present?) - buffer << seo_meta_tag(field, value) if value - end - %w(og_image).each do |field| - value = seo_metas.map(&field.to_sym).find(&:present?) - buffer << seo_meta_tag(field, value.url) if value + if value && value.respond_to?(:url) + buffer << seo_meta_tag(field, value.url) + elsif value + buffer << seo_meta_tag(field, value) + end end buffer.html_safe end
Allow static url for og:image
diff --git a/lib/activerecord/humanized_errors.rb b/lib/activerecord/humanized_errors.rb index abc1234..def5678 100644 --- a/lib/activerecord/humanized_errors.rb +++ b/lib/activerecord/humanized_errors.rb @@ -2,8 +2,7 @@ module HumanizedErrors def humanized_errors - errors.clear - send :run_validations! + valid? errors.full_messages.join ', ' end end
Use `valid?` to trigger validations. Instead of juggling with ActiveRecord internals, use the `valid?` method totrigger validation callbacks, making errors be available when using humanized_errors method.
diff --git a/lib/bayvid_hasselhoff/puts_slowly.rb b/lib/bayvid_hasselhoff/puts_slowly.rb index abc1234..def5678 100644 --- a/lib/bayvid_hasselhoff/puts_slowly.rb +++ b/lib/bayvid_hasselhoff/puts_slowly.rb @@ -0,0 +1,20 @@+module BayvidHasselhoff + class PutsSlowly + attr_reader :strang + + def initialize(strang) + @strang = strang + end + + def run(speed = 5.0) + thr = Thread.new do + @strang.length.times do |i| + print "\r#{@strang[0..i]}" + sleep(rand / speed) + STDOUT.flush + end + end + thr.run + end + end +end
Add a PutsSlowly class to, you know, puts slowly.
diff --git a/lib/chargify/booking_value_report.rb b/lib/chargify/booking_value_report.rb index abc1234..def5678 100644 --- a/lib/chargify/booking_value_report.rb +++ b/lib/chargify/booking_value_report.rb @@ -18,15 +18,15 @@ table << headers @products.values.each do |product| - table << Row.new(@transactions, product).row + ProductRow.new(@transactions, product).rows.each do |row| + table << row + end end table end - # When we add a breakdown of each product this could - # be renamed to RowGroup or similar? - class Row + class ProductRow attr_reader :transactions, :product def initialize(transactions, product) @@ -60,6 +60,12 @@ 0.2 * net end + def rows + [ + row + ] + end + def row [ product.handle,
Rename because more rows are coming
diff --git a/runner/daily_runner.rb b/runner/daily_runner.rb index abc1234..def5678 100644 --- a/runner/daily_runner.rb +++ b/runner/daily_runner.rb @@ -12,6 +12,7 @@ stats.connect Pod.where(:deleted => false).each do |pod| + puts "Grabbing stats for: #{pod.name}" data = stats.stat_for_pod pod.id, pod.name stats.update_pod pod.id,data end
Make sure it echos something out, heroku cancels a task after an hour if it's not outputted anything
diff --git a/integration-tests/spec/runtime_injection_spec.rb b/integration-tests/spec/runtime_injection_spec.rb index abc1234..def5678 100644 --- a/integration-tests/spec/runtime_injection_spec.rb +++ b/integration-tests/spec/runtime_injection_spec.rb @@ -17,9 +17,15 @@ require 'torquebox-core' - it "should work" do - TorqueBox.fetch( 'service:SimpleService' ).should_not be_nil - TorqueBox.fetch( '/queue/container_queue' ).should_not be_nil + it 'should work for valid injections' do + TorqueBox.fetch('service:SimpleService').should_not be_nil + TorqueBox.fetch('/queue/container_queue').should_not be_nil + end + + it 'should raise InjectionError for invalid injection' do + lambda { + TorqueBox.fetch('something_not_valid') + }.should raise_error(TorqueBox::InjectionError) end end
Add integration test to ensure InjectionError is raised for invalid injections
diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb index abc1234..def5678 100644 --- a/app/helpers/sites_helper.rb +++ b/app/helpers/sites_helper.rb @@ -10,14 +10,12 @@ puts sites if sites.count > 100 #all is well sites.each do |site| - if Site.find_by_site_url(site["site_url"]) == nil - s=Site.new - s.site_url = site["site_url"] - s.site_domain = URI.parse(s.site_url).host - s.site_logo = site["favicon_url"].gsub(/http:/, "") - s.site_name = site["name"] - s.save! - end + s = Site.find_or_create_by(:site_url => site["site_url"]) + s.site_url = site["site_url"] + s.site_domain = URI.parse(s.site_url).host + s.site_logo = site["favicon_url"].gsub(/http:/, "") + s.site_name = site["name"] + s.save! end end end
Update sites from sites helper instead of trying to create new ones
diff --git a/lib/versionator/detector/owncloud.rb b/lib/versionator/detector/owncloud.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/owncloud.rb +++ b/lib/versionator/detector/owncloud.rb @@ -6,7 +6,7 @@ set :app_name, "ownCloud" set :project_url, "http://owncloud.org/" - set :detect_dirs, %w{3rdparty apps config core data lib settings} + set :detect_dirs, %w{3rdparty apps core lib settings} set :detect_files, %w{db_structure.xml index.php lib/util.php README} set :installed_version_file, "lib/util.php"
Fix ownCloud detector to also detect the development version
diff --git a/api/lib/spree/api/controller_setup.rb b/api/lib/spree/api/controller_setup.rb index abc1234..def5678 100644 --- a/api/lib/spree/api/controller_setup.rb +++ b/api/lib/spree/api/controller_setup.rb @@ -17,6 +17,7 @@ include CanCan::ControllerAdditions append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__)) + append_view_path Rails.root + "app/views" respond_to :json end
Append application view paths to possible view path locations
diff --git a/merb_datamapper/lib/merb_datamapper/merbtasks.rb b/merb_datamapper/lib/merb_datamapper/merbtasks.rb index abc1234..def5678 100644 --- a/merb_datamapper/lib/merb_datamapper/merbtasks.rb +++ b/merb_datamapper/lib/merb_datamapper/merbtasks.rb @@ -3,34 +3,27 @@ namespace :dm do task :merb_start do - Merb.start :adapter => 'runner', - :environment => ENV['MERB_ENV'] || 'development' + Merb.start_environment :adapter => 'runner', + :environment => ENV['MERB_ENV'] || 'development' end namespace :db do desc "Perform automigration" task :automigrate do - puts '='*70 - puts "Sorry, Auto Migrations are not yet supported in DataMapper 0.9" - puts '-'*70 - puts "They should be ready in the very near future," - puts "in the meantime you'll need to create your tables by hand." - puts '='*70 + ::DataMapper.repository.auto_migrate! end end namespace :sessions do - desc "Creates session migration" + desc "Perform automigration for sessions" task :create => :merb_start do - dest = File.join(Merb.root, "schema", "migrations","001_add_sessions_table.rb") - source = File.join(File.dirname(__FILE__), "merb", "session","001_add_sessions_table.rb") - #FileUtils.cp source, dest unless File.exists?(dest) + Merb::DataMapperSession.auto_migrate! end - + desc "Clears sessions" task :clear => :merb_start do table_name = ((Merb::Plugins.config[:datamapper] || {})[:session_table_name] || "sessions") - #Merb::Orms::DataMapper.connect.execute("DELETE FROM #{table_name}") + ::DataMapper.repository.adapter.execute("DELETE FROM #{table_name}") end end end
Return automigration stuff to merb_datamapper rake tasks
diff --git a/app/controllers/doctors_controller.rb b/app/controllers/doctors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/doctors_controller.rb +++ b/app/controllers/doctors_controller.rb @@ -2,7 +2,7 @@ include Pageable def index - @doctors = Doctor.page(@page).per(@per_page) + @doctors = Doctor.order(:last_name).page(@page).per(@per_page) end def new
Order doctors by last name