diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'simplecov' SimpleCov.start do - add_group "API", "lib/evertrue/api" + add_group 'API', 'lib/evertrue/api' end VCR.configure do |c|
Add api group to SimpleCov
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,9 @@ require 'dm-transactions' -require 'dm-core/spec/lib/counter_adapter' +require 'dm-core/spec/lib/spec_helper' require 'dm-core/spec/lib/pending_helpers' require 'dm-core/spec/lib/adapter_helpers' +require 'dm-core/spec/lib/counter_adapter' require 'dm-core/spec/resource_shared_spec' require 'dm-core/spec/sel_shared_spec' @@ -21,6 +22,12 @@ DataMapper::Spec::AdapterHelpers.setup_adapters(adapters) Spec::Runner.configure do |config| + config.extend(DataMapper::Spec::AdapterHelpers) config.include(DataMapper::Spec::PendingHelpers) + + config.after :all do + DataMapper::Spec.cleanup_models + end + end
Use global model cleanup code from dm-core. All green now!
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ $:.unshift File.expand_path('../../lib', __FILE__) -require 'chef/knife/cloud/exceptions' +require 'chef/exceptions' require 'json' class App
Fix require path for Chef::Exceptions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,16 @@ add_filter '/gem/' end SimpleCov.minimum_coverage 100 + +# Minimal auto-load for quicker specs. This avoids loading the whole of Rails +# solely for dependency resolution. +autoload :ActiveModel, 'active_model' +autoload :Virtus, 'virtus' +require 'active_support/dependencies' +Dir[File.expand_path('../../{lib,app/**/*}', __FILE__)].each do |path| + next unless File.directory?(path) + ActiveSupport::Dependencies.autoload_paths << path +end RSpec.configure do |config| config.expect_with :rspec do |expectations|
Facilitate running specs without Rails By implementing the bare bones of autoload and loading a few libraries, we can avoid having to require rails_helper - and thus the whole of Rails - which takes a significant time.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,7 @@ require 'chefspec' require 'chefspec/berkshelf' +ChefSpec::Coverage.start! require 'chef/application' @@ -14,10 +15,6 @@ # Omit warnings from output config.log_level = :fatal - - config.before(:suite) do - ChefSpec::Coverage.start! - end end require 'support/source_installation'
Reposition ChefSpec::Coverage as per ChefSpec docs
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../') if ENV['CODECLIMATE_REPO_TOKEN'] - require "codeclimate-test-reporter" + require 'codeclimate-test-reporter' CodeClimate::TestReporter.start end @@ -38,4 +38,5 @@ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes' c.hook_into :webmock c.configure_rspec_metadata! + c.ignore_hosts 'codeclimate.com' end
Allow VCR to post to codeclimate
diff --git a/discover_oids.rb b/discover_oids.rb index abc1234..def5678 100644 --- a/discover_oids.rb +++ b/discover_oids.rb @@ -1,8 +1,14 @@ require 'config/initialize.rb' +pool_size = 10 +executorPool = Executors.newFixedThreadPool(10) +# partitions = Java::JavaUtil::ArrayList.new + # TODO move into discoverer class config = gov.nrel.bacnet.consumer.BACnet.parseOptions(ARGV) bacnet = gov.nrel.bacnet.consumer.BACnet.new(config) local_device = bacnet.getLocalDevice KnownDevice.all.each do |kd| - kd.discover_oids local_device + # does not save timeout + executorPool.execute(DeviceOidLookup.new(kd, local_device)) end +# executorPool.invokeAll(partitions, 10000, TimeUnit::SECONDS)
Use Executor and ThreadPool to look up oids by device. Request timeouts will no longer kill main thread.
diff --git a/spec/features/nav_spec.rb b/spec/features/nav_spec.rb index abc1234..def5678 100644 --- a/spec/features/nav_spec.rb +++ b/spec/features/nav_spec.rb @@ -3,11 +3,9 @@ RSpec.describe "nav", :js => true, :type => :feature do include Capybara::Angular::DSL - before do + it "contains links to top-level pages" do visit "/" - end - - it "contains links to top-level pages" do + page_names = get_page_names page_names[page_names.index("home")] = "" @@ -16,4 +14,19 @@ expect(page).to have_selector ".navbar a[href='/#/#{page_name}']" end end + + it "highlights link of current page" do + page_names = get_page_names - ["home"] + + page_links = page_names.map do |page_name| + "/#/#{page_name}" + end + + page_links.each do |link| + visit link + + active_link = ".navbar li.active a[href='#{link}']" + expect(page).to have_selector active_link + end + end end
Add test for nav bar link highlighting
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index abc1234..def5678 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -0,0 +1,68 @@+require 'spec_helper' + +describe Event do + describe '.create_from_lastfm' do + let(:data) { + { + lastfm_uuid: "3705233", + title: "GRAPE FESTIVAL 2014", + headliner: "Editors", + venue_name: "Letisko", + venue_latitude: "48.625", + venue_longitude: "17.828611", + venue_city: "Piešťany", + venue_country: "Slovakia", + venue_street: "", + starts_at: Time.parse('2014-08-15 13:38:01 +0200'), + ends_at: Time.parse('2014-08-16 13:38:01 +0200'), + website: "http://www.grapefestival.sk/", + lastfm_url: "http://www.last.fm/festival/3705233+GRAPE+FESTIVAL+2014", + lastfm_image_small: "http://userserve-ak.last.fm/serve/34/36233633.jpg", + lastfm_image_medium: "http://userserve-ak.last.fm/serve/64/36233633.jpg", + lastfm_image_large: "http://userserve-ak.last.fm/serve/126/36233633.jpg", + lastfm_image_extralarge: "http://userserve-ak.last.fm/serve/252/36233633.jpg", + artists: [ + "Editors", + "Klaxons", + "La Roux", + "Bombay Bicycle Club", + "Flux Pavilion", + "Palma Violets", + "Wilkinson", + "Diego", + "Skyline", + "Rangleklods", + "The Prostitutes", + "Vec", + "Lavagance", + "Le Payaco", + "Fiordmoss", + "Korben Dallas", + "Modré hory", + "Strapo", + "The Feud", + "No Distance Paradise", + "Boyband", + "Walter Schnitzelsson", + "Fallgrapp", + "Saténové Ruky", + "Papyllon", + "MALALATA", + "Tichonov", + "Martina Javor" + ] + } + } + + it 'creates event from lastfm attributes' do + event = Event.create_from_lastfm(data) + + data.except(:headliner, :artists).each do |key, value| + expect(event.read_attribute(key)).to eql(value) + end + + expect(data[:artists].sort).to eql(event.artists.pluck(:name).sort) + expect(data[:headliner]).to eql(events.headliners.first.name) + end + end +end
Add specs for Event import from Lastfm
diff --git a/0_code_wars/alternating_case.rb b/0_code_wars/alternating_case.rb index abc1234..def5678 100644 --- a/0_code_wars/alternating_case.rb +++ b/0_code_wars/alternating_case.rb @@ -0,0 +1,14 @@+# http://www.codewars.com/kata/56efc695740d30f963000557/ +# --- iteration 1 --- +class String + def to_alternating_case + self.swapcase + end +end + +# --- iteration 2 --- +class String + def to_alternating_case + swapcase + end +end
Add code wars (8) - alternating case
diff --git a/dynosaur.gemspec b/dynosaur.gemspec index abc1234..def5678 100644 --- a/dynosaur.gemspec +++ b/dynosaur.gemspec @@ -20,7 +20,7 @@ spec.add_runtime_dependency 'platform-api', '>= 2.0', '< 2.3' spec.add_runtime_dependency 'sys-proctable', '>= 0.9', '< 2.0' - spec.add_development_dependency 'bundler', '~> 1.8' + spec.add_development_dependency 'bundler', '~> 2.0' spec.add_development_dependency 'pry-byebug', '~> 3' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3'
Update bundler requirement from ~> 1.8 to ~> 2.0 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/compare/v1.8.0...v2.0.2) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/test/cookbooks/test/recipes/source.rb b/test/cookbooks/test/recipes/source.rb index abc1234..def5678 100644 --- a/test/cookbooks/test/recipes/source.rb +++ b/test/cookbooks/test/recipes/source.rb @@ -2,5 +2,6 @@ node.default['php']['install_method'] = 'source' node.default['php']['pear'] = '/usr/local/bin/pear' +node.default['php']['url'] = 'https://ftp.osuosl.org/pub/php/' # the default site blocks github actions boxes include_recipe 'php'
Use a different mirror in testing since GH Actions is blocked Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index abc1234..def5678 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -1,7 +1,11 @@ class ActionController::Base - before_filter :set_view_paths - - def set_view_paths + # The following prepends the path of the current theme's views to + # the "filter_path" that Rails searches when deciding which + # template to use for a view. It does so by creating a method + # uniquely named for this theme. + path_function_name = "set_view_paths_for_#{THEME_NAME}" + before_filter path_function_name.to_sym + send :define_method, path_function_name do self.prepend_view_path File.join(File.dirname(__FILE__), "views") end end
Create and use a dynamically-named filter path for the theme, so we can ensure multiple themes don't overwrite each other.
diff --git a/lib/enum_help/i18n.rb b/lib/enum_help/i18n.rb index abc1234..def5678 100644 --- a/lib/enum_help/i18n.rb +++ b/lib/enum_help/i18n.rb @@ -1,24 +1,15 @@ module EnumHelp + module I18n # overwrite the enum method def enum( definitions ) - klass = self super( definitions ) - definitions.each do |name, values| - # def status_i18n() statuses.key self[:status] end - i18n_method_name = "#{name}_i18n".to_sym - define_method(i18n_method_name) do - enum_value = self.send(name) - if enum_value - ::I18n.t("enums.#{klass.to_s.underscore}.#{name}.#{enum_value}", default: enum_value) - else - nil - end - end + definitions.each do |name, _| + Helper.define_attr_i18n_method(self, name) + Helper.define_collection_i18n_method(self, name) end end - def self.extended(receiver) # receiver.class_eval do @@ -27,5 +18,44 @@ end end + + module Helper + + def self.define_attr_i18n_method(klass, attr_name) + attr_i18n_method_name = "#{attr_name}_i18n" + + klass.class_eval <<-METHOD, __FILE__, __LINE__ + def #{attr_i18n_method_name} + enum_label = self.send(:#{attr_name}) + if enum_label + ::EnumHelp::Helper.translate_enum_label(self.class, :#{attr_name}, enum_label) + else + nil + end + end + METHOD + end + + def self.define_collection_i18n_method(klass, attr_name) + collection_method_name = "#{attr_name.to_s.pluralize}" + collection_i18n_method_name = "#{collection_method_name}_i18n" + + klass.instance_eval <<-METHOD, __FILE__, __LINE__ + def #{collection_i18n_method_name}(*args) + options = args.extract_options! + collection = args[0] || send(:#{collection_method_name}) + collection.except! options[:except] if options[:except] + + collection.map do |label, value| + [::EnumHelp::Helper.translate_enum_label(self, :#{attr_name}, label), value] + end.to_h + end + METHOD + end + + def self.translate_enum_label(klass, attr_name, enum_label) + ::I18n.t("enums.#{klass.to_s.underscore}.#{attr_name}.#{enum_label}", default: enum_label) + end + + end end -
Create a dynamic method to translate enum collections For a field named "status" we now have a "Foo.statuses_i18n" method, which is similar to the existing "foo_instance.status_i18n". Refactored the code to keep everything understandable with the new changes. It now uses "instance_eval" and "class_eval" with string arguments, which is faster than with blocks. Helper methods were placed in a distinct module to avoid ActiveRecord::Base namespace pollution.
diff --git a/cats.gemspec b/cats.gemspec index abc1234..def5678 100644 --- a/cats.gemspec +++ b/cats.gemspec @@ -1,7 +1,7 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'cats/version' +require 'cats' Gem::Specification.new do |spec| spec.name = "cats"
Fix getting Cats::VERSION from the gemspec
diff --git a/lib/money_accessor.rb b/lib/money_accessor.rb index abc1234..def5678 100644 --- a/lib/money_accessor.rb +++ b/lib/money_accessor.rb @@ -7,21 +7,39 @@ def money_accessor(*columns) Array(columns).flatten.each do |name| define_method(name) do - value = instance_variable_get("@#{name}") + value = _money_get(name) value.blank? ? nil : Money.new(value) end define_method("#{name}=") do |value| if value.blank? || !value.respond_to?(:to_money) - instance_variable_set("@#{name}", nil) + _money_set(name, nil) nil else money = value.to_money - instance_variable_set("@#{name}", money.value) + _money_set(name, money.value) money end end end end end + + private + + def _money_set(ivar, value) + if self.is_a?(Struct) + self[ivar] = value + else + instance_variable_set("@#{ivar}", value) + end + end + + def _money_get(ivar) + if self.is_a?(Struct) + self[ivar] + else + instance_variable_get("@#{ivar}") + end + end end
Use struct accessor instead of instance variable set/get
diff --git a/firebase.gemspec b/firebase.gemspec index abc1234..def5678 100644 --- a/firebase.gemspec +++ b/firebase.gemspec @@ -21,7 +21,7 @@ s.licenses = ["MIT"] s.summary = "Firebase wrapper for Ruby" - s.add_runtime_dependency 'httpclient' + s.add_runtime_dependency 'httpclient', '>= 2.5.3' s.add_runtime_dependency 'json' s.add_development_dependency 'rake' s.add_development_dependency 'rdoc'
Update required version of httpclient to ensure :default_header works Closes https://github.com/oscardelben/firebase-ruby/issues/75
diff --git a/lib/protest/runner.rb b/lib/protest/runner.rb index abc1234..def5678 100644 --- a/lib/protest/runner.rb +++ b/lib/protest/runner.rb @@ -16,6 +16,9 @@ test_case.run(self) fire_event :exit, test_case end + rescue Interrupt + $stderr.puts "Interrupted!" + ensure fire_event :end end @@ -30,6 +33,7 @@ rescue AssertionFailed => e fire_event :failure, FailedTest.new(test, e) rescue Exception => e + raise if e.is_a?(Interrupt) fire_event :error, ErroredTest.new(test, e) end
Stop test suite when ^C
diff --git a/lib/rom/repository.rb b/lib/rom/repository.rb index abc1234..def5678 100644 --- a/lib/rom/repository.rb +++ b/lib/rom/repository.rb @@ -1,6 +1,5 @@ module ROM - # Repository exposes native database connection and schema when it's - # supported by the adapter + # Repository exposes schema if supported by the adapter # # @api public class Repository @@ -33,13 +32,6 @@ adapter.logger end - # Return the database connection provided by the adapter - # - # @api public - def connection - adapter.connection - end - # Return the schema provided by the adapter # # @api private
Remove unused `connection` from Repository
diff --git a/lib/hash_easy/bottomless_hash.rb b/lib/hash_easy/bottomless_hash.rb index abc1234..def5678 100644 --- a/lib/hash_easy/bottomless_hash.rb +++ b/lib/hash_easy/bottomless_hash.rb @@ -1,15 +1,17 @@-class BottomlessHash < Hash - def initialize - super &-> h, k { h[k] = self.class.new } +module HashEasy + class BottomlessHash < Hash + def initialize + super &-> h, k { h[k] = self.class.new } + end + + def self.from_hash(hash) + new.merge(hash) + end end - def self.from_hash(hash) - new.merge(hash) + class Hash + def bottomless + BottomlessHash.from_hash(self) + end end end - -class Hash - def bottomless - BottomlessHash.from_hash(self) - end -end
Fix bottomless hash add module
diff --git a/lib/ids_please/grabbers/vimeo.rb b/lib/ids_please/grabbers/vimeo.rb index abc1234..def5678 100644 --- a/lib/ids_please/grabbers/vimeo.rb +++ b/lib/ids_please/grabbers/vimeo.rb @@ -3,10 +3,10 @@ class Vimeo < IdsPlease::Grabbers::Base def grab_link - @network_id = find_network_id + # @network_id = find_network_id @avatar = find_avatar @display_name = find_display_name - @username = find_username + # @username = find_username self rescue => e
Comment out network id and username for now
diff --git a/lib/support/string.rb b/lib/support/string.rb index abc1234..def5678 100644 --- a/lib/support/string.rb +++ b/lib/support/string.rb @@ -30,7 +30,7 @@ "create" when "index", "show" "read" - when "edit", "update", "position", "toggle", "relate", "unrelate", "detach" + when "edit", "update", "position", "toggle", "relate", "unrelate" "update" when "destroy", "trash" "delete"
Detach was removed a few commits ago
diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index abc1234..def5678 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -0,0 +1,16 @@+namespace :load do + task :defaults do + set :owned_by_user, 'app' + set :owned_by_group, 'deploy' + end +end + +namespace :deploy do + task :set_app_ownership do + on release_roles(:all) do + within release_path do + sudo "chown -R #{fetch(:owned_by_user)}:#{fetch(:owned_by_group)} ." + end + end + end +end
Add ability to change user / group permissions in release directory
diff --git a/consumer.rb b/consumer.rb index abc1234..def5678 100644 --- a/consumer.rb +++ b/consumer.rb @@ -17,12 +17,13 @@ def do_work_that_blocks_the_event_loop(arg) p arg Vertx.exit if arg >= 500 - sleep(0.1) end -Vertx.set_timer(1_000) do - sub = eventstore.new_catchup_subscription(stream, -1) - sub.on_event { |event| received += 1 ; do_work_that_blocks_the_event_loop(received)} - sub.on_error { |error| p error.inspect } +sub = eventstore.new_catchup_subscription(stream, -1) +sub.on_event { |event| received += 1 ; do_work_that_blocks_the_event_loop(received)} +sub.on_error { |error| p error.inspect } + +Vertx.set_timer(5_000) do + p "Timeout reached, starting the subscriptions" sub.start end
Remove sleep, restructure a bit
diff --git a/cogy.gemspec b/cogy.gemspec index abc1234..def5678 100644 --- a/cogy.gemspec +++ b/cogy.gemspec @@ -13,7 +13,7 @@ "and deploying commands from your application is a breeze." s.license = "MIT" - s.files = Dir["{app,config,lib}/**/*", "LICENSE", "Rakefile", "README.md"] + s.files = Dir["{app,config,lib}/**/*", "CHANGELOG.md", "LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 4.2"
Include CHANGELOG.md in gem files
diff --git a/config/software/libmysql.rb b/config/software/libmysql.rb index abc1234..def5678 100644 --- a/config/software/libmysql.rb +++ b/config/software/libmysql.rb @@ -14,10 +14,10 @@ # limitations under the License. # name "libmysql" -version "6.1.0" +version "6.1.3" source :url => "http://mirror.cogentco.com/pub/mysql/Connector-C/mysql-connector-c-#{version}-src.tar.gz", - :md5 => "02b8cb2bdc2ca281d3d87b0ab8d719c4" + :md5 => "490e2dd5d4f86a20a07ba048d49f36b2" relative_path "mysql-connector-c-#{version}-src"
Update mysql-connector source url and md5sum The previous version (6.1.0) of mysql-connector is no longer available at cogentco.com. Update this to the latest version, 6.1.3.
diff --git a/immortal.gemspec b/immortal.gemspec index abc1234..def5678 100644 --- a/immortal.gemspec +++ b/immortal.gemspec @@ -10,13 +10,13 @@ s.summary = %q{Replacement for acts_as_paranoid for Rails 3} s.description = %q{Typical paranoid gem built for Rails 3 and with the minimum code needed to satisfy acts_as_paranoid's API} s.license = "MIT" - + s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'activerecord', '>= 3.1.1', '<= 3.2.21' + s.add_dependency 'activerecord', '~> 3.2.0' s.add_development_dependency 'rspec', '~> 2.6.0' s.add_development_dependency 'sqlite3'
Set activerecord to ~> 3.2.0 version
diff --git a/http-commands.gemspec b/http-commands.gemspec index abc1234..def5678 100644 --- a/http-commands.gemspec +++ b/http-commands.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'http-commands' - s.version = '0.0.2.5' + s.version = '0.0.2.6' s.summary = 'Convenience abstractions for common HTTP operations, such as post and get' s.description = ' '
Package version is increased from 0.0.2.5 to 0.0.2.6
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -2,3 +2,19 @@ Role.create!(:name => Role::ADMIN, :kind => Role::KIND_ADMIN) Role.create!(:name => Role::MEMBER, :kind => Role::KIND_MEMBER) end + +unless User.count > 0 + hostname = ENV["GITORIOUS_HOSTNAME"] || `hostname`.strip + + user = User.create!( + login: "admin", + password: "g1torious", + password_confirmation: "g1torious", + email: "admin@#{hostname}", + is_admin: true, + terms_of_use: true, + activated_at: Time.now, + activation_code: nil + ) + user.accept_terms! +end
Create admin user when seeding the database
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,25 @@-# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +require 'faker' + +User.create(name: "Hailey", password: "a") +User.create(name: "Don J.", password: "a") +User.create(name: "Frank", password: "a") +User.create(name: "Mike", password: "a") +User.create(name: "Peter", password: "a") + +20.times { User.create(name: Faker::Name.name, password: "a") } + + + +rand(5..20).times { + user = User.find(rand(1..25)) + user.questions.create(title: Faker::Lorem.sentence + "?", body: Faker::Lorem.paragraph) +} + +rand(5..20).times { + user = User.find(rand(1..20)) + q_num = Question.all.length + user.answers.create(question_id: rand(1..q_num), body: Faker::Lorem.paragraph) +} + + +
Add fake data in seed file.
diff --git a/ws-test.rb b/ws-test.rb index abc1234..def5678 100644 --- a/ws-test.rb +++ b/ws-test.rb @@ -0,0 +1,22 @@+require 'faye/websocket' +require 'eventmachine' + +EM.run do + ws = Faye::WebSocket::Client.new('ws://127.0.0.1:6601/') + + ws.on :open do |_| + p [:open] + Thread.new do + loop { ws.send(gets.chomp) } + end + end + + ws.on :message do |event| + p [:message, event.data] + end + + ws.on :close do |event| + p [:close, event.code, event.reason] + ws = nil + end +end
Make a script to test websocket connections
diff --git a/commands.rb b/commands.rb index abc1234..def5678 100644 --- a/commands.rb +++ b/commands.rb @@ -1,5 +1,5 @@ GitHub.register :open do - if remote = `git config -l`.split("\n").detect { |line| line =~ /remote.origin.url/ } + if remote = `git config --get remote.origin.url`.chomp exec "open http://github.com/#{remote.split(':').last.chomp('.git')}" end end
Use git config --get for obtaining the single config value
diff --git a/core/lib/generators/refinery/engine/templates/spec/models/refinery/singular_name_spec.rb b/core/lib/generators/refinery/engine/templates/spec/models/refinery/singular_name_spec.rb index abc1234..def5678 100644 --- a/core/lib/generators/refinery/engine/templates/spec/models/refinery/singular_name_spec.rb +++ b/core/lib/generators/refinery/engine/templates/spec/models/refinery/singular_name_spec.rb @@ -1,32 +1,18 @@ require 'spec_helper' -describe ::Refinery::<%= class_name %> do +module Refinery + describe <%= class_name %> do + describe "validations" do + subject do + FactoryGirl.create(:<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>, + :<%= title.name %> => "Refinery CMS"<% end %>) + end - def reset_<%= singular_name %>(options = {}) - @valid_attributes = { - :id => 1<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>, - :<%= title.name %> => "RSpec is great for testing too"<% end %> - } - - @<%= singular_name %>.destroy! if @<%= singular_name %> - @<%= singular_name %> = <%= class_name %>.create!(@valid_attributes.update(options)) + it { should be_valid } + its(:errors) { should be_empty } +<% if title -%> + its(:<%= title.name %>) { should == "Refinery CMS" } +<% end -%> + end end - - before(:each) do - reset_<%= singular_name %> - end - - context "validations" do - <% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %> - it "rejects empty <%= title.name %>" do - <%= class_name %>.new(@valid_attributes.merge(:<%= title.name %> => "")).should_not be_valid - end - - it "rejects duplicate <%= title.name %>" do - # as one gets created before each spec by reset_<%= singular_name %> - <%= class_name %>.new(@valid_attributes).should_not be_valid - end - <% end %> - end - end
Simplify engine generator model spec template.
diff --git a/db/migrate/20090218111119_rename_participations_to_committers_and_make_it_polymorphic.rb b/db/migrate/20090218111119_rename_participations_to_committers_and_make_it_polymorphic.rb index abc1234..def5678 100644 --- a/db/migrate/20090218111119_rename_participations_to_committers_and_make_it_polymorphic.rb +++ b/db/migrate/20090218111119_rename_participations_to_committers_and_make_it_polymorphic.rb @@ -5,7 +5,7 @@ add_column :committerships, :committer_type, :string add_index :committerships, [:committer_id, :committer_type] - ActiveRecord::Base.reload_column_information + ActiveRecord::Base.reset_column_information Committership.update_all("committer_type = 'Group'") end
Fix spelling error in migrate script (reload_column_information) Signed-off-by: Tor Arne Vestbø <e15670bde49f42788b511fae93b8512474990c44@gmail.com>
diff --git a/lib/emcee/railtie.rb b/lib/emcee/railtie.rb index abc1234..def5678 100644 --- a/lib/emcee/railtie.rb +++ b/lib/emcee/railtie.rb @@ -6,6 +6,12 @@ initializer :add_html_processor do |app| app.assets.register_mime_type "text/html", ".html" app.assets.register_preprocessor "text/html", HtmlProcessor + end + + initializer :add_html_compressor do |app| + app.assets.register_bundle_processor "text/html", :html_compressor do |context, data| + HtmlCompressor.new.compress(data) + end end end end
Add html compressor as shorthand bundle processor
diff --git a/lib/hestia/railtie.rb b/lib/hestia/railtie.rb index abc1234..def5678 100644 --- a/lib/hestia/railtie.rb +++ b/lib/hestia/railtie.rb @@ -10,7 +10,7 @@ extension = case ActionPack::VERSION::MAJOR when 3 Hestia::SignedCookieJarExtension::ActionPack3 - when 4 + else if Rails.application.config.respond_to?(:secret_key_base) && Rails.application.config.secret_key_base fail "Having `config.secret_token' and `config.secret_key_base' defined is not allowed in Hestia. Please refer to Hestia's Readme for more information." end
Use Hestia::SignedCookieJarExtension::ActionPack4 when actionpack version is >= 4
diff --git a/lib/lifx/utilities.rb b/lib/lifx/utilities.rb index abc1234..def5678 100644 --- a/lib/lifx/utilities.rb +++ b/lib/lifx/utilities.rb @@ -2,18 +2,23 @@ module Utilities def try_until(condition_proc, timeout_exception: Timeout::Error, timeout: 3, - retry_wait: 0.5, + condition_interval: 0.1, + action_interval: 0.5, signal: nil, &action_block) Timeout.timeout(timeout) do m = Mutex.new + time = 0 while !condition_proc.call - action_block.call + if Time.now.to_f - time > action_interval + time = Time.now.to_f + action_block.call + end if signal m.synchronize do - signal.wait(m, retry_wait) + signal.wait(m, condition_interval) end else - sleep(retry_wait) + sleep(condition_interval) end end end
Split out condition_interval and action_interval to prevent early signal triggers from causing action_block to be called more than necessary
diff --git a/lib/punchblock/dsl.rb b/lib/punchblock/dsl.rb index abc1234..def5678 100644 --- a/lib/punchblock/dsl.rb +++ b/lib/punchblock/dsl.rb @@ -28,6 +28,10 @@ write @protocol.class::Command::Redirect.new(:to => dest) end + def record(options = {}) + write @protocol.class::Command::Record.new(options) + end + def say(string, type = :text) # :nodoc: write @protocol.class::Command::Tropo::Say.new(type => string) puts "Waiting on the queue..."
Add recording to the DSL
diff --git a/lib/raygun/railtie.rb b/lib/raygun/railtie.rb index abc1234..def5678 100644 --- a/lib/raygun/railtie.rb +++ b/lib/raygun/railtie.rb @@ -1,29 +1,28 @@ class Raygun::Railtie < Rails::Railtie initializer "raygun.configure_rails_initialization" do |app| - if Raygun.configured? - # Thanks Airbrake: See https://github.com/rails/rails/pull/8624 - middleware = if defined?(ActionDispatch::DebugExceptions) - if Rails::VERSION::STRING >= "5" - ActionDispatch::DebugExceptions - else - # Rails >= 3.2.0 - "ActionDispatch::DebugExceptions" - end - else - # Rails < 3.2.0 - "ActionDispatch::ShowExceptions" - end - raygun_middleware = Raygun::Middleware::RackExceptionInterceptor - raygun_middleware = raygun_middleware.to_s unless Rails::VERSION::STRING >= "5" - app.config.middleware.insert_after middleware, raygun_middleware + # Thanks Airbrake: See https://github.com/rails/rails/pull/8624 + middleware = if defined?(ActionDispatch::DebugExceptions) + if Rails::VERSION::STRING >= "5" + ActionDispatch::DebugExceptions + else + # Rails >= 3.2.0 + "ActionDispatch::DebugExceptions" + end + else + # Rails < 3.2.0 + "ActionDispatch::ShowExceptions" + end - # Affected User tracking - require "raygun/middleware/rails_insert_affected_user" - affected_user_middleware = Raygun::Middleware::RailsInsertAffectedUser - affected_user_middleware = affected_user_middleware.to_s unless Rails::VERSION::STRING >= "5" - app.config.middleware.insert_after Raygun::Middleware::RackExceptionInterceptor, affected_user_middleware - end + raygun_middleware = Raygun::Middleware::RackExceptionInterceptor + raygun_middleware = raygun_middleware.to_s unless Rails::VERSION::STRING >= "5" + app.config.middleware.insert_after middleware, raygun_middleware + + # Affected User tracking + require "raygun/middleware/rails_insert_affected_user" + affected_user_middleware = Raygun::Middleware::RailsInsertAffectedUser + affected_user_middleware = affected_user_middleware.to_s unless Rails::VERSION::STRING >= "5" + app.config.middleware.insert_after Raygun::Middleware::RackExceptionInterceptor, affected_user_middleware end config.to_prepare do
Reset Railtie back to master code, approach does not seem to be working
diff --git a/lib/pwnbox/crypto.rb b/lib/pwnbox/crypto.rb index abc1234..def5678 100644 --- a/lib/pwnbox/crypto.rb +++ b/lib/pwnbox/crypto.rb @@ -7,8 +7,8 @@ last_remainder, remainder = [a, b].map(&:abs) numbers = [0, 1, 1, 0] while remainder != 0 - last_remainder, (quotient, remainder) \ - = remainder, last_remainder.divmod(remainder) + last_remainder, (quotient, remainder) = + remainder, last_remainder.divmod(remainder) numbers = next_numbers(numbers, quotient) end
Use backslash only for string concatenation
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 @@ -4,8 +4,8 @@ @latest_exercises = Exercise.last(5).reverse @hottest_exercises = Exercise.order(:submissions_count).limit(5) if current_user? - @my_exercises = current_user.exercises.first(10).reverse - @my_submissions = current_user.submissions.first(10).reverse + @my_exercises = current_user.exercises.last(10).reverse + @my_submissions = current_user.submissions.last(10).reverse end end end
Fix to elements order in home
diff --git a/app/operations/story_operations.rb b/app/operations/story_operations.rb index abc1234..def5678 100644 --- a/app/operations/story_operations.rb +++ b/app/operations/story_operations.rb @@ -26,7 +26,10 @@ def after_save new_documents = model.documents_attributes if new_documents != model.documents_attributes_was - model.instance_variable_get('@changed_attributes')[:documents_attributes] = model.documents_attributes_was + model.instance_variable_set( + '@changed_attributes', + model.instance_variable_get('@changed_attributes').merge(documents_attributes: model.documents_attributes_was) + ) end model.changesets.create!
Fix how to set `changed_attributes` in Rails 4.2.x
diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -2,4 +2,9 @@ attributes :id, :name, :email, :gender, :birthday, :picture has_many :subjects + has_one :picture, serializer: PictureSerializer + + def picture + Picture.new object.picture + end end
Add serialization of pictures in user serializer
diff --git a/lib/street_lights.rb b/lib/street_lights.rb index abc1234..def5678 100644 --- a/lib/street_lights.rb +++ b/lib/street_lights.rb @@ -9,6 +9,7 @@ unless File.exists?(@street_lights_dir) FileUtils.mkdir_p(@street_lights_dir) end + at_exit { File.rm "#{@street_lights_dir}/#{Process.pid}" } end def call(env)
Delete pid when application quits.
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake index abc1234..def5678 100644 --- a/lib/tasks/users.rake +++ b/lib/tasks/users.rake @@ -13,5 +13,6 @@ raise StandardError, "Could not generate token" end Transferatu::User.create(name: args.name, password: password, token: token) + puts "Created user #{args.name} with password #{password}" end end
Print password after user creation, since its plaintext is not stored anywhere.
diff --git a/app/cells/plugins/core/user_cell.rb b/app/cells/plugins/core/user_cell.rb index abc1234..def5678 100644 --- a/app/cells/plugins/core/user_cell.rb +++ b/app/cells/plugins/core/user_cell.rb @@ -16,7 +16,7 @@ end def user_data_for_select - @options[:user_data].map{ |user| [user.fullname, user.id] } + @options[:user_data].map{ |user| ["#{user.fullname} (#{user.email})", user.id] } end end end
Include email in UserFieldType picker, so content creators can discern between users with the same fullname
diff --git a/Rakefile.rb b/Rakefile.rb index abc1234..def5678 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -1,50 +1 @@-$:.unshift(File.join(File.dirname(__FILE__), 'lib')) - -require 'rubygems' -require 'rake/gempackagetask' -require 'rake/rdoctask' -require 'risky/version' -require 'find' - -# Don't include resource forks in tarballs on Mac OS X. -ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true' -ENV['COPYFILE_DISABLE'] = 'true' - -# Gemspec -gemspec = Gem::Specification.new do |s| - s.rubyforge_project = 'risky' - - s.name = 'risky' - s.version = Risky::VERSION - s.author = 'Kyle Kingsbury' - s.email = 'aphyr@aphyr.com' - s.homepage = 'https://github.com/aphyr/risky' - s.platform = Gem::Platform::RUBY - s.summary = 'A Ruby ORM for the Riak distributed database.' - - s.files = FileList['{lib}/**/*', 'LICENSE', 'README.markdown'].to_a - s.executables = [] - s.require_path = 'lib' - s.has_rdoc = true - - s.required_ruby_version = '>= 1.8.6' - - s.add_dependency('riak-client', '~> 1.0.4') -end - -Rake::GemPackageTask.new(gemspec) do |p| - p.need_tar_gz = true -end - -Rake::RDocTask.new do |rd| - rd.main = 'Risky' - rd.title = 'Risky' - rd.rdoc_dir = 'doc' - - rd.rdoc_files.include('lib/**/*.rb') -end - -desc "install Risky" -task :install => :gem do - sh "gem install #{File.dirname(__FILE__)}/pkg/risky-#{Risky::VERSION}.gem" -end +require "bundler/gem_tasks"
Use rake tasks from bundler
diff --git a/app/controllers/ideas_controller.rb b/app/controllers/ideas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ideas_controller.rb +++ b/app/controllers/ideas_controller.rb @@ -30,7 +30,7 @@ def update @idea = Idea.find(params[:id]) - @idea.update_attributes(params[:idea]) - redirect_to :root + #@idea.update_attributes(params[:idea]) + redirect_to action: "index" end end
Fix two examples, spec still does not test if update method is working, break update method to test spec.
diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index abc1234..def5678 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -1,7 +1,7 @@ class StatsController < ApplicationController def show @url = request.url - @dojo_count = Dojo.count + @dojo_count = Dojo.active.count @regions_and_dojos = Dojo.group_by_region_on_active # TODO: 次の静的なDojoの開催数もデータベース上で集計できるようにする
Fix wrong dojo count in Stats controller
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,7 +5,7 @@ respond_to :js, only: :index def index - @users = User.order('pull_requests_count desc').includes(:pull_requests).page params[:page] + @users = User.order('pull_requests_count desc, nickname asc').includes(:pull_requests).page params[:page] respond_with @users end
Order users by pull_request_count and nickname
diff --git a/app/decorators/payment_decorator.rb b/app/decorators/payment_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/payment_decorator.rb +++ b/app/decorators/payment_decorator.rb @@ -3,6 +3,7 @@ has_one :adjustment, :as => :source, :dependent => :destroy after_save :ensure_correct_adjustment, :update_order + after_create :ensure_correct_adjustment # Create it ASACP before_save :delete_orphened_adjustment @@ -37,7 +38,7 @@ def delete_orphened_adjustment real_payments = order.payments.where("state != ?", 'failed').all - to_kill = order.adjustments.payment.where("source_id NOT IN (?)", real_payments).all + to_kill = order.adjustments.payment.where("source_id NOT IN (?) OR amount = ?", real_payments, 0.0).all if to_kill.size > 0 to_kill.destroy_all order.update!
Create the surcharge as soon as the payment gets created.
diff --git a/app/mailers/notifications_mailer.rb b/app/mailers/notifications_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/notifications_mailer.rb +++ b/app/mailers/notifications_mailer.rb @@ -14,7 +14,7 @@ def email_peek(peek) recipients = User.all.pluck(:email) build_header(recipients) - attachments["Peek#{peek.date}"] = open("#{peek.file.url}").read + attachments["Peek#{peek.date}.pdf"] = open("#{peek.file.url}").read mail( subject: "Peek at Our Week(s) Available Now", body: "A new peek at our upcoming weeks is available now." @@ -24,7 +24,7 @@ def email_newsletter(newsletter) recipients = User.all.pluck(:email) build_header(recipients) - attachments["Newsletter#{newsletter.date}"] = open("#{newsletter.file.url}").read + attachments["Newsletter#{newsletter.date}.pdf"] = open("#{newsletter.file.url}").read mail( subject: "Newsletter Available Now", body: "A new edition of the Here We Grow Preschool newsletter is available now."
Add pdf ending to mailer attachment
diff --git a/app/models/spree/price_decorator.rb b/app/models/spree/price_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/price_decorator.rb +++ b/app/models/spree/price_decorator.rb @@ -4,6 +4,12 @@ private + def check_price + if currency.nil? + self.currency = Spree::Config[:currency] + end + end + def refresh_products_cache variant.andand.refresh_products_cache end
Remove orphan price check from price model This is a quick fix. This check is breaking product deletion in some situations and orphan Prices are not really a problem in the DB
diff --git a/definitions/puma_web_app.rb b/definitions/puma_web_app.rb index abc1234..def5678 100644 --- a/definitions/puma_web_app.rb +++ b/definitions/puma_web_app.rb @@ -18,7 +18,7 @@ application deploy end - service "#{application}-puma" do + service application do action :restart end end
Fix servie name to match the new init.d script name
diff --git a/lib/micky/uri.rb b/lib/micky/uri.rb index abc1234..def5678 100644 --- a/lib/micky/uri.rb +++ b/lib/micky/uri.rb @@ -1,15 +1,13 @@ require 'uri' module Micky - HTTP_URI_REGEX = %r{\Ahttps?://?} - SINGLE_SLASH_HTTP_URI_REGEX = %r{\Ahttps?:/[^/]} + HTTP_URI_REGEX = %r{\Ahttps?:/+} def self.URI(uri) uri = uri.to_s.strip if uri =~ HTTP_URI_REGEX - if uri =~ SINGLE_SLASH_HTTP_URI_REGEX - uri.sub! '/', '//' - end + # Replace any number of slashes (1, 3 or 4579) by two slashes + uri.sub! %r{/+}, '//'.freeze else uri = "http://#{uri}" end
Replace any number of slashes following https: by two
diff --git a/lib/templater.rb b/lib/templater.rb index abc1234..def5678 100644 --- a/lib/templater.rb +++ b/lib/templater.rb @@ -1,4 +1,11 @@ module Templater + # Replaces templates in a string with the values. + # + # @note templates in a string are supposed to be like `{{temp}}` + # + # @param str [String] the string with templates. + # @param values [Hash, Array] the values to replace templates + # @return [String] the string with replaced values. def self.replace(str, values) if values.is_a? Hash str.gsub(/{{(.*?)}}/) {
Add documentation to replace method
diff --git a/spec/ttt_spec.rb b/spec/ttt_spec.rb index abc1234..def5678 100644 --- a/spec/ttt_spec.rb +++ b/spec/ttt_spec.rb @@ -17,8 +17,13 @@ cell.content.should == '.' end - it 'should take a players update' do - cell.players_move(TestPlayer.new) - cell.content.should == 'X' + context 'when player makes a move' do + + let(:player) { TestPlayer.new } + + it 'should mirror that move' do + cell.players_move(player) + cell.content.should == player.move + end end end
Add spec for players move.
diff --git a/app/helpers/auths_helper.rb b/app/helpers/auths_helper.rb index abc1234..def5678 100644 --- a/app/helpers/auths_helper.rb +++ b/app/helpers/auths_helper.rb @@ -1,7 +1,7 @@ module AuthsHelper def current_user - if session[:user_id] - @current_user ||= User.find_by_id(session[:user_id]) + if session[:id] + @current_user ||= User.find(session[:id]) end end
Fix session user id param.
diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index abc1234..def5678 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -24,7 +24,7 @@ # Channel-specific html case item.channel_type when 'youtube' - "<iframe width=\"640\" height=\"390\" src=\"https://www.youtube.com/embed/#{KSBKMrb-8KI}\" frameborder=\"0\" allowfullscreen></iframe>" + "<iframe width=\"640\" height=\"390\" src=\"https://www.youtube.com/embed/#{KSBKMrb-8KI}\" frameborder=\"0\" allowfullscreen></iframe>".html_safe when 'instagram' image_tag(item.assets.first.url) else
Fix bug where rails tag helper tried to make iFrame self-closing
diff --git a/app/presenters/dashboard.rb b/app/presenters/dashboard.rb index abc1234..def5678 100644 --- a/app/presenters/dashboard.rb +++ b/app/presenters/dashboard.rb @@ -19,7 +19,7 @@ end def notifications - @notifications ||= user.notifications.unread.personal.reject {|note| note.item.nil? || note.item.creator.nil?} + @notifications ||= user.notifications.unread.personal.reject {|note| note.item.nil? || note.item.user.nil?} end end end
Fix bad reference on notifications
diff --git a/org-converge.gemspec b/org-converge.gemspec index abc1234..def5678 100644 --- a/org-converge.gemspec +++ b/org-converge.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = OrgConverge::VERSION gem.add_runtime_dependency('docopt', '~> 0.5.0') - gem.add_runtime_dependency('org-ruby', '~> 0.9.5') + gem.add_runtime_dependency('org-ruby', '~> 0.9.6') gem.add_runtime_dependency('foreman', '~> 0.63.0') gem.add_runtime_dependency('tco', '~> 0.1.0') gem.add_runtime_dependency('rake', '~> 10.3')
Update dependencies of Org Ruby
diff --git a/lib/aasm.rb b/lib/aasm.rb index abc1234..def5678 100644 --- a/lib/aasm.rb +++ b/lib/aasm.rb @@ -1,5 +1,3 @@-require 'ostruct' - require 'aasm/version' require 'aasm/errors' require 'aasm/configuration'
Remove needless require ostruct statement ostruct is no longer required since v4.0.0 ref. 55f1eed4fa2e01a95ca35be0231ad5181939deb6
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index abc1234..def5678 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,2 +1,7 @@ module UsersHelper + def render_common_form(submit_value = 'submit') + form_for :user do |f| + f.submit(submit_value) + end + end end
Create common form render helper
diff --git a/app/models/business_days.rb b/app/models/business_days.rb index abc1234..def5678 100644 --- a/app/models/business_days.rb +++ b/app/models/business_days.rb @@ -1,22 +1,26 @@ class BusinessDays - # This can't happen in an initializer because: - # https://github.com/zendesk/biz/issues/18 - Biz.configure do |config| - config.hours = { - mon: { '08:00' => '17:30' }, - tue: { '08:00' => '17:30' }, - wed: { '08:00' => '17:30' }, - thu: { '08:00' => '17:30' }, - fri: { '08:00' => '17:30' } - } - config.holidays = [] - end - def self.from_now(amount) + configure Biz.time(amount, :day).after(Time.zone.now) end def self.before_now(amount) + configure Biz.time(amount, :day).before(Time.zone.now) end + + # This can't happen in an initializer because: + # https://github.com/zendesk/biz/issues/18 + def self.configure + @configuration ||= Biz.configure do |config| + config.hours = { + mon: { '08:00' => '17:30' }, + tue: { '08:00' => '17:30' }, + wed: { '08:00' => '17:30' }, + thu: { '08:00' => '17:30' }, + fri: { '08:00' => '17:30' } + } + config.holidays = [] + end + end end
Fix biz crashing on POST appointment_attempts/:id/appointments
diff --git a/app/models/learn_session.rb b/app/models/learn_session.rb index abc1234..def5678 100644 --- a/app/models/learn_session.rb +++ b/app/models/learn_session.rb @@ -1,3 +1,25 @@ class LearnSession include Mongoid::Document + include Mongoid::Timestamps::Created + include Mongoid::Timestamps::Updated + + + has_one :user + has_many :words + + # the idea behind the boxes is the following: + # first all words go into the first box + # if a user answers the question for one word correct, the word goes one box up until it's box4 + # a word remains in the current box, when the answer of the user is wrong. It doesn't go one box down! + # the learnSession is not completed until all words are in box4 + # + # An idea would be to put the words directly into the first box without storing them in the attribute words + # this way you have no duplicates but i don't know if this works with the mongoid relations + + field :box0, type: Array + field :box1, type: Array + field :box2, type: Array + field :box3, type: Array + field :box4, type: Array + field :completed, type: Boolean, default: false end
Add attributes and comment to learnSession model
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,4 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +User.create :email => 'admin@example.com', :password => 'password'
Add first user to seed
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,6 +7,7 @@ User.create(name: Faker::Name.name, age: rand(1..100), gender: ["male","female"].sample, + orientation: ["Lesbian","Gay","Bisexual","Pansexual", "Straight", "Asexual", "Prefer not to Say"].sample, location: Faker::Address.state, password: password, password_digest: password,
Add data for sexual orientation.
diff --git a/lib/dragonfly/config/r_magick_images.rb b/lib/dragonfly/config/r_magick_images.rb index abc1234..def5678 100644 --- a/lib/dragonfly/config/r_magick_images.rb +++ b/lib/dragonfly/config/r_magick_images.rb @@ -15,17 +15,17 @@ c.register_analyser(Analysis::RMagickAnalyser) c.register_processor(Processing::RMagickProcessor) c.register_encoder(Encoding::RMagickEncoder) - c.define_job do - process :thumb, opts[:geometry] - encode opts[:format] || app.default_format - end - c.define_job :encode do - encode opts[:format] - end - c.define_job :rotate do - process :rotate, :amount => opts[:amount], :background_colour => '#0000' - encode opts[:format] || app.default_format - end + # c.define_job do + # process :thumb, opts[:geometry] + # encode opts[:format] || app.default_format + # end + # c.define_job :encode do + # encode opts[:format] + # end + # c.define_job :rotate do + # process :rotate, :amount => opts[:amount], :background_colour => '#0000' + # encode opts[:format] || app.default_format + # end end end
Comment out breaking config for now
diff --git a/lib/duck_puncher/ducks/active_record.rb b/lib/duck_puncher/ducks/active_record.rb index abc1234..def5678 100644 --- a/lib/duck_puncher/ducks/active_record.rb +++ b/lib/duck_puncher/ducks/active_record.rb @@ -10,12 +10,13 @@ end def associations - reflections.select { |key, reflection| + refls = send respond_to?(:reflections) ? :reflections : :_reflections + refls.keep_if { |key, reflection| begin if reflection.macro.to_s =~ /many/ - send(key).exists? + public_send(key).exists? else - send(key).present? + public_send(key).present? end rescue nil
Fix associations for Rails 4
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,60 +1,61 @@+# Controller for user registrations class Users::RegistrationsController < Devise::RegistrationsController - # before_action :configure_sign_up_params, only: [:create] - # before_action :configure_account_update_params, only: [:update] + before_action :configure_sign_up_params, only: [:create] + before_action :configure_account_update_params, only: [:update] # GET /resource/sign_up - # def new - # super - # end + def new + super + end # POST /resource - # def create - # super - # end + def create + super + end # GET /resource/edit - # def edit - # super - # end + def edit + super + end # PUT /resource - # def update - # super - # end + def update + super + end # DELETE /resource - # def destroy - # super - # end + def destroy + super + end # GET /resource/cancel # Forces the session data which is usually expired after sign # in to be expired now. This is useful if the user wants to # cancel oauth signing in/up in the middle of the process, # removing all OAuth session data. - # def cancel - # super - # end + def cancel + super + end - # protected + protected # If you have extra params to permit, append them to the sanitizer. - # def configure_sign_up_params - # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) - # end + def configure_sign_up_params + devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) + end # If you have extra params to permit, append them to the sanitizer. - # def configure_account_update_params - # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) - # end + def configure_account_update_params + devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) + end # The path used after sign up. - # def after_sign_up_path_for(resource) - # super(resource) - # end + def after_sign_up_path_for(resource) + super(resource) + end # The path used after sign up for inactive accounts. - # def after_inactive_sign_up_path_for(resource) - # super(resource) - # end + def after_inactive_sign_up_path_for(resource) + super(resource) + end end
Fix rubocop offense and uncomment most of registrationscontroller
diff --git a/lib/git_compound/worker/pretty_print.rb b/lib/git_compound/worker/pretty_print.rb index abc1234..def5678 100644 --- a/lib/git_compound/worker/pretty_print.rb +++ b/lib/git_compound/worker/pretty_print.rb @@ -11,8 +11,7 @@ def print_component(component) Logger.inline ' ' * component.ancestors.count - # TODO: LoD - Logger.info "`#{component.name}` component, #{component.source.version}" + Logger.info "`#{component.name}` component, #{component.version}" end end end
Fix TODO in pretty print visitor (refactoring, LoD)
diff --git a/lib/icapps/translations/import/react.rb b/lib/icapps/translations/import/react.rb index abc1234..def5678 100644 --- a/lib/icapps/translations/import/react.rb +++ b/lib/icapps/translations/import/react.rb @@ -11,6 +11,14 @@ def fetch_language_file(language) short_name = language['short_name'] puts "[VERBOSE] Fetching #{short_name} translations.".colorize(:white) if options[:verbose] + json_files = Dir.glob("labels/#{short_name}.json") + + if json_files.count > 1 + puts "[WARNING] Multiple '#{short_name}.json' files found for the #{short_name} language.".colorize(:yellow) + else + json = ::Icapps::Translations::Http.authenticated_response("translations/#{language['id']}.json") + write_to_file json, json_files, language + end end end end
Make sure we right it correct
diff --git a/accept_values_for.gemspec b/accept_values_for.gemspec index abc1234..def5678 100644 --- a/accept_values_for.gemspec +++ b/accept_values_for.gemspec @@ -0,0 +1,53 @@+# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{accept_values_for} + s.version = "0.2.1" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Bogdan Gusiev"] + s.date = %q{2010-06-29} + s.description = %q{Rspec: When you have a complex validation(e.g. regexp or custom method) on ActiveRecord model +you have to write annoying easy specs on which values should be accepted by your validation method and which should not. +accepts_values_for rspec matcher simplify the code. See example for more information. +} + s.email = %q{agresso@gmail.com} + s.files = [ + "Gemfile", + "Rakefile", + "Readme.textile", + "VERSION", + "lib/accept_values_for.rb", + "spec/accept_values_for_spec.rb", + "spec/spec_helper.rb" + ] + s.homepage = %q{http://github.com/bogdan/accept_values_for} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.6} + s.summary = %q{In order to test a complex validation for ActiveRecord models Implemented accept_values_for custom rspec matcher} + s.test_files = [ + "spec/accept_values_for_spec.rb", + "spec/spec_helper.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q<activerecord>, [">= 0"]) + s.add_runtime_dependency(%q<rspec>, [">= 0"]) + else + s.add_dependency(%q<activerecord>, [">= 0"]) + s.add_dependency(%q<rspec>, [">= 0"]) + end + else + s.add_dependency(%q<activerecord>, [">= 0"]) + s.add_dependency(%q<rspec>, [">= 0"]) + end +end +
Add gemspec file to repository
diff --git a/borealis.gemspec b/borealis.gemspec index abc1234..def5678 100644 --- a/borealis.gemspec +++ b/borealis.gemspec @@ -16,6 +16,8 @@ gem.test_files = gem.files.grep("spec") gem.require_paths = ["lib"] + gem.requirements << 'ImageMagick' + gem.add_development_dependency 'rspec' gem.add_dependency 'cocaine'
Add ImageMagick requirement to gemspec
diff --git a/example/send-get-request.rb b/example/send-get-request.rb index abc1234..def5678 100644 --- a/example/send-get-request.rb +++ b/example/send-get-request.rb @@ -0,0 +1,36 @@+#!/usr/bin/env ruby + +# Simple get request example. + +$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') +require 'rubygems' +require 'meac_control' +require 'httpclient' + +host = ARGV.shift +deviceid = ARGV.shift + +unless host and deviceid + puts "Usage: #{File.basename(__FILE__)} <ip-address> <device-id>" + exit 1 +end + +command = [MEACControl::Command::Drive.request, MEACControl::Command::FanSpeed.request] +device = MEACControl::Device.new(deviceid) + +xml = MEACControl::XML::GetRequest.new(device, command) + +puts "########### get request ###########" +puts xml.to_xml +puts "" + +header = {'Accept' => 'text/xml', 'Content-Type' => 'text/xml'} + +client = HTTPClient.new +client.protocol_version = 'HTTP/1.0' +client.agent_name = 'meac_control/1.0' +response = client.post("http://#{host}/servlet/MIMEReceiveServlet", xml.to_xml, header) + +puts "########### get response ###########" +puts response.content +puts ""
Add a small example script to send get requests.
diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +++ b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb @@ -4,5 +4,6 @@ class ApplicationController < ActionController::Base helper :all protect_from_forgery + respond_to :html, :js, :xml, :json filter_parameter_logging :password end
Add default respond_to formats to ApplicationController.
diff --git a/app/lib/services.rb b/app/lib/services.rb index abc1234..def5678 100644 --- a/app/lib/services.rb +++ b/app/lib/services.rb @@ -18,7 +18,7 @@ end end - def self.search + def self.rummager @search ||= GdsApi::Rummager.new( Plek.new.find('rummager'), )
Rename search service to rummager As this is clearer.
diff --git a/acceptance/setup/pre_suite/80_add_dev_repo.rb b/acceptance/setup/pre_suite/80_add_dev_repo.rb index abc1234..def5678 100644 --- a/acceptance/setup/pre_suite/80_add_dev_repo.rb +++ b/acceptance/setup/pre_suite/80_add_dev_repo.rb @@ -14,13 +14,15 @@ on database, "curl #{apt_url}/pubkey.gpg |apt-key add -" on database, "apt-get update" when :redhat - create_remote_file database, '/etc/yum.repos.d/puppetlabs-prerelease.repo', <<-REPO + yum_repo = <<-REPO [puppetlabs-development] name=Puppet Labs Development - $basearch baseurl=#{test_config[:package_repo_url]}/el/$releasever/products/$basearch enabled=1 gpgcheck=0 REPO + Log.notify("Yum repo definition.\n\n#{yum_repo}\n\n") + create_remote_file database, '/etc/yum.repos.d/puppetlabs-prerelease.repo', yum_repo else raise ArgumentError, "Unsupported OS '#{os}'" end
Add logging to show the yum repo definition We're getting some test failures due to not being able to access the puppetlabs development yum repo (s3?). This commit simply adds logging to show the repo configuration, which should help us to troubleshoot this kind of error going forward.
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -12,6 +12,7 @@ private def require_admin - current_user.admin? + # redirect_to root_path, notice: "#{t 'authorization.admin.unauthorized'}" unless current_user.admin? + redirect_to root_path unless current_user.admin? end end
Fix Admin before action checking Admin user status If a user is not an admin, redirect them back to the home page. Optionally, we can flash a message stating that they do not have the proper authorization to access the interface, but that may be revealing too much information.
diff --git a/app/controllers/admin/snapshots_controller.rb b/app/controllers/admin/snapshots_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/snapshots_controller.rb +++ b/app/controllers/admin/snapshots_controller.rb @@ -17,12 +17,11 @@ attributes = filter_header(parsed) snapshot = Snapshot.create!(attributes) when Array - parsed.each do |metadata| + records = parsed.map do |metadata| id = Digest::MD5.hexdigest(metadata["id"] + snapshot.id) - attributes = { id: id, record: metadata } - metadata = MetadataRecord.create!(attributes) - snapshot.metadata_records << metadata + attributes = { id: id, record: metadata, snaphot_id: snapshot.id } end + MetadataRecord.collection.insert(records) else raise TypeError, "Unknown type #{parsed.class}" end @@ -43,11 +42,13 @@ gz = Zlib::GzipReader.new(file) parser = Yajl::Parser.new parser.on_parse_complete = Proc.new { |obj| yield(obj) } - parser << gz.read + while not gz.eof? + parser << gz.readchar + end end def filter_header(header) - fields = Snapshot.fields.keys.map(&:to_sym) + fields = Snapshot.fields.keys header.keys.inject({}) do |filtered, key| filtered[key] = header[key] if fields.include?(key) filtered
Change input parsing to one character at a time Another reason for the horrendous memory consumption was the fact that I read the complete file before starting to process it. For now, I solved this by reading one character at at time. This again, the absolute trade-off between memory and speed, is too slow again. I finally need to start using line breaks in my JSON dumps, then I can read one line at a time. Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
diff --git a/app/serializers/task_definition_serializer.rb b/app/serializers/task_definition_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/task_definition_serializer.rb +++ b/app/serializers/task_definition_serializer.rb @@ -1,13 +1,13 @@ class TaskDefinitionSerializer < ActiveModel::Serializer - attributes :id, :abbreviation, :name, :description, - :weight, :target_grade, :target_date, - :upload_requirements, + attributes :id, :abbreviation, :name, :description, + :weight, :target_grade, :target_date, + :upload_requirements, :plagiarism_checks, :plagiarism_report_url, :plagiarism_warn_pct, :restrict_status_updates, :group_set_id, :has_task_pdf?, :has_task_resources?, - :due_date, :start_date + :due_date, :start_date, :is_graded def weight - object.weighting + object.weighting end end
ENHANCE: Add is_graded to task definition serializer
diff --git a/test/models/cart_item_test.rb b/test/models/cart_item_test.rb index abc1234..def5678 100644 --- a/test/models/cart_item_test.rb +++ b/test/models/cart_item_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class CartItemTest < ActiveSupport::TestCase - test "CartItem Weight should match" do + test "CartItem weight should match" do assert_equal 200, cart_items(:george_one).weight end
Fix typo in CartItem test name
diff --git a/test/unit/spec/spec_helper.rb b/test/unit/spec/spec_helper.rb index abc1234..def5678 100644 --- a/test/unit/spec/spec_helper.rb +++ b/test/unit/spec/spec_helper.rb @@ -17,7 +17,6 @@ log_level: ::LOG_LEVEL }.freeze -def stub_resources -end +def stub_resources; end at_exit { ChefSpec::Coverage.report! }
C: Put empty method definitions on a single line.
diff --git a/spec/features/teacher/progress_reports/standards/standards_by_student_progress_report_spec.rb b/spec/features/teacher/progress_reports/standards/standards_by_student_progress_report_spec.rb index abc1234..def5678 100644 --- a/spec/features/teacher/progress_reports/standards/standards_by_student_progress_report_spec.rb +++ b/spec/features/teacher/progress_reports/standards/standards_by_student_progress_report_spec.rb @@ -28,8 +28,6 @@ end it 'displays activity session data in the table' do - pending("This does not work yet") - alice = full_classroom.students.first expect(report_page.table_rows.first).to eq( [ alice.name,
Fix standards by student feature spec
diff --git a/db/fixtures/development/02_source_code.rb b/db/fixtures/development/02_source_code.rb index abc1234..def5678 100644 --- a/db/fixtures/development/02_source_code.rb +++ b/db/fixtures/development/02_source_code.rb @@ -1,4 +1,4 @@-root = Gitlab.config.gitolite.repos_path +root = Gitlab.config.gitlab_shell.repos_path projects = [ { path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' },
Fix development fixture for gitlab_shell
diff --git a/app/controllers/users.rb b/app/controllers/users.rb index abc1234..def5678 100644 --- a/app/controllers/users.rb +++ b/app/controllers/users.rb @@ -4,6 +4,11 @@ get '/login' do erb :'users/login' +end + +get '/logout' do + session.clear + redirect '/' end post '/login' do
Add ability for user to logout. Added get '/logout' route to the users.rb controller. A request to that route will simply clear the session and redirect to the root url.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -11,7 +11,6 @@ depends 'apt', '>= 2.0' depends 'runit', '>= 1.7' depends 'yum', '>= 3.0' -depends 'yum', '~> 3.0' source_url 'https://github.com/chef-cookbooks/jenkins' issues_url 'https://github.com/chef-cookbooks/jenkins/issues'
Remove the double yum dep Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index abc1234..def5678 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -26,4 +26,4 @@ end end - end+end
Correct end at file ending
diff --git a/cmu.gemspec b/cmu.gemspec index abc1234..def5678 100644 --- a/cmu.gemspec +++ b/cmu.gemspec @@ -16,5 +16,5 @@ s.add_development_dependency 'rake' s.add_development_dependency 'rspec' - s.add_runtime_dependency 'net-ldap2' + s.add_runtime_dependency 'net-ldap' end
Change net-ldap dependency to original gem
diff --git a/app/models/article.rb b/app/models/article.rb index abc1234..def5678 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -1,4 +1,6 @@-# News Articles +# Article +# Simple model used for news about MO, e.g., new releases +# New articles are added to the Acitivity feed # # == Attributes #
Add description of Article model to documentation
diff --git a/app/models/contact.rb b/app/models/contact.rb index abc1234..def5678 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -14,7 +14,7 @@ def headers { subject: "Neue Anmeldung für '#{course}'", - to: "nmauchle@gmail.com", # barbara.schumacher@bluewin.ch + to: "barbara.schumacher@bluewin.ch", # barbara.schumacher@bluewin.ch from: %("#{name_teacher}" <#{email}>) } end
Add email correct email address
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,4 +16,18 @@ user.approved = true end end + + class WorkFactory + def actor_create(attributes:, work_class: Vdc::Resource) + user = User.find_by(email: 'admin@example.com') + ability = Ability.new(user) + work = work_class.new + env = Hyrax::Actors::Environment.new(work, ability, attributes) + + Hyrax::CurationConcern.actor.create(env) + end + end + + factory = WorkFactory.new + factory.actor_create(attributes: { title: ['Test'] }) end
Introduce a seed for a test `Vdc::Resource` Creates a test `Vdc::Resource` when `rake db:seeds` is run.
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,14 @@ require 'csv' +require 'faraday' School.delete_all -csv_text = File.read('db/cfe-money-new-data-feb15.csv') -csv = CSV.parse(csv_text, :headers => true) -csv.each do |row| - School.create!(row.to_hash) +location = Location.first +url = URI(location.endpoint) +connection = Faraday.new(url: url.to_s) +response = connection.get +collection = JSON.parse(response.body) + +collection.each do |item| + location.schools << School.create!(item) end
Update seed file to use endpoint link in location table item
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,7 +8,7 @@ # require 'webmock' WebMock.allow_net_connect! -url = 'http://student.ugent.be/hydra/api/1.1/Associations.json' +url = 'https://raw.githubusercontent.com/ZeusWPI/hydra/master/iOS/Resources/Associations.json' hash = JSON(HTTParty.get(url).body) WebMock.disable_net_connect!
Use github URL instead of hydra API on the DSA server
diff --git a/core/app/views/notifications/activity.rb b/core/app/views/notifications/activity.rb index abc1234..def5678 100644 --- a/core/app/views/notifications/activity.rb +++ b/core/app/views/notifications/activity.rb @@ -2,7 +2,7 @@ class Activity < Mustache::Railstache def unread - self[:activity].created_at_as_datetime > current_user.last_read_activities_on.change(:offset => "+0700") + self[:activity].created_at_as_datetime > current_user.last_read_activities_on end def username
Revert "change the offset of the Mongoid time back to 0700" This reverts commit 748ae6f6f1ec2912f46e71405049248b26485515.
diff --git a/plugins/github.rb b/plugins/github.rb index abc1234..def5678 100644 --- a/plugins/github.rb +++ b/plugins/github.rb @@ -5,16 +5,17 @@ match /ghpull (.+) (.+)/, method: :ghissue def ghissue(m, repo, issuenum) - issuenum = issuenum.to_i - if issuenum < 1 - m.reply 'Invalid Issue count!' - return - end issueurl = "https://api.github.com/repos/#{repo}/issues/#{issuenum}" begin parsed = JSON.parse(RestClient.get(issueurl)) rescue m.reply 'Invalid Repo or Issue number!' + return + end + issuenum = parsed['number'] if issuenum == 'latest' + issuenum = issuenum.to_i + if issuenum < 1 + m.reply 'Invalid Issue count!' return end issueorpull = parsed['html_url'].split('/')[5]
Add latest issue to gh-issue
diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index abc1234..def5678 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,6 +1,8 @@ Rails.application.config.middleware.use Rack::Cors do allow do - origins 'localhost:8181', 'bibliaolvaso.dev', 'bibliaolvaso.hu' + origins 'bibliaolvaso.hu', 'd16lfcr0o0mhas.cloudfront.net', + 'localhost:8181', 'bibliaolvaso.dev', 'bibliaolvaso.hu', + /http:\/\/bibliaolvaso(?:\.\d+){4}\.xip\.io/ resource '*', methods: :any, max_age: 3600 end end
Allow CORS from xip.io and CloudFront host
diff --git a/attributes/bash_it.rb b/attributes/bash_it.rb index abc1234..def5678 100644 --- a/attributes/bash_it.rb +++ b/attributes/bash_it.rb @@ -8,7 +8,6 @@ "pivotal_workstation" => %w[ bash_it/custom/disable_ctrl-s_output_control.bash bash_it/custom/enable_ctrl-o_history_execution.bash - bash_it/custom/history_settings.bash bash_it/custom/ensure_usr_local_bin_first.bash bash_it/custom/add_user_initials_to_git_prompt_info.bash ]
Remove history_settings which does not have a template.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -27,8 +27,6 @@ iotop tmux keychain - rar - unrar wakeonlan whois tcpdump
Revert "Install rar and unrar" (multiverse should be optional) This reverts commit dd31e5575fc173d476bec7e9fe65233014e0afd8. Conflicts: attributes/default.rb
diff --git a/lib/alephant/models/queue.rb b/lib/alephant/models/queue.rb index abc1234..def5678 100644 --- a/lib/alephant/models/queue.rb +++ b/lib/alephant/models/queue.rb @@ -15,5 +15,8 @@ sleep 1 until @q.exists? end + def poll(*args, &block) + @q.poll(*args, &block) + end end end
Add missing poll method which delegates to real Queue poll method