diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/Casks/zendstudio.rb b/Casks/zendstudio.rb
index abc1234..def5678 100644
--- a/Casks/zendstudio.rb
+++ b/Casks/zendstudio.rb
@@ -3,5 +3,5 @@ homepage 'http://www.zend.com/en/products/studio/'
version '10.6.0'
sha256 '391c77f62e281f7d6dc8039962d4fcb03b66e8c1a28267840b9f3af3f9cc30e7'
- link 'Zend Studio/ZendStudio.app'
+ link 'ZendStudio.app'
end
|
Fix symlink path error in ZendStudio.app Cask
|
diff --git a/spec/get_events_spec.rb b/spec/get_events_spec.rb
index abc1234..def5678 100644
--- a/spec/get_events_spec.rb
+++ b/spec/get_events_spec.rb
@@ -4,12 +4,70 @@ include Sandthorn::AggregateRoot
end
+class AnotherAggregate
+ include Sandthorn::AggregateRoot
+ event_store :other
+end
+
describe Sandthorn do
- before(:each) { AnAggregate.new.save }
- let(:events) { Sandthorn.get_events aggregate_types: [AnAggregate] }
- context "when getting events using Sandthorn.get_events for an aggregate type" do
- it "should return raw events" do
- expect(events).to_not be_empty
- end
- end
+
+ describe "::get_events" do
+ context "when getting events using Sandthorn.get_events for an aggregate type" do
+ before do
+ AnAggregate.new.save
+ end
+ let(:events) { Sandthorn.get_events aggregate_types: [AnAggregate] }
+ it "should return events" do
+ expect(events).to_not be_empty
+ end
+ end
+
+ context "when there are many event stores configured" do
+ before do
+ setup_secondary_db
+ end
+
+ let!(:agg) do
+ AnAggregate.new.save
+ end
+
+ let!(:other_agg) do
+ AnotherAggregate.new.save
+ end
+
+ shared_examples(:default_event_store) do
+ it "returns events from the default event store" do
+ events = Sandthorn.get_events
+ expect(events).to all(have_aggregate_type("AnAggregate"))
+ end
+ end
+
+ context "when no explicit event store is used" do
+ it_behaves_like :default_event_store
+ end
+
+ context "when given an explicit event store" do
+ context "and that event store exists" do
+ it "returns events from the chosen event store" do
+ events = Sandthorn.get_events(event_store: :other)
+ expect(events).to all(have_aggregate_type("AnotherAggregate"))
+ end
+ end
+
+ context "and that event store does not exist" do
+ it_behaves_like :default_event_store
+ end
+ end
+
+ end
+ end
+
+ def setup_secondary_db
+ url = "sqlite://spec/db/other_db.sqlite3"
+ driver = SandthornDriverSequel.driver_from_url(url: url)
+ Sandthorn.event_stores.add(:other, driver)
+ migrator = SandthornDriverSequel::Migration.new url: url
+ SandthornDriverSequel.migrate_db url: url
+ migrator.send(:clear_for_test)
+ end
end
|
Add specs for get_events with named event stores
|
diff --git a/server/lib/tasks/idleserver.rake b/server/lib/tasks/idleserver.rake
index abc1234..def5678 100644
--- a/server/lib/tasks/idleserver.rake
+++ b/server/lib/tasks/idleserver.rake
@@ -0,0 +1,12 @@+namespace :idleserver do
+ desc 'Clean stale clients out of database'
+ task :dbclean, [:hours] => [:environment] do |t, args|
+ if args.hours
+ Client.find(:all, :conditions => ['updated_at < ?', args.hours.to_i.hours.ago]).each do |client|
+ puts "Deleting #{client.name}"
+ client.destroy
+ end
+ end
+ end
+end
+
|
Add a rake task to simplify removing old entries from the database.
|
diff --git a/Casks/noun-project.rb b/Casks/noun-project.rb
index abc1234..def5678 100644
--- a/Casks/noun-project.rb
+++ b/Casks/noun-project.rb
@@ -0,0 +1,14 @@+cask :v1 => 'noun-project' do
+ version '1.0.2'
+ sha256 '3063a23c568254053513fbadbdd9087f3cb6f87fd1a749e61e7452e36772a28b'
+
+ # amazonaws.com is the official download host per the vendor homepage
+ url "https://s3.amazonaws.com/nounproject/mac/Noun-Project-#{version}.dmg"
+ name 'Noun Project'
+ homepage 'https://thenounproject.com'
+ license :commercial
+
+ app 'Noun Project.app'
+
+ depends_on :macos => '>= 10.9'
+end
|
Add Noun Project.app version 1.0.2
Search over 100,000 icons. The Mac App constantly updates, giving you fresh content every day. https://thenounproject.com
|
diff --git a/Casks/phpstorm-eap.rb b/Casks/phpstorm-eap.rb
index abc1234..def5678 100644
--- a/Casks/phpstorm-eap.rb
+++ b/Casks/phpstorm-eap.rb
@@ -1,7 +1,7 @@ class PhpstormEap < Cask
- url 'http://download.jetbrains.com/webide/PhpStorm-EAP-138.38.dmg'
+ url 'http://download.jetbrains.com/webide/PhpStorm-EAP-138.84.dmg'
homepage 'http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program'
- version '138.38'
- sha256 '10bd216cab733340447a2ef531d24284a319284cfa673fa71b908affefa55278'
+ version '138.84'
+ sha256 '15ecf78338296d4936269bb040f427e739b7fdfac6fc0a0534882de7ab027263'
link 'PhpStorm EAP.app'
end
|
Update PHPStorm-EAP to latest build 138.84
|
diff --git a/recipes/wheneverize.rb b/recipes/wheneverize.rb
index abc1234..def5678 100644
--- a/recipes/wheneverize.rb
+++ b/recipes/wheneverize.rb
@@ -7,6 +7,10 @@
execute 'whenever' do
cwd "#{node[:whenever][:whenever_path]}"
- command "whenever --update-crontab '#{node[:application]}_#{node[:rails_env]}'"
+ # After below command is run, the crontab file is updated
+ # with a section for whenever tasks, marked by a beginning and ending comment
+ # e.g. # Begin / End Whenever generated tasks for: '#{node[:application]}'
+ #
+ command "whenever --update-crontab '#{node[:application]}'"
action :run
end
|
Add comment to whenever --update-crontab
|
diff --git a/convert_church_directory_for_mapalist_spreadsheet.rb b/convert_church_directory_for_mapalist_spreadsheet.rb
index abc1234..def5678 100644
--- a/convert_church_directory_for_mapalist_spreadsheet.rb
+++ b/convert_church_directory_for_mapalist_spreadsheet.rb
@@ -0,0 +1,64 @@+require 'csv'
+
+Record = Struct.new(:household, :primary, :secondary, :address)
+
+states = [:scanning_for_next_record, :reading_primary, :reading_secondary, :reading_address]
+current_state = :scanning_for_next_record
+current_record = nil
+records = []
+i = 0
+CSV.foreach(ARGV[0], :headers => false, :encoding => 'windows-1251:utf-8') do |row|
+ i += 1
+ unless current_record
+ current_record = Record.new
+ end
+
+ begin
+ parse = lambda do
+ case current_state
+ when :scanning_for_next_record
+ unless row[1].nil? || row[1].to_s.strip.empty?
+ current_record.household = row[1]
+ current_state = :reading_primary
+ end
+ when :reading_primary
+ current_record.primary = row[0]
+ current_state = :reading_secondary
+ when :reading_secondary
+ if row[0].nil? || row[0].to_s.strip.empty?
+ current_state = :reading_address
+ parse.call
+ else
+ current_record.secondary = row[0]
+ end
+ when :reading_address
+ if row[1].nil? || row[1].to_s.strip.empty?
+ current_record.address = current_record.address.join(', ')
+ records << current_record
+ current_record = nil
+ current_state = :scanning_for_next_record
+ else
+ current_record.address ||= []
+ current_record.address << row[1]
+ end
+ end
+ end
+
+ parse.call
+ rescue => e
+ puts "Format error near row #{i} (may cause additional rows to report errors until fixed.)"
+ end
+end
+
+csv_rows = [['Household', 'Primary', 'Secondary', 'Address']]
+records.each do |r|
+ csv_rows << [r.household, r.primary, r.secondary, r.address]
+end
+
+csv_string = CSV.generate do |csv|
+ csv_rows.each do |row|
+ csv << row
+ end
+end
+
+puts csv_string
|
Add proof-of-concept ruby script for posterity's sake.
|
diff --git a/dm-types/lib/dm-types/flag.rb b/dm-types/lib/dm-types/flag.rb
index abc1234..def5678 100644
--- a/dm-types/lib/dm-types/flag.rb
+++ b/dm-types/lib/dm-types/flag.rb
@@ -52,6 +52,7 @@
def self.typecast(value, property)
case value
+ when nil then nil
when Array then value.map {|v| v.to_sym}
else value.to_sym
end
|
Allow Flag property to be nullable.
Signed-off-by: Michael S. Klishin <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@novemberain.com>
|
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
@@ -10,6 +10,7 @@ Before do
@__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
+ @aruba_timeout_seconds = 5
end
After do
|
Increase Aruba timeout to 5 seconds
|
diff --git a/lib/rack/dev-mark/theme/github_fork_ribbon.rb b/lib/rack/dev-mark/theme/github_fork_ribbon.rb
index abc1234..def5678 100644
--- a/lib/rack/dev-mark/theme/github_fork_ribbon.rb
+++ b/lib/rack/dev-mark/theme/github_fork_ribbon.rb
@@ -27,9 +27,9 @@ div_tag_str = <<-EOS
<div class="github-fork-ribbon-wrapper #{position}#{fixed}" onClick="this.style.display='none'" title="#{title}"><div class="github-fork-ribbon #{color}"><span class="github-fork-ribbon-text">#{env}</span></div></div>
EOS
- html
- .sub('</head>', "#{style_tag_str.strip}</head>")
- .sub %r{(<body[^>]*>)}i, "\\1#{div_tag_str.strip}"
+ html.
+ sub("</head>", "#{style_tag_str.strip}</head>").
+ sub /(<body[^>]*>)/i, "\\1#{div_tag_str.strip}"
end
end
end
|
Fix method chain and quotations
|
diff --git a/config/initializers/attachment_fu_file_mime_type.rb b/config/initializers/attachment_fu_file_mime_type.rb
index abc1234..def5678 100644
--- a/config/initializers/attachment_fu_file_mime_type.rb
+++ b/config/initializers/attachment_fu_file_mime_type.rb
@@ -7,7 +7,16 @@ tmp_file = self.uploaded_data_without_unix_file_mime_type=(file_data)
if tmp_file.present? && (unix_file = `which file`.chomp).present? && File.exists?(unix_file)
- self.content_type = `#{ unix_file } -b --mime-type #{ tmp_file.path }`.chomp
+ `#{ unix_file } -v` =~ /^file-(.*)$/
+ version = $1.to_i
+
+ self.content_type = case version
+ when 5
+ `#{ unix_file } -b --mime-type #{ tmp_file.path }`.chomp
+ else
+ `#{ unix_file } -bi #{ tmp_file.path }`.chomp =~ /(\w*\/[\w+-\.]*)/
+ $1
+ end
end
tmp_file
|
Make unix_file_mime_type compatible with file versions < 5
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -20,6 +20,7 @@ include_recipe 'omnibus::_bash'
include_recipe 'omnibus::_ccache'
include_recipe 'omnibus::_common'
+include_recipe 'omnibus::_chruby'
include_recipe 'omnibus::_compile'
include_recipe 'omnibus::_git'
include_recipe 'omnibus::_github'
|
Make chruby part of the base recipe
|
diff --git a/saga.gemspec b/saga.gemspec
index abc1234..def5678 100644
--- a/saga.gemspec
+++ b/saga.gemspec
@@ -6,7 +6,7 @@ spec.date = "2012-07-10"
spec.authors = ["Manfred Stienstra"]
- spec.email = "manfred@fngtpspec.com"
+ spec.email = "manfred@fngtps.com"
spec.description = "Saga is a tool to convert stories syntax to a nicely formatted document."
spec.summary = "Saga is a tool to convert stories syntax to a nicely formatted document."
|
Fix my e-mail address in the gemspec.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -20,8 +20,8 @@ include_recipe "apt"
template "/etc/apt/sources.list" do
- mode 0644
- variables :code_name => node[:lsb][:codename]
+ mode 00644
+ variables :code_name => node['lsb']['codename']
notifies :run, resources(:execute => "apt-get update"), :immediately
source "sources.list.erb"
end
|
Use 5 character mode def and strings not symbols for the node attributes
|
diff --git a/spec/event_spec.rb b/spec/event_spec.rb
index abc1234..def5678 100644
--- a/spec/event_spec.rb
+++ b/spec/event_spec.rb
@@ -1,7 +1,7 @@ require "spec_helper"
describe React::Event do
- it "should bridge attributes of native SyntheticEvent" do
+ it "should bridge attributes of native SyntheticEvent (see http://facebook.github.io/react/docs/events.html#syntheticevent)" do
element = React.create_element('div').on(:click) do |event|
expect(event.bubbles).to eq(`#{event.to_n}.bubbles`)
expect(event.cancelable).to eq(`#{event.to_n}.cancelable`)
|
Add reference to React.js doc
|
diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb
index abc1234..def5678 100644
--- a/spec/test_app_templates/lib/generators/test_app_generator.rb
+++ b/spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -24,4 +24,11 @@ def copy_fixture_data
generate 'curation_concerns:sample_data', '-f'
end
+
+ def enable_i18n_translation_errors
+ gsub_file "config/environments/development.rb",
+ "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
+ gsub_file "config/environments/test.rb",
+ "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
+ end
end
|
Test suite should fail when there are missing translations
|
diff --git a/spec/util.rb b/spec/util.rb
index abc1234..def5678 100644
--- a/spec/util.rb
+++ b/spec/util.rb
@@ -7,7 +7,10 @@
describe Daniel::Util do
it "converts hex to binary as expected" do
- expected = "\x00A7\x80".force_encoding("BINARY")
+ expected = "\x00A7\x80"
+ if ::RUBY_VERSION.to_f > 1.8
+ expected = expected.force_encoding("BINARY")
+ end
expect(Daniel::Util.from_hex("00413780")).to eq expected
end
it "converts hex to binary as expected" do
|
Fix additional Ruby 1.8 incompatibility.
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
|
diff --git a/test/api_helper.rb b/test/api_helper.rb
index abc1234..def5678 100644
--- a/test/api_helper.rb
+++ b/test/api_helper.rb
@@ -1,4 +1,5 @@ require './test/integration_helper'
+require 'gravatarify'
require 'sinatra/base'
require 'rack/test'
|
Add missing requirement to tests
Gravatarify was an unknown constant so the tests blew up.
|
diff --git a/spec/dmm-crawler/ranking_spec.rb b/spec/dmm-crawler/ranking_spec.rb
index abc1234..def5678 100644
--- a/spec/dmm-crawler/ranking_spec.rb
+++ b/spec/dmm-crawler/ranking_spec.rb
@@ -22,6 +22,7 @@ let(:term) { '24' }
it { is_expected.to all(include(:title, :title_link, :image_url, :submedia, :author, :informations, :tags)) }
+ it { is_expected.to all(satisfy { |art| art.all? { |_k, v| v != '' } }) }
end
context 'with not registered argument' do
|
Add examples that needed for checking crawled value is not empty
|
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index abc1234..def5678 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -7,6 +7,7 @@
# Checks for pending migration and applies them before tests are run.
# ActiveRecord::Migration.maintain_test_schema!
+system("cd spec/test_app; bin/rake db:create db:migrate db:test:prepare")
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
Introduce a hacky way to run migrations from code across rails versions
|
diff --git a/spec/regexes_spec.rb b/spec/regexes_spec.rb
index abc1234..def5678 100644
--- a/spec/regexes_spec.rb
+++ b/spec/regexes_spec.rb
@@ -0,0 +1,84 @@+require 'spec_helper'
+require 'strscan'
+
+def ScanShortcutFor(regex)
+ Module.new { define_method :scan do |text|
+ StringScanner.new(text).scan(Wptemplates::Regexes.send(regex))
+ end }
+end
+
+describe Wptemplates::Regexes do
+
+ describe '.till_doublebrace_or_pipe' do
+ include ScanShortcutFor(:till_doublebrace_or_pipe)
+
+ it 'consumes a string with no doublebraces or pipes at all' do
+ expect(scan "abc").to eq("abc")
+ end
+ it 'consumes until doublebraces or pipe' do
+ expect(scan "abc{{d").to eq("abc")
+ expect(scan "abc|d").to eq("abc")
+ expect(scan "abc}}d").to eq("abc")
+ end
+ it 'does not accept an empty string (epsilon transition)' do
+ expect(scan "{{d").to be_false
+ expect(scan "|d").to be_false
+ expect(scan "}}d").to be_false
+ end
+ it 'consumes until doublebraces or pipe even if other braces and pipes show up (not greedy)' do
+ expect(scan "ab|c{{d}}e").to eq("ab")
+ expect(scan "ab|c|d|e").to eq("ab")
+ expect(scan "ab{{c|d}}e").to eq("ab")
+ expect(scan "ab}}c|d{{e").to eq("ab")
+ end
+ it 'ignores lone braces' do
+ expect(scan "ab{c|d}}e").to eq("ab{c")
+ expect(scan "ab}c|d{{e").to eq("ab}c")
+ end
+ end
+
+ describe '.till_doubleopenbrace' do
+ include ScanShortcutFor(:till_doubleopenbrace)
+
+ it 'consumes a string with no doubleopenbraces at all' do
+ expect(scan "abc").to eq("abc")
+ expect(scan "ab}}c").to eq("ab}}c")
+ expect(scan "ab|c").to eq("ab|c")
+ end
+ it 'consumes until doubleopenbraces' do
+ expect(scan "abc{{d").to eq("abc")
+ expect(scan "abc|d{{").to eq("abc|d")
+ expect(scan "abc}}d{{").to eq("abc}}d")
+ end
+ it 'does not accept an empty string (epsilon transition)' do
+ expect(scan "{{d").to be_false
+ end
+ it 'consumes until doubleopenbraces even if other doubleopenbraces show up (not greedy)' do
+ expect(scan "ab{{d{{e").to eq("ab")
+ end
+ it 'ignores lone braces' do
+ expect(scan "ab{c{{e").to eq("ab{c")
+ end
+ end
+
+ describe '.till_doubleclosebrace_or_pipe' do
+
+ end
+
+ describe '.an_equals_no_doubleclosebrace_or_pipe' do
+
+ end
+
+ describe '.a_pipe' do
+
+ end
+
+ describe '.a_doubleopenbrace' do
+
+ end
+
+ describe '.a_doubleclosingbrace' do
+
+ end
+
+end
|
Add specs for some of the regexes
|
diff --git a/lib/byebug/commands/restart.rb b/lib/byebug/commands/restart.rb
index abc1234..def5678 100644
--- a/lib/byebug/commands/restart.rb
+++ b/lib/byebug/commands/restart.rb
@@ -41,7 +41,7 @@ argv = prepend_byebug_bin(argv)
argv = prepend_ruby_bin(argv)
- argv += (@match[:args] ? @match[:args].shellsplit : $ARGV.compact)
+ argv += (@match[:args] ? @match[:args].shellsplit : $ARGV)
puts pr('restart.success', cmd: argv.shelljoin)
Kernel.exec(*argv)
|
Remove unnecessary call to `compact`
|
diff --git a/EPSReactiveTableViewController.podspec b/EPSReactiveTableViewController.podspec
index abc1234..def5678 100644
--- a/EPSReactiveTableViewController.podspec
+++ b/EPSReactiveTableViewController.podspec
@@ -14,7 +14,6 @@ s.requires_arc = true
s.source_files = 'Classes'
- s.resources = 'Assets'
s.public_header_files = 'Classes/*.h'
s.dependency 'ReactiveCocoa', '~> 2.2.4'
|
Remove unnecessary resources line from podspec.
|
diff --git a/spec/common/install_chef_spec.rb b/spec/common/install_chef_spec.rb
index abc1234..def5678 100644
--- a/spec/common/install_chef_spec.rb
+++ b/spec/common/install_chef_spec.rb
@@ -0,0 +1,8 @@+require 'spec_helper'
+
+# Make sure Chef installs
+
+describe command('curl -kL https://www.chef.io/chef/install.sh | bash') do
+ its(:exit_status) { should eq 0 }
+end
+
|
Test to ensure Chef can successfully install
|
diff --git a/spec/fuzz/consumer_group_spec.rb b/spec/fuzz/consumer_group_spec.rb
index abc1234..def5678 100644
--- a/spec/fuzz/consumer_group_spec.rb
+++ b/spec/fuzz/consumer_group_spec.rb
@@ -0,0 +1,49 @@+describe "Consumer groups", fuzz: true do
+ let(:logger) { Logger.new(LOG) }
+ let(:num_messages) { 750_000 }
+ let(:num_partitions) { 30 }
+ let(:num_consumers) { 10 }
+ let(:topic) { "fuzz-consumer-group" }
+
+ before do
+ require "test_cluster"
+
+ logger.level = Logger::INFO
+
+ KAFKA_CLUSTER.create_topic(topic, num_partitions: num_partitions, num_replicas: 1)
+
+ kafka = Kafka.new(seed_brokers: KAFKA_BROKERS, logger: logger)
+ producer = kafka.producer(max_buffer_size: 5000)
+
+ (1..num_messages).each do |i|
+ producer.produce("message#{i}", topic: topic, partition: i % num_partitions)
+ producer.deliver_messages if i % 3000 == 0
+ end
+
+ producer.deliver_messages
+ end
+
+ example "consuming messages in a group with unreliable members" do
+ result_queue = Queue.new
+
+ consumer_threads = num_consumers.times.map do
+ thread = Thread.new do
+ kafka = Kafka.new(seed_brokers: KAFKA_BROKERS, logger: logger)
+ consumer = kafka.consumer(group_id: "fuzz")
+ consumer.subscribe(topic)
+
+ consumer.each_message do
+ result_queue << :ok
+ end
+ end
+
+ thread.abort_on_exception = true
+
+ thread
+ end
+
+ expect {
+ num_messages.times { result_queue.deq }
+ }.to_not raise_exception
+ end
+end
|
Add a fuzz test for consumer groups
|
diff --git a/app/controllers/category_tree/api/categories_controller.rb b/app/controllers/category_tree/api/categories_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/category_tree/api/categories_controller.rb
+++ b/app/controllers/category_tree/api/categories_controller.rb
@@ -3,7 +3,6 @@ def index
@categories = Category.order(:name)
@categories = @categories.search(params[:term]) if params[:term].present?
- puts @categories
end
def show
|
Clean up unnecessary puts lines
Signed-off-by: Joan Tiffany Siy <e0397393f2258e8c6ee68e35ceb46d86a4ac5382@teamcodeflux.com>
|
diff --git a/lib/data_kitten/origins/git.rb b/lib/data_kitten/origins/git.rb
index abc1234..def5678 100644
--- a/lib/data_kitten/origins/git.rb
+++ b/lib/data_kitten/origins/git.rb
@@ -44,9 +44,9 @@
def working_copy_path
# Create holding directory
- FileUtils.mkdir_p(File.join(File.dirname(__FILE__), 'tmp', 'repositories'))
+ FileUtils.mkdir_p(File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories'))
# generate working copy dir
- File.join(File.dirname(__FILE__), 'tmp', 'repositories', @access_url.gsub('/','-'))
+ File.join(File.dirname(__FILE__), '..', '..', '..', 'tmp', 'repositories', @access_url.gsub('/','-'))
end
def repository
|
Make tmp folder in gem root
|
diff --git a/spec/factories/subjects.rb b/spec/factories/subjects.rb
index abc1234..def5678 100644
--- a/spec/factories/subjects.rb
+++ b/spec/factories/subjects.rb
@@ -23,10 +23,5 @@ create_list(:set_member_subject, 2, subject: s)
end
end
-
- #factory :migrated_project_subject do
- #locations(standard: "http://www.galaxyzoo.org.s3.amazonaws.com/subjects/standard/1237679543502373086.jpg")
- #migrated true
- #end
end
end
|
Remove unused migrated subject factory
|
diff --git a/spec/spec_helper_models.rb b/spec/spec_helper_models.rb
index abc1234..def5678 100644
--- a/spec/spec_helper_models.rb
+++ b/spec/spec_helper_models.rb
@@ -19,12 +19,10 @@
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
-silence_stream(STDOUT) do
- ActiveRecord::Schema.define(version: 0) do
- create_table :posts, force: true do |t|
- t.string :title_sv, :title_en, :title_pt_br
- t.string :body_sv, :body_en, :body_pt_br
- end
+ActiveRecord::Schema.define(version: 0) do
+ create_table :posts, force: true do |t|
+ t.string :title_sv, :title_en, :title_pt_br
+ t.string :body_sv, :body_en, :body_pt_br
end
end
|
Remove use of silence_stream, now gone from Rails
Rails 5 removed it. It doesn't suppress a lot of noise anyway, so it's no big deal. Might even be nicer to see this output (from migrating the DB) to know what is going on.
|
diff --git a/spec/ssdp/listener_spec.rb b/spec/ssdp/listener_spec.rb
index abc1234..def5678 100644
--- a/spec/ssdp/listener_spec.rb
+++ b/spec/ssdp/listener_spec.rb
@@ -8,7 +8,35 @@
it "should receive alive and byebye notifications"
it "should ignore M-SEARCH requests"
- it "should ignore and log unknown requests"
+
+ it "should ignore and log unknown requests" do
+ rd_io, wr_io = IO.pipe
+ RUPNP.logdev = wr_io
+ RUPNP.log_level = :warn
+ begin
+ em do
+ listener = SSDP.listen
+ listener.notifications.subscribe do |notification|
+ fail
+ end
+
+ fake = EM.open_datagram_socket(MULTICAST_IP, DISCOVERY_PORT,
+ FakeMulticast)
+ cmd = "GET / HTTP/1.1\r\n\r\n"
+ fake.send_datagram(cmd, MULTICAST_IP, DISCOVERY_PORT)
+
+ EM.add_timer(1) do
+ warn = rd_io.readline
+ expect(warn).to eq("[warn] Unknown HTTP command: #{cmd[0..-3]}")
+ done
+ end
+ end
+ ensure
+ rd_io.close
+ wr_io.close
+ end
+ end
+
end
end
|
Make RUPNP::SSDP::Listener should ignore and log unknown requests pass.
|
diff --git a/lib/rails/patch/json/encode.rb b/lib/rails/patch/json/encode.rb
index abc1234..def5678 100644
--- a/lib/rails/patch/json/encode.rb
+++ b/lib/rails/patch/json/encode.rb
@@ -5,7 +5,7 @@ [Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].each do |klass|
klass.class_eval do
def to_json(opts = {})
- MultiJson::dump(self, opts)
+ MultiJson::dump(self.as_json(opts), opts)
end
end
end
|
Fix compatibility with Rails' own options like :root, :except and :only
|
diff --git a/lib/requirejs/rails/builder.rb b/lib/requirejs/rails/builder.rb
index abc1234..def5678 100644
--- a/lib/requirejs/rails/builder.rb
+++ b/lib/requirejs/rails/builder.rb
@@ -16,7 +16,11 @@ end
def digest_for(path)
- Rails.application.assets.file_digest(path).hexdigest
+ if !Rails.application.assets.file_digest(path).nil?
+ Rails.application.assets.file_digest(path).hexdigest
+ else
+ puts "Asset digest not found:", path
+ end
end
def generate_rjs_driver
@@ -26,4 +30,4 @@ end
end
end
-end+end
|
Make explicit warnings when an asset is not found
|
diff --git a/test/integration/site_layout_test.rb b/test/integration/site_layout_test.rb
index abc1234..def5678 100644
--- a/test/integration/site_layout_test.rb
+++ b/test/integration/site_layout_test.rb
@@ -11,4 +11,12 @@ assert_select 'a[href=?]', contact_path
end
+ test 'should get signup' do
+ get signup_path
+ assert_response :success
+ assert_template 'users/new'
+ assert_select 'title', "Sign up | Ruby on Rails Tutorial Sample App"
+ assert_select 'h1', 'Sign up'
+ end
+
end
|
Add signup template integration test
|
diff --git a/test/server/run_clang_ptrace_test.rb b/test/server/run_clang_ptrace_test.rb
index abc1234..def5678 100644
--- a/test/server/run_clang_ptrace_test.rb
+++ b/test/server/run_clang_ptrace_test.rb
@@ -0,0 +1,34 @@+# frozen_string_literal: true
+require_relative '../test_base'
+
+module Dual
+ class RunClangPtraceTest < TestBase
+
+ def self.id58_prefix
+ 's8E'
+ end
+
+ # - - - - - - - - - - - - - - - - -
+
+ clang_assert_test 'k8W', %w( clang image adds ptrace capability ) do
+ stdout_tgz = TGZ.of({'stderr' => 'any'})
+ stderr = ''
+ @context = Context.new(
+ logger:StdoutLoggerSpy.new,
+ process:process=ProcessAdapterStub.new,
+ threader:ThreaderStub.new(stdout_tgz, stderr)
+ )
+ puller.add(image_name)
+ tp = ProcessAdapter.new
+ command = nil
+ process.spawn { |cmd,opts| command = cmd; tp.spawn('sleep 10', opts) }
+ process.detach { |pid| tp.detach(pid); ThreadStub.new(0) }
+ process.kill { |signal,pid| tp.kill(signal, pid) }
+
+ run_cyber_dojo_sh
+
+ assert command.include?('--cap-add=SYS_PTRACE'), command
+ end
+
+ end
+end
|
Add server-side clang ptrace test
|
diff --git a/lib/activo-rails.rb b/lib/activo-rails.rb
index abc1234..def5678 100644
--- a/lib/activo-rails.rb
+++ b/lib/activo-rails.rb
@@ -1,6 +1,7 @@ module ActivoRails
class Engine < Rails::Engine
- puts "Loaded engine"
- config.asset_path = "/activo/%s"
+ initializer "static assets" do |app|
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
+ end
end
end
|
Make sure static content is loaded
|
diff --git a/db/migrate/20201112155002_set_other_utilisation_to_zero.rb b/db/migrate/20201112155002_set_other_utilisation_to_zero.rb
index abc1234..def5678 100644
--- a/db/migrate/20201112155002_set_other_utilisation_to_zero.rb
+++ b/db/migrate/20201112155002_set_other_utilisation_to_zero.rb
@@ -0,0 +1,14 @@+require 'etengine/scenario_migration'
+
+class SetOtherUtilisationToZero < ActiveRecord::Migration[5.2]
+ include ETEngine::ScenarioMigration
+
+ def up
+ migrate_scenarios do |scenario|
+ # Set other utilisation to zero. This is a new input. In some areas it
+ # has a non-zero default value. This could result in unintended 'other use'
+ # of captured CO2 in the future.
+ scenario.user_values["demand_of_molecules_other_utilisation_co2"] = 0.0
+ end
+ end
+end
|
Add migration to set 'other utilisation' demand to zero
Set other utilisation to zero. This is a new input. In some areas it has a non-zero default value. This could result in unintended 'other use' of captured CO2 in the future.
|
diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/cmd/help_spec.rb
+++ b/Library/Homebrew/test/cmd/help_spec.rb
@@ -6,6 +6,7 @@ it "prints help for a documented Ruby command" do
expect { brew "help", "cat" }
.to output(/^Usage: brew cat/).to_stdout
+ .and not_to_output.to_stderr
.and be_a_success
end
end
|
Make `brew help cat` test stricter.
|
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -6,7 +6,7 @@ @latest_reviews = Review.order('created_at DESC').limit(2)
@recent_anime_users = User.joins(:watchlists).where('watchlists.episodes_watched > 0').order('MAX(watchlists.last_watched) DESC').group('users.id').limit(8)
- @recent_anime = @recent_anime_users.map {|x| x.watchlists.where("EXISTS (SELECT 1 FROM anime WHERE anime.id = anime_id AND age_rating <> 'Rx')").order('updated_at DESC').limit(1).first }.sort_by {|x| x.last_watched || x.updated_at }.reverse
+ @recent_anime = @recent_anime_users.map {|x| x.watchlists.where("EXISTS (SELECT 1 FROM anime WHERE anime.id = anime_id AND age_rating <> 'R18+')").order('updated_at DESC').limit(1).first }.sort_by {|x| x.last_watched || x.updated_at }.reverse
end
def dashboard
|
Hide hentai on the home page.:
|
diff --git a/app/jobs/update_clinical_trials.rb b/app/jobs/update_clinical_trials.rb
index abc1234..def5678 100644
--- a/app/jobs/update_clinical_trials.rb
+++ b/app/jobs/update_clinical_trials.rb
@@ -12,5 +12,8 @@ end
sleep 1
end
+ orphaned_clinical_trials = ClinicalTrial.joins("LEFT JOIN clinical_trials_sources ON clinical_trials.id = clinical_trials_sources.clinical_trial_id")
+ .where("clinical_trials_sources.source_id IS NULL")
+ orphaned_clinical_trials.delete_all
end
end
|
Delete orphaned/unused clinical trial records
|
diff --git a/app/models/trigger/set_due_date.rb b/app/models/trigger/set_due_date.rb
index abc1234..def5678 100644
--- a/app/models/trigger/set_due_date.rb
+++ b/app/models/trigger/set_due_date.rb
@@ -2,11 +2,11 @@ class Trigger::SetDueDate < Trigger::Action
def days=(a)
- @argument=a
+ self.argument=a
end
def days
- @argument
+ argument
end
def execute(task)
|
Fix argument setter/getter in Trigger::SetDueDate.
|
diff --git a/lib/feedcellar.rb b/lib/feedcellar.rb
index abc1234..def5678 100644
--- a/lib/feedcellar.rb
+++ b/lib/feedcellar.rb
@@ -1,5 +1,7 @@ require "feedcellar/version"
+require "feedcellar/groonga_database"
+require "feedcellar/opml"
+require "feedcellar/command"
module Feedcellar
- # Your code goes here...
end
|
Add require because when use for API
|
diff --git a/lib/hiera/util.rb b/lib/hiera/util.rb
index abc1234..def5678 100644
--- a/lib/hiera/util.rb
+++ b/lib/hiera/util.rb
@@ -8,7 +8,7 @@ end
def microsoft_windows?
- return false if posix?
+ return false unless File::ALT_SEPARATOR
begin
require 'win32/dir'
|
Use File::ALT_SEPARATOR to test platform
|
diff --git a/lib/pronto/cli.rb b/lib/pronto/cli.rb
index abc1234..def5678 100644
--- a/lib/pronto/cli.rb
+++ b/lib/pronto/cli.rb
@@ -9,9 +9,9 @@
method_option :commit,
type: :string,
- default: nil,
+ default: 'master',
aliases: '-c',
- banner: 'Commit for the diff, defaults to master'
+ banner: 'Commit for the diff'
method_option :runner,
type: :array,
@@ -21,10 +21,9 @@
method_option :formatter,
type: :string,
- default: nil,
+ default: 'text',
aliases: '-f',
- banner: "Formatter, defaults to text.
- Available: #{::Pronto::Formatter.names.join(', ')}"
+ banner: "Pick output formatter. Available: #{::Pronto::Formatter.names.join(', ')}"
def exec
gem_names = options[:runner].any? ? options[:runner] : ::Pronto.gem_names
|
Use Thor default parameter, instead of writing it down manually
|
diff --git a/spec/IMF/image/open_spec.rb b/spec/IMF/image/open_spec.rb
index abc1234..def5678 100644
--- a/spec/IMF/image/open_spec.rb
+++ b/spec/IMF/image/open_spec.rb
@@ -0,0 +1,59 @@+require 'spec_helper'
+
+RSpec.xdescribe IMF::Image, '.open' do
+ describe 'Abnormal conditions' do
+ context 'Given a non-existing pathname' do
+ it 'raise Errno::ENOENT', :with_tmpdir do
+ expect {
+ IMF::Image.open(Pathname(tmpdir).join('non_existing.jpg'))
+ }.to raise_error(Errno::ENOENT)
+ end
+ end
+
+ context 'Given a directory pathname' do
+ it 'raise Errno::EISDIR', :with_tmpdir do
+ expect {
+ IMF::Image.open(Pathname(tmpdir))
+ }.to raise_error(Errno::EISDIR)
+ end
+ end
+
+ context 'Given a non-existing filename string' do
+ it 'raise Errno::ENOENT', :with_tmpdir do
+ expect {
+ IMF::Image.open(File.join(tmpdir, 'non_existing.jpg'))
+ }.to raise_error(Errno::ENOENT)
+ end
+ end
+
+ context 'Given a directory name string' do
+ it 'raise Errno::EISDIR', :with_tmpdir do
+ expect {
+ IMF::Image.open(tmpdir)
+ }.to raise_error(Errno::EISDIR)
+ end
+ end
+
+ context 'Given an object not a string nor a pathname' do
+ it 'raises ArgumentError' do
+ expect {
+ IMF::Image.open(42)
+ }.to raise_error(ArgumentError)
+ end
+ end
+ end
+
+ context 'Given a GIF image' do
+ let(:image_filename) do
+ fixture_file("vimlogo-141x141.gif")
+ end
+
+ end
+
+ context 'Given a JPEG image' do
+ let(:image_filename) do
+ fixture_file("momosan.jpg")
+ end
+
+ end
+end
|
:white_check_mark: Add a placeholder spec file for IMF::Image.open
|
diff --git a/app/services/document_publisher.rb b/app/services/document_publisher.rb
index abc1234..def5678 100644
--- a/app/services/document_publisher.rb
+++ b/app/services/document_publisher.rb
@@ -9,9 +9,11 @@ end
Services.publishing_api.publish(document.content_id)
+ # Refresh the document from the publishing-api to get extra fields like
+ # `public_updated_at` that are set on publish.
published_document = document.class.find(document.content_id)
+
indexable_document = SearchPresenter.new(published_document)
-
RummagerWorker.perform_async(
document.search_document_type,
document.base_path,
@@ -19,7 +21,7 @@ )
if document.send_email_on_publish?
- EmailAlertApiWorker.perform_async(EmailAlertPresenter.new(document).to_json)
+ EmailAlertApiWorker.perform_async(EmailAlertPresenter.new(published_document).to_json)
end
if previously_unpublished?(document)
|
Send the published document to email-alert-api
This commit changes the document publisher to send the published document (rather than the in-memory instance before it is published) to email-alert-api and other classes. This means that fields that are populated by publishing-api (such as `public_updated_at`) are available to use.
|
diff --git a/spec/semvergen/bump_spec.rb b/spec/semvergen/bump_spec.rb
index abc1234..def5678 100644
--- a/spec/semvergen/bump_spec.rb
+++ b/spec/semvergen/bump_spec.rb
@@ -1,5 +1,5 @@ describe Semvergen::Bump do
- let(:semvergen) { Semvergen::Bump.new nil, nil, nil, nil, nil, nil, nil }
+ let(:semvergen) { Semvergen::Bump.new nil, nil, nil, nil, nil, nil, nil, nil }
describe :next_version do
let(:next_version) { semvergen.next_version current_version, release_type }
|
Fix spec broken by removing default arg
|
diff --git a/spec/unit/account_helper.rb b/spec/unit/account_helper.rb
index abc1234..def5678 100644
--- a/spec/unit/account_helper.rb
+++ b/spec/unit/account_helper.rb
@@ -0,0 +1,21 @@+# spec/unit/account.rb
+
+require_relative '../spec_helper'
+
+describe 'Character', :unit do
+ before do
+ Account.all.destroy
+ end
+
+ it "is valid with a username and password" do
+ a = Account.create
+ a.name = "test"
+ a.password = "test"
+ a.valid?.must_equal false
+ end
+
+ it "is invalid without a username and password" do
+ a = Account.create
+ a.valid?.must_equal false
+ end
+end
|
Add unit tests for the account model
|
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sessions_helper.rb
+++ b/app/helpers/sessions_helper.rb
@@ -1,9 +1,4 @@ module SessionsHelper
-
- def current_user=(user)
- # set the current user object
- @current_user = user
- end
def current_user
# find and return the current user object
@@ -25,4 +20,11 @@ ! self.current_user.nil?
end
+ private
+
+ def current_user=(user)
+ # set the current user object
+ @current_user = user
+ end
+
end
|
Make current user assignment private
|
diff --git a/test/graph_test.rb b/test/graph_test.rb
index abc1234..def5678 100644
--- a/test/graph_test.rb
+++ b/test/graph_test.rb
@@ -0,0 +1,19 @@+require 'test_helper'
+
+describe Funk::Graph do
+ it "orders functions in dependency order" do
+ graph = Funk::Graph.new(
+ a: -> (b, d) { "#{b}, #{d}" },
+ b: -> (c, e) { "#{c}, #{e}" },
+ c: -> (d, e, f) { "#{d}, #{e}, #{f}" },
+ g: -> (f) { "separate graph" },
+ )
+
+ seen = []
+
+ graph.tsort.each do |fn|
+ assert !seen.include?(fn.name)
+ seen += fn.dependencies
+ end
+ end
+end
|
Add a quick test for the graph
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -6,8 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version IO.read(File.join(File.dirname(__FILE__), 'VERSION')) rescue "0.0.1"
-supports 'ubuntu', '= 14.04'
-supports 'ubuntu', '= 13.04'
+supports 'ubuntu', '>= 12.04'
depends 'python'
depends 'runit'
|
Change supported platforms to 12.04+
|
diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/appearances_helper.rb
+++ b/app/helpers/appearances_helper.rb
@@ -2,7 +2,12 @@
module AppearancesHelper
def brand_title
- current_appearance&.title.presence || 'GitLab Community Edition'
+ current_appearance&.title.presence || default_brand_title
+ end
+
+ def default_brand_title
+ # This resides in a separate method so that EE can easily redefine it.
+ 'GitLab Community Edition'
end
def brand_image
|
Move default brand title to a method
This moves the default brand title in AppearancesHelper#brand_title to a
separate method, allowing EE to redefine it without having to redefine
the entire #brand_title method.
|
diff --git a/lib/interactive_bitmap_editor/command_interpreter.rb b/lib/interactive_bitmap_editor/command_interpreter.rb
index abc1234..def5678 100644
--- a/lib/interactive_bitmap_editor/command_interpreter.rb
+++ b/lib/interactive_bitmap_editor/command_interpreter.rb
@@ -1,4 +1,5 @@ require 'interactive_bitmap_editor/matrix/matrix'
+require 'interactive_bitmap_editor/exceptions'
module InteractiveBitmapEditor
class CommandInterpreter
@@ -32,6 +33,10 @@ @matrix.fill_region(x, y, colour)
when 'P'
@printer.print @matrix.contents
+ when 'X'
+ raise InteractiveBitmapEditor::Exceptions::AbortProgram
+ else
+ raise InteractiveBitmapEditor::Exceptions::UnknownCommand
end
end
|
Support program exit and raise on unsupported command request.
|
diff --git a/fluent-plugin-logsene.gemspec b/fluent-plugin-logsene.gemspec
index abc1234..def5678 100644
--- a/fluent-plugin-logsene.gemspec
+++ b/fluent-plugin-logsene.gemspec
@@ -4,7 +4,7 @@
Gem::Specification.new do |spec|
spec.name = "fluent-plugin-logsene"
- spec.version = "0.0.2"
+ spec.version = "0.0.3"
spec.authors = ["Sematext"]
spec.email = ["info@sematext.com"]
spec.description = %q{fluent plugin for logsene}
|
Bump spec version to 0.0.3
|
diff --git a/lib/flame/static.rb b/lib/flame/static.rb
index abc1234..def5678 100644
--- a/lib/flame/static.rb
+++ b/lib/flame/static.rb
@@ -2,6 +2,8 @@ class Dispatcher
## Module for working with static files
module Static
+ private
+
## Find static files and try return it
def try_static(dir = config[:public_dir])
file = File.join(dir, URI.decode(request.path_info))
|
Make Static method for Dispatcher private
|
diff --git a/lib/forem/engine.rb b/lib/forem/engine.rb
index abc1234..def5678 100644
--- a/lib/forem/engine.rb
+++ b/lib/forem/engine.rb
@@ -5,7 +5,7 @@ class << self
attr_accessor :root
def root
- @root ||= Pathname.new(File.expand_path('../../', __FILE__))
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end
end
|
Change Engine.root to match the actual root of Forem and not the lib directory.
Fixes #366
|
diff --git a/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb b/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
index abc1234..def5678 100644
--- a/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
+++ b/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
@@ -9,7 +9,7 @@ module TakesScreenshot
def save_screenshot(png_path)
- File.open(png_path, 'w') { |f| f << screenshot_as(:png) }
+ File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
end
def screenshot_as(format)
@@ -26,4 +26,4 @@ end # TakesScreenshot
end # DriverExtensions
end # WebDriver
-end # Selenium+end # Selenium
|
JariBakken: Use "wb" mode string when saving screenshots (needed on Windows).
git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@9686 07704840-8298-11de-bf8c-fd130f914ac9
|
diff --git a/app/solidus_decorators/spree/variant_decorator.rb b/app/solidus_decorators/spree/variant_decorator.rb
index abc1234..def5678 100644
--- a/app/solidus_decorators/spree/variant_decorator.rb
+++ b/app/solidus_decorators/spree/variant_decorator.rb
@@ -3,7 +3,7 @@
private
def mailchimp_sync
- if product && product.deleted?
+ if product && !product.deleted?
SolidusMailchimpSync::VariantSynchronizer.new(self).auto_sync
end
end
|
Fix product delete logic on variant decorator
|
diff --git a/scripts/mock_sieste.rb b/scripts/mock_sieste.rb
index abc1234..def5678 100644
--- a/scripts/mock_sieste.rb
+++ b/scripts/mock_sieste.rb
@@ -0,0 +1,69 @@+require 'sinatra'
+require 'json'
+
+require 'sinatra/reloader' if development?
+set :port, 1234
+
+
+simple = ["JISPVTWX", "EVVDPKOX", "FASXEOMD", "FWNDTEZZ", "WZBXPSXK", "PRBXDCLZ"]
+meta_list = ["hostname","metric","uom"]
+
+list_url = "/simple/search"
+metric_url = "/interpolated/:source"
+
+
+get '/' do
+ "MOCK Sieste thingy. Use in case of ZMQTmieouts or whatnot." +
+ "<dt><code>#{list_url}</code> <dd>query list of available sources</dt>"+
+ "<dt><code>#{metric_url}</code> <dd>get information for a source</dt>"
+end
+
+get list_url do
+ content_type :json
+ return [].to_json if params[:page] && params[:page].to_i > 0
+ list = simple.each_with_index.map{|a,i| "address~#{a},#{meta_list.map{|b| "#{b}~#{a}"}.join(",")}#{",is_float~true" if i.even?}"}
+ list.to_json
+end
+
+get metric_url do
+ content_type :json
+
+ [:start, :end].each do |p|
+ return { error: "Must provide #{p}"}.to_json unless params[p]
+ end
+
+ start = params[:start].to_i
+
+ return {error: "Start must be > 0"}.to_json if start < 0
+ stop = params[:end].to_i
+ step = (params[:interval] || 60).to_i
+ float = true if params[:as_double]
+
+ unless simple.include? params[:source] then
+ return {error: "Source #{params[:source]} does not exist. Check #{list_url}"}.to_json
+ end
+
+ source = params[:source]
+
+ i = simple.index(source) || 2
+ len = simple.length
+
+ data = []
+
+ round = float ? 2 : 0
+
+ (start..(stop-step)).step(step).each do |x|
+ y = 10 * (Math.sin(0.005 * x) + Math.sin((0.004 * x) + ((Math::PI * i) / len) )) + 20 + i
+ data << [x,y.round(round)]
+ end
+
+ data.to_json
+
+end
+
+["/source/","/source"].each do |path|
+ get path do
+ "Must provide a source. See <code>#{list_url}</code>"
+ end
+end
+
|
Add very basic sieste v2 mock instance
|
diff --git a/spec/redis_spec.rb b/spec/redis_spec.rb
index abc1234..def5678 100644
--- a/spec/redis_spec.rb
+++ b/spec/redis_spec.rb
@@ -22,9 +22,9 @@ include_context 'session_helper'
include_context 'tomcat_helper'
- xit 'stores session data from Tomcat',
- fixture: 'default' do
- expect(redis.get(session_id)).to eq(session_data)
+ it 'stores session data from Tomcat',
+ fixture: 'default' do
+ expect(redis.get(session_id).scrub).to match(session_data)
end
end
|
Enable basic test for storing session data in Redis
This change enables the test for storing session data in Redis (rather
than in Tomcat's native session data store).
[#64605932]
|
diff --git a/lib/mws-rb/api/base.rb b/lib/mws-rb/api/base.rb
index abc1234..def5678 100644
--- a/lib/mws-rb/api/base.rb
+++ b/lib/mws-rb/api/base.rb
@@ -2,7 +2,6 @@ module API
class Base
attr_reader :connection, :uri, :version, :verb
- @verb = :get
def initialize(connection)
@verb ||= :get
@@ -11,6 +10,7 @@
def call(action, params={})
@verb = params.delete(:verb) || @verb
+ request_params = params.delete(:format, :body)
query = Query.new({
verb: @verb,
uri: @uri,
@@ -28,7 +28,7 @@ when "GET"
HTTParty.get(query.request_uri)
when "POST"
- HTTParty.post(query.request_uri)
+ HTTParty.post(query.request_uri, request_params)
end
end
end
|
Send body params (format, body) to post requests
|
diff --git a/lib/hmote/render.rb b/lib/hmote/render.rb
index abc1234..def5678 100644
--- a/lib/hmote/render.rb
+++ b/lib/hmote/render.rb
@@ -8,8 +8,9 @@
def self.setup(app)
app.settings[:hmote] ||= {}
- app.settings[:hmote][:views] ||= File.expand_path("views", Dir.pwd)
- app.settings[:hmote][:layout] ||= "layout"
+
+ app.layout("layout")
+ app.view_path("views")
end
def render(template, params = {}, layout = settings[:hmote][:layout])
@@ -30,4 +31,14 @@ def template_path(template)
return File.join(settings[:hmote][:views], "#{template}.mote")
end
+
+ module ClassMethods
+ def layout(name)
+ settings[:hmote][:layout] = name
+ end
+
+ def view_path(path)
+ settings[:hmote][:views] = File.expand_path(path, Dir.pwd)
+ end
+ end
end
|
Add class methods to set layout and view path.
|
diff --git a/app/concerns/viewable.rb b/app/concerns/viewable.rb
index abc1234..def5678 100644
--- a/app/concerns/viewable.rb
+++ b/app/concerns/viewable.rb
@@ -7,12 +7,14 @@ def mark_read(user, at_time=nil)
view = view_for(user)
return true if view.ignored
- if at_time.present? && !view.new_record?
+ if view.new_record?
+ view.updated_at = at_time
+ view.save
+ else
+ return view.touch unless at_time.present?
return true if at_time <= view.updated_at
- return view.update_attributes(updated_at: at_time)
+ view.update_attributes(updated_at: at_time)
end
- return view.save if view.new_record?
- view.touch
end
def ignore(user)
|
Refactor to respect at_time for new view records
|
diff --git a/SafeUINavigationController.podspec b/SafeUINavigationController.podspec
index abc1234..def5678 100644
--- a/SafeUINavigationController.podspec
+++ b/SafeUINavigationController.podspec
@@ -0,0 +1,28 @@+#
+# Be sure to run `pod lib lint SafeUINavigationController.podspec' to ensure this is a
+# valid spec and remove all comments before submitting the spec.
+#
+# Any lines starting with a # are optional, but encouraged
+#
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
+#
+
+Pod::Spec.new do |s|
+ s.name = "SafeUINavigationController"
+ s.version = "1.0.0"
+ s.summary = "A drop-in replacement for UINavigationController to serialize transistions."
+ s.homepage = "https://github.com/CapoChino/SafeUINavigationController"
+ s.license = 'MIT'
+ s.author = { "Casey Persson" => "casey.persson@gmail.com" }
+ s.source = { :git => "https://github.com/CapoChino/SafeUINavigationController.git", :tag => s.version.to_s }
+ s.platform = :ios, '7.0'
+ s.requires_arc = true
+ s.source_files = 'SafeUINavigationController.{m,h}'
+ #s.resource_bundles = {
+ # 'SafeUINavigationController' => ['Pod/Assets/*.png']
+ #}
+
+ # s.public_header_files = 'Pod/Classes/**/*.h'
+ # s.frameworks = 'UIKit', 'MapKit'
+ # s.dependency 'AFNetworking', '~> 2.3'
+end
|
Add a podspec file to make this into a CocoaPod.
|
diff --git a/lib/slippery/assets.rb b/lib/slippery/assets.rb
index abc1234..def5678 100644
--- a/lib/slippery/assets.rb
+++ b/lib/slippery/assets.rb
@@ -1,13 +1,17 @@ require 'fileutils'
+# Manage the assets and their URI/path
module Slippery
module Assets
ASSETS_PATH = '../../../assets/'
+ # Copies the assets locally
def self.embed_locally
FileUtils.cp_r(File.expand_path(ASSETS_PATH, __FILE__), './')
end
+ # returns a composer returning a URI for a given relative file path
+ # considering if the asset is local or not
def self.path_composer(local)
if local
->(path) { File.join('assets', path) }
|
Add documentation to Assets module
|
diff --git a/lib/travis/api/app/schedulers/schedule_cron_jobs.rb b/lib/travis/api/app/schedulers/schedule_cron_jobs.rb
index abc1234..def5678 100644
--- a/lib/travis/api/app/schedulers/schedule_cron_jobs.rb
+++ b/lib/travis/api/app/schedulers/schedule_cron_jobs.rb
@@ -32,8 +32,12 @@ scheduled = Travis::API::V3::Models::Cron.scheduled
count = scheduled.count
- Travis.logger.info "Found #{count} cron jobs to enqueue"
-
+ if Travis.config.enterprise
+ Travis.logger.debug "Found #{count} cron jobs to enqueue"
+ else
+ Travis.logger.info "Found #{count} cron jobs to enqueue"
+ end
+
Metriks.gauge("api.v3.cron_scheduler.upcoming_jobs").set(count)
scheduled.each do |cron|
@@ -48,4 +52,4 @@ end
end
end
-end+end
|
Make cron enqueue messages debug only in enterprise
|
diff --git a/lib/multi_logger.rb b/lib/multi_logger.rb
index abc1234..def5678 100644
--- a/lib/multi_logger.rb
+++ b/lib/multi_logger.rb
@@ -7,7 +7,7 @@ rails_logger_class = get_rails_logger_class()
if rails_logger_class.method_defined?(name)
- raise "'#{name}' is reserved in #{rails_logger_class} and can not be used as a log name."
+ raise "'#{name}' is reserved in #{rails_logger_class} and can not be used as a log accessor name."
else
logger = Logger.new(get_path(name, path))
rails_logger_class.class_eval do
|
Update message for name collision
|
diff --git a/lib/plugins/cafe.rb b/lib/plugins/cafe.rb
index abc1234..def5678 100644
--- a/lib/plugins/cafe.rb
+++ b/lib/plugins/cafe.rb
@@ -15,17 +15,14 @@ cafe_hash = {}
return m.reply 'no results bru' if response.body['channel']['result'] == '0'
response.body['channel']['item'].each do |cafe|
- if cafe_hash[cafe['cafeUrl']].nil?
- cafe_hash[cafe['cafeUrl']] = 1
- else
- cafe_hash[cafe['cafeUrl']] += 1
- end
+ cafe_hash[cafe['cafeUrl']] += 1
+ cafe_hash[cafe['cafeUrl']] = 1 if cafe_hash[cafe['cafeUrl']].nil?
+ m.reply cafe_hash.max_by { |k,v| v }.first.strip
end
- m.reply cafe_hash.max_by {|k,v| v}.first
end
def help(m)
- m.reply 'searches daumcafe posts and returns cafe url for most frequent '
+ m.reply 'searches daumcafe posts and returns cafe url for cafe most posted in'
end
end
|
Refactor and clarify help method response
|
diff --git a/lib/rmega/crypto.rb b/lib/rmega/crypto.rb
index abc1234..def5678 100644
--- a/lib/rmega/crypto.rb
+++ b/lib/rmega/crypto.rb
@@ -9,5 +9,12 @@ include AesEcb
include AesCtr
include Rsa
+
+ # Check if all the used ciphers are supported
+ ciphers = OpenSSL::Cipher.ciphers.map(&:upcase)
+ %w[AES-128-CBC AES-128-CTR AES-128-ECB].each do |name|
+ next if ciphers.include?(name)
+ warn "WARNING: Your Ruby is compiled with OpenSSL #{OpenSSL::VERSION} and does not support cipher #{name}."
+ end
end
end
|
Check if all the used ciphers are supported
|
diff --git a/api/notifications_and_subscriptions.rb b/api/notifications_and_subscriptions.rb
index abc1234..def5678 100644
--- a/api/notifications_and_subscriptions.rb
+++ b/api/notifications_and_subscriptions.rb
@@ -3,7 +3,7 @@ end
get "#{APIPREFIX}/users/:user_id/subscribed_threads" do |user_id|
- handle_threads_query(user.subscribed_threads)
+ handle_threads_query(user.subscribed_threads.where(:course_id=>params[:course_id]))
end
post "#{APIPREFIX}/users/:user_id/subscriptions" do |user_id|
|
Make sure to scope followed threads by course.
|
diff --git a/handy_feature_helpers.gemspec b/handy_feature_helpers.gemspec
index abc1234..def5678 100644
--- a/handy_feature_helpers.gemspec
+++ b/handy_feature_helpers.gemspec
@@ -18,6 +18,9 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
+ spec.add_dependency 'capybara'
+ spec.add_dependency 'rspec'
+
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end
|
[gemspec] Add dependencies to capybara and rspec
|
diff --git a/compath.gemspec b/compath.gemspec
index abc1234..def5678 100644
--- a/compath.gemspec
+++ b/compath.gemspec
@@ -24,4 +24,5 @@ spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
+ spec.add_development_dependency "pry"
end
|
Add pry as development dependency
|
diff --git a/test/new/test_helper.rb b/test/new/test_helper.rb
index abc1234..def5678 100644
--- a/test/new/test_helper.rb
+++ b/test/new/test_helper.rb
@@ -1,5 +1,6 @@ require 'pathname'
require 'rubygems'
+require 'bundler/setup'
require 'minitest/autorun'
require 'mocha/setup'
|
Add bundler initialization to test helper
|
diff --git a/middleman-neat.gemspec b/middleman-neat.gemspec
index abc1234..def5678 100644
--- a/middleman-neat.gemspec
+++ b/middleman-neat.gemspec
@@ -16,5 +16,5 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
- gem.add_dependency "sinatra"
+ gem.add_dependency "neat"
end
|
Add neat as dependency, not sinatra..
|
diff --git a/files/default/ohai_plugins/pci.rb b/files/default/ohai_plugins/pci.rb
index abc1234..def5678 100644
--- a/files/default/ohai_plugins/pci.rb
+++ b/files/default/ohai_plugins/pci.rb
@@ -21,10 +21,13 @@ pci2 Mash.new
# use the more verbose lspci output:
# devices are split by double newlines
- `lspci -vmm`.split("\n\n").each do |d|
+ # -vmm: output format
+ # -k: add kernel driver
+ # -nn: add numeric PCI ids
+ `lspci -vmm -k -nn`.split("\n\n").each do |d|
# each device is a list of "key1:\tvalue1\nkey2:..."
# we scan this into [ [ 'key1', 'value1' ], [ ... ] ]
- a = d.scan(/^(.*?):\t(.*?)\n/)
+ a = d.scan(/^(.*?):\t(.*?)$/)
# make the keys lowercase and turn result into a hash
h = a.map { |k, v| [k.downcase, v] }.to_h
# remove the 'slot' and use it as the key for the pci2 hash
|
Extend collected information and fix regex for scan
|
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -5,12 +5,18 @@ end
def create
- user = User.find_by(name: params[:name])
- if user and user.authenticate(params[:password])
+ if User.count > 1
+ user = User.find_by(name: params[:name])
+ if user and user.authenticate(params[:password])
+ session[:user_id] = user.id
+ redirect_to admin_url
+ else
+ redirect_to login_url, alert: "Invalid user/password combination"
+ end
+ else
+ user = User.create(name: params[:name], password: params[:password])
session[:user_id] = user.id
redirect_to admin_url
- else
- redirect_to login_url, alert: "Invalid user/password combination"
end
end
|
Create a new user, if there is none
|
diff --git a/lib/analytics-client.rb b/lib/analytics-client.rb
index abc1234..def5678 100644
--- a/lib/analytics-client.rb
+++ b/lib/analytics-client.rb
@@ -0,0 +1,44 @@+#!/usr/bin/env ruby -w
+require 'optparse'
+require 'yaml'
+
+puts 'Fetching all data'
+
+#grab config
+options = {}
+
+OptionParser.new do |opts|
+ opts.banner = "Usage: analytics-client.rb [options]"
+
+ opts.on("-v", "Run verbosely") do |v|
+ options[:verbose] = v
+ end
+
+ opts.on("-c", "--config PATH", "Path to config") do |path|
+ settings = YAML::load_file path
+
+ if settings
+ options[:config] = settings
+ else
+ raise 'Config file does not exist.'
+ end
+ end
+
+ opts.on("-j", "--jobs JOBS", Array, "job name") do |jobs|
+ options[:jobs] = jobs
+ end
+end.parse!
+
+if options[:jobs].respond_to? :each
+ options[:config].keep_if { |key|
+ options[:jobs].member? key
+ }
+end
+
+p options[:config]
+
+
+#require_relative 'Flurry/flurry.wikia'
+#require_relative 'GTMetrix/gtmetrix.wikia'
+
+puts 'Done'
|
Allow for passing -c for config path and -j for job names
|
diff --git a/lib/sass/plugin/merb.rb b/lib/sass/plugin/merb.rb
index abc1234..def5678 100644
--- a/lib/sass/plugin/merb.rb
+++ b/lib/sass/plugin/merb.rb
@@ -1,10 +1,19 @@ unless defined?(Sass::MERB_LOADED)
Sass::MERB_LOADED = true
- Sass::Plugin.options.merge!(:template_location => MERB_ROOT + '/public/stylesheets/sass',
- :css_location => MERB_ROOT + '/public/stylesheets',
- :always_check => MERB_ENV != "production",
- :full_exception => MERB_ENV != "production")
+ version = Merb::VERSION.split('.').map { |n| n.to_i }
+ if version[0] <= 0 && version[1] < 5
+ root = MERB_ROOT
+ env = MERB_ENV
+ else
+ root = Merb.root
+ env = Merb.environment
+ end
+
+ Sass::Plugin.options.merge!(:template_location => root + '/public/stylesheets/sass',
+ :css_location => root + '/public/stylesheets',
+ :always_check => env != "production",
+ :full_exception => env != "production")
config = Merb::Plugins.config[:sass] || Merb::Plugins.config["sass"] || {}
config.symbolize_keys!
Sass::Plugin.options.merge!(config)
|
Use the proper Merb root and environment constants. Thanks to Dan Gilkerson.
git-svn-id: 93069e0dc7225fbffdaa34e2b50be2112296e79e@727 7063305b-7217-0410-af8c-cdc13e5119b9
|
diff --git a/lib/sensu-plugin/cli.rb b/lib/sensu-plugin/cli.rb
index abc1234..def5678 100644
--- a/lib/sensu-plugin/cli.rb
+++ b/lib/sensu-plugin/cli.rb
@@ -52,7 +52,7 @@ rescue SystemExit => e
exit e.status
rescue Exception => e
- self.new.critical "Check failed to run: #{e}"
+ self.new.critical "Check failed to run: #{e.message}, #{e.backtrace}"
end
self.new.warning "Check did not exit! You should call an exit code method."
end
|
Include backtrace in failure message
|
diff --git a/merging/binary.rb b/merging/binary.rb
index abc1234..def5678 100644
--- a/merging/binary.rb
+++ b/merging/binary.rb
@@ -0,0 +1,58 @@+module Merging
+ # @abstract A Service for taking two sorted list, and merging them into a
+ # single sorted list. Each item in the lists must be comparable, ie. It must
+ # respond to and implement the Ruby comparison methods
+ # (:<, :<=, :==, :>=, :>, :<=>), at the very least they should implement the
+ # default :<
+ class Binary
+ # Takes sorted lists and merges them into a single sorted list.
+ #
+ # @example using Integers
+ # Merging::Binary.call [1, 3, 5], [2, 4, 6]
+ # #=> [1, 2, 3, 4, 5, 6]
+ #
+ # @example using Strings
+ # Merging::Binary.call ['a', 'c'], ['b', 'd']
+ # #=> ['a', 'b', 'c', 'd']
+ #
+ # @example using a custom comparable class
+ # class TestCompare
+ # include Comparable
+ # attr_accessor :comp_val
+ #
+ # def initialize(val)
+ # @comp_val = val
+ # end
+ #
+ # def <=>(other)
+ # comp_cal <=> other.comp_val
+ # end
+ # end
+ # a = TestCompare.new(1); b = TestCompare.new(2); c = TestCompare.new(3)
+ #
+ # Merging::Binary.call [a, c], [b]
+ # #=> [a, b, c]
+ #
+ # @example using Integers with a descending direction
+ # Merging::Binary.call [5, 3, 1], [6, 4, 2], :>
+ # #=> [6, 5, 4, 3, 2, 1]
+ #
+ # @param list_a [Array] A sorted array
+ # @param list_b [Array] A sorted array
+ # @param dir [Symbol] the direction to sort the list, defaults to :< for an
+ # ascending sort, pass :> if a descending sort is desired
+ #
+ # @return [Array] A sorted array containing the content of list_a and list_b
+ def self.call(list_a, list_b, dir = :<)
+ operand = :"#{dir}="
+ [].tap do |output|
+ until list_a.empty? || list_b.empty?
+ to_shift = list_a.first.send(operand, list_b.first) ? :a : :b
+ output.push(binding.local_variable_get(:"list_#{to_shift}").shift)
+ end
+ output.push(*list_a) unless list_a.empty?
+ output.push(*list_b) unless list_b.empty?
+ end
+ end
+ end
+end
|
Change module / class naming and add documentation
|
diff --git a/app/models/gitosis_observer.rb b/app/models/gitosis_observer.rb
index abc1234..def5678 100644
--- a/app/models/gitosis_observer.rb
+++ b/app/models/gitosis_observer.rb
@@ -17,13 +17,13 @@
def update_repositories(object)
case object
- when Project: Gitosis::update_repositories(object)
- when Repository: Gitosis::update_repositories(object.project)
- when User: Gitosis::update_repositories(object.projects)
- when GitosisPublicKey: Gitosis::update_repositories(object.user.projects)
- when Member: Gitosis::update_repositories(object.project)
- when Role: Gitosis::update_repositories(object.members.map(&:project).uniq.compact)
+ when Project then Gitosis::update_repositories(object)
+ when Repository then Gitosis::update_repositories(object.project)
+ when User then Gitosis::update_repositories(object.projects)
+ when GitosisPublicKey then Gitosis::update_repositories(object.user.projects)
+ when Member then Gitosis::update_repositories(object.project)
+ when Role then Gitosis::update_repositories(object.members.map(&:project).uniq.compact)
end
end
-end+end
|
Fix cases for ruby 1.9
|
diff --git a/app/models/renalware/hd/session/dna.rb b/app/models/renalware/hd/session/dna.rb
index abc1234..def5678 100644
--- a/app/models/renalware/hd/session/dna.rb
+++ b/app/models/renalware/hd/session/dna.rb
@@ -16,14 +16,6 @@ delay = Renalware.config.delay_after_which_a_finished_session_becomes_immutable
(Time.zone.now - delay) > created_at
end
-
- # DNA sessions have a nil jsonb `document` but to avoid clumsy nil? checks
- # wherever session.documents are being used, always return a NullSessionDocument
- # which will even allow you to do eg session.document.objecta.objectb.attribute1 without
- # issue. Inspired by Avdi Grim's confident ruby approach and using his naught gem.
- def document
- super || NullSessionDocument.instance
- end
end
end
end
|
Remove DNA null session document
Its causing issues elsewhere. Reinstate later,
|
diff --git a/config/environments/production.rb b/config/environments/production.rb
index abc1234..def5678 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -21,5 +21,5 @@ # SOFTWARE.
Yeah.application.configure :production do
- log_folder File.join(ENV['ORBIT_HOME'], 'logs'), 'iss.log'
+ log_folder File.join(ENV.fetch('ORBIT_HOME', '.'), 'logs'), 'iss.log'
end
|
Use same folder for log file if ORBIT_HOME is not set
|
diff --git a/tests/clippy.rb b/tests/clippy.rb
index abc1234..def5678 100644
--- a/tests/clippy.rb
+++ b/tests/clippy.rb
@@ -1,4 +1,4 @@-$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../lib')))
+$:.unshift(File.expand_path("../../lib", __FILE__))
unless defined?(Gem) then require 'rubygems' end
require 'minitest/autorun'
require 'minitest/pride'
|
Clean up the $:.unshift expand_path a bit.
|
diff --git a/test/compiler_compile_test.rb b/test/compiler_compile_test.rb
index abc1234..def5678 100644
--- a/test/compiler_compile_test.rb
+++ b/test/compiler_compile_test.rb
@@ -2,20 +2,27 @@
class CompilerCompileTest < Test::Unit::TestCase
include IronRubyInline
-
+
context "when no output is specified" do
setup do
+ def Compiler.compile_from_parameters(code, parameters)
+ $parameters = parameters
+ end
flexmock(IronRubyInline::Path).
should_receive(:tmpfile => "tempfilename").
once
end
should "use temp file name for output parameter" do
- def Compiler.compile_from_parameters(code, parameters)
- $parameters = parameters
- end
IronRubyInline::Compiler.compile("code")
assert_equal "tempfilename", $parameters.output
end
end
+
+ context "when output is specified" do
+ should "use specified file name for output parameter" do
+ IronRubyInline::Compiler.compile("code", :output => "output")
+ assert_equal "output", $parameters.output
+ end
+ end
end
|
Add when output is specified test.
|
diff --git a/coursemology2/db/transforms/models/file_upload.rb b/coursemology2/db/transforms/models/file_upload.rb
index abc1234..def5678 100644
--- a/coursemology2/db/transforms/models/file_upload.rb
+++ b/coursemology2/db/transforms/models/file_upload.rb
@@ -9,17 +9,22 @@ # Return the attachment reference or nil
def transform_attachment_reference
hash = $url_mapper.get_hash(url)
+ reference = nil
if hash && attachment = ::Attachment.find_by(name: hash)
- ::AttachmentReference.new(
- attachment: attachment,
- name: sanitized_name
- )
+ reference = ::AttachmentReference.new(
+ attachment: attachment,
+ name: sanitized_name
+ )
elsif local_file = download_to_local
- reference = ::AttachmentReference.new(file: local_file)
+ attachment = ::Attachment.find_or_initialize_by(file: local_file)
+ attachment.save!
+ local_file.close unless local_file.closed?
+ reference = ::AttachmentReference.new(attachment: attachment)
reference.name = sanitized_name
$url_mapper.set(url, reference.attachment.name, reference.url)
- reference
end
+
+ reference
end
def url
|
Create attachment first before build the reference
|
diff --git a/db/migrate/20140621230121_change_suburb_postcode_to_string.rb b/db/migrate/20140621230121_change_suburb_postcode_to_string.rb
index abc1234..def5678 100644
--- a/db/migrate/20140621230121_change_suburb_postcode_to_string.rb
+++ b/db/migrate/20140621230121_change_suburb_postcode_to_string.rb
@@ -4,6 +4,6 @@ end
def down
- change_column :suburbs, :postcode, :integer
+ change_column :suburbs, :postcode, 'integer USING (postcode::integer)'
end
end
|
Fix down migration - need explicit cast for string -> integer
|
diff --git a/spec/photomosaic/image_spec.rb b/spec/photomosaic/image_spec.rb
index abc1234..def5678 100644
--- a/spec/photomosaic/image_spec.rb
+++ b/spec/photomosaic/image_spec.rb
@@ -12,10 +12,10 @@
describe "#calculate_color_distance" do
it "should calculate color distance" do
- color_a = { red: 100, green: 200, blue: 300 }
+ color_a = { red: 50, green: 100, blue: 200 }
color_b = { red: 10, green: 20, blue: 30 }
expect(described_class.calculate_color_distance(color_a, color_b))
- .to be_within(336.7).of(336.8)
+ .to be_within(192.0).of(192.1)
end
end
|
Fix test data to be suitable for RGB range
|
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,23 +1,18 @@-require 'beaker-rspec/spec_helper'
-require 'beaker-rspec/helpers/serverspec'
+require 'beaker-rspec'
+require 'beaker-puppet'
require 'beaker/puppet_install_helper'
+require 'beaker/module_install_helper'
run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
RSpec.configure do |c|
- # Project root
- proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
- # Install module and dependencies
- puppet_module_install(source: proj_root, module_name: 'selinux')
- hosts.each do |host|
- on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1]
- end
+ install_module
+ install_module_dependencies
end
end
|
Clean up acceptance spec helper
|
diff --git a/spec/support/validator_spec.rb b/spec/support/validator_spec.rb
index abc1234..def5678 100644
--- a/spec/support/validator_spec.rb
+++ b/spec/support/validator_spec.rb
@@ -1,7 +1,7 @@ RSpec.shared_examples "validate valid parameter" do |validator_class, parameter|
subject(:valid_parameter_validator) { validator_class.new('name', validator_definition, parameter).tap {|validator| validator.validate} }
- it 'should be valid' do
+ it 'is valid' do
expect(valid_parameter_validator.is_valid).to be_truthy
end
end
@@ -9,11 +9,11 @@ RSpec.shared_examples "validate invalid parameter" do |validator_class, parameter, error|
subject(:invalid_parameter_validator) { validator_class.new('name', validator_definition, parameter).tap {|validator| validator.validate} }
- it 'should not be valid' do
+ it 'is not valid' do
expect(invalid_parameter_validator.is_valid).to be_falsey
end
- it 'should have an error' do
+ it 'has an error' do
expect(invalid_parameter_validator.error).to eql "name:#{error} does not match allowed_pattern:#{validator_definition[:allowed_pattern]}"
end
-end+end
|
Use positive language for specs
|
diff --git a/spec/tty/table/options_spec.rb b/spec/tty/table/options_spec.rb
index abc1234..def5678 100644
--- a/spec/tty/table/options_spec.rb
+++ b/spec/tty/table/options_spec.rb
@@ -0,0 +1,30 @@+# -*- encoding: utf-8 -*-
+
+require 'spec_helper'
+
+describe TTY::Table, 'options' do
+ let(:rows) { [['a1', 'a2'], ['b1', 'b2']] }
+ let(:widths) { [] }
+ let(:aligns) { [] }
+ let(:object) {
+ described_class.new rows, :column_widths => widths, :column_aligns => aligns
+ }
+
+ subject { object.to_s; object.renderer }
+
+ its(:column_widths) { should == [2,2] }
+
+ its(:column_aligns) { should == [] }
+
+ context '#column_widths' do
+ let(:widths) { [10, 10] }
+
+ its(:column_widths) { should == widths }
+ end
+
+ context '#column_aligns' do
+ let(:aligns) { [:center, :center] }
+
+ its(:column_aligns) { should == aligns }
+ end
+end
|
Add integration tests between table and basic renderer.
|
diff --git a/spec/views/dataservice/blobs/index.html.haml_spec.rb b/spec/views/dataservice/blobs/index.html.haml_spec.rb
index abc1234..def5678 100644
--- a/spec/views/dataservice/blobs/index.html.haml_spec.rb
+++ b/spec/views/dataservice/blobs/index.html.haml_spec.rb
@@ -8,7 +8,7 @@ allow(view).to receive(:show_menu_for).and_return("show menu")
power_user = stub_model(User, :has_role? => true)
- allow(view).to receive(:current_visitor).and_return(power_user)
+ allow(view).to receive(:current_user).and_return(power_user)
# the changeable? => true prevents a current_visitor lookup, but will test if editing links correctly wrap the passed block
collection = WillPaginate::Collection.create(1,10) do |coll|
@@ -16,6 +16,7 @@ coll << stub_model(Dataservice::Blob, :id => 2, :token => "8ad04a50ba96463d80407cd119173b86", :content => "2", :changeable? => true)
coll.total_entries = 2
end
+
assign(:dataservice_blobs, collection)
end
|
Change current_visitor to current_user for policy check.
|
diff --git a/traffiq.gemspec b/traffiq.gemspec
index abc1234..def5678 100644
--- a/traffiq.gemspec
+++ b/traffiq.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency 'bunny', '~> 1.5.1'
+ spec.add_dependency 'bunny', '>= 1.5.1', '< 2.0'
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
end
|
Update bunny dependency to allow bunny 1.x.x
Bunny is now on version 1.6.1 without braking API changes. We should
allow that.
|
diff --git a/tasks/bnd-ext.rake b/tasks/bnd-ext.rake
index abc1234..def5678 100644
--- a/tasks/bnd-ext.rake
+++ b/tasks/bnd-ext.rake
@@ -17,9 +17,13 @@ "gov.nih.nci.*, *;resolution:=optional"
end
- def configure_bundle(bundle)
+ def configure_bundle(bundle, options = {})
+ unless options.has_key?(:resources)
+ options[:resources] = File.exist?(_(:source, :main, :resources))
+ end
+
bundle["Export-Package"] = bnd_export_package
bundle["Import-Package"] = bnd_import_package
- bundle["Include-Resource"] = _(:target, :resources) if File.exist?(_(:target, :resources))
+ bundle["Include-Resource"] = _(:target, :resources) if options[:resources]
end
end
|
Use a more sensible mechanism to determine whether to bundle resources.
(The previous one only worked by accident.)
SVN-Revision: 343
|
diff --git a/lib/idcf/ilb/resources/l7route.rb b/lib/idcf/ilb/resources/l7route.rb
index abc1234..def5678 100644
--- a/lib/idcf/ilb/resources/l7route.rb
+++ b/lib/idcf/ilb/resources/l7route.rb
@@ -5,7 +5,7 @@ class L7route < Base
def inspect
o_id = object_id
- "#<#{self.class}:0x%014x @name=#{name} @id=#{id}>" % [o_id]
+ "#<#{self.class}:0x%014x @pattern=#{pattern} @id=#{id}>" % [o_id]
end
end
end
|
:wrench: Change name to pattern in resouce module
|
diff --git a/lib/pronto/credo/output_parser.rb b/lib/pronto/credo/output_parser.rb
index abc1234..def5678 100644
--- a/lib/pronto/credo/output_parser.rb
+++ b/lib/pronto/credo/output_parser.rb
@@ -17,8 +17,8 @@
def parse
output.lines.map do |line|
- next unless line.start_with?(file)
line_parts = line.split(':')
+ next unless file.start_with?(line_parts[0])
offence_in_line = line_parts[1]
column_line = nil
if line_parts[2].to_i == 0
|
Fix bug with path matching
|
diff --git a/lib/rss/atom/feed_history/atom.rb b/lib/rss/atom/feed_history/atom.rb
index abc1234..def5678 100644
--- a/lib/rss/atom/feed_history/atom.rb
+++ b/lib/rss/atom/feed_history/atom.rb
@@ -1,5 +1,3 @@-require 'rss/atom/feed_history'
-
module RSS
module Atom
class Feed
|
Remove `require` to avoide circular requirement
|
diff --git a/lib/aws_sns_manager/client.rb b/lib/aws_sns_manager/client.rb
index abc1234..def5678 100644
--- a/lib/aws_sns_manager/client.rb
+++ b/lib/aws_sns_manager/client.rb
@@ -35,7 +35,8 @@ aps: {
alert: text,
sound: 'default',
- badge: 1
+ badge: 1,
+ 'content-available': 1
}
}
end
|
Add content-available key to notification json
|
diff --git a/lib/cheffish/merged_config.rb b/lib/cheffish/merged_config.rb
index abc1234..def5678 100644
--- a/lib/cheffish/merged_config.rb
+++ b/lib/cheffish/merged_config.rb
@@ -2,30 +2,40 @@ class MergedConfig
def initialize(*configs)
@configs = configs
+ @merge_arrays = {}
end
attr_reader :configs
+ def merge_arrays(*symbols)
+ symbols.each do |symbol|
+ @merge_arrays[symbol] = true
+ end
+ end
def [](name)
- result_configs = []
- configs.each do |config|
- value = config[name]
- if !value.nil?
- if value.respond_to?(:keys)
- result_configs << value
- elsif result_configs.size > 0
- return result_configs[0]
- else
- return value
+ if @merge_arrays[name]
+ configs.select { |c| !c[name].nil? }.collect_concat { |c| c[name] }
+ else
+ result_configs = []
+ configs.each do |config|
+ value = config[name]
+ if !value.nil?
+ if value.respond_to?(:keys)
+ result_configs << value
+ elsif result_configs.size > 0
+ return result_configs[0]
+ else
+ return value
+ end
end
end
- end
- if result_configs.size > 1
- MergedConfig.new(*result_configs)
- elsif result_configs.size == 1
- result_configs[0]
- else
- nil
+ if result_configs.size > 1
+ MergedConfig.new(*result_configs)
+ elsif result_configs.size == 1
+ result_configs[0]
+ else
+ nil
+ end
end
end
|
Add ability to merge arrays
|
diff --git a/db/pending_migration_cleanups/20130917161734_drop_attachment_join_models.rb b/db/pending_migration_cleanups/20130917161734_drop_attachment_join_models.rb
index abc1234..def5678 100644
--- a/db/pending_migration_cleanups/20130917161734_drop_attachment_join_models.rb
+++ b/db/pending_migration_cleanups/20130917161734_drop_attachment_join_models.rb
@@ -0,0 +1,13 @@+class DropAttachmentJoinModels < ActiveRecord::Migration
+ def up
+ drop_table :consultation_response_attachments
+ drop_table :corporate_information_page_attachments
+ drop_table :edition_attachments
+ drop_table :policy_group_attachments
+ drop_table :supporting_page_attachments
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
|
Add pending migration to drop attachment join model tables
|
diff --git a/app/controllers/china_region_fu/fetch_options_controller.rb b/app/controllers/china_region_fu/fetch_options_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/china_region_fu/fetch_options_controller.rb
+++ b/app/controllers/china_region_fu/fetch_options_controller.rb
@@ -5,6 +5,11 @@ if params_valid?(params) and parent_klass = params[:parent_klass].classify.safe_constantize.find(params[:parent_id])
table_name = params[:klass].tableize
regions = parent_klass.__send__(table_name).select("#{table_name}.id, #{table_name}.name")
+ if has_level_column?(params[:klass])
+ regions = regions.order('level ASC')
+ else
+ regions = regions.order('name ASC')
+ end
self.response_body = regions.to_json
else
self.response_body = [].to_json
@@ -14,6 +19,10 @@
private
+ def has_level_column?(klass_name)
+ klass_name.classify.safe_constantize.try(:column_names).to_a.include?('level')
+ end
+
def params_valid?(params)
params[:klass].present? and params[:parent_klass] =~ /^province|city$/i and params[:parent_id].present?
end
|
Order the drop down options
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.