diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/vendor/plugins/themes/rails/init.rb b/vendor/plugins/themes/rails/init.rb
index abc1234..def5678 100644
--- a/vendor/plugins/themes/rails/init.rb
+++ b/vendor/plugins/themes/rails/init.rb
@@ -1,29 +1,32 @@-# Set up middleware to serve theme files
-config.middleware.use "ThemeServer"
+# Before the application gets setup this will fail badly if there's no database.
+if RefinerySetting.table_exists?
+ # Set up middleware to serve theme files
+ config.middleware.use "ThemeServer"
-# Add or remove theme paths to/from Refinery application
-::Refinery::ApplicationController.module_eval do
- before_filter do |controller|
- controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} }
- if (theme = RefinerySetting[:theme]).present?
- # Set up view path again for the current theme.
- controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s
+ # Add or remove theme paths to/from Refinery application
+ ::Refinery::ApplicationController.module_eval do
+ before_filter do |controller|
+ controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} }
+ if (theme = RefinerySetting[:theme]).present?
+ # Set up view path again for the current theme.
+ controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s
- RefinerySetting[:refinery_menu_cache_action_suffix] = "#{theme}_site_menu"
- else
- # Set the cache key for the site menu (thus expiring the fragment cache if theme changes).
- RefinerySetting[:refinery_menu_cache_action_suffix] = "site_menu"
+ RefinerySetting[:refinery_menu_cache_action_suffix] = "#{theme}_site_menu"
+ else
+ # Set the cache key for the site menu (thus expiring the fragment cache if theme changes).
+ RefinerySetting[:refinery_menu_cache_action_suffix] = "site_menu"
+ end
end
end
+
+ if (theme = RefinerySetting[:theme]).present?
+ # Set up controller paths, which can only be brought in with a server restart, sorry. (But for good reason)
+ controller_path = Rails.root.join("themes", theme, "controllers").to_s
+
+ ::ActiveSupport::Dependencies.load_paths.unshift controller_path
+ config.controller_paths.unshift controller_path
+ end
+
+ # Include theme functions into application helper.
+ Refinery::ApplicationHelper.send :include, ThemesHelper
end
-
-if (theme = RefinerySetting[:theme]).present?
- # Set up controller paths, which can only be brought in with a server restart, sorry. (But for good reason)
- controller_path = Rails.root.join("themes", theme, "controllers").to_s
-
- ::ActiveSupport::Dependencies.load_paths.unshift controller_path
- config.controller_paths.unshift controller_path
-end
-
-# Include theme functions into application helper.
-Refinery::ApplicationHelper.send :include, ThemesHelper
| Fix themes breaking rake db:setup because RefinerySetting.table_exists? is false.
|
diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/albums_controller.rb
+++ b/app/controllers/albums_controller.rb
@@ -1,9 +1,18 @@ class AlbumsController < ApplicationController
expose(:albums) { Album.active }
- expose(:album) { Album.find_by_slug!(params[:id]) }
+ expose(:album) { Album.find_by_slug!(slug) }
+ expose(:redirect) { Redirect.find_by_from(slug) }
expose(:images) { album.photos.to_a }
def index; end
- def show; end
+ def show
+ redirect_to redirect.to if redirect
+ end
+
+ private
+
+ def slug
+ params[:id]
+ end
end
| Handle redirects in albums controller
|
diff --git a/app/controllers/status_controller.rb b/app/controllers/status_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/status_controller.rb
+++ b/app/controllers/status_controller.rb
@@ -11,15 +11,19 @@ @smoke_detector.location = params[:location]
@smoke_detector.is_standby = params[:standby] || false
+ # If an instance is manually switched to standby, we
+ # don't want it to immediately kick back
+ new_standby_switch = @smoke_detector.is_standby_changed? and @smoke_detector.is_standby
+
@smoke_detector.save!
respond_to do |format|
format.json do
- if @smoke_detector.should_failover
+ if @smoke_detector.should_failover and not new_standby_switch
@smoke_detector.update(:is_standby => false, :force_failover => false)
render :status => 200, :json => { 'failover': true }
else
- render :status => 200, :json => { 'failover': false }
+ head 200, content_type: "text/html"
end
end
end
| Revert "Revert "Save a few bytes on every ping""
This reverts commit 5ef95920039bb38ae7a6bcb1bf228955ba898085.
|
diff --git a/app/importers/attendance_importer.rb b/app/importers/attendance_importer.rb
index abc1234..def5678 100644
--- a/app/importers/attendance_importer.rb
+++ b/app/importers/attendance_importer.rb
@@ -6,8 +6,8 @@ end
def parse_row(row)
- student_state_id = row[1]
- attendance_info = row[3..5]
+ student_state_id = row[0]
+ attendance_info = row[1..3]
student = Student.where(state_id: student_state_id).first_or_create!
attendance_attributes = Hash[attendance_headers.zip(attendance_info)]
@@ -18,4 +18,4 @@ tardy: attendance_attributes['tardy'],
).first_or_create!
end
-end+end
| Update AttendanceImporter for new input data format (we should really get headers in here...)
|
diff --git a/app/models/ability.rb b/app/models/ability.rb
index abc1234..def5678 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -7,8 +7,10 @@ can :manage, :all
elsif user.has_role? :user
can :read, Site, id: Site.with_role(:user, user).pluck(:id)
- can [:read, :update, :assign, :all, :create, :export, :destroy], Device, site_id: Site.with_role(:user, user).pluck(:id)
- can [:read, :update, :assign, :history, :all, :create, :export, :destroy], Supply, site_id: Site.with_role(:user, user).pluck(:id)
+ can [:read, :update, :assign, :all, :export, :destroy], Device, site_id: Site.with_role(:user, user).pluck(:id)
+ can :create, Device
+ can [:read, :update, :assign, :history, :all, :export, :destroy], Supply, site_id: Site.with_role(:user, user).pluck(:id)
+ can :create, Supply
can :manage, :static_page
else
can [:home, :about], :static_page
| Fix for devices and supplies creation not authorized by users
|
diff --git a/app/models/ability.rb b/app/models/ability.rb
index abc1234..def5678 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -2,10 +2,28 @@ include CanCan::Ability
def initialize(user)
- user ||= User.new # guest user (not logged in)
+ user ||= User.new
+
if user.has_role? :admin
can :manage, :all
+ elsif user.has_role? :user
+ can :read, :all
+ can :manage, Farm
+ else # guest user
+ can :read, Farm
end
+
+
+
+ # guest user (not logged in)
+ # if user.has_role? :admin
+ # can :manage, :all
+ # end
+ # if user.has_role? :user
+ # can :manage, Farm
+ # else
+ # can :read, Farm
+ # end
# Define abilities for the passed in user here. For example:
#
# user ||= User.new # guest user (not logged in)
| Define some initial abilities: Users can read everything and manage farms, Admins can manage everything. Anonymous users can only read farms.
|
diff --git a/app/models/journal.rb b/app/models/journal.rb
index abc1234..def5678 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -1,16 +1,13 @@ class Journal < ActiveRecord::Base
VALID_TASK_TYPES = ["ReviewerReportTask",
"PaperAdminTask",
- "MessageTask",
+ "UploadManuscriptTask",
+ "PaperEditorTask",
+ "DeclarationTask",
+ "PaperReviewerTask",
+ "RegisterDecisionTask",
"StandardTasks::TechCheckTask",
"StandardTasks::FigureTask",
- "UploadManuscriptTask",
- "PaperEditorTask",
- "FigureTask",
- "DeclarationTask",
- "Task",
- "PaperReviewerTask",
- "RegisterDecisionTask",
"StandardTasks::AuthorsTask"]
has_many :papers, inverse_of: :journal
| Remove tasks which require attributes when initialized
|
diff --git a/spec/classes/openldap_client_spec.rb b/spec/classes/openldap_client_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/openldap_client_spec.rb
+++ b/spec/classes/openldap_client_spec.rb
@@ -0,0 +1,23 @@+require 'spec_helper'
+
+describe 'openldap::client' do
+
+ let(:facts) {{
+ :osfamily => 'Debian',
+ }}
+
+ context 'with no parameters' do
+ it { should compile.with_all_deps }
+ it { should contain_class('openldap::client').with({
+ :package => 'libldap-2.4-2',
+ :file => '/etc/ldap/ldap.conf',
+ :base => nil,
+ :uri => nil,
+ :tls_cacert => nil,
+ })}
+ it { should contain_class('openldap::client::install') }
+ it { should contain_class('openldap::client::config') }
+ end
+
+end
+
| Add unit tests for openldap::client
|
diff --git a/spec/redshift_extractor/drop_spec.rb b/spec/redshift_extractor/drop_spec.rb
index abc1234..def5678 100644
--- a/spec/redshift_extractor/drop_spec.rb
+++ b/spec/redshift_extractor/drop_spec.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+module RedshiftExtractor; describe Drop do
+
+ context "#drop_sql" do
+ it "returns the SQL to drop a table" do
+ dropper = Drop.new(table_name: "table_name")
+ expect(dropper.drop_sql).to eq "drop table if exists table_name;"
+ end
+ end
+
+end; end
+
+
| Add specs for the Drop class
|
diff --git a/spec/routing/friends_routing_spec.rb b/spec/routing/friends_routing_spec.rb
index abc1234..def5678 100644
--- a/spec/routing/friends_routing_spec.rb
+++ b/spec/routing/friends_routing_spec.rb
@@ -6,28 +6,8 @@ expect(get: "/friends").to route_to("friends#index")
end
- it "routes to #new" do
- expect(get: "/friends/new").to route_to("friends#new")
- end
-
it "routes to #show" do
expect(get: "/friends/1").to route_to("friends#show", id: "1")
end
-
- it "routes to #edit" do
- expect(get: "/friends/1/edit").to route_to("friends#edit", id: "1")
- end
-
- it "routes to #create" do
- expect(post: "/friends").to route_to("friends#create")
- end
-
- it "routes to #update" do
- expect(put: "/friends/1").to route_to("friends#update", id: "1")
- end
-
- it "routes to #destroy" do
- expect(delete: "/friends/1").to route_to("friends#destroy", id: "1")
- end
end
end
| Fix routing spec for friends
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -2,7 +2,5 @@ $api_key = "12312312312312312312312312312312"
AfterConfiguration do |_config|
- MazeRunner.config.receive_no_requests_wait = 15
- # TODO: Remove once the Bugsnag-Integrity header has been implemented
- MazeRunner.config.enforce_bugsnag_integrity = false
+ MazeRunner.config.receive_no_requests_wait = 15 if MazeRunner.config.respond_to? :receive_no_requests_wait=
end
| Handle config not being present before MR 3.6.0 |
diff --git a/unchanged_validator.gemspec b/unchanged_validator.gemspec
index abc1234..def5678 100644
--- a/unchanged_validator.gemspec
+++ b/unchanged_validator.gemspec
@@ -20,6 +20,7 @@
spec.add_runtime_dependency "activemodel", ">= 3.1"
+ spec.add_development_dependency "activesupport", ">= 3.1"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake", "~> 10.0"
end
| Add development dependency on activesupport (>= 3.1)
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -12,6 +12,7 @@ end
def create_file path, content
+ FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') do |f|
f.write(content)
end
| Make missing directories automatically to test
|
diff --git a/lib/gollum/auth/user.rb b/lib/gollum/auth/user.rb
index abc1234..def5678 100644
--- a/lib/gollum/auth/user.rb
+++ b/lib/gollum/auth/user.rb
@@ -40,7 +40,7 @@ end
def valid_password?(password)
- password_digest == build_digest(password)
+ Rack::Utils.secure_compare(password_digest, build_digest(password))
end
def password=(password)
| Use Rack::Utils.secure_compare to verify password.
|
diff --git a/lib/is_it_up/railtie.rb b/lib/is_it_up/railtie.rb
index abc1234..def5678 100644
--- a/lib/is_it_up/railtie.rb
+++ b/lib/is_it_up/railtie.rb
@@ -1,7 +1,7 @@ module IsItUp
class Railtie < Rails::Railtie
- initializer "is_it_up.configure_rails_initialization" do
- Rails.application.middleware.use IsItUp::Middleware
+ initializer "is_it_up.configure_rails_initialization" do |app|
+ app.middleware.use IsItUp::Middleware
end
end
end
| Use the application object to access the middleware property
|
diff --git a/test/unit/line_test.rb b/test/unit/line_test.rb
index abc1234..def5678 100644
--- a/test/unit/line_test.rb
+++ b/test/unit/line_test.rb
@@ -26,4 +26,10 @@ assert_equal false, line.action?
assert_equal '<foo> bar', line.raw_line
end
+
+ test "trigger parser exception" do
+ assert_raise Exception do
+ Line.new(raw_line: '')
+ end
+ end
end
| Add parser exception test to LineTest
|
diff --git a/spec/name_checker/net_checker_spec.rb b/spec/name_checker/net_checker_spec.rb
index abc1234..def5678 100644
--- a/spec/name_checker/net_checker_spec.rb
+++ b/spec/name_checker/net_checker_spec.rb
@@ -7,9 +7,9 @@ let(:host_name) { "apple" }
let(:tld) { ".com" }
- # NOTE: This test assumes there is a ROBO_WHOIS_API_KEY
- # set in spec/shec_helper.rb
it "should hit the RoboWhoisChecker if there is an api key" do
+ NameChecker.configuration.stub(:robo_whois_api_key) { "123" }
+
NameChecker::RoboWhoisChecker.should_receive(:check)
.with(host_name + tld)
subject.check(host_name, tld)
| Fix broken net checker spec
|
diff --git a/refinerycms-retailers.gemspec b/refinerycms-retailers.gemspec
index abc1234..def5678 100644
--- a/refinerycms-retailers.gemspec
+++ b/refinerycms-retailers.gemspec
@@ -15,12 +15,9 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["readme.md"]
# Runtime dependencies
- s.add_dependency 'refinerycms-core', '~> 3.0.0'
+ s.add_dependency 'refinerycms-core', ['~> 3.0', '>= 3.0.0']
s.add_dependency 'globalize', ['>= 4.0.0', '< 5.2']
s.add_dependency 'acts_as_indexed', '~> 0.8.0'
s.add_dependency 'carmen-rails', '~> 1.0.1'
s.add_dependency 'actionview-encoded_mail_to', '~> 1.0.5'
-
- # Development dependencies (usually used for testing)
- s.add_development_dependency 'refinerycms-testing', '~> 3.0.0'
end
| Allow ['~> 3.0', '>= 3.0.0'] for refinerycms-core
|
diff --git a/test/unit/handshake_request_packet_test.rb b/test/unit/handshake_request_packet_test.rb
index abc1234..def5678 100644
--- a/test/unit/handshake_request_packet_test.rb
+++ b/test/unit/handshake_request_packet_test.rb
@@ -2,10 +2,16 @@
module Digger
class HandshakeRequestPacketTest < TestCase
- test 'generating a handshake request with the default session ID' do
+ test 'generating a handshake request without a session ID' do
expected = "\xFE\xFD\x09\x00\x00\x00\x00".force_encoding('ASCII-8BIT')
packet = HandshakeRequestPacket.new
assert_equal expected, packet.to_binary_s
end
+
+ test 'generating a handshake request with a session ID' do
+ expected = "\xFE\xFD\x09\x00\x00\x00\x01".force_encoding('ASCII-8BIT')
+ packet = HandshakeRequestPacket.new(session_id: 1)
+ assert_equal expected, packet.to_binary_s
+ end
end
end
| Add test coverage for generating a handshake request with a session ID
|
diff --git a/lib/twitter_listener.rb b/lib/twitter_listener.rb
index abc1234..def5678 100644
--- a/lib/twitter_listener.rb
+++ b/lib/twitter_listener.rb
@@ -6,6 +6,7 @@ @client = Twitter::Client.new(credentials)
@query = query
@queue = queue
+ async.start_listening
end
def start_listening
| Make the twitter listener start itself on initialize
|
diff --git a/publify_core/app/controllers/content_controller.rb b/publify_core/app/controllers/content_controller.rb
index abc1234..def5678 100644
--- a/publify_core/app/controllers/content_controller.rb
+++ b/publify_core/app/controllers/content_controller.rb
@@ -1,21 +1,5 @@ class ContentController < BaseController
- class ExpiryFilter
- def before(_controller)
- @request_time = Time.now
- end
-
- def after(controller)
- future_article =
- this_blog.articles.where('published = ? AND published_at > ?', true, @request_time).
- order('published_at ASC').first
- if future_article
- delta = future_article.published_at - Time.now
- controller.response.lifetime = delta <= 0 ? 0 : delta
- end
- end
- end
-
- protected
+ private
# TODO: Make this work for all content.
def auto_discovery_feed(options = {})
| Remove unused expiry filter class
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -18,8 +18,8 @@ #
default['nodejs']['install_method'] = 'source'
-default['nodejs']['version'] = '0.8.16'
-default['nodejs']['checksum'] = '2cd09d4227c787d6886be45dc54dad5aed779d7bd4b1e15ba930101d9d1ed2a4'
+default['nodejs']['version'] = '0.8.18'
+default['nodejs']['checksum'] = '1d63dd42f9bd22f087585ddf80a881c6acbe1664891b1dda3b71306fe9ae00f9'
default['nodejs']['dir'] = '/usr/local'
default['nodejs']['npm'] = '1.2.0'
default['nodejs']['src_url'] = "http://nodejs.org/dist"
| Update to latest stable release
|
diff --git a/attributes/default.rb b/attributes/default.rb
index abc1234..def5678 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -6,6 +6,7 @@
domain_prefix = ''
domain_prefix = "#{node.chef_environment}-" if node.chef_environment != 'prod'
+domain_prefix = 'stage-' if node.chef_environment == 'stage-newvpc'
set['et_accounts_app']['server_name'] = "#{domain_prefix}accounts.evertrue.com"
| Fix subdomain for stage w/ stage-newvpc
|
diff --git a/spec/acceptance/wanikani_user_spec.rb b/spec/acceptance/wanikani_user_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/wanikani_user_spec.rb
+++ b/spec/acceptance/wanikani_user_spec.rb
@@ -3,7 +3,7 @@ describe 'WaniKani User' do
let(:valid_api_key) { 'fe1d61e66c3a8421db3b8fdbff4fa522' } # koichi's API key, as given in the WaniKani forums.
- describe 'Logging in' do
+ xdescribe 'Logging in' do
before(:each) do
visit '/'
end
@@ -21,7 +21,7 @@ end
end
- describe 'Logging out' do
+ xdescribe 'Logging out' do
it "should log out successfully when clicking on the 'Not <username>?' page" do
visit '/'
fill_in 'wanikani_api_key', with: valid_api_key
| Mark acceptance tests as pending since site is under maintainence
|
diff --git a/spec/features/client_features_spec.rb b/spec/features/client_features_spec.rb
index abc1234..def5678 100644
--- a/spec/features/client_features_spec.rb
+++ b/spec/features/client_features_spec.rb
@@ -0,0 +1,35 @@+require 'spec_helper'
+
+describe "Clients" do
+ before :all do
+ load "#{Rails.root}/db/seeds.rb"
+ end
+
+ before :each do
+ user = FactoryGirl.create(:user)
+ user.add_role :admin
+ sign_in_user(user)
+ visit '/clients'
+ end
+
+ it "should show the clients page" do
+ page.should have_content "Clients"
+ end
+
+ it "should a client name" do
+ page.should have_content "i-424242"
+ end
+
+ it "should show a client address" do
+ page.should have_content "127.0.0.1"
+ end
+
+ it "should show subscriptions" do
+ page.should have_content "test"
+ end
+
+ it "should show a client time" do
+ page.should have_content time_ago_in_words(Time.at(1377890282))
+ end
+
+end
| Update client feature specs to run agains sensu api v0.10.2
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,9 +1,9 @@ # Be sure to restart your server when you modify this file.
options = if Rails.env.production?
- {domain: ['.glowfic.com', '.glowfic-staging.herokuapp.com'], tld_length: 2}
+ { domain: ['.glowfic.com', '.glowfic-staging.herokuapp.com'], tld_length: 2 }
elsif Rails.env.development?
- {domain: ['web', 'localhost', '127.0.0.1'], tld_length: 2}
+ { domain: ['web', 'localhost', '127.0.0.1'], tld_length: 2 }
else
{}
end
| Add spaces to session store initializer
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,6 +1,4 @@-options = { :key => '_alive_session' }
-
# options = { :key => '_alive_{{username}}_session' }
# options[:domain] = '{{username}}.com' if Rails.env.production?
-Rails.application.config.session_store :cookie_store, options
+# Rails.application.config.session_store :cookie_store, options
| Remove the (unneded) session store.
|
diff --git a/config/initializers/verify_config.rb b/config/initializers/verify_config.rb
index abc1234..def5678 100644
--- a/config/initializers/verify_config.rb
+++ b/config/initializers/verify_config.rb
@@ -0,0 +1,15 @@+# Check that the app is configured correctly. Raise some helpful errors if something is wrong.
+
+if Rails.env.production? and ['localhost', 'production.localhost'].include?(Discourse.current_hostname)
+ puts <<END
+
+ Discourse.current_hostname = '#{Discourse.current_hostname}'
+
+ Please update the host_names property in config/database.yml
+ so that it uses the hostname of your site. Otherwise you will
+ experience problems, like links in emails using #{Discourse.current_hostname}.
+
+END
+
+ raise "Invalid host_names in database.yml"
+end | Raise an error in production env if host_names is using production.localhost
|
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/chef/attributes/default.rb
+++ b/cookbooks/chef/attributes/default.rb
@@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.17.33"
# Set the default client version
-default[:chef][:client][:version] = "16.3.45"
+default[:chef][:client][:version] = "16.4.38"
| Update chef client to 16.4.38
|
diff --git a/lib/gems/pending/lib/tasks/azure.rake b/lib/gems/pending/lib/tasks/azure.rake
index abc1234..def5678 100644
--- a/lib/gems/pending/lib/tasks/azure.rake
+++ b/lib/gems/pending/lib/tasks/azure.rake
@@ -0,0 +1,52 @@+require 'rake'
+
+# Tasks for regenerating cassettes and running tests for the Azure
+# solid state stuff. You should run these while in the gems/pending
+# subdirectory.
+#
+# The tasks that regenerate cassettes assume that you have cloned the
+# gems-pending-config project to your $HOME/Dev directory.
+
+namespace 'azure' do
+ namespace 'record' do
+ env_dir = File.join(Dir.home, 'Dev', 'gems-pending-config')
+
+ desc 'Recreate the Azure blob disk cassettes'
+ task :disk do
+ yaml_dir = File.join(Rake.original_dir, 'spec/recordings/disk/modules/azure_blob_disk_spec')
+ Dir["#{yaml_dir}/*.yml"].each { |f| FileUtils.rm_rf(f) }
+ sh "TEST_ENV_DIR=#{env_dir} bundle exec rspec spec/disk/modules/azure_blob_disk_spec.rb"
+ end
+
+ desc 'Recreate the Azure VM image cassettes'
+ task :vm_image do
+ yaml_dir = File.join(Rake.original_dir, 'spec/recordings/miq_vm/miq_azure_vm_image_spec')
+ Dir["#{yaml_dir}/*.yml"].each { |f| FileUtils.rm_rf(f) }
+ sh "TEST_ENV_DIR=#{env_dir} bundle exec rspec spec/miq_vm/miq_azure_vm_image_spec.rb"
+ end
+
+ desc 'Recreate the Azure VM instance cassettes'
+ task :vm_instance do
+ yaml_dir = File.join(Rake.original_dir, 'spec/recordings/miq_vm/miq_azure_vm_instance_spec')
+ Dir["#{yaml_dir}/*.yml"].each { |f| FileUtils.rm_rf(f) }
+ sh "TEST_ENV_DIR=#{env_dir} bundle exec rspec spec/miq_vm/miq_azure_vm_instance_spec.rb"
+ end
+ end
+
+ namespace 'spec' do
+ desc 'Run blob disk specs without regenerating cassettes'
+ task 'disk' do
+ sh "bundle exec rspec spec/disk/modules/azure_blob_disk_spec.rb"
+ end
+
+ desc 'Run VM image specs without regenerating cassettes'
+ task 'vm_image' do
+ sh "bundle exec rspec spec/miq_vm/miq_azure_vm_image_spec.rb"
+ end
+
+ desc 'Run VM instance specs without regenerating cassettes'
+ task 'vm_instance' do
+ sh "bundle exec rspec spec/miq_vm/miq_azure_vm_instance_spec.rb"
+ end
+ end
+end
| Add tasks for Azure SSA specs.
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -22,6 +22,7 @@ config.to_prepare do
Devise::SessionsController.layout "login"
Devise::PasswordsController.layout "login"
+ Devise::RegistrationsController.layout "application"
end
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
| Make the devise invitable views look normal.
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -32,7 +32,7 @@ end
config.action_mailer.default_url_options = { host: ENV["SMTP_DOMAIN"] }
- config.session_expiration = 15.minutes
+ config.session_expiration = 30.minutes
config.i18n.available_locales = %w(en de fr)
end
| Increase session expiration time to 30 minutes.
|
diff --git a/lib/puppet/parser/functions/type3x.rb b/lib/puppet/parser/functions/type3x.rb
index abc1234..def5678 100644
--- a/lib/puppet/parser/functions/type3x.rb
+++ b/lib/puppet/parser/functions/type3x.rb
@@ -21,7 +21,7 @@
klass = value.class
- unless %w[TrueClass FalseClass Array Bignum Fixnum Float Hash String].include?(klass.to_s)
+ unless [TrueClass, FalseClass, Array, Bignum, Fixnum, Float, Hash, String].include?(klass) # rubocop:disable Lint/UnifiedInteger
raise(Puppet::ParseError, 'type3x(): Unknown type')
end
| Revert "get rid of fixnum|bignum deprecation warning"
|
diff --git a/lib/stronglyboards/view_controller.rb b/lib/stronglyboards/view_controller.rb
index abc1234..def5678 100644
--- a/lib/stronglyboards/view_controller.rb
+++ b/lib/stronglyboards/view_controller.rb
@@ -7,6 +7,10 @@ UIVIEWCONTROLLER = 'UIViewController'
UITABLEVIEWCONTROLLER = 'UITableViewController'
UINAVIGATIONCONTROLLER = 'UINavigationController'
+ UITABBARCONTROLLER = 'UITabBarController'
+ UICOLLECTIONVIEWCONTROLLER = 'UICollectionViewController'
+ UISPLITVIEWCONTROLLER = 'UISplitViewController'
+ UIPAGEVIEWCONTROLLER = 'UIPageViewController'
def initialize(xml, is_initial_view_controller = false)
@class_name = xml.attr('customClass') || class_name_from_type(xml)
@@ -28,7 +32,14 @@ UITABLEVIEWCONTROLLER
when 'navigationController'
UINAVIGATIONCONTROLLER
- # TODO: Add more built-in classes
+ when 'tabBarController'
+ UITABBARCONTROLLER
+ when 'collectionViewController'
+ UICOLLECTIONVIEWCONTROLLER
+ when 'splitViewController'
+ UISPLITVIEWCONTROLLER
+ when 'pageViewController'
+ UIPAGEVIEWCONTROLLER
end
end
| Add more built-in view controller classes
|
diff --git a/spec/lib/core/repositories/categories/fake_spec.rb b/spec/lib/core/repositories/categories/fake_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/core/repositories/categories/fake_spec.rb
+++ b/spec/lib/core/repositories/categories/fake_spec.rb
@@ -2,23 +2,24 @@ require 'core/repositories/categories/fake'
describe Core::Repositories::Categories::Fake do
- let(:valid_id) { 'category-1' }
- let(:valid_subcategory_id) { 'subcategory-1' }
+ let(:subcategory) { build :category_hash }
+ let(:category) { build :category_hash, contents: [subcategory] }
let(:invalid_id) { 'fake' }
+ let(:repository) { described_class.new(category) }
describe '#all' do
- subject { described_class.new.all }
+ subject { repository.all }
it { should be_a(Array) }
- specify { expect(subject.first['id']).to eq(valid_id) }
+ specify { expect(subject.first['id']).to eq(category['id']) }
end
describe '#find' do
context 'when the category exists' do
- subject { described_class.new.find(valid_id) }
+ subject { repository.find(category['id']) }
it { should be_a(Hash) }
- specify { expect(subject['id']).to eq(valid_id) }
+ specify { expect(subject['id']).to eq(category['id']) }
it 'instantiates a valid Category' do
expect(Core::Category.new(subject['id'], subject)).to be_valid
@@ -30,10 +31,10 @@ end
context 'when retrieving a subcategory' do
- subject { described_class.new.find(valid_subcategory_id) }
+ subject { repository.find(subcategory['id']) }
it { should be_a(Hash) }
- specify { expect(subject['id']).to eq(valid_subcategory_id) }
+ specify { expect(subject['id']).to eq(subcategory['id']) }
end
end
| Define the contents of the repository within the tests
|
diff --git a/lib/firebolt/railtie.rb b/lib/firebolt/railtie.rb
index abc1234..def5678 100644
--- a/lib/firebolt/railtie.rb
+++ b/lib/firebolt/railtie.rb
@@ -5,14 +5,14 @@ initializer "firebolt.rails.configuration" do |app|
# Configure Firebolt
::Firebolt.configure do |config|
+ # Set defaults based on Rails
+ config.cache = ::Rails.cache
+ config.cache_file_path = ::File.join(::Rails.root, 'tmp')
+
app.config.firebolt.each do |config_key, config_value|
config_setter = "#{config_key}="
config.__send__(config_setter, config_value) if config.respond_to?(config_setter)
end
-
- # Set defaults based on Rails
- config.cache ||= ::Rails.cache
- config.cache_file_path ||= ::File.join(::Rails.root, 'tmp')
end
end
| Set the defaults before grabbing the user config.
|
diff --git a/lib/frakup/backupset.rb b/lib/frakup/backupset.rb
index abc1234..def5678 100644
--- a/lib/frakup/backupset.rb
+++ b/lib/frakup/backupset.rb
@@ -36,7 +36,7 @@ backupset.save
$log.info " Backup finished"
- $log.info " - duration: #{Time.at(backupset.finished_at - backupset.started_at).gmtime.strftime('%R:%S')}"
+ $log.info " - duration: #{Time.at(backupset.finished_at.to_time - backupset.started_at.to_time).gmtime.strftime('%R:%S')}"
$log.info " - backupelements: #{backupset.backupelements.count}"
$log.info " - fileobjects: #{backupset.fileobjects.count}"
$log.info " - size: #{Frakup::Helper.human_size(backupset.fileobjects.sum(:size))}"
| Fix broken duration for backup log message.
|
diff --git a/lib/rml/element_args.rb b/lib/rml/element_args.rb
index abc1234..def5678 100644
--- a/lib/rml/element_args.rb
+++ b/lib/rml/element_args.rb
@@ -1,14 +1,28 @@ module RML
class ElementArgs
- attr_reader :attributes, :text
+ def initialize(*args)
+ @args = args
+ end
+
+ def attributes
+ @attributes ||= find_attributes
+ end
- def initialize(*args)
- @attributes = args.find { |a| a.is_a? Hash } || {}
- @text = args.find { |a| a.is_a? String }
+ def text
+ @text ||= find_text
end
def has_text?
- !@text.nil?
+ !text.nil?
end
+
+ private
+ def find_attributes
+ @args.find { |a| a.is_a? Hash } || {}
+ end
+
+ def find_text
+ @args.find { |a| a.is_a? String }
+ end
end
end
| Refactor ElementArgs class
Preserves the original arguments
|
diff --git a/lib/scrivener_errors.rb b/lib/scrivener_errors.rb
index abc1234..def5678 100644
--- a/lib/scrivener_errors.rb
+++ b/lib/scrivener_errors.rb
@@ -22,10 +22,10 @@ end
end
- def to_s
+ def message
messages.join(', ').capitalize
end
- alias :message :to_s
+ alias :to_s :message
def messages
scrivener.errors.inject([]) do |memo, error|
| Swap the message and to_s methods
I think it's more obvious this way.
|
diff --git a/lib/sequel_cascading.rb b/lib/sequel_cascading.rb
index abc1234..def5678 100644
--- a/lib/sequel_cascading.rb
+++ b/lib/sequel_cascading.rb
@@ -3,13 +3,13 @@ module Cascading
def self.apply(model, options = {})
Array(options[:destroy]).each do |assoc|
- model.instance_eval "before_destroy { #{assoc}_dataset.destroy }"
+ model.instance_eval "def before_destroy; super; #{assoc}_dataset.destroy; end"
end
Array(options[:nullify]).each do |assoc|
- model.instance_eval "before_destroy { remove_all_#{assoc} }"
+ model.instance_eval "def before_destroy; super; remove_all_#{assoc}; end"
end
Array(options[:restrict]).each do |assoc|
- model.instance_eval "before_destroy { raise Error::InvalidOperation, 'Delete would orphan associated #{assoc}' unless #{assoc}_dataset.empty? }"
+ model.instance_eval "def before_destroy; super; raise Error::InvalidOperation, 'Delete would orphan associated #{assoc}' unless #{assoc}_dataset.empty?; end"
end
end
end
| Use a before_destroy method instead of the old hook system to avoid deprecation warnings
Signed-off-by: S. Brent Faulkner <fe025f82eb26909ef35ab792eedfa01fd68bfb52@gto.net> |
diff --git a/lib/stations/gtvoice.rb b/lib/stations/gtvoice.rb
index abc1234..def5678 100644
--- a/lib/stations/gtvoice.rb
+++ b/lib/stations/gtvoice.rb
@@ -8,8 +8,7 @@ def process
track = data.at_css("marquee")
artist, song = (track and split(track.text))
- { :song => (song), :artist => (artist) }
-
+ { song: song, artist: artist }
end
end
end
| Move to new Ruby syntax
|
diff --git a/lib/svgeez/optimizer.rb b/lib/svgeez/optimizer.rb
index abc1234..def5678 100644
--- a/lib/svgeez/optimizer.rb
+++ b/lib/svgeez/optimizer.rb
@@ -8,7 +8,7 @@ raise SVGO_NOT_INSTALLED unless installed?
raise SVGO_MINIMUM_VERSION_MESSAGE unless supported?
- `cat <<EOF | svgo --disable={cleanupIDs,removeHiddenElems,removeViewBox} -i - -o -\n#{file_contents}\nEOF`
+ `cat <<EOF | svgo --disable=cleanupIDs --disable=removeHiddenElems --disable=removeViewBox -i - -o -\n#{file_contents}\nEOF`
rescue RuntimeError => exception
logger.warn exception.message
end
| Use individual --disable args to svgo
|
diff --git a/lib/tasks/knapsack.rake b/lib/tasks/knapsack.rake
index abc1234..def5678 100644
--- a/lib/tasks/knapsack.rake
+++ b/lib/tasks/knapsack.rake
@@ -4,13 +4,13 @@ task :rspec do
allocator = Knapsack::Allocator.new
- Knapsack.logger.info
- Knapsack.logger.info 'Report specs:'
- Knapsack.logger.info allocator.report_node_specs
- Knapsack.logger.info
- Knapsack.logger.info 'Leftover specs:'
- Knapsack.logger.info allocator.leftover_node_specs
- Knapsack.logger.info
+ puts
+ puts 'Report specs:'
+ puts allocator.report_node_specs
+ puts
+ puts 'Leftover specs:'
+ puts allocator.leftover_node_specs
+ puts
cmd = %Q[bundle exec rspec --default-path #{allocator.spec_dir} -- #{allocator.stringify_node_specs}]
| Use puts in rake task
|
diff --git a/lib/tasks/settings.rake b/lib/tasks/settings.rake
index abc1234..def5678 100644
--- a/lib/tasks/settings.rake
+++ b/lib/tasks/settings.rake
@@ -0,0 +1,11 @@+namespace :settings do
+
+ desc "Changes Setting key per_page_code for per_page_code_head"
+ task per_page_code_migration: :environment do
+ per_page_code_setting = Setting.where(key: 'per_page_code').first
+
+ Setting['per_page_code_head'] = per_page_code_setting&.value.to_s if Setting.where(key: 'per_page_code_head').first.blank?
+ per_page_code_setting.destroy if per_page_code_setting.present?
+ end
+
+end
| Create rake task to migrate Setting key from per_page_code to per_page_code_head
|
diff --git a/lib/barebones/builders/app_builder.rb b/lib/barebones/builders/app_builder.rb
index abc1234..def5678 100644
--- a/lib/barebones/builders/app_builder.rb
+++ b/lib/barebones/builders/app_builder.rb
@@ -16,6 +16,9 @@
def app
super
+ keep_file "app/services"
+ keep_file "app/decorators"
+ keep_file "app/workers"
end
def config
| Add app directories for services, decorators, and workers
|
diff --git a/lib/builderator/util/aws_exception.rb b/lib/builderator/util/aws_exception.rb
index abc1234..def5678 100644
--- a/lib/builderator/util/aws_exception.rb
+++ b/lib/builderator/util/aws_exception.rb
@@ -23,7 +23,7 @@ end
def message
- "An error occured executing performing task #{ task }. #{ operation }"\
+ "An error occured performing task #{ task }. #{ operation }"\
"(#{ JSON.generate(parameters) }): #{ exception.message }"
end
end
| Fix grammar in exception message
|
diff --git a/lib/generators/hook/hook_generator.rb b/lib/generators/hook/hook_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/hook/hook_generator.rb
+++ b/lib/generators/hook/hook_generator.rb
@@ -7,7 +7,7 @@ source_root File.expand_path("../templates", __FILE__)
def create_hook_file
- template "hook.rb", "#{Pokey.hook_dir}/#{file_path.tr('/', '_')}.rb"
+ template "hook.rb", "#{Pokey.hook_dir}/#{file_path.tr('/', '_')}_hook.rb"
end
end
end
| Add _hook suffix to generated hooks...
|
diff --git a/lib/git_evolution/report_presenter.rb b/lib/git_evolution/report_presenter.rb
index abc1234..def5678 100644
--- a/lib/git_evolution/report_presenter.rb
+++ b/lib/git_evolution/report_presenter.rb
@@ -2,31 +2,48 @@ class ReportPresenter
def initialize(commits)
@commits = commits
- @ownership = Hash.new(0)
+ @ownership = { commits: Hash.new(0), changes: Hash.new(0) }
end
def print
print_commits
+ puts
puts '-' * 80
puts
- print_ownership
+ print_commit_ownership
+ puts
+ print_changes_ownership
+ puts
end
def print_commits
puts 'Commits:'
@commits.each do |commit|
- puts "#{commit.author} (#{Time.at(commit.date.to_i)}) - #{commit.sha}"
- puts "#{commit.title}"
+ puts "#{commit.author} (#{commit.date}) - #{commit.sha}"
+ puts "#{commit.subject}"
puts
- @ownership[commit.author] = @ownership[commit.author] + 1
+ @ownership[:commits][commit.author] = @ownership[:commits][commit.author] + 1
+ @ownership[:changes][commit.author] = @ownership[:changes][commit.author] + commit.additions + commit.deletions
end
end
- def print_ownership
- puts 'Ownership:'
- @ownership.each do |author, count|
+ def print_commit_ownership
+ puts 'Ownership (Commits):'
+ @ownership[:commits].each do |author, count|
puts "#{author} - #{count}/#{@commits.size} (#{(count.to_f / @commits.size * 100).round(2)}%)"
+ end
+ end
+
+ def print_changes_ownership
+ puts 'Ownership (Changes):'
+
+ total_additions = @commits.inject(0) { |sum, commit| sum + commit.additions }
+ total_deletions = @commits.inject(0) { |sum, commit| sum + commit.deletions }
+ total_changes = total_additions + total_deletions
+
+ @ownership[:changes].each do |author, count|
+ puts "#{author} - #{count}/#{total_changes} (#{(count.to_f / total_changes * 100).round(2)}%)"
end
end
end
| Allow the ReportPresenter to print the ownership based on changes
The commit additions/deletions are tallied up as 'changes', and reported
in the output.
|
diff --git a/lib/proxy_rb/drivers/webkit_driver.rb b/lib/proxy_rb/drivers/webkit_driver.rb
index abc1234..def5678 100644
--- a/lib/proxy_rb/drivers/webkit_driver.rb
+++ b/lib/proxy_rb/drivers/webkit_driver.rb
@@ -8,23 +8,18 @@ exit 1
end
+# rubocop:disable Style/SymbolProc
+::Capybara::Webkit.configure do |config|
+ config.allow_unknown_urls
+end
+# rubocop:enable Style/SymbolProc
+
# ProxyRb
module ProxyRb
# Drivers
module Drivers
# Driver for Capybara-Webkit
class WebkitDriver < BasicDriver
- # Configure driver
- def configure_driver
- # rubocop:disable Style/SymbolProc
- ::Capybara::Webkit.configure do |config|
- config.allow_unknown_urls
- end
- # rubocop:enable Style/SymbolProc
-
- super
- end
-
# Register proxy
#
# @param [HttpProxy] proxy
| Configure webkit only a single time
|
diff --git a/app/overrides/promotions/manage_codes.rb b/app/overrides/promotions/manage_codes.rb
index abc1234..def5678 100644
--- a/app/overrides/promotions/manage_codes.rb
+++ b/app/overrides/promotions/manage_codes.rb
@@ -4,7 +4,7 @@ :name => 'hide_code_in_form',
:replace => 'erb[loud]:contains("f.field_container :code")',
:closing_selector => 'erb[silent]:contains("end")',
- :text => "<%= button_link_to(Spree.t('actions.manage_codes'), admin_promotion_promotion_codes_path(@promotion), { class: 'btn-success' }) %>")
+ :text => "<%= button_link_to(Spree.t('actions.manage_codes'), admin_promotion_promotion_codes_path(@promotion), { class: 'btn-success' }) if @promotion.id %>")
| Fix code input in new promotion code
|
diff --git a/foodspot_friend_sele.rb b/foodspot_friend_sele.rb
index abc1234..def5678 100644
--- a/foodspot_friend_sele.rb
+++ b/foodspot_friend_sele.rb
@@ -0,0 +1,84 @@+#!/usr/bin/env ruby
+
+# This script uses Selenium WebDriver and Safari to scrape the friends and
+# followers lists of the currently logged-in Foodspotting user.
+# Then it groups the contacts into 3 sets: mutual friends, only followers, and
+# only following.
+
+require 'selenium-webdriver'
+require 'set'
+
+# Get the user name.
+def get_user_name web
+ puts 'Getting user name...'
+ url = 'http://foodspotting.com/me'
+ web.get url
+ m = web.current_url.match(%r{foodspotting\.com/([^/]+)$})
+ fail 'Unable to retrieve user name. Please log in to Foodspotting before running this script.' unless m
+ m[1]
+end
+
+# Find the highest-numbered page by parsing the pages links.
+def get_last_page web
+ web.find_elements(:css, 'div.pagination a[href*="?page="]').map { |elem|
+ elem.attribute('href').match(/\?page=(\d+)/)[1].to_i
+ }.max
+end
+
+# Parse user IDs and names from the contact list.
+def get_names web
+ web.find_elements(:css, 'div.title a').map { |elem|
+ id = elem.attribute('href').sub(%r{^/}, '')
+ name = elem.text.strip
+ { id: id, name: name }
+ }
+end
+
+# Process the contact list, returning a list of users from all the pages in
+# the list.
+def process_list what, username, web
+ puts "Fetching #{what} page 1..."
+
+ url = "http://www.foodspotting.com/#{username}/#{what}"
+ web.get url
+
+ last_page = get_last_page web
+ names = get_names web
+
+ (2..last_page).each { |page|
+ puts "Fetching #{what} page #{page}..."
+ web.get "#{url}?page=#{page}"
+
+ names += get_names web
+ }
+
+ names
+end
+
+def show_list flist
+ flist.each_with_index { |name, i|
+ puts "#{i + 1}: #{name[:id]} - #{name[:name]}"
+ }
+end
+
+web = nil
+begin
+ web = Selenium::WebDriver.for :safari
+ username = get_user_name web
+
+ followers = Set.new(process_list(:followers, username, web))
+ following = Set.new(process_list(:following, username, web))
+
+ puts 'Mutual followers:'
+ show_list(following & followers)
+
+ puts 'Only followers:'
+ show_list(followers - following)
+
+ puts 'Only following:'
+ show_list(following - followers)
+ensure
+ web.close if web
+end
+
+__END__
| Add a version of foodspot_friend that uses only Selenium to parse the web page.
|
diff --git a/rails_launcher.gemspec b/rails_launcher.gemspec
index abc1234..def5678 100644
--- a/rails_launcher.gemspec
+++ b/rails_launcher.gemspec
@@ -15,6 +15,6 @@ gem.require_paths = ["lib"]
gem.version = RailsLauncher::VERSION
- gem.add_dependency 'active_support'
+ gem.add_dependency 'activesupport'
gem.add_development_dependency 'rspec', '~> 2.11.0'
end
| Fix gem name for activesupport
active_support loads an old version, which does not have `pluralize` in Inflector
|
diff --git a/recipes/install_kvm.rb b/recipes/install_kvm.rb
index abc1234..def5678 100644
--- a/recipes/install_kvm.rb
+++ b/recipes/install_kvm.rb
@@ -34,7 +34,7 @@ action :permissive
end
-include_recipe "iptables::disabled"
+include_recipe "iptables"
service "rpcbind" do
action [:enable, :start]
| Use a permissive iptables configuration
|
diff --git a/coderwall_api.gemspec b/coderwall_api.gemspec
index abc1234..def5678 100644
--- a/coderwall_api.gemspec
+++ b/coderwall_api.gemspec
@@ -10,7 +10,7 @@ gem.email = ['kachick1+ruby@gmail.com']
gem.summary = 'An API wrapper for the coderwall.com'
gem.description = gem.summary.dup
- gem.homepage = 'http://github.com/kachick/coderwall_api'
+ gem.homepage = 'http://kachick.github.com/coderwall_api'
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Replace URI of PJ-homepage in gemspec
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,7 +1,20 @@ require 'csv'
-csv_text = File.read('./events/2014.csv')
-csv = CSV.parse(csv_text, :headers => true)
-csv.each do |row|
- Event.create!(row.to_hash)
+files = Dir.glob('./events/*.csv')
+
+files.each do |csv_file|
+ csv_text = File.read(csv_file)
+ csv = CSV.parse(csv_text, :headers => true)
+ csv.each do |row|
+ Event.create!(row.to_hash)
+ end
+ p "*" * 50
+ p "Finished #{csv_file}"
+ p "*" * 50
end
+#
+# csv_text = File.read('./events/2014.csv')
+# csv = CSV.parse(csv_text, :headers => true)
+# csv.each do |row|
+# Event.create!(row.to_hash)
+# end
| Adjust seed file to injest multiple files
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -5,3 +5,13 @@ #
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
+
+# Jobs
+Job.delete_all
+
+Job.create!(
+ company: "Acme Software Inc.",
+ title: "Ruby Cutter",
+ start_date: DateTime.strptime("2014-06-21", "%Y-%m-%d"),
+ end_date: DateTime.strptime("2014-07-26", "%Y-%m-%d")
+)
| Add seed data to Job table
|
diff --git a/lib/fog/google/examples/eric-fail.rb b/lib/fog/google/examples/eric-fail.rb
index abc1234..def5678 100644
--- a/lib/fog/google/examples/eric-fail.rb
+++ b/lib/fog/google/examples/eric-fail.rb
@@ -12,7 +12,7 @@
disk.wait_for { disk.ready? }
- server = connection.servers.create(defaults = {
+ server = connection.servers.create({
:name => name,
:disks => [disk],
:machine_type => "n1-standard-1",
@@ -26,5 +26,5 @@
raise "Could not reload created server." unless server.reload
raise "Could not create sshable server." unless server.ssh("whoami")
- raise "Cloud note delete server." unless server.destroy
+ raise "Could not delete server." unless server.destroy
end
| [google|compute] Fix spelling errors in example
|
diff --git a/library/socket/udpsocket/new_spec.rb b/library/socket/udpsocket/new_spec.rb
index abc1234..def5678 100644
--- a/library/socket/udpsocket/new_spec.rb
+++ b/library/socket/udpsocket/new_spec.rb
@@ -26,17 +26,7 @@ @socket.should be_an_instance_of(UDPSocket)
end
- platform_is_not :solaris do
- it 'raises Errno::EAFNOSUPPORT if unsupported family passed' do
- lambda { UDPSocket.new(-1) }.should raise_error(Errno::EAFNOSUPPORT)
- end
- end
-
- platform_is :solaris do
- # Solaris throws error EPROTONOSUPPORT if the protocol family is not recognized.
- # https://docs.oracle.com/cd/E19253-01/816-5170/socket-3socket/index.html
- it 'raises Errno::EPROTONOSUPPORT if unsupported family passed' do
- lambda { UDPSocket.new(-1) }.should raise_error(Errno::EPROTONOSUPPORT)
- end
+ it 'raises Errno::EAFNOSUPPORT if unsupported family passed' do
+ lambda { UDPSocket.new(-1) }.should raise_error(Errno::EAFNOSUPPORT)
end
end
| Revert "Fix UDPSocket.new spec, Solaris reports a different error on unknown protocol family."
This reverts commit 30ae2c38169fd3e317f5336ed9a4a586d36ea448.
UDPSocket.new's argument is address family; if it receive wrong
argument, it raises EAFNOSUPPORT like other platforms.
http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20161127T132503Z.fail.html.gz
> The specified address family is not supported by the protocol family.
Errno::EPROTONOSUPPORT is for a protocol type like below:
> % ruby -rsocket -e'Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM, -1)'
> -e:1:in `initialize': Protocol not supported - socket(2) (Errno::EPROTONOSUPPORT)
> from -e:1:in `new'
> from -e:1:in `<main>'
|
diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
index abc1234..def5678 100644
--- a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb
@@ -6,12 +6,12 @@ fixtures :developers
def setup
- @default_prepared_statements = Developer.connection_config[:prepared_statements]
- Developer.connection_config[:prepared_statements] = false
+ @default_prepared_statements = ActiveRecord::Base.connection.instance_variable_get("@prepared_statements")
+ ActiveRecord::Base.connection.instance_variable_set("@prepared_statements", false)
end
def teardown
- Developer.connection_config[:prepared_statements] = @default_prepared_statements
+ ActiveRecord::Base.connection.instance_variable_set("@prepared_statements", @default_prepared_statements)
end
def test_nothing_raised_with_falsy_prepared_statements
| Fix mucking of connection_config leading to issues in prepared_statements
|
diff --git a/hephaestus/lib/resque/task_finder.rb b/hephaestus/lib/resque/task_finder.rb
index abc1234..def5678 100644
--- a/hephaestus/lib/resque/task_finder.rb
+++ b/hephaestus/lib/resque/task_finder.rb
@@ -2,8 +2,7 @@ attr_reader :document
DEFAULT_TASKS = %w(
- normalization_task
- layout_analysis_task
+ text_extraction_task
extraction_task
coreference_resolution_task
)
| [hephaestus] Add new tools to queue
|
diff --git a/app/inputs/array_input.rb b/app/inputs/array_input.rb
index abc1234..def5678 100644
--- a/app/inputs/array_input.rb
+++ b/app/inputs/array_input.rb
@@ -4,7 +4,7 @@
TEXT_FIELD_CLASSES = "text optional array-element"
- def input
+ def input(_wrapper_options)
input_html_options[:type] ||= input_type
content_tag(:div, class: "array-input") do
| Fix deprecation warning when defining custom input
Since https://github.com/plataformatec/simple_form/pull/997,
custom input adapters must accept a hash of wrapper options
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -18,8 +18,8 @@
config.active_record.observers = :world_record_observer
- # Use dalli(memcache) as default cache store.
- config.cache_store = :dalli_store, {
+ # Use memcache as default cache store.
+ config.cache_store = :mem_cache_store, {
namespace: 'qlrace',
expires_in: 1.hour
}
| Use :mem_cache_store instead of :dalli_store
|
diff --git a/nikeplus_client.gemspec b/nikeplus_client.gemspec
index abc1234..def5678 100644
--- a/nikeplus_client.gemspec
+++ b/nikeplus_client.gemspec
@@ -8,8 +8,8 @@ spec.version = NikeplusClient::VERSION
spec.authors = ["julien michot"]
spec.email = ["ju.michot@gmail.com"]
- spec.summary = %q{TODO: Write a short summary. Required.}
- spec.description = %q{TODO: Write a longer description. Optional.}
+ spec.summary = %q{nike+ client to retrieve activities}
+ spec.description = %q{nike+ client to retrieve activities}
spec.homepage = ""
spec.license = "MIT"
| Update gemspec to remove warnings
|
diff --git a/lib/daimon_skycrawlers/consumer/url.rb b/lib/daimon_skycrawlers/consumer/url.rb
index abc1234..def5678 100644
--- a/lib/daimon_skycrawlers/consumer/url.rb
+++ b/lib/daimon_skycrawlers/consumer/url.rb
@@ -48,7 +48,7 @@
# XXX When several crawlers are registered, how should they behave?
self.class.crawlers.each do |crawler|
- crawler.process(message)
+ crawler.process(message.dup)
if crawler.skipped?
sleep(crawler_interval) if crawler.n_processed_urls % 50 == 0
else
| Copy message argument to be used by all crawlers
|
diff --git a/lib/database_bank/database_exchange.rb b/lib/database_bank/database_exchange.rb
index abc1234..def5678 100644
--- a/lib/database_bank/database_exchange.rb
+++ b/lib/database_bank/database_exchange.rb
@@ -4,8 +4,14 @@ module DatabaseBank
class DatabaseExchange < Money::Bank::VariableExchange
- def get_rate(from, to)
- rate = DatabaseBank.exchange_rate_model.where(from_currency: from).where(to_currency: to).order(:sourced_at).last
+
+ # Retrieve the rate for the given currencies
+ #
+ # from_currency - a Currency object representing the currency being converted from
+ # to_iso_code - the ISO code of the currency to convert to
+ #
+ def get_rate(from_currency, to_iso_code)
+ rate = DatabaseBank.exchange_rate_model.where(from_currency: from_currency.iso_code).where(to_currency: to_iso_code).order(:sourced_at).last
raise UnknownRate unless rate
rate.rate
end
| Deal with proper currency object types for get_rate
|
diff --git a/nothing_magical.gemspec b/nothing_magical.gemspec
index abc1234..def5678 100644
--- a/nothing_magical.gemspec
+++ b/nothing_magical.gemspec
@@ -16,6 +16,9 @@ spec.files = `git ls-files`.split($/)
spec.executables =["nothing_magical"]
spec.require_paths = ["lib"]
+ spec.has_rdoc = false
spec.default_executable = %q{nothing_magical}
+
+ spec.add_development_dependency 'rake'
end
| Add rake as dev dependency and disable rdoc.
|
diff --git a/lib/fake_elasticache/options/docker.rb b/lib/fake_elasticache/options/docker.rb
index abc1234..def5678 100644
--- a/lib/fake_elasticache/options/docker.rb
+++ b/lib/fake_elasticache/options/docker.rb
@@ -10,7 +10,7 @@ :version => ENV.fetch('MEMCACHED_VERSION', '2.4.14')
}
- ENV.keys.select { |key| key.to_s.match(/^MEMCACHED[0-9]*_PORT/) }.each do |linked_container|
+ ENV.keys.select { |key| key.to_s.match(/^MEMCACHED[0-9]*_PORT$/) }.each do |linked_container|
id = linked_container[/\d+/,0]
memcached_server = ENV[linked_container].nil? ? ['127.0.0.1', '11211'] : ENV[linked_container].sub("tcp://", "").split(':')
options[:servers] << "#{ENV.fetch("DNS#{id}_NAME", 'localhost')}|#{memcached_server[0]}|#{memcached_server[1]}"
| Stop matching all keys that contain MEMCACHE{NUMBER}_PORT
|
diff --git a/lib/cryptoexchange/exchanges/vinex/services/market.rb b/lib/cryptoexchange/exchanges/vinex/services/market.rb
index abc1234..def5678 100644
--- a/lib/cryptoexchange/exchanges/vinex/services/market.rb
+++ b/lib/cryptoexchange/exchanges/vinex/services/market.rb
@@ -38,7 +38,7 @@ ticker.last = NumericHelper.to_d(output['lastPrice'])
ticker.high = NumericHelper.to_d(output['high24h'])
ticker.low = NumericHelper.to_d(output['low24h'])
- ticker.volume = NumericHelper.to_d(output['volume'])
+ ticker.volume = NumericHelper.divide(NumericHelper.to_d(output['volume']), ticker.last)
ticker.change = NumericHelper.to_d(output['change24h'])
ticker.timestamp = nil
| Fix Vinex volume by divide
|
diff --git a/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb b/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb
index abc1234..def5678 100644
--- a/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb
+++ b/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb
@@ -10,15 +10,18 @@ _, st = run_kubectl("get", type, @name)
@found = st.success?
@status = true
+
+
+
log_status
end
def deploy_succeeded?
- exists?
+ cloudsql_proxy_deployment_exists? && mysql_service_exists?
end
def deploy_failed?
- false
+ !cloudsql_proxy_deployment_exists? || !mysql_service_exists?
end
def tpr?
@@ -28,5 +31,36 @@ def exists?
@found
end
+
+ private
+ def cloudsql_proxy_deployment_exists?
+ deployments, st = run_kubectl("get", "deployments", "--selector", "name=cloudsql-proxy", "--namespace=#{@namespace}", "-o=json")
+ if st.success?
+ deployment_list = JSON.parse(deployments)
+ cloudsql_proxy = deployment_list["items"].first
+
+ if cloudsql_proxy.fetch("status", {}).fetch("availableReplicas", -1) == cloudsql_proxy["replicas"]
+ # all cloudsql-proxy pods are running
+ return true
+ end
+ end
+
+ false
+ end
+
+ def mysql_service_exists?
+ services, st = run_kubectl("get", "services", "--selector", "name=mysql", "--namespace=#{@namespace}", "-o=json")
+ if st.success?
+ services_list = JSON.parse(services)
+
+ if .any? { |s| s.fetch("spec", {}).fetch("clusterIP", "") != "" }
+ # the service has an assigned cluster IP and is therefore functioning
+ return true
+ end
+ end
+
+ false
+ end
+
end
end
| Add some deploy_succeeded? logic to Cloudsql
|
diff --git a/lib/capistrano/tasks/capistrano-resque-pool.rake b/lib/capistrano/tasks/capistrano-resque-pool.rake
index abc1234..def5678 100644
--- a/lib/capistrano/tasks/capistrano-resque-pool.rake
+++ b/lib/capistrano/tasks/capistrano-resque-pool.rake
@@ -4,7 +4,7 @@ task :start do
on roles(workers) do
within app_path do
- execute :bundle, :exec, 'resque-pool', '--daemon --environment production'
+ execute :bundle, :exec, 'resque-pool', "--daemon --environment #{fetch(:rails_env)}"
end
end
end
@@ -42,4 +42,4 @@ fetch(:resque_server_roles) || :app
end
end
-end+end
| Use the current environment when lauching the pool manager
|
diff --git a/app/models/euclidean_distance.rb b/app/models/euclidean_distance.rb
index abc1234..def5678 100644
--- a/app/models/euclidean_distance.rb
+++ b/app/models/euclidean_distance.rb
@@ -17,12 +17,13 @@ # Add up the squares of all the differences
squares = []
prefs[person1].each do |k, v|
+ puts "Book: #{k}"
v2 = prefs[person2][k]
if v2
square = ((v - v2) ** 2)
puts "(#{v} - #{v2}) ** 2 = #{square}"
- squares << square
+ squares << square
end
end
| Add log message to show the book
|
diff --git a/test/integration/test_localization.rb b/test/integration/test_localization.rb
index abc1234..def5678 100644
--- a/test/integration/test_localization.rb
+++ b/test/integration/test_localization.rb
@@ -0,0 +1,61 @@+require_relative '../capybara_helper'
+
+context 'Localized frontend' do
+ include Capybara::DSL
+
+ setup do
+ @path = cloned_testpath "examples/lotr.git"
+ @wiki = Gollum::Wiki.new(@path)
+
+ Precious::App.set :gollum_path, @path
+ Precious::App.set :wiki_options, {mathjax: true}
+
+ Capybara.app = Precious::App
+ end
+
+ test 'can visit search results page' do
+ visit '/gollum/search'
+
+ fill_in('Search', with: 'something-to-return-no-results')
+ .native
+ .send_keys(:return)
+
+ assert_includes page.text,
+ 'Search results for something-to-return-no-results'
+ assert_includes page.text,
+ 'There are no results for your search something-to-return-no-results.'
+
+ click_on 'Back to Top'
+
+ visit '/gollum/search'
+
+ fill_in('Search', with: 'Bilbo').native.send_keys(:return)
+
+ assert_includes page.text, 'Search results for Bilbo'
+
+ click_on 'Show all hits on this page'
+ click_on 'Bilbo-Baggins.md'
+
+ assert page.current_path, '/Bilbo-Baggins.md'
+ end
+
+ test 'can visit overview page' do
+ visit "/gollum/overview"
+
+ assert_includes page.text, 'Overview of master'
+ assert_includes page.text, 'Home'
+
+ click_on 'Back to Top'
+ click_on 'Bilbo-Baggins.md'
+
+ assert page.current_path, '/Bilbo-Baggins.md'
+ end
+
+ teardown do
+ @path = nil
+ @wiki = nil
+
+ Capybara.reset_sessions!
+ Capybara.use_default_driver
+ end
+end
| Test localization for some views
In #1853, it was reported that some views are errorring out due to
missing translations. These tests exercise the translations for the
reported views.
|
diff --git a/lib/survey_gizmo/api/campaign.rb b/lib/survey_gizmo/api/campaign.rb
index abc1234..def5678 100644
--- a/lib/survey_gizmo/api/campaign.rb
+++ b/lib/survey_gizmo/api/campaign.rb
@@ -6,6 +6,7 @@ attribute :name, String
attribute :type, String
attribute :_type, String
+ attribute :subtype, String
attribute :_subtype, String
attribute :__subtype, String
attribute :status, String
| Add missing attribute "subtype" needed when creating Campains
|
diff --git a/core/spec/poltergeist_style_overrides.rb b/core/spec/poltergeist_style_overrides.rb
index abc1234..def5678 100644
--- a/core/spec/poltergeist_style_overrides.rb
+++ b/core/spec/poltergeist_style_overrides.rb
@@ -8,6 +8,7 @@ #real_tos { overflow:hidden !important; }
html.phantom_js body { -webkit-transform: rotate(0.00001deg); }
html.phantom_js body.client { overflow: auto; }
+ html.phantom_js .discussion-modal-container { position: absolute; min-height:100%; overflow-y: auto; bottom: auto; }
</style>
<script>
document.addEventListener("DOMContentLoaded", function(){
| Use absolute rather than fixed positioning for the NDP screenshots.
This lets then fill the screenshot naturally, rather than be clipped to the (small) phantomjs viewport.
|
diff --git a/VENPromotionsManager.podspec b/VENPromotionsManager.podspec
index abc1234..def5678 100644
--- a/VENPromotionsManager.podspec
+++ b/VENPromotionsManager.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "VENPromotionsManager"
- s.version = "0.1.1"
+ s.version = "0.2.0"
s.summary = "Definition, management and control of in-app location based promotions."
s.description = <<-DESC
VENPromotionsManager enables easy definition, management and control of in-app location based promotions including the following:
| Update podspec to latest version
|
diff --git a/lib/model-visualizer.rb b/lib/model-visualizer.rb
index abc1234..def5678 100644
--- a/lib/model-visualizer.rb
+++ b/lib/model-visualizer.rb
@@ -13,7 +13,13 @@
root = if ARGV.length == 1 then ARGV[0] else '.' end
- models = Parser.parse root
- Visualizer.new(models).create_visualization(File.basename root)
+ path = File.absolute_path root
+
+ unless Dir.exists? path
+ abort 'Error: Path given does not exist!'
+ end
+
+ models = Parser.parse path
+ Visualizer.new(models).create_visualization(File.basename path)
end
end
| Fix error with title when path is not given
|
diff --git a/lib/jekyll/converters/coffeescript.rb b/lib/jekyll/converters/coffeescript.rb
index abc1234..def5678 100644
--- a/lib/jekyll/converters/coffeescript.rb
+++ b/lib/jekyll/converters/coffeescript.rb
@@ -5,7 +5,7 @@ priority :low
def matches(ext)
- ext =~ /\A\.coffee\z/
+ ext =~ /^\.coffee$/i
end
def output_ext(ext)
| Change Matching Regex to use standard symbols
For beginning and end of line, ^ and $.
And added i flag for case insensitivity.
This also more closely matches the sass/scss converters |
diff --git a/lib/capistrano/notifier/statsd.rb b/lib/capistrano/notifier/statsd.rb
index abc1234..def5678 100644
--- a/lib/capistrano/notifier/statsd.rb
+++ b/lib/capistrano/notifier/statsd.rb
@@ -24,8 +24,8 @@ end
end
- def self.get_options(yaml = "", configuration)
- yaml = (YAML.load(yaml) || {}).symbolize_keys
+ def self.get_options(file, configuration)
+ yaml = (YAML.load(file) || {}).symbolize_keys
# Use the staging key if we have it
if configuration.exists?(:stage)
yaml = yaml[configuration.fetch(:stage).to_sym].symbolize_keys
| Remove argument default from beginning of parameter list
|
diff --git a/lib/cfssl-trust-store-preamble.rb b/lib/cfssl-trust-store-preamble.rb
index abc1234..def5678 100644
--- a/lib/cfssl-trust-store-preamble.rb
+++ b/lib/cfssl-trust-store-preamble.rb
@@ -6,4 +6,4 @@ ca-bundle.crt.metadata
int-bundle.crt ]
-TRUST_STORE = Redis.connect url:ENV["REDISCLOUD_URL"]
+TRUST_STORE = Redis.connect url:ENV["REDIS_URL"]
| Switch from REDISCLOUD_URL to REDIS_URL
|
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -1,5 +1,4 @@ class OrganizationsController < ApplicationController
-
def index
@organizations = Organization.paginate(:page => params[:page], :per_page => 10)
end
@@ -9,11 +8,9 @@ end
def create
- @organization = Organization.new(organization_params)
+ @organization = current_user.organizations.new(organization_params)
respond_to do |format|
if @organization.save
- @user = User.find(session[:user_id])
- @user.update(organization_id: @organization.id)
format.html {redirect_to services_new_path, notice: 'Organization was successfully created.' }
else
format.html {render :new}
| Streamline organization creation under the current user.
|
diff --git a/app/controllers/pdf_converter_controller.rb b/app/controllers/pdf_converter_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/pdf_converter_controller.rb
+++ b/app/controllers/pdf_converter_controller.rb
@@ -13,7 +13,7 @@ end
end
puts "All Images >>>>>>>>>>>>>> #{extractor.images}"
- @images = extractor.images
+ @images = extractor.images.compact
@images = @images.partition {|image| image.split('.').last == 'tif'}
@tiff_images = @images.first
@other_images = @images.last
| Fix for handling empty array of images
|
diff --git a/lib/marples/model_action_broadcast.rb b/lib/marples/model_action_broadcast.rb
index abc1234..def5678 100644
--- a/lib/marples/model_action_broadcast.rb
+++ b/lib/marples/model_action_broadcast.rb
@@ -13,7 +13,7 @@ # If you'd like the actions performed by Marples to be logged, set a
# logger. By default this uses the NullLogger.
class_attribute :marples_logger
- self.marples_logger = Rails.logger
+ self.marples_logger = NullLogger.instance
CALLBACKS.each do |callback|
callback_action = callback.to_s =~ /e$/ ? "#{callback}d" : "#{callback}ed"
| Use the NullLogger by default. |
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -1,5 +1,5 @@ class EventsController < ApplicationController
def feed
- open("http://dl.dropbox.com/s/5r7ht992dpexnyk/events.json") { |io| render json: io.read }
+ open("https://dl.dropbox.com/s/5r7ht992dpexnyk/events.json") { |io| render json: io.read }
end
end
| Fix event json Dropbox redirect
|
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -6,7 +6,7 @@ # GET /events.rss
# GET /events.ics
def index
- @events = Event.where(['date >= ?', DateTime.now]).order('date')
+ @events = Event.where(['date >= ?', DateTime.now.utc]).order('date')
respond_to do |format|
format.html
| Use now DateTime in UTC for getting events
|
diff --git a/app/controllers/recipe_controller.rb b/app/controllers/recipe_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/recipe_controller.rb
+++ b/app/controllers/recipe_controller.rb
@@ -1,16 +1,27 @@ require 'rakuten_web_service'
class RecipeController < ApplicationController
+ def pickup
+ rakuten_api
+ @menus = RakutenWebService::Recipe.ranking(15)
+ end
+ # Test Page
def index
- RakutenWebService.configure do |c|
- c.application_id = ENV["APPID"]
- c.affiliate_id = ENV["AFID"]
- end
-
+ rakuten_api
+
@large_categories = RakutenWebService::Recipe.large_categories
@menus = RakutenWebService::Recipe.ranking(15)
@title = 'rakuten_recipe_test'
end
+
+ private
+ # For Rakuten API Setting
+ def rakuten_api
+ RakutenWebService.configure do |c|
+ c.application_id = ENV["APPID"]
+ c.affiliate_id = ENV["AFID"]
+ end
+ end
end
| Add API call for pickup
|
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -8,14 +8,17 @@ end
end
- def breadcrumb_link_according_to_user_status
- if current_user && @event.organizer_id == current_user.id
- link_to 'Your Events', user_path(current_user)
- elsif current_user && current_user.admin?
- link_to 'Admin', admin_path
- else
- link_to 'Events', events_path
- end
- end
+ #Currently not used - Left it for further refactoring, maybe we can
+ #reuse this later if we modify it for the breadcrumb_partial:
+
+ # def breadcrumb_link_according_to_user_status
+ # if current_user && @event.organizer_id == current_user.id
+ # link_to 'Your Events', user_path(current_user)
+ # elsif current_user && current_user.admin?
+ # link_to 'Admin', admin_path
+ # else
+ # link_to 'Events', events_path
+ # end
+ # end
end
| doc: Comment out event helper method
I left this code on purpose, we might be able to use a modified version after more refactoring of the breadcrumbs
|
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sessions_helper.rb
+++ b/app/helpers/sessions_helper.rb
@@ -13,16 +13,30 @@ { site: base } )
request_token = consumer.get_request_token(oauth_callback: callback)
- puts request_token.inspect
session[:request_token] = request_token
redirect request_token.authorize_url
end
def get_twitter_access_token
- puts params
- puts session[:request_token]
- access_token = session[:request_token].get_access_token(oauth_verifier: params[:oauth_verifier])
- puts access_token.inspect
+ session[:access_token] = access_token = session[:request_token].get_access_token(oauth_verifier: params[:oauth_verifier])
+ end
+
+ def store_twitter_access_token
+ id = session[:user_id]
+ token = session[:access_token].token
+ secret = session[:access_token].secret
+ destination = Destination.find_by(user_id: id)
+ if destination
+ destination.twitter_secret = secret
+ destination.twitter_token = token
+ destination.save
+ else
+ Destination.create(user_id: id, twitter_secret: secret, twitter_token: token)
+ end
+ end
+
+ def send_tweet
+
end
end | Store twitter access token info to db
|
diff --git a/app/helpers/tiny_mce_helper.rb b/app/helpers/tiny_mce_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/tiny_mce_helper.rb
+++ b/app/helpers/tiny_mce_helper.rb
@@ -7,7 +7,8 @@ mode : 'textareas',
width : '100%',
height : '100%',
- theme_advanced_resizing : false,
+ theme_advanced_resizing : true,
+ theme_advanced_resizing_use_cookie : true,
theme_advanced_toolbar_location : 'top',
theme_advanced_buttons1 : 'justifyleft,justifycenter,justifyfull,',
theme_advanced_buttons1_add : '|,bold,italic,underline,|,fontselect,fontsizeselect,|,bullist,numlist,|link,image',
| Put resizing and cookie remember size back into tiny MCE |
diff --git a/lib/mysql_tools/init_obfuscate.rb b/lib/mysql_tools/init_obfuscate.rb
index abc1234..def5678 100644
--- a/lib/mysql_tools/init_obfuscate.rb
+++ b/lib/mysql_tools/init_obfuscate.rb
@@ -1,5 +1,13 @@ module MysqlTools
class InitObfuscate
+
+# # -*- mode: ruby -*-
+# {
+# :sitaddresses => {
+# :p_email => { :type => :email },
+# :p_streetname => { :type => :string, :length => 8, :chars => MyObfuscate::USERNAME_CHARS }
+# }
+# }
def self.init
desc "Initialize obfuscate file"
| Add example obfuscate file. Command still not working.
|
diff --git a/lib/nyanko/unit_proxy_provider.rb b/lib/nyanko/unit_proxy_provider.rb
index abc1234..def5678 100644
--- a/lib/nyanko/unit_proxy_provider.rb
+++ b/lib/nyanko/unit_proxy_provider.rb
@@ -4,7 +4,6 @@
included do
extend UnitProxyProvider
- include Helper
end
# Define #unit method in this class when #unit is called in first time.
| Remove unnecessary inclusion of Helper in UnitProxyProvider
Helper will be included in Railtie.
|
diff --git a/lib/quotes/gateways/quotes_gateway.rb b/lib/quotes/gateways/quotes_gateway.rb
index abc1234..def5678 100644
--- a/lib/quotes/gateways/quotes_gateway.rb
+++ b/lib/quotes/gateways/quotes_gateway.rb
@@ -40,7 +40,9 @@ end
def merge(quotes)
- (load_all + quotes).uniq { |q| q.content }
+ (load_all + quotes).uniq do |quote|
+ quote.content && quote.author && quote.title
+ end
end
def ensure_validity(quotes)
| Update how uniqueness is determined in gateway
|
diff --git a/lib/swa/ec2/instance.rb b/lib/swa/ec2/instance.rb
index abc1234..def5678 100644
--- a/lib/swa/ec2/instance.rb
+++ b/lib/swa/ec2/instance.rb
@@ -12,19 +12,15 @@ end
def summary
- summary_fields.map { |x| (x || "-") }.join(" ")
- end
-
- def summary_fields
- name = tags["Name"]
[
- i.instance_id,
- i.image_id,
- i.instance_type,
- i.state.name,
- (i.private_ip_address || "-"),
- (%("#{name}") if name)
- ]
+ pad(i.instance_id, 11),
+ pad(i.image_id, 13),
+ pad(i.instance_type, 10),
+ pad(i.state.name, 11),
+ pad(i.private_ip_address, 15),
+ pad(i.public_ip_address, 15),
+ quoted_name
+ ].join(" ")
end
def data
@@ -42,6 +38,21 @@ end
end
+ def name
+ tags["Name"]
+ end
+
+ def quoted_name
+ %("#{name}") if name
+ end
+
+ private
+
+ def pad(s, width)
+ s = (s || "").to_s
+ s.ljust(width)
+ end
+
end
end
| Align columns in "summary" output.
|
diff --git a/lib/rocket_pants/active_record.rb b/lib/rocket_pants/active_record.rb
index abc1234..def5678 100644
--- a/lib/rocket_pants/active_record.rb
+++ b/lib/rocket_pants/active_record.rb
@@ -7,9 +7,6 @@ map_error! ActiveRecord::RecordNotFound, RocketPants::NotFound
map_error! ActiveRecord::RecordNotUnique, RocketPants::Conflict
map_error!(ActiveRecord::RecordNotSaved) { RocketPants::InvalidResource.new nil }
- map_error! ActiveRecord::RecordInvalid do |exception|
- RocketPants::InvalidResource.new exception.record.errors
- end
end
ActiveSupport.on_load :active_record do
| Remove RocketPants default handling of AR validations so that exceptions
are thrown normally
|
diff --git a/ruby_tests/tty_read.rb b/ruby_tests/tty_read.rb
index abc1234..def5678 100644
--- a/ruby_tests/tty_read.rb
+++ b/ruby_tests/tty_read.rb
@@ -12,12 +12,21 @@ puts "*** Connecting to RPi on #{host}:#{port}"
@socket = TCPSocket.new(host, port) # a magic Celluloid::IO socket
+ @arduino_buffer = ''
async.run
end
def handle_read(msg)
- puts ("[#{msg}]")
+ line = ''
+ puts ("read [#{msg}]")
+ @arduino_buffer += msg
+ cr_pos = @arduino_buffer.index("\r")
+ if cr_pos
+ line = @arduino_buffer.slice(0..(cr_pos-1))
+ @arduino_buffer = @arduino_buffer.slice((cr_pos+1)..-1)
+ puts "line [#{line}]"
+ end
end
def run
@@ -27,7 +36,7 @@ end
end
- def write_to_pi(msg)
+ def write_to_arduino(msg)
puts "write #{msg}"
@socket.write(msg)
end
@@ -45,7 +54,7 @@ counter = 1
every (20) do
counter += 1
- Celluloid::Actor[:pi_sock].async.write_to_pi("p#{counter}\r")
+ Celluloid::Actor[:pi_sock].async.write_to_arduino("p#{counter}\r")
end
end
end
| Add code to buffer the partial socket reads into lines
|
diff --git a/app/policies/comment_policy.rb b/app/policies/comment_policy.rb
index abc1234..def5678 100644
--- a/app/policies/comment_policy.rb
+++ b/app/policies/comment_policy.rb
@@ -1,6 +1,6 @@ class CommentPolicy < ApplicationPolicy
def new?
- record.post.member?(user)
+ record.subject.member?(user)
end
def create?
| Use comment subject in policy
|
diff --git a/lib/magento/product_attribute_set.rb b/lib/magento/product_attribute_set.rb
index abc1234..def5678 100644
--- a/lib/magento/product_attribute_set.rb
+++ b/lib/magento/product_attribute_set.rb
@@ -16,6 +16,14 @@ def create(attributes)
commit("create", attributes[:name], attributes[:skeleton_id])
end
+
+ def group_add(id, name)
+ commit("groupAdd", id, name)
+ end
+
+ def attribute_add(attribute_id, id, group_id)
+ commit("attributeAdd", attribute_id, id, group_id)
+ end
end
end
| Add group add to attributes set
|
diff --git a/lib/netsuite_config/netsuite_init.rb b/lib/netsuite_config/netsuite_init.rb
index abc1234..def5678 100644
--- a/lib/netsuite_config/netsuite_init.rb
+++ b/lib/netsuite_config/netsuite_init.rb
@@ -1,13 +1,18 @@ NetSuite.configure do
reset!
-
+
+ read_timeout 100_000
+
email ENV['NETSUITE_EMAIL']
password ENV['NETSUITE_PASSWORD']
account ENV['NETSUITE_ACCOUNT']
role ENV['NETSUITE_ROLE']
api_version ENV['NETSUITE_API']
- read_timeout 100000
sandbox ENV['NETSUITE_PRODUCTION'].nil? || ENV['NETSUITE_PRODUCTION'] != 'true'
# log File.join(Rails.root, 'log/netsuite.log')
+
+ if ENV['NETSUITE_WSDL_DOMAIN']
+ wsdl_domain ENV['NETSUITE_WSDL_DOMAIN']
+ end
end
| Allow wsdl_domain to be specified via env vars
|
diff --git a/lib/roo_on_rails/railties/sidekiq.rb b/lib/roo_on_rails/railties/sidekiq.rb
index abc1234..def5678 100644
--- a/lib/roo_on_rails/railties/sidekiq.rb
+++ b/lib/roo_on_rails/railties/sidekiq.rb
@@ -1,5 +1,7 @@ require 'sidekiq'
require 'roo_on_rails/sidekiq/settings'
+require 'roo_on_rails/sidekiq/sla_metric'
+
module RooOnRails
module Railties
class Sidekiq < Rails::Railtie
@@ -31,7 +33,7 @@ app.middleware.use HireFire::Middleware
HireFire::Resource.configure do |config|
config.dyno(:worker) do
- RooOnRails::SidekiqSla.queue
+ RooOnRails::Sidekiq::SlaMetric.queue
end
end
end
| HOTFIX: Use correct SLA class name
This could really do with some tests, but I’m not quite sure how to
test it and this is causing errors in production so I’d prefer to patch
it quickly and then work out how to test it later.
@danielcooper maybe you have some thoughts on how to test?
|
diff --git a/lib/rubygems/comparator/dir_utils.rb b/lib/rubygems/comparator/dir_utils.rb
index abc1234..def5678 100644
--- a/lib/rubygems/comparator/dir_utils.rb
+++ b/lib/rubygems/comparator/dir_utils.rb
@@ -1,51 +1,53 @@ require 'pathname'
-module DirUtils
- SHEBANG_REGEX = /\A#!.*/
+class Gem::Comparator
+ module DirUtils
+ SHEBANG_REGEX = /\A#!.*/
- attr_accessor :files_first_line
+ attr_accessor :files_first_line
- def self.file_first_line(file)
- File.open(file){ |f| f.readline }.gsub(/(.*)\n/, '\1')
- rescue
+ def self.file_first_line(file)
+ File.open(file){ |f| f.readline }.gsub(/(.*)\n/, '\1')
+ rescue
+ end
+
+ def self.file_has_shebang?(file)
+ file_first_line(file) =~ SHEBANG_REGEX
+ end
+
+ def self.files_same_first_line?(file1, file2)
+ file_first_line(file1) == file_first_line(file2)
+ end
+
+ def self.file_permissions(file)
+ sprintf("%o", File.stat(file).mode)
+ end
+
+ def self.gem_bin_file?(file)
+ file =~ /(\A|.*\/)bin\/.*/
+ end
+
+ ##
+ # Returns a unique list of directories and top level files
+ # out of an array of files
+
+ def self.dirs_of_files(file_list)
+ dirs_of_files = []
+ file_list.each do |file|
+ unless Pathname.new(file).dirname.to_s == '.'
+ dirs_of_files << "#{Pathname.new(file).dirname.to_s}/"
+ else
+ dirs_of_files << file
+ end
+ end
+ dirs_of_files.uniq
+ end
+
+ def self.remove_subdirs(dirs)
+ dirs.dup.sort_by(&:length).reverse.each do |dir|
+ dirs.delete_if{ |d| d =~ /#{dir}\/.+/ }
+ end
+ dirs
+ end
end
-
- def self.file_has_shebang?(file)
- file_first_line(file) =~ SHEBANG_REGEX
- end
-
- def self.files_same_first_line?(file1, file2)
- file_first_line(file1) == file_first_line(file2)
- end
-
- def self.file_permissions(file)
- sprintf("%o", File.stat(file).mode)
- end
-
- def self.gem_bin_file?(file)
- file =~ /(\A|.*\/)bin\/.*/
- end
-
- ##
- # Returns a unique list of directories and top level files
- # out of an array of files
-
- def self.dirs_of_files(file_list)
- dirs_of_files = []
- file_list.each do |file|
- unless Pathname.new(file).dirname.to_s == '.'
- dirs_of_files << "#{Pathname.new(file).dirname.to_s}/"
- else
- dirs_of_files << file
- end
- end
- dirs_of_files.uniq
- end
-
- def self.remove_subdirs(dirs)
- dirs.dup.sort_by(&:length).reverse.each do |dir|
- dirs.delete_if{ |d| d =~ /#{dir}\/.+/ }
- end
- dirs
- end
-end
+end | Move DirUtils to proper namespace
|
diff --git a/lib/blimp/web_server.rb b/lib/blimp/web_server.rb
index abc1234..def5678 100644
--- a/lib/blimp/web_server.rb
+++ b/lib/blimp/web_server.rb
@@ -7,10 +7,14 @@ end
before do
- logger.info "Sites defined: #{Site.all}"
+ logger.info "Started GET \"#{request.path_info}\" for #{request.ip} at #{Time.now.strftime("%Y-%m-%d %H:%M:%s")}"
@site = Site.find_by_domain(request.host) or raise Sinatra::NotFound, "No site defined for #{request.host}"
end
-
+
+ after do
+ logger.info ""
+ end
+
get '*' do
begin
page = @site.find_page(request.path_info)
| Add a little logging to webserver
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.