diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/kernel/common/variable_scope.rb b/kernel/common/variable_scope.rb index abc1234..def5678 100644 --- a/kernel/common/variable_scope.rb +++ b/kernel/common/variable_scope.rb @@ -11,10 +11,10 @@ end def set_eval_local(name, val) - dynamic_locals[name] = val + @parent.dynamic_locals[name] = val end def get_eval_local(name) - dynamic_locals[name] + @parent.dynamic_locals[name] end end
Fix where eval introduced locals end up
diff --git a/app/models/key.rb b/app/models/key.rb index abc1234..def5678 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -19,7 +19,7 @@ end # set a flag or flags to true - def can(*flags) + def can!(*flags) flags.each do |flag| self.send "can_#{flag.to_s}=", true end @@ -27,7 +27,7 @@ end # set a flag or flags to false - def cannot(*flags) + def cannot!(*flags) flags.each do |flag| self.send "can_#{flag.to_s}=", false end
Add bang to can and cannot methods
diff --git a/mootools-plus.gemspec b/mootools-plus.gemspec index abc1234..def5678 100644 --- a/mootools-plus.gemspec +++ b/mootools-plus.gemspec @@ -9,7 +9,7 @@ s.files = `git ls-files`.split("\n") - s.add_dependency "railties", '>= 3.2.0', '< 5.0' + s.add_dependency 'railties', '>= 3.1.0', '< 5.0' s.require_path = 'lib' end
Downgrade railties version to 3.1
diff --git a/example_app_template.rb b/example_app_template.rb index abc1234..def5678 100644 --- a/example_app_template.rb +++ b/example_app_template.rb @@ -1,5 +1,5 @@-$LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__)) +$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__)) require 'rspec/rails/version' -gem 'rspec-rails', :path => File.expand_path('../../../', __FILE__) +gem 'rspec-rails', :path => File.expand_path('../', __FILE__)
Use paths relative to rspec-rails directory in template
diff --git a/lib/chatrix/bot/plugins/echo.rb b/lib/chatrix/bot/plugins/echo.rb index abc1234..def5678 100644 --- a/lib/chatrix/bot/plugins/echo.rb +++ b/lib/chatrix/bot/plugins/echo.rb @@ -11,8 +11,22 @@ 'Makes the bot echo the specified text to chat', aliases: ['say'], handler: :say - def say(room, sender, command, args) - @bot.send_message room, args[:text] + register_command 'act', '<text>', + 'Makes the bot perform an emote', + aliases: %w(em emote), handler: :emote + + register_command 'notice', '<text>', 'Sends a notice', handler: :notice + + def say(room, _sender, _command, args) + room.messaging.send_message args[:text] + end + + def emote(room, _sender, _command, args) + room.messaging.send_emote args[:text] + end + + def notice(room, _sender, _command, args) + room.messaging.send_notice args[:text] end end end
Add more commands to Echo and fix wrong method called The #say method was calling bot.send_message, which doesn't exist. Fixed #say to call room.messaging.send_message instead.
diff --git a/lib/filter_factory/condition.rb b/lib/filter_factory/condition.rb index abc1234..def5678 100644 --- a/lib/filter_factory/condition.rb +++ b/lib/filter_factory/condition.rb @@ -2,8 +2,12 @@ class Condition attr_reader :field_name, :value + # Initializes new instance of Condition class. + # + # @param [Symbol] field_name field name which will be used in condition + # @param [Object] value value which will be used in condition def initialize(field_name, value) @field_name, @value = field_name, value end end -end+end
Add RDoc/Yard comments to Condition class.
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 @@ -4,15 +4,31 @@ #Note: bookmarklet caps at 4096 chars. this is fine for now, but may need to refactor if we wanna get fancy #TODO: make post_url variable script = '(function() { + + function getSelectionText() { + var text = ""; + if (window.getSelection) { + text = window.getSelection().toString(); + } else if (document.selection && document.selection.type != "Control") { + text = document.selection.createRange().text; + } + return text; + } + var post_url = "' + root_url + 'entries/create_api"; var user_id = ' + user.id.to_s + '; var encrypted_password = "' + user.encrypted_password + '"; - var content = document.getElementById("outputbox").innerHTML; + var content = getSelectionText(); + if (content === "") { + alert("Highlight text to create an entry"); + return; + } var obj = { "entry": { - "content": content, "api_data": { + "content": content, + "api_data": { "user_id": user_id, "auth_token": encrypted_password }
Change JS to sent highlighted text as an entry
diff --git a/app/mailers/alert_mailer.rb b/app/mailers/alert_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/alert_mailer.rb +++ b/app/mailers/alert_mailer.rb @@ -1,7 +1,7 @@ class AlertMailer < ActionMailer::Base include ActionView::Helpers::TextHelper include ActionView::Helpers::AssetUrlHelper - default from: "contact@morph.io" + default from: "Morph <contact@morph.io>" def alert_email(user, broken_runs, successful_count) count = broken_runs.count
Add a name to the from email address
diff --git a/interactive-tests/interactives_samples_1-oil-and-water-shake.rb b/interactive-tests/interactives_samples_1-oil-and-water-shake.rb index abc1234..def5678 100644 --- a/interactive-tests/interactives_samples_1-oil-and-water-shake.rb +++ b/interactive-tests/interactives_samples_1-oil-and-water-shake.rb @@ -0,0 +1,6 @@+# Run basic test first. +load 'interactive-tests/default.rb', true +# Click a button and take a screenshot again. +$test.driver.find_element(:css, '#shake > button').click +sleep 1 +$test.save_screenshot
Add custom test script for "Oil and Water Shake" interactive [#69189676]
diff --git a/spec/components/document_list.spec.rb b/spec/components/document_list.spec.rb index abc1234..def5678 100644 --- a/spec/components/document_list.spec.rb +++ b/spec/components/document_list.spec.rb @@ -0,0 +1,98 @@+require "spec_helper" + +describe "Document list", type: :view do + def component_name + "document_list" + end + + def render_component(component_arguments) + render partial: "components/#{component_name}", locals: component_arguments + end + + def default + { + items: [ + { + link: { + text: "School behaviour and attendance: parental responsibility measures", + path: "/government/publications/parental-responsibility-measures-for-behaviour-and-attendance", + }, + }, + ], + } + end + + def with_parts + { + items: [ + { + link: { + text: "Item title", + path: "/link", + }, + parts: [ + { + link: { + text: "Part title", + path: "part-link", + description: "Part description", + }, + }, + ], + }, + ], + } + end + + def with_parts_no_link + { + items: [ + { + link: { + text: "Item title", + path: "/link", + }, + parts: [ + { + link: { + text: "Part title without link", + description: "Part description", + }, + }, + ], + }, + ], + } + end + + it "does not render parts if they are not available" do + render_component(default) + expect(rendered).not_to have_selector(".gem-c-document-list__children") + end + + it "renders parts if they are available" do + render_component(with_parts) + expect(rendered).to have_selector(".gem-c-document-list__children") + end + + it "part contains a title" do + render_component(with_parts) + expect(rendered).to have_selector(".gem-c-document-list-child__link", text: "Part title") + end + + it "part link contains a valid url" do + render_component(with_parts) + expect(rendered).to have_link "Part title", href: "/link/part-link" + end + + it "part contains a description" do + render_component(with_parts) + expect(rendered).to have_selector(".gem-c-document-list-child__description", text: "Part description") + end + + it "part renders a heading span if no link is provided" do + render_component(with_parts_no_link) + expect(rendered).to have_selector(".gem-c-document-list-child__heading", text: "Part title without link") + expect(rendered).not_to have_selector(".gem-c-document-list-child__link") + end +end
Test output of item 'parts' As the ouput of an item has already been tested upstream, this test just tets the enhancement
diff --git a/spec/features/category_scopes_spec.rb b/spec/features/category_scopes_spec.rb index abc1234..def5678 100644 --- a/spec/features/category_scopes_spec.rb +++ b/spec/features/category_scopes_spec.rb @@ -12,13 +12,9 @@ stub_oauth_edit end - it 'show up for ArticleScopedPrograms' do + it 'lets a facilitator add and remove a category' do visit "/courses/#{course.slug}/articles" expect(page).to have_content 'Tracked Categories' - end - - it 'lets a facilitator add and remove a category' do - visit "/courses/#{course.slug}/articles" click_button 'Add category' find('#category_name').set('Photography') click_button 'Add this category'
Remove trivial spec that may have been causing others to fail I have an unconfirmed hunch that the dangling requests from the first, trivial spec may have caused the second spec to fail intermittently, because of the database getting reset.
diff --git a/spec/integration/entry_schema_spec.rb b/spec/integration/entry_schema_spec.rb index abc1234..def5678 100644 --- a/spec/integration/entry_schema_spec.rb +++ b/spec/integration/entry_schema_spec.rb @@ -14,4 +14,85 @@ expect(subject.description). to eq('schema for an fstab entry') end + + describe 'properties' do + subject { root.properties } + + it 'has four items' do + expect(subject.length).to eq(4) + end + + describe 'first' do + subject { root.properties[0] } + + it { is_expected.to be_kind_of(Argo::ObjectProperty) } + + it 'has a name' do + expect(subject.name).to eq('storage') + end + + it 'is required' do + expect(subject).to be_required + end + end + + describe 'second' do + subject { root.properties[1] } + + it { is_expected.to be_kind_of(Argo::StringProperty) } + + it 'has a name' do + expect(subject.name).to eq('fstype') + end + + it 'is not required' do + expect(subject).not_to be_required + end + + it 'has constraints' do + expect(subject.constraints).to eq(enum: %w[ ext3 ext4 btrfs ]) + end + end + + describe 'third' do + subject { root.properties[2] } + + it { is_expected.to be_kind_of(Argo::ArrayProperty) } + + it 'has a name' do + expect(subject.name).to eq('options') + end + + describe 'items' do + subject { root.properties[2].items } + + it { is_expected.to be_kind_of(Argo::StringProperty) } + end + + it 'is not required' do + expect(subject).not_to be_required + end + + it 'has constraints' do + expect(subject.constraints).to eq( + minItems: 1, + uniqueItems: true + ) + end + end + + describe 'fourth' do + subject { root.properties[3] } + + it { is_expected.to be_kind_of(Argo::BooleanProperty) } + + it 'has a name' do + expect(subject.name).to eq('readonly') + end + + it 'is not required' do + expect(subject).not_to be_required + end + end + end end
Test existing behaviour on entry schema
diff --git a/spec/ruby/1.8/language/ensure_spec.rb b/spec/ruby/1.8/language/ensure_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/1.8/language/ensure_spec.rb +++ b/spec/ruby/1.8/language/ensure_spec.rb @@ -21,4 +21,15 @@ t.do_test.should == :did_test t.values.should == [:start, :in_block, :end] end + + it "propagates the original exception even when exceptions are caught inside the ensure block" do + code = lambda do + begin + raise EOFError, "foo" + ensure + "".size rescue nil + end + end + code.should raise_error(EOFError) + end end
Add spec for exception handling inside ensure block. Signed-off-by: Michael S. Klishin <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@novemberain.com>
diff --git a/app/models/todo_list.rb b/app/models/todo_list.rb index abc1234..def5678 100644 --- a/app/models/todo_list.rb +++ b/app/models/todo_list.rb @@ -8,8 +8,12 @@ index({user_id: 1, date: 1}, {unique: true}) def add(text, hour, minute) - schedule_date = DateTime.new(date.year, date.mon, date.day, hour, minute) - todos << Todo.new(text: text, date: schedule_date) + time = Time.new(date.year, date.mon, date.day, hour, minute) + todos << Todo.new(text: text, time: time) + end + + def find_by_id(todo_id) + todos.find(todo_id) end def remove(todo_id) @@ -17,21 +21,15 @@ todos.delete(todo) if todo end - def done_todos + def completed_todos todos.select { |todo| todo.done } end - def undone_todos + def active_todos todos.reject { |todo| todo.done } end - class << self - def find_by_date(date, user_id) - find_or_create_by(date: date, user_id: user_id) - end - - def find_by_id(id, user_id) - where(id: id, user_id: user_id).first - end + def self.find_by_date(date, user_id) + find_or_create_by(date: date, user_id: user_id) end end
Add method for finding the todo list for a given date, which will create it if it is not found. Add method for finding a todo by id
diff --git a/config/initializers/01_monkeypatch.rb b/config/initializers/01_monkeypatch.rb index abc1234..def5678 100644 --- a/config/initializers/01_monkeypatch.rb +++ b/config/initializers/01_monkeypatch.rb @@ -62,7 +62,7 @@ def format_error return { # TODO: I18n - message: self.message, + message: "not allowed to #{self.query} for this #{self.record.class.to_s.downcase}", kind: self.class.to_s, } end
Change error message when unauthorized.
diff --git a/lib/operawatir/quickwidgets/quick_dropdownitem.rb b/lib/operawatir/quickwidgets/quick_dropdownitem.rb index abc1234..def5678 100644 --- a/lib/operawatir/quickwidgets/quick_dropdownitem.rb +++ b/lib/operawatir/quickwidgets/quick_dropdownitem.rb @@ -28,9 +28,18 @@ # @return true if item is now selected, otherwise false # def select_with_click - click + if mac_internal? + press_menu + else + click + end selected? end - + + private + # Selects an item from a drop down pop menu where you can't click them on Mac + def press_menu + driver.pressQuickMenuItem(text, true); + end end end
Add press menu for selecting drop downs
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -3,9 +3,15 @@ RSpec.describe UsersController, type: :controller do describe "GET #show" do - it "returns http success" do - get :show - expect(response).to have_http_status(:success) + let(:user) { create(:user) } + before { get :show, params: { id: user } } + + it "renders :show view" do + expect(response).to render_template(:show) + end + + it "assigns the requested object to @user" do + expect(assigns(:user)).to eq(user) end end
Add users controller basic tests
diff --git a/BabyBluetooth.podspec b/BabyBluetooth.podspec index abc1234..def5678 100644 --- a/BabyBluetooth.podspec +++ b/BabyBluetooth.podspec @@ -16,9 +16,10 @@ s.author = { "liuyanwei" => "coolnameismy@hotmail.com" } s.source = { :git => "https://github.com/coolnameismy/BabyBluetooth.git", :tag => "0.7.0" } - s.platform = :ios, "7.0" + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.10' s.requires_arc = true - + s.source_files = "Classes", "Classes/objc/*.{h,m}" end
Update podspec to support macOS platform
diff --git a/app/overrides/add_original_price_to_product_edit.rb b/app/overrides/add_original_price_to_product_edit.rb index abc1234..def5678 100644 --- a/app/overrides/add_original_price_to_product_edit.rb +++ b/app/overrides/add_original_price_to_product_edit.rb @@ -1,11 +1,12 @@ Deface::Override.new(:virtual_path => 'spree/admin/products/_form', :name => 'add_original_price_to_product_edit', - :insert_after => "erb[loud]:contains('text_field :price')", + :insert_after => "div[data-hook=admin_product_form_price]", :text => " - <%= f.field_container :original_price do %> - <%= f.label :original_price, raw(Spree.t(:original_price) + content_tag(:span, ' *')) %> - <%= f.text_field :original_price, :value => - number_to_currency(@product.original_price, :unit => '') %> - <%= f.error_message_on :original_price %> - <% end %> + <div data-hook='admin_product_form_original_price'> + <%= f.field_container :original_price, class: ['form-group'] do %> + <%= f.label :original_price, raw(Spree.t(:original_price)) %> + <%= f.text_field :original_price, :value => number_to_currency(@product.original_price, :unit => ''), class: 'form-control' %> + <%= f.error_message_on :original_price %> + <% end %> + </div> ")
Format original price data form in product edit to match other data elements
diff --git a/soyuz.gemspec b/soyuz.gemspec index abc1234..def5678 100644 --- a/soyuz.gemspec +++ b/soyuz.gemspec @@ -20,7 +20,7 @@ spec.add_dependency "commander" spec.add_dependency "safe_yaml" - spec.add_dependency "psych" + spec.add_dependency "psych", ">=2.0.5" spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake"
Add version requirement for psych so it doesn't uses an old heap overflow version of libyaml
diff --git a/lib/image_server/installer.rb b/lib/image_server/installer.rb index abc1234..def5678 100644 --- a/lib/image_server/installer.rb +++ b/lib/image_server/installer.rb @@ -37,7 +37,7 @@ end def current_version - '1.16.1' + '1.17.0' end def executable_name
Update to latest image server version
diff --git a/helpers/custom_helpers.rb b/helpers/custom_helpers.rb index abc1234..def5678 100644 --- a/helpers/custom_helpers.rb +++ b/helpers/custom_helpers.rb @@ -3,7 +3,7 @@ 'coffee' => 'coffeescript', 'rb' => 'ruby', 'java' => 'java', - 'py' => 'python3' + 'py' => 'python' }.freeze def code_from_file(filename)
Fix syntax highlighting for Python
diff --git a/lib/postal_address/address.rb b/lib/postal_address/address.rb index abc1234..def5678 100644 --- a/lib/postal_address/address.rb +++ b/lib/postal_address/address.rb @@ -2,12 +2,13 @@ class Address Fields = %i(recipient street zip state city country country_code).freeze - attr_accessor *Fields + attr_accessor(*Fields) - def initialize(**attrs) - attrs.each { |k,v| public_send(:"#{k}=", v) if respond_to?(:"#{k}=") } - end - + def initialize(**attrs, &block) + attrs.each { |k,v| public_send("#{k}=", v) if respond_to?("#{k}=") } + yield self if block_given? + end + def country_code=(code) @country_code = Postal.sanitize(code) end
Fix for warning: `*' interpreted as argument prefix
diff --git a/name_resolution/name_resolver.rb b/name_resolution/name_resolver.rb index abc1234..def5678 100644 --- a/name_resolution/name_resolver.rb +++ b/name_resolution/name_resolver.rb @@ -12,7 +12,7 @@ def build_report begin # Only Ruby >= 2.0.0 supports setting a timeout, so use this - Timeout.timeout(option(:timeout)) do + Timeout.timeout(option(:timeout).to_i) do resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)]) resolver.getaddress(option(:resolve_address)) end
Fix issue with timeout variable being passed as a string
diff --git a/Casks/anytrans-for-android.rb b/Casks/anytrans-for-android.rb index abc1234..def5678 100644 --- a/Casks/anytrans-for-android.rb +++ b/Casks/anytrans-for-android.rb @@ -0,0 +1,10 @@+cask 'anytrans-for-android' do + version :latest + sha256 :no_check + + url 'http://dl.imobie.com/anytrans-android-mac.dmg' + name 'AnyTrans' + homepage 'https://www.imobie.com/anytrans/android-manager.htm' + + app 'AnyTrans for Android.app' +end
Add AnyTrans for Android.app Latest
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb index abc1234..def5678 100644 --- a/Casks/handbrakecli-nightly.rb +++ b/Casks/handbrakecli-nightly.rb @@ -1,6 +1,6 @@ class HandbrakecliNightly < Cask - version '6452svn' - sha256 'cce4733a704bab3d0314d8950b98c2cdce4ed47e4e838727f8e996a3f5cfa537' + version '6469svn' + sha256 '0eb150843aa2a7f2f23ad1c9359478e1843f26fc12d50a0c55a8fc92f0a7d398' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr'
Update HandBrakeCLI Nightly to v6469svn HandBrakeCLI Nightly Build 6469svn released 2014-10-26.
diff --git a/lib/scrapinghub/api_method.rb b/lib/scrapinghub/api_method.rb index abc1234..def5678 100644 --- a/lib/scrapinghub/api_method.rb +++ b/lib/scrapinghub/api_method.rb @@ -11,7 +11,7 @@ build_params! build_uri!(base_url) - [@uri, @parameters] + @uri end def build_params! @@ -24,6 +24,7 @@ def build_uri!(base_url) @uri = URI( File.join(base_url, @location) ) + @uri.query = URI.encode_www_form(@parameters) end end end
Add the parameters in ApiMethod
diff --git a/app/models/inputs/effective_ckeditor_text_area_input.rb b/app/models/inputs/effective_ckeditor_text_area_input.rb index abc1234..def5678 100644 --- a/app/models/inputs/effective_ckeditor_text_area_input.rb +++ b/app/models/inputs/effective_ckeditor_text_area_input.rb @@ -5,7 +5,7 @@ class EffectiveCkeditorTextAreaInput < SimpleForm::Inputs::StringInput def input(wrapper_options = nil) - Inputs::EffectiveCkeditorTextarea::Input.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html + Inputs::EffectiveCkeditorTextArea::Input.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html end end
Fix module naming bug for effective ckeditor text area input
diff --git a/lib/thor-scmversion/errors.rb b/lib/thor-scmversion/errors.rb index abc1234..def5678 100644 --- a/lib/thor-scmversion/errors.rb +++ b/lib/thor-scmversion/errors.rb @@ -26,6 +26,7 @@ class GitError < SCMVersionError; end class GitTagError < GitError + status_code(100) def initialize(tag) @tag = tag end
Add status code to git tag error
diff --git a/lib/yasuri/yasuri_map_node.rb b/lib/yasuri/yasuri_map_node.rb index abc1234..def5678 100644 --- a/lib/yasuri/yasuri_map_node.rb +++ b/lib/yasuri/yasuri_map_node.rb @@ -21,32 +21,30 @@ end def to_h - h = {} - h["node"] = "map" - h["name"] = self.name - h["children"] = self.children.map{|c| c.to_h} if not children.empty? + node_hash = {} + node_hash["node"] = "map".freeze + node_hash["name"] = self.name + node_hash["children"] = self.children.map{|c| c.to_h} if not children.empty? self.opts.each do |key,value| - h[key] = value if not value.nil? + node_hash[key] = value if not value.nil? end - h + node_hash end - def self.hash2node(node_h) - reserved_keys = %i|node name children| + def self.hash2node(node_hash) + reserved_keys = %i|node name children|.freeze - node, name, children = reserved_keys.map do |key| - node_h[key] - end + node, name, children = reserved_keys.map{|key| node_hash[key]} fail "Not found 'name' value in map" if name.nil? fail "Not found 'children' value in map" if children.nil? children ||= [] childnodes = children.map{|c| Yasuri.hash2node(c) } - reserved_keys.each{|key| node_h.delete(key)} - opt = node_h + reserved_keys.each{|key| node_hash.delete(key)} + opt = node_hash self.new(name, childnodes, **opt) end
Improve rename variable more concrete
diff --git a/lib/yira.rb b/lib/yira.rb index abc1234..def5678 100644 --- a/lib/yira.rb +++ b/lib/yira.rb @@ -11,52 +11,34 @@ "jpace:H@ll0w3dB3Thy" end - def get_url url + def run_curl type, *params args = Array.new args << "curl" args << "-k" args << "-u" args << qq(my_credentials) args << "-X" - args << "GET" + args << type args << "-H" args << qq("Content-Type: application/json") - args << qq(url) - puts "args: #{args}" + args.concat params cmd = args.join " " puts "cmd: #{cmd}" contents = IO.popen(cmd).readlines.join "" puts "contents" - puts contents + # puts contents JSON.parse contents end + def get_url url + run_curl "GET", url + end + def post_url data, url - args = Array.new - args << "curl" - args << "-k" - args << "-u" - args << qq(my_credentials) - args << "-X" - args << "POST" - args << "-H" - args << qq("Content-Type: application/json") - args << "--data" - args << q(data) - args << qq(url) - # puts "args: #{args}" - cmd = args.join " " - puts "cmd: #{cmd}" - - contents = IO.popen(cmd).readlines.join "" - - puts "contents" - puts contents - - JSON.parse contents + run_curl "POST", "--data", q(data), url end def q str
Clean up common Jira/curl code
diff --git a/db/migrate/20170109161435_move_lock_version_data.rb b/db/migrate/20170109161435_move_lock_version_data.rb index abc1234..def5678 100644 --- a/db/migrate/20170109161435_move_lock_version_data.rb +++ b/db/migrate/20170109161435_move_lock_version_data.rb @@ -0,0 +1,15 @@+class MoveLockVersionData < ActiveRecord::Migration[5.0] + def up + execute "UPDATE link_sets + SET lock_version = t.number + FROM (SELECT target_id, number FROM lock_versions) t + WHERE link_sets.id = t.target_id" + end + + def down + execute "UPDATE lock_versions + SET number = t.lock_version + FROM (SELECT id, lock_version FROM link_sets) t + WHERE lock_versions.target_id = t.id" + end +end
Add migration to move lock version data
diff --git a/cg_role_client.gemspec b/cg_role_client.gemspec index abc1234..def5678 100644 --- a/cg_role_client.gemspec +++ b/cg_role_client.gemspec @@ -11,15 +11,15 @@ s.description = "Client library for the CG Role Service." s.summary = "" - s.add_dependency "jruby-openssl", ">= 0.7.4" - s.add_dependency "rake", "0.8.7" s.add_dependency "activemodel", ">= 3.0.0" s.add_dependency "activerecord", ">= 3.0.0" s.add_dependency "activesupport", ">= 3.0.0" - s.add_dependency "rspec", ">= 2.5.0" s.add_dependency "aspect4r", ">= 0.9.1" s.add_dependency "rest-client", ">= 1.6.3" s.add_dependency "cg_lookup_client", ">= 0.5.0" + + s.add_development_dependency 'rake', '0.8.7' + s.add_development_dependency 'rspec', '>= 2.5.0' s.files = Dir.glob("{lib,spec}/**/*")
Remove dep on jruby-openssl; move rspec and rake to dev deps. git-svn-id: fa1a74920b061848e2ced189e7c50f362c0f37df@6865 bc291798-7d79-44a5-a816-fbf4f7d05ffa
diff --git a/app/helpers/elements_helper.rb b/app/helpers/elements_helper.rb index abc1234..def5678 100644 --- a/app/helpers/elements_helper.rb +++ b/app/helpers/elements_helper.rb @@ -6,6 +6,32 @@ end nil end + + def render_paragraph(element) + # TODO: WRITE MORE GOOD + # Seriously, what the fuck? + @footnote_placeholder_count ||= 0 + @footnote_counter ||= 0 + footnotes = Nokogiri::HTML(element.content).css("span.footnote") + content = element.content.gsub(/<span class="footnote"(.*?)>(.*?)<\/span>/) do + @footnote_placeholder_count += 1 + content_tag("sup") do + link_to(@footnote_placeholder_count, "#footnote_#{@footnote_placeholder_count}") + end + end + concat(raw(content)) + footnotes.each do |footnote| + @footnote_counter += 1 + footnote_element = content_tag("span", :class => "footnote") do + anchor = content_tag("a", :name => "footnote_#{@footnote_counter}") { "#{@footnote_counter}" } + "#{anchor} #{footnote.to_html}".html_safe + end + concat(footnote_element.html_safe) + end + nil + end + + private def find_element_partial(element) @partials ||= {}
Write fucking ugly render paragraph method
diff --git a/app/lenses/people/user_lens.rb b/app/lenses/people/user_lens.rb index abc1234..def5678 100644 --- a/app/lenses/people/user_lens.rb +++ b/app/lenses/people/user_lens.rb @@ -24,7 +24,7 @@ # Returns the tag that says 'All Users'. Remote select2s only need one actual option tag. def selected_option_tag if value.present? - user = context.policy_scope(User).find(value) + user = UserPolicy::Scope.new(h.current_user, User).resolve.find(value) h.content_tag(:option, user.name, value: user.id, selected: "selected") else ""
Fix bug in meal jobs search
diff --git a/app/mailers/reporter_mailer.rb b/app/mailers/reporter_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/reporter_mailer.rb +++ b/app/mailers/reporter_mailer.rb @@ -11,7 +11,8 @@ def named_maps_near_the_limit(message) mail_to = Cartodb.get_config(:mailer, 'support_email') + mail_from = Cartodb.get_config(:mailer, 'internal_notifications_email') - mail to: mail_to, subject: message if mail_to + mail from: mail_from, to: mail_to, subject: message if mail_to && mail_from end end
Add new mail sender for internal notifications
diff --git a/app/reports/integrity_check.rb b/app/reports/integrity_check.rb index abc1234..def5678 100644 --- a/app/reports/integrity_check.rb +++ b/app/reports/integrity_check.rb @@ -17,7 +17,7 @@ end def models_to_check - [StudentAssessment, Assessment, Educator, Student, StudentSchoolYear] + [StudentAssessment, Assessment, Educator, Student] end def has_valid_data?
Remove StudentSchoolYear from data integrity check
diff --git a/kamelopard/lib/kamelopard.rb b/kamelopard/lib/kamelopard.rb index abc1234..def5678 100644 --- a/kamelopard/lib/kamelopard.rb +++ b/kamelopard/lib/kamelopard.rb @@ -3,3 +3,4 @@ require 'kamelopard/geocode' require 'kamelopard/function' require 'kamelopard/function_paths' +require 'kamelopard/multicam'
Include multicam stuff by default
diff --git a/sandwich.rb b/sandwich.rb index abc1234..def5678 100644 --- a/sandwich.rb +++ b/sandwich.rb @@ -18,12 +18,11 @@ def run_chef rebuild_node - Chef::Log.level = :debug run_context = Chef::RunContext.new($client.node, {}) recipe = Chef::Recipe.new(nil, nil, run_context) input = ARGF.read recipe.from_string(input) - Chef::Log.level = :debug + Chef::Log.level = :warn runrun = Chef::Runner.new(run_context).converge runrun end
Set standard log level to warn
diff --git a/Casks/eclipse-jee.rb b/Casks/eclipse-jee.rb index abc1234..def5678 100644 --- a/Casks/eclipse-jee.rb +++ b/Casks/eclipse-jee.rb @@ -1,12 +1,12 @@ cask :v1 => 'eclipse-jee' do - version '4.4.1' + version '4.4.2' if Hardware::CPU.is_32_bit? - sha256 '3e3d6c80fb0a4c4fa12060cd52680df0722ebc45efae27e367c1d2a8fa0b8b0b' - url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR1a/eclipse-jee-luna-SR1a-macosx-cocoa.tar.gz' + sha256 '319a0c224c356aca62d3aae2b157cb958031e4afb4dfd41f6ab853915cd62dba' + url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR2/eclipse-jee-luna-SR2-macosx-cocoa.tar.gz' else - sha256 '6f24c787d247323a69b3c2ba0312edce46a23337d61199276cd2ea8681e90612' - url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR1a/eclipse-jee-luna-SR1a-macosx-cocoa-x86_64.tar.gz' + sha256 '27e4307b45b76f664c52c43995cc2dca605cc751aa4605baf08b625eacf3d6ab' + url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR2/eclipse-jee-luna-SR2-macosx-cocoa-x86_64.tar.gz' end name 'Eclipse'
Update Eclipse IDE for Java EE Developers to v4.4.2 (Luna SR2)
diff --git a/Casks/spacemonkey.rb b/Casks/spacemonkey.rb index abc1234..def5678 100644 --- a/Casks/spacemonkey.rb +++ b/Casks/spacemonkey.rb @@ -9,5 +9,7 @@ homepage 'https://www.spacemonkey.com' license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder + auto_updates true + app 'SpaceMonkey.app' end
Add auto_updates flag to SpaceMonkey
diff --git a/lib/aliyun/common/logging.rb b/lib/aliyun/common/logging.rb index abc1234..def5678 100644 --- a/lib/aliyun/common/logging.rb +++ b/lib/aliyun/common/logging.rb @@ -11,7 +11,6 @@ # logger.info(xxx) module Logging - DEFAULT_LOG_FILE = "./aliyun_sdk.log" MAX_NUM_LOG = 100 ROTATE_SIZE = 10 * 1024 * 1024 @@ -34,11 +33,8 @@ def self.logger unless @logger - @log_file = nil - # Environment parameter ALIYUN_OSS_SDK_LOG_PATH used to control whether output log to a file - if ENV['ALIYUN_OSS_SDK_LOG_PATH'] - @log_file ||= DEFAULT_LOG_FILE - end + # Environment parameter ALIYUN_OSS_SDK_LOG_PATH used to set output log to a file,do not output log if not set + @log_file ||= ENV["ALIYUN_OSS_SDK_LOG_PATH"] @logger = Logger.new( @log_file, MAX_NUM_LOG, ROTATE_SIZE) @logger.level = Logger::INFO
Add variable control log output path
diff --git a/lib/codeclimate_ci/report.rb b/lib/codeclimate_ci/report.rb index abc1234..def5678 100644 --- a/lib/codeclimate_ci/report.rb +++ b/lib/codeclimate_ci/report.rb @@ -1,22 +1,24 @@ module CodeclimateCi - class Report - def self.result_not_ready(retry_count, branch) + module Report + module_function + + def result_not_ready(retry_count, branch) puts "Retry #{retry_count}. #{branch} branch analyze is not ready or branch does not exist" end - def self.worse_code(gpa_diff) + def worse_code(gpa_diff) puts "Code in your branch became worse on #{rounded_diff_value(gpa_diff)} points" end - def self.good_code(gpa_diff) + def good_code(gpa_diff) puts "Gpa score has improved to #{rounded_diff_value(gpa_diff)} points. Go on..." end - def self.invalid_credentials - puts 'Given invalid credentials. Please check your codeclimate_api_token and repo_id.' + def invalid_credentials + puts 'Invalid credentials given. Please check your codeclimate_api_token and repo_id.' end - def self.rounded_diff_value(gpa_diff) + def rounded_diff_value(gpa_diff) gpa_diff.abs.round(2) end end
Replace Report class by module
diff --git a/filmbuff.gemspec b/filmbuff.gemspec index abc1234..def5678 100644 --- a/filmbuff.gemspec +++ b/filmbuff.gemspec @@ -15,6 +15,7 @@ s.required_ruby_version = '>= 2.0.0' s.add_dependency('faraday', '~> 0.8') + s.add_dependency('faraday_middleware', '~> 0.8') s.add_development_dependency('minitest', '>= 1.4.0') s.add_development_dependency('yard', '>= 0.8.5.2')
Revert "Don't need Faraday middleware at the moment" This reverts commit fa88be417886218bf19bec15cf0071055e54ca98.
diff --git a/lib/password_and_ordinals.rb b/lib/password_and_ordinals.rb index abc1234..def5678 100644 --- a/lib/password_and_ordinals.rb +++ b/lib/password_and_ordinals.rb @@ -5,11 +5,11 @@ def initialize password, character_ordinals raise(ArgumentError, "#{character_ordinals.uniq.to_sentence} duplicated in #{character_ordinals}") unless uniq?(character_ordinals) raise(ArgumentError, "#{character_ordinals} is not in ascending order") unless sorted?(character_ordinals) + raise(ArgumentError, "#{character_ordinals} would reveal entire password") unless character_ordinals.size < password.size @password = password @indices = indices character_ordinals - raise(ArgumentError, "#{character_ordinals} would reveal entire password") unless subset? abort 'Indices were out of bounds' unless in_bounds? end @@ -27,12 +27,6 @@ a.sort == a end - def subset? - all_indices_set = Set.new 0...@password.length - indices_set = Set.new @indices - indices_set.proper_subset? all_indices_set - end - def in_bounds? @indices.all? { |i| i >= 0 && i < @password.length } end
Move precondition earlier in constructor
diff --git a/lib/pieces/tilt_extension.rb b/lib/pieces/tilt_extension.rb index abc1234..def5678 100644 --- a/lib/pieces/tilt_extension.rb +++ b/lib/pieces/tilt_extension.rb @@ -3,12 +3,8 @@ module Tilt if respond_to?(:register_lazy) register_lazy 'Pieces::Tilt::MustacheTemplate', 'pieces/tilt/mustache', 'mustache', 'ms' - register_lazy 'Pieces::Tilt::CssTemplate', 'pieces/tilt/css', 'css' else # support tilt v1 require 'pieces/tilt/mustache' register Pieces::Tilt::MustacheTemplate, 'mustache', 'ms' - - require 'pieces/tilt/css' - register Pieces::Tilt::CssTemplate, 'css' end end
Remove unused CssTemplate from tilt extension
diff --git a/lib/aruba/config/jruby.rb b/lib/aruba/config/jruby.rb index abc1234..def5678 100644 --- a/lib/aruba/config/jruby.rb +++ b/lib/aruba/config/jruby.rb @@ -6,12 +6,12 @@ next unless RUBY_PLATFORM == 'java' # disable JIT since these processes are so short lived - ENV['JRUBY_OPTS'] = "-X-C #{ENV['JRUBY_OPTS']}" + ENV['JRUBY_OPTS'] = "-X-C #{ENV['JRUBY_OPTS']}" unless ENV['JRUBY_OPTS'].include? '-X-C' # Faster startup for jruby - ENV['JRUBY_OPTS'] = "--dev #{ENV['JRUBY_OPTS']}" + ENV['JRUBY_OPTS'] = "--dev #{ENV['JRUBY_OPTS']}" unless ENV['JRUBY_OPTS'].include? '--dev' # force jRuby to use client JVM for faster startup times - ENV['JAVA_OPTS'] = "-d32 #{ENV['JAVA_OPTS']}" if RbConfig::CONFIG['host_os'] =~ /solaris|sunos/i + ENV['JAVA_OPTS'] = "-d32 #{ENV['JAVA_OPTS']}" if RbConfig::CONFIG['host_os'] =~ /solaris|sunos/i && !ENV['JAVA_OPTS'].include?('-d32') end end
Add those flags only if not already added
diff --git a/test/vagrant/downloaders/file_test.rb b/test/vagrant/downloaders/file_test.rb index abc1234..def5678 100644 --- a/test/vagrant/downloaders/file_test.rb +++ b/test/vagrant/downloaders/file_test.rb @@ -17,11 +17,25 @@ end context "downloading" do + setup do + clean_paths + end + should "cp the file" do - path = '/path' - @tempfile.expects(:path).returns(path) - FileUtils.expects(:cp).with(@uri, path) - @downloader.download!(@uri, @tempfile) + uri = tmp_path.join("foo_source") + dest = tmp_path.join("foo_dest") + + # Create the source file, then "download" it + File.open(uri, "w+") { |f| f.write("FOO") } + File.open(dest, "w+") do |dest_file| + @downloader.download!(uri, dest_file) + end + + # Finally, verify the destination file was properly created + assert File.file?(dest) + File.open(dest) do |f| + assert_equal "FOO", f.read + end end end
Improve the file downloader test to use a real file
diff --git a/core/file/path_spec.rb b/core/file/path_spec.rb index abc1234..def5678 100644 --- a/core/file/path_spec.rb +++ b/core/file/path_spec.rb @@ -16,3 +16,15 @@ File.open(@file2, 'w'){|file| file.path.should == tmp("../tmp/xxx")} end end + +describe "File.path" do + before :each do + @file1 = tmp("../tmp/xxx") + end + + ruby_version_is "1.9.1" do + it "returns the full path for the given file" do + File.path(@file1).should == tmp("../tmp/xxx") + end + end +end
Add spec for Ruby 1.9's File.path.
diff --git a/test/controllers/kiitos/admin/administrators_controller_test.rb b/test/controllers/kiitos/admin/administrators_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/kiitos/admin/administrators_controller_test.rb +++ b/test/controllers/kiitos/admin/administrators_controller_test.rb @@ -12,11 +12,11 @@ it 'turns a user into an admin' do Kiitos::Administrator.all.count.must_equal 0 - post :create, user_id: @user.id - Kiitos::Administrator.all.count.must_equal 1 + post :create, id: @user.id + Kiitos::Administrator.last.user_id.must_equal @user.id end it 'redirects to the users management panel' do - post :create, user_id: 1 + post :create, id: 1 response.must_redirect_to admin_users_path end end
Change test to test for the user id
diff --git a/spec/end_view_spec.rb b/spec/end_view_spec.rb index abc1234..def5678 100644 --- a/spec/end_view_spec.rb +++ b/spec/end_view_spec.rb @@ -1,6 +1,6 @@ require 'end_view' -Dir["#{__FILE__}/../examples/*.rb"].each { |f| require f } +Dir[File.join(__FILE__, '..', 'examples', '*.rb')].each { |f| require f } describe EndView do it 'renders a simple template' do
Use File.join to require examples
diff --git a/app/controllers/concerns/measurements.rb b/app/controllers/concerns/measurements.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/measurements.rb +++ b/app/controllers/concerns/measurements.rb @@ -4,8 +4,7 @@ MEASUREMENT_OPTIONS = ActiveSupport::HashWithIndifferentAccess.new( kwh: 'energy used in kilowatt-hours', gb_pounds: 'energy cost in pounds', - co2: 'carbon dioxide in kilograms produced', - library_books: 'number of library books you could buy' + co2: 'carbon dioxide in kilograms produced' ).freeze def set_measurement_options @@ -29,7 +28,12 @@ end def default_measurement_or_preference - cookies[:energy_sparks_measurement] || @default_measurement + cookie_value = cookies[:energy_sparks_measurement] + if valid_measurement?(cookie_value) + cookie_value + else + @default_measurement + end end def set_cookie_preference(measurement)
Remove library books as an analytics scaling option
diff --git a/lib/fishwife/hijack_io.rb b/lib/fishwife/hijack_io.rb index abc1234..def5678 100644 --- a/lib/fishwife/hijack_io.rb +++ b/lib/fishwife/hijack_io.rb @@ -5,7 +5,7 @@ end def write(str) - @async_context.response.output_stream.print(str) + @async_context.response.output_stream.write(str.to_java_bytes) end def flush
Write raw bytes instead of converting through Java strings
diff --git a/lib/etl/transform/calculation_transform.rb b/lib/etl/transform/calculation_transform.rb index abc1234..def5678 100644 --- a/lib/etl/transform/calculation_transform.rb +++ b/lib/etl/transform/calculation_transform.rb @@ -15,15 +15,52 @@ return nil if row[@fields[0]].nil? if (@function.eql? "A + B") - first = row[@fields[0]] - second = "" - second = row[@fields[1]] unless row[@fields[1]].nil? - row[name] = first + second + result = "" + @fields.each do |field| + next if field.nil? + + string = "" + if field.to_s.eql? field + string = field + begin + string = eval('"' + field + '"') + rescue + end + else + string = row[field] + end + next if string.nil? + + result = result + string + end + + row[name] = result end if (@function.eql? "date A") first = row[@fields[0]] row[name] = Time.parse(first) + end + + if (@function.eql? "trim A") + first = row[@fields[0]] + row[name] = first.strip + end + + if (@function.eql? "lower A") + first = row[@fields[0]] + row[name] = first.downcase + end + + if (@function.eql? "upper A") + first = row[@fields[0]] + row[name] = first.upcase + end + + if (@function.eql? "encoding A") + # Bug from ruby 1.8 http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ + first = row[@fields[0]] + row[name] = Iconv.conv(@fields[1], @fields[2], first + ' ')[0..-2] end row[name]
Add much more operations to calculation step
diff --git a/lib/fog/aws/parsers/dns/get_hosted_zone.rb b/lib/fog/aws/parsers/dns/get_hosted_zone.rb index abc1234..def5678 100644 --- a/lib/fog/aws/parsers/dns/get_hosted_zone.rb +++ b/lib/fog/aws/parsers/dns/get_hosted_zone.rb @@ -17,14 +17,14 @@ case name when 'Id' @hosted_zone[name]= value.sub('/hostedzone/', '') - when 'Name', 'CallerReference', 'Comment', 'PrivateZone', 'Config', 'ResourceRecordSetCount' + when 'Name', 'CallerReference', 'Comment', 'PrivateZone', 'Config' @hosted_zone[name]= value + when 'ResourceRecordSetCount' + @hosted_zone['ResourceRecordSetCount'] = value.to_i when 'HostedZone' @response['HostedZone'] = @hosted_zone @hosted_zone = {} @section = :name_servers - when 'ResourceRecordSetCount' - @response['ResourceRecordSetCount'] = value.to_i end elsif @section == :name_servers case name
Fix get hosted zone parser to correctly convert ResourceRecordSetCount into integer
diff --git a/lib/ghpreview/instant_markdown_d/viewer.rb b/lib/ghpreview/instant_markdown_d/viewer.rb index abc1234..def5678 100644 --- a/lib/ghpreview/instant_markdown_d/viewer.rb +++ b/lib/ghpreview/instant_markdown_d/viewer.rb @@ -1,11 +1,14 @@ module GHPreview module InstantMarkdownD class Viewer - def self.open_url(host, port) - `xdg-open http://#{host}:#{port}/` + command = if RUBY_PLATFORM =~ /linux/ + 'xdg-open' + else + 'open' + end + `#{command} http://#{host}:#{port}` end - end end end
Add `open` command for OS X
diff --git a/humboldt.gemspec b/humboldt.gemspec index abc1234..def5678 100644 --- a/humboldt.gemspec +++ b/humboldt.gemspec @@ -23,7 +23,7 @@ s.add_dependency 'aws-sdk' s.add_dependency 'jruby-openssl' - s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] + Dir['config/*'] + s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] + Dir['config/**/*'] s.executables = %w[humboldt] s.require_paths = %w[lib] end
Make sure that config/emr-bootstrap is included in the gem
diff --git a/lib/rollbar/plugins/rails/railtie_mixin.rb b/lib/rollbar/plugins/rails/railtie_mixin.rb index abc1234..def5678 100644 --- a/lib/rollbar/plugins/rails/railtie_mixin.rb +++ b/lib/rollbar/plugins/rails/railtie_mixin.rb @@ -14,7 +14,13 @@ config.environment ||= ::Rails.env config.root ||= ::Rails.root config.framework = "Rails: #{::Rails::VERSION::STRING}" - config.filepath ||= ::Rails.application.class.parent_name + '.rollbar' + config.filepath ||= begin + if ::Rails.application.class.respond_to?(:module_parent_name) + ::Rails.application.class.module_parent_name + '.rollbar' + else + ::Rails.application.class.parent_name + '.rollbar' + end + end end end end
Use `module_parent_name` instead of deprecated `parent_name` `Module#parent_name is` deprecated in Rails 6.0. Ref: https://github.com/rails/rails/pull/34051
diff --git a/lib/dry/view/exposures.rb b/lib/dry/view/exposures.rb index abc1234..def5678 100644 --- a/lib/dry/view/exposures.rb +++ b/lib/dry/view/exposures.rb @@ -25,9 +25,9 @@ end def bind(obj) - bound_exposures = Hash[exposures.map { |name, exposure| - [name, exposure.bind(obj)] - }] + bound_exposures = exposures.each_with_object({}) { |(name, exposure), memo| + memo[name] = exposure.bind(obj) + } self.class.new(bound_exposures) end
Convert another hash map over to use each_with_object
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index abc1234..def5678 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,12 +1,14 @@ module Gitlab module LDAP class Person - def self.find_by_uid(uid) - Gitlab::LDAP::Adapter.new.user(config.uid, uid) + def self.find_by_uid(uid, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.user(config.uid, uid) end - def self.find_by_dn(dn) - Gitlab::LDAP::Adapter.new.user('dn', dn) + def self.find_by_dn(dn, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.user('dn', dn) end def initialize(entry)
Allow passing an adapter to Gitlab::LDAP::Person
diff --git a/lib/lazily/associating.rb b/lib/lazily/associating.rb index abc1234..def5678 100644 --- a/lib/lazily/associating.rb +++ b/lib/lazily/associating.rb @@ -18,25 +18,27 @@ # { a: [4], b: [4, 4] } # ] # - def associate(enumerable_map, &distinctor) - labels = enumerable_map.keys - labelled_enumerables = enumerable_map.map do |label, enumerable| - enumerable.lazily.map do |e| - key = distinctor ? distinctor.call(e) : e - [key, e, label] + def associate(source_map, &block) + labels = source_map.keys + tagged_element_sources = source_map.map do |label, enumerable| + enumerable.lazily.map do |value| + key = block ? block.call(value) : value + TaggedElement.new(key, value, label) end end - labelled_elements = Lazily.merge(*labelled_enumerables) { |triple| triple.first } - labelled_elements.chunk { |triple| triple.first }.map do |key, triples| + tagged_elements = Lazily.merge(*tagged_element_sources) { |te| te.key } + tagged_elements.chunk { |te| te.key }.map do |_, tagged_elements| association = {} labels.each { |label| association[label] = [] } - triples.each do |triple| - association[triple.last] << triple[1] + tagged_elements.each do |te| + association[te.label] << te.value end association end end + TaggedElement = Struct.new(:key, :value, :label) + end end
Rename things, and introduce a struct, for clarity.
diff --git a/lib/mongoid/selectable.rb b/lib/mongoid/selectable.rb index abc1234..def5678 100644 --- a/lib/mongoid/selectable.rb +++ b/lib/mongoid/selectable.rb @@ -38,7 +38,7 @@ if persisted? && _id_changed? _parent.atomic_selector else - _parent.atomic_selector.merge("#{atomic_path}._id" => _id) + _root.atomic_selector.merge("#{atomic_path}._id" => _id) end end
Make the embedded_atomic_selector less specific Works around a bug where embeds_one -> embeds_many -> embeds_many structures generate a selector which silently targets the wrong document. This may cause fire, we'll see..
diff --git a/lib/quartz/validations.rb b/lib/quartz/validations.rb index abc1234..def5678 100644 --- a/lib/quartz/validations.rb +++ b/lib/quartz/validations.rb @@ -11,20 +11,20 @@ end def self.check_go_quartz_version - current_pulse = File.read(File.join(File.dirname(__FILE__), '../../go/quartz/quartz.go')) + current_quartz = File.read(File.join(File.dirname(__FILE__), '../../go/quartz/quartz.go')) - installed_pulse_dir = ENV['GOPATH'].split(File::PATH_SEPARATOR).select do |directory| + installed_quartz_dir = ENV['GOPATH'].split(File::PATH_SEPARATOR).select do |directory| File.exist?(File.join(directory, Quartz::Validations::GO_FILE_LOCATION)) end[0] - unless installed_pulse_dir + unless installed_quartz_dir raise "GOPATH not configured." end - installed_pulse = File.read(File.join(installed_pulse_dir, + installed_quartz = File.read(File.join(installed_quartz_dir, Quartz::Validations::GO_FILE_LOCATION)) - if current_pulse != installed_pulse + if current_quartz != installed_quartz STDERR.write <<-EOS Warning: the version of Quartz in $GOPATH does not match the version packaged with the gem. Please update the Go
Use Quartz as a name
diff --git a/opal/browser/dom/element/form.rb b/opal/browser/dom/element/form.rb index abc1234..def5678 100644 --- a/opal/browser/dom/element/form.rb +++ b/opal/browser/dom/element/form.rb @@ -1,5 +1,3 @@-require 'browser/blob' - module Browser; module DOM; class Element < Node class Form < Element @@ -26,8 +24,6 @@ alias_native :method= alias_native :target alias_native :target= - alias_native :name - alias_native :name= alias_native :encoding alias_native :encoding=
Element::Form: Remove name (conflicts with tag name) and remove a require
diff --git a/lib/mighty_grid/column.rb b/lib/mighty_grid/column.rb index abc1234..def5678 100644 --- a/lib/mighty_grid/column.rb +++ b/lib/mighty_grid/column.rb @@ -18,7 +18,7 @@ end @model = @options[:model] - fail MightyGrid::Exceptions::ArgumentError.new('Model of field for filtering should have type ActiveRecord') if @model && @model.superclass != ActiveRecord::Base + fail MightyGrid::Exceptions::ArgumentError.new('Model of field for filtering should have type ActiveRecord') if @model && !@model.ancestors.include?(ActiveRecord::Base) @attrs = @options[:html] if @options.key?(:html) @th_attrs = @options[:th_html] if @options.key?(:th_html)
Fix case when model inherited from ActiveRecord::Base not directly
diff --git a/lib/togglv8/workspaces.rb b/lib/togglv8/workspaces.rb index abc1234..def5678 100644 --- a/lib/togglv8/workspaces.rb +++ b/lib/togglv8/workspaces.rb @@ -10,26 +10,34 @@ get "workspaces" end - def clients(workspace=nil) - if workspace.nil? + def clients(workspace_id=nil) + if workspace_id.nil? get "clients" else - get "workspaces/#{workspace}/clients" + get "workspaces/#{workspace_id}/clients" end end - def projects(workspace, params={}) + def projects(workspace_id, params={}) active = params.has_key?(:active) ? "?active=#{params[:active]}" : "" - get "workspaces/#{workspace}/projects#{active}" + get "workspaces/#{workspace_id}/projects#{active}" end - def users(workspace) - get "workspaces/#{workspace}/users" + def users(workspace_id) + get "workspaces/#{workspace_id}/users" end - def tasks(workspace, params={}) + def tasks(workspace_id, params={}) active = params.has_key?(:active) ? "?active=#{params[:active]}" : "" - get "workspaces/#{workspace}/tasks#{active}" + get "workspaces/#{workspace_id}/tasks#{active}" + end + + def dashboard(workspace_id) + get "dashboard/#{workspace_id}" + end + + def leave_workspace(workspace_id) + delete "workspaces/#{workspace_id}/leave" end end end
Add dashboard() and leave_workspace(). Update params to workspace_id.
diff --git a/lib/watir-classic/link.rb b/lib/watir-classic/link.rb index abc1234..def5678 100644 --- a/lib/watir-classic/link.rb +++ b/lib/watir-classic/link.rb @@ -21,6 +21,13 @@ return "" end end + + def to_s + assert_exists + r = string_creator + r = r + link_string_creator + return r.join("\n") + end # @private def link_string_creator @@ -31,13 +38,6 @@ return n end - def to_s - assert_exists - r = string_creator - r = r + link_string_creator - return r.join("\n") - end - end end
Restructure code - move private methods to bottom of class declaration etc.
diff --git a/lib/gish/commands/find_command.rb b/lib/gish/commands/find_command.rb index abc1234..def5678 100644 --- a/lib/gish/commands/find_command.rb +++ b/lib/gish/commands/find_command.rb @@ -35,9 +35,7 @@ files = found.flatten.uniq end - files.map! { |f| "\"#{f}\"" } - - return files.join(" "), Gish::OK + return files.join("\n") + "\n", Gish::OK end end end
Change the output of the find command to show one path per line
diff --git a/db/migrate/20150306181423_create_electoral_districts.rb b/db/migrate/20150306181423_create_electoral_districts.rb index abc1234..def5678 100644 --- a/db/migrate/20150306181423_create_electoral_districts.rb +++ b/db/migrate/20150306181423_create_electoral_districts.rb @@ -12,6 +12,8 @@ t.string :website t.string :albany_office_no t.string :do_office_no + t.string :social_facebook + t.string :social_twitter t.timestamps end
Add social parameters to electoral district table
diff --git a/lib/spree_fancy/engine.rb b/lib/spree_fancy/engine.rb index abc1234..def5678 100644 --- a/lib/spree_fancy/engine.rb +++ b/lib/spree_fancy/engine.rb @@ -13,6 +13,8 @@ initializer :assets do |config| Rails.application.config.assets.precompile += %w( spree/fancy/print.css ) + Rails.application.config.assets.precompile << %r(icons\.(?:eot|svg|ttf|woff)$) + Rails.application.config.assets.precompile << %w( bx_loader.gif controls.png ) end def self.activate
Add fonts and images into assets.precompile array Fixes #97 Fixes #98
diff --git a/lib/sprig/seed/factory.rb b/lib/sprig/seed/factory.rb index abc1234..def5678 100644 --- a/lib/sprig/seed/factory.rb +++ b/lib/sprig/seed/factory.rb @@ -4,17 +4,17 @@ def self.new_from_directive(directive) raise ArgumentError, 'Must provide a Directive' unless directive.is_a? Directive - klass = directive.klass - datasource = directive.datasource - options = directive.options - - new(klass, datasource, options) + new( + directive.klass, + directive.datasource, + directive.options + ) end def initialize(klass, datasource, options) - self.klass = klass - self.datasource = datasource - self.initial_options = options + self.klass = klass + self.datasource = datasource + self.initial_options = options end def add_seeds_to_hopper(hopper) @@ -30,6 +30,7 @@ def klass=(klass) raise ArgumentError, 'Must provide a Class as first argument' unless klass.is_a? Class + klass.reset_column_information @klass = klass end
Reset column info before seeding
diff --git a/integration-tests/apps/rack/background/something.rb b/integration-tests/apps/rack/background/something.rb index abc1234..def5678 100644 --- a/integration-tests/apps/rack/background/something.rb +++ b/integration-tests/apps/rack/background/something.rb @@ -11,8 +11,8 @@ end def foo - puts "JC: in foo" - puts "JC: ", @background.receive(:timeout => 25000) - @foreground.publish "success" + if "release" == @background.receive(:timeout => 25000) + @foreground.publish "success" + end end end
Make sure we get what we expect.
diff --git a/texticle.gemspec b/texticle.gemspec index abc1234..def5678 100644 --- a/texticle.gemspec +++ b/texticle.gemspec @@ -9,6 +9,7 @@ spec.authors = ["David Hahn"] spec.email = ["davidmichaelhahn@gmail.com"] spec.description = %q{ One stop shop for sending sms via email. } + spec.summary = %q{ Gem that makes sending a text message via email super simple } spec.homepage = "https://github.com/dhahn/texticle" spec.license = "MIT"
Add summary back to gemspec
diff --git a/config/initializers/datadog.rb b/config/initializers/datadog.rb index abc1234..def5678 100644 --- a/config/initializers/datadog.rb +++ b/config/initializers/datadog.rb @@ -4,5 +4,6 @@ c.use :delayed_job, service_name: 'delayed_job' c.use :dalli, service_name: 'memcached' c.analytics_enabled = true + c.runtime_metrics_enabled = true end end
Enable Ruby Runtime Metrics in Datadog This automatically collects a bunch of Ruby's GC-related metrics that will come in handy while we tune the Unicorn workers. Some of theres are: * runtime.ruby.class_count * runtime.ruby.gc.malloc_increase_bytes * runtime.ruby.gc.total_allocated_objects * runtime.ruby.gc.total_freed_objects * runtime.ruby.gc.heap_marked_slots * runtime.ruby.gc.heap_available_slots * runtime.ruby.gc.heap_free_slots * runtime.ruby.thread_count Check https://docs.datadoghq.com/tracing/runtime_metrics/ruby/#data-collected for the complete list. The cool thing is that > Runtime metrics can be viewed in correlation with your Ruby services
diff --git a/config/initializers/timeout.rb b/config/initializers/timeout.rb index abc1234..def5678 100644 --- a/config/initializers/timeout.rb +++ b/config/initializers/timeout.rb @@ -7,5 +7,5 @@ # early. To avoid clogging processing ability, Rack::Timeout terminates long # running requests. if defined?(Rack::Timeout) - Rack::Timeout.timeout = 20 # seconds + Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 30 end
Update Rack::Timeout settings for Heroku
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -26,8 +26,10 @@ c_pkg.run_action(:install) end -chef_gem 'unf' do - compile_time true if Chef::Resource::ChefGem.method_defined? :compile_time +%w(unf rest-client).each do |gem_pkg| + chef_gem gem_pkg do + compile_time true if Chef::Resource::ChefGem.method_defined? :compile_time + end end # TODO: Remove this once the gem_hell cookbook is ready to roll
Add rest-client to list of chef_gem dependencies
diff --git a/lib/capistrano/ec2_tagged.rb b/lib/capistrano/ec2_tagged.rb index abc1234..def5678 100644 --- a/lib/capistrano/ec2_tagged.rb +++ b/lib/capistrano/ec2_tagged.rb @@ -17,9 +17,11 @@ instances = instances.tagged_values(value.to_s) if value != true end - instances.map { |instance| - instance.ip_address || instance.private_ip_address if instance.status == :running - }.compact + AWS.memoize do + instances.map { |instance| + instance.ip_address || instance.private_ip_address if instance.status == :running + }.compact + end end end end
Reduce API requests by memoizing
diff --git a/lib/client/alumni_stories.rb b/lib/client/alumni_stories.rb index abc1234..def5678 100644 --- a/lib/client/alumni_stories.rb +++ b/lib/client/alumni_stories.rb @@ -3,7 +3,7 @@ module AlumniStories include BaseClient - # Create a checkpoint + # Change the sort order of an alumni story. # # @param id [Integer] An alumni story id. # @param direction [String] The direction to move to the alumni story.
Fix copy paste doc error
diff --git a/netsol.gemspec b/netsol.gemspec index abc1234..def5678 100644 --- a/netsol.gemspec +++ b/netsol.gemspec @@ -6,7 +6,7 @@ spec.name = 'netsol' spec.version = '0.2.0' spec.authors = ['Michael Malet'] - spec.email = ['michael@tagadab.com'] + spec.email = ['developers@tagadab.com'] spec.description = %q{A gem to make interacting with NetSol's Partner API less painful} spec.summary = spec.description spec.homepage = 'http://www.tagadab.com'
Switch author email to one which is valid
diff --git a/lib/cucumber/tree/feature.rb b/lib/cucumber/tree/feature.rb index abc1234..def5678 100644 --- a/lib/cucumber/tree/feature.rb +++ b/lib/cucumber/tree/feature.rb @@ -34,7 +34,7 @@ end def Scenario(name, &proc) - add_scenario(name, &proc) + add_scenario(name, *caller[0].split(':')[1].to_i, &proc) end def Table(matrix = [], &proc)
Add a missing method argument.
diff --git a/lib/dimples/configuration.rb b/lib/dimples/configuration.rb index abc1234..def5678 100644 --- a/lib/dimples/configuration.rb +++ b/lib/dimples/configuration.rb @@ -4,39 +4,35 @@ module Configuration def self.defaults { - source_path: Dir.pwd, - destination_path: File.join(Dir.pwd, 'site'), - rendering: {}, - category_names: {}, + paths: default_paths, generation: default_generation, - paths: default_paths, layouts: default_layouts, pagination: default_pagination, date_formats: default_date_formats, - feed_formats: default_feed_formats + feed_formats: default_feed_formats, + rendering: {}, + category_names: {}, + } + end + + def self.default_paths + { + output: 'site', + archives: 'archives', + posts: 'archives/%Y/%m/%d', + categories: 'archives/categories' } end def self.default_generation { - categories: true, - - main_feed: true, - category_feeds: true, - archive_feeds: true, - archives: true, year_archives: true, month_archives: true, - day_archives: true - } - end - - def self.default_paths - { - archives: 'archives', - posts: 'archives/%Y/%m/%d', - categories: 'archives/categories' + day_archives: true, + categories: true, + main_feed: true, + category_feeds: true, } end
Move the output path into the paths config, remove archive_feeds
diff --git a/core/db/default/spree/zones.rb b/core/db/default/spree/zones.rb index abc1234..def5678 100644 --- a/core/db/default/spree/zones.rb +++ b/core/db/default/spree/zones.rb @@ -5,9 +5,9 @@ %w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE HR CZ GR). each do |symbol| - eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(iso: symbol)) + eu_vat.zone_members.find_or_create_by!(zoneable: Spree::Country.find_by!(iso: symbol)) end %w(US CA).each do |symbol| - north_america.zone_members.create!(zoneable: Spree::Country.find_by!(iso: symbol)) + north_america.zone_members.find_or_create_by!(zoneable: Spree::Country.find_by!(iso: symbol)) end
Make zone members creation idempotent
diff --git a/lib/generators/access_lint/install/install_generator.rb b/lib/generators/access_lint/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/access_lint/install/install_generator.rb +++ b/lib/generators/access_lint/install/install_generator.rb @@ -5,7 +5,7 @@ desc "Add AccessLint routes and include statements." def insert_route - insert_into_file "config/routes.rb", :after => "Rails.application.routes.draw do\n" do + insert_into_file "config/routes.rb", :after => /routes.draw do\n/ do <<-RUBY.strip_heredoc if Rails.env.test? || Rails.env.development? mount AccessLint::Rails::Engine, at: "access_lint"
Insert route after looser pattern - Regex will match MyApp::Application.routes.draw do, which is a pattern in Rails apps.
diff --git a/traco.gemspec b/traco.gemspec index abc1234..def5678 100644 --- a/traco.gemspec +++ b/traco.gemspec @@ -11,9 +11,9 @@ s.summary = "Translatable columns for Rails 4.2 or better, stored in the model table itself." 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.files = Dir["{lib}/**/*"] + %w[LICENSE.txt] + s.test_files = Dir["{spec}/**/*"] + s.executables = [] s.require_paths = ["lib"] s.required_ruby_version = ">= 2.3.0"
gemspec: Use Ruby, not git, to pick files There is a nice rationale written up at https://packaging.rubystyle.guide/#using-git-in-gemspec Upside: We distribute less files to the user.
diff --git a/lib/polymorphic_preloader.rb b/lib/polymorphic_preloader.rb index abc1234..def5678 100644 --- a/lib/polymorphic_preloader.rb +++ b/lib/polymorphic_preloader.rb @@ -18,6 +18,8 @@ end end +private + def preloader @preloader ||= ActiveRecord::Associations::Preloader.new end
Make preloader instance method private
diff --git a/SPTDataLoader.podspec b/SPTDataLoader.podspec index abc1234..def5678 100644 --- a/SPTDataLoader.podspec +++ b/SPTDataLoader.podspec @@ -5,7 +5,7 @@ s.summary = "SPTDataLoader is Spotify's HTTP library for Objective-C" s.description = <<-DESC - Authentication and back-off logic is a pain, let's do it + Authentication and back-off logic is a pain, let’s do it once and forget about it! This is a library that allows you to centralise this logic and forget about the ugly parts of making HTTP requests. @@ -13,6 +13,8 @@ s.ios.deployment_target = "6.0" s.osx.deployment_target = "10.8" + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' s.homepage = "https://github.com/spotify/SPTDataLoader" s.license = "Apache 2.0"
Add tvOS and watchOS to podspec - Also fix wrong type of apostrophe in the description.
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb index abc1234..def5678 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb @@ -6,7 +6,18 @@ cask_tokens = cask_tokens_from(args) raise CaskUnspecifiedError if cask_tokens.empty? - appcask_checkpoint(cask_tokens, calculate) + if cask_tokens.all? { |t| t =~ %r{^https?://} && t !~ /\.rb$/ } + appcask_checkpoint_for_url(cask_tokens) + else + appcask_checkpoint(cask_tokens, calculate) + end + end + + def self.appcask_checkpoint_for_url(urls) + urls.each do |url| + appcast = DSL::Appcast.new(url) + puts appcast.calculate_checkpoint[:checkpoint] + end end def self.appcask_checkpoint(cask_tokens, calculate) @@ -39,7 +50,7 @@ end def self.help - "prints (no flag) or calculates ('--calculate') a given Cask's appcast checkpoint" + "prints (no flag) or calculates ('--calculate') a given Cask's (or URL's) appcast checkpoint" end def self.needs_init?
Add support for calculating appcast checkpoint from URLs.
diff --git a/dry-monitor.gemspec b/dry-monitor.gemspec index abc1234..def5678 100644 --- a/dry-monitor.gemspec +++ b/dry-monitor.gemspec @@ -15,6 +15,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.add_runtime_dependency 'rouge', '~> 2.0' spec.add_runtime_dependency 'dry-equalizer', '~> 0.2' spec.add_runtime_dependency 'dry-configurable', '~> 0.5'
Add rouge gem as a runtime dep
diff --git a/lib/vestal_versions/reset.rb b/lib/vestal_versions/reset.rb index abc1234..def5678 100644 --- a/lib/vestal_versions/reset.rb +++ b/lib/vestal_versions/reset.rb @@ -14,7 +14,7 @@ # documentation for more details. def reset_to!(value) if saved = skip_version{ revert_to!(value) } - versions.send(:delete_records, versions.after(value)) + versions.send(:delete, versions.after(value)) reset_version end saved
Use :delete instead of :delete_records
diff --git a/lotus-validations.gemspec b/lotus-validations.gemspec index abc1234..def5678 100644 --- a/lotus-validations.gemspec +++ b/lotus-validations.gemspec @@ -13,14 +13,15 @@ spec.homepage = 'http://lotusrb.org' spec.license = 'MIT' - spec.files = `git ls-files -z`.split("\x0") + spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md lotus-validations.gemspec`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.required_ruby_version = '>= 2.0.0' spec.add_dependency 'lotus-utils', '~> 0.3' - spec.add_development_dependency 'bundler', '~> 1.6' - spec.add_development_dependency 'minitest', '~> 5' - spec.add_development_dependency 'rake', '~> 10' + spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'minitest', '~> 5' + spec.add_development_dependency 'rake', '~> 10' end
Exclude test files from the gem. Requires a version of Ruby 2+
diff --git a/exercises/rotational-cipher/.meta/solutions/rotational_cipher.rb b/exercises/rotational-cipher/.meta/solutions/rotational_cipher.rb index abc1234..def5678 100644 --- a/exercises/rotational-cipher/.meta/solutions/rotational_cipher.rb +++ b/exercises/rotational-cipher/.meta/solutions/rotational_cipher.rb @@ -3,6 +3,51 @@ end class RotationalCipher - def self.rotate(text, shift_key) + SMALL_LETTERS_RANGE = (97..122) + BIG_LETTERS_RANGE = (65..90) + ROTATION_MODIFIER = 1 + + attr_reader :text + + def initialize(text, key) + @text = text + @shift_key = key + end + + def self.rotate(text, key) + new(text, key).rotate + end + + def rotate + text.split('').map { |char| shift_char(char) }.join + end + + private + + def shift_char(char) + shift_ascii(char.ord).chr + end + + def shift_key + @shift_key % 26 + end + + def shift_ascii(char_ascii) + case char_ascii + when SMALL_LETTERS_RANGE + shift_within(char_ascii, SMALL_LETTERS_RANGE.min, SMALL_LETTERS_RANGE.max) + when BIG_LETTERS_RANGE + shift_within(char_ascii, BIG_LETTERS_RANGE.min, BIG_LETTERS_RANGE.max) + else + char_ascii + end + end + + def shift_within(char_ascii, lower_limit, upper_limit) + shifted_ascii = char_ascii + shift_key + + return shifted_ascii if shifted_ascii <= upper_limit + + lower_limit + (shifted_ascii - upper_limit - ROTATION_MODIFIER) end end
Add Example Solution to Rotational Cipher
diff --git a/ruby/billing-time-change.rb b/ruby/billing-time-change.rb index abc1234..def5678 100644 --- a/ruby/billing-time-change.rb +++ b/ruby/billing-time-change.rb @@ -13,14 +13,23 @@ c.api_key = ENV['CHARGIFY_API_KEY'] end -subscriptions = Chargify::Subscription.find(:all, params: { per_page: 5, state: "active" } ) +page = 1 -puts subscriptions.count +while true do -subscriptions.each { |sub| - curr_next_billing = sub.next_assessment_at - new_next_billing = Time.new curr_next_billing.year, curr_next_billing.month, curr_next_billing.day, 6, 0, 0, "-05:00" - sub.next_billing_at = new_next_billing - puts "id: #{sub.id} curr: #{curr_next_billing} new: #{new_next_billing}" - sub.save -} + subscriptions = Chargify::Subscription.find( :all, params: { per_page: 5, page: page, state: ["active","trialing"] } ) + + puts subscriptions.count + if subscriptions.count == 0 then break end + + subscriptions.each { |sub| + curr_next_billing = sub.next_assessment_at + new_next_billing = Time.new curr_next_billing.year, curr_next_billing.month, curr_next_billing.day, 6, 0, 0, "-05:00" + sub.next_billing_at = new_next_billing + puts "id: #{sub.id} curr: #{curr_next_billing} new: #{new_next_billing}" + #sub.save + } + + page = page + 1 + +end
Update billing time change to page through results
diff --git a/frontend/lib/mno_enterprise/frontend/engine.rb b/frontend/lib/mno_enterprise/frontend/engine.rb index abc1234..def5678 100644 --- a/frontend/lib/mno_enterprise/frontend/engine.rb +++ b/frontend/lib/mno_enterprise/frontend/engine.rb @@ -11,10 +11,10 @@ # I18n management # Internally rewrite /en/dashboard/#/apps to /dashboard/#/apps - if MnoEnterprise.i18n_enabled && (Rails.env.development? || Rails.env.test?) - require 'rack-rewrite' + initializer "mnoe.middleware" do |app| + if MnoEnterprise.i18n_enabled && (Rails.env.development? || Rails.env.test?) + require 'rack-rewrite' - initializer "mnoe.middleware" do |app| app.middleware.insert_before(0, Rack::Rewrite) do rewrite %r{/[a-z]{2}/dashboard/(.*)}, '/dashboard/$1' end
[i18n] Fix frontend routing in dev
diff --git a/GitHub_Desktop.rb b/GitHub_Desktop.rb index abc1234..def5678 100644 --- a/GitHub_Desktop.rb +++ b/GitHub_Desktop.rb @@ -0,0 +1,45 @@+cheatsheet do + title 'GitHub Desktop' + docset_file_name 'GitHub_Desktop' + keyword 'GitHub' + source_url 'http://cheat.kapeli.com' + + category do + id 'File' + + entry do + name 'New Repository' + command 'CMD+N' + end + + entry do + name 'New Branch' + command 'CMD+SHIFT+N' + end + + entry do + name 'New Window' + command 'CMD+ALT+N' + end + + entry do + name 'Clone Repository' + command 'CMD+CTRL+O' + end + + entry do + name 'Add Local Repository' + command 'CMD+O' + end + + entry do + name 'Close' + command 'CMD+W' + end + + end + + notes <<-'END' + * Created by [Peter Blazejewicz](https://github.com/peterblazejewicz). + END +end
Add first version of cheatsheet file
diff --git a/hash_selectors.gemspec b/hash_selectors.gemspec index abc1234..def5678 100644 --- a/hash_selectors.gemspec +++ b/hash_selectors.gemspec @@ -2,7 +2,7 @@ spec = Gem::Specification.new do |s| s.name = "hash_selectors" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "Some select methods for Ruby Hashes" s.description = "Provides additional select-type methods for Ruby Hashes" s.authors = ["Kevin C. Baird"]
Increment version 0.0.1 -> 0.0.2: Add reject_by... and partition_by... methods
diff --git a/hash_selectors.gemspec b/hash_selectors.gemspec index abc1234..def5678 100644 --- a/hash_selectors.gemspec +++ b/hash_selectors.gemspec @@ -2,7 +2,7 @@ spec = Gem::Specification.new do |s| s.name = "hash_selectors" - s.version = "0.0.3" + s.version = "0.0.4" s.summary = "Some select methods for Ruby Hashes" s.description = "Provides additional select-type methods for Ruby Hashes" s.authors = ["Kevin C. Baird"]
Increment version 0.0.3 -> 0.0.4: Add merge_into and filter_by... aliases
diff --git a/sidekiq-oj.gemspec b/sidekiq-oj.gemspec index abc1234..def5678 100644 --- a/sidekiq-oj.gemspec +++ b/sidekiq-oj.gemspec @@ -9,9 +9,8 @@ spec.authors = ["Rafal Wojsznis"] spec.email = ["rafal.wojsznis@gmail.com"] - spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.} - spec.description = %q{TODO: Write a longer description or delete this line.} - spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.summary = "Speed-up sidekiq for free" + spec.description = "Save some precious milliseconds by using oj instead of json inside sidekiq" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe"
Add proper summary and description
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -1,4 +1,10 @@ class ApiApp < Grape::API + + get do + # Redirect to current version + redirect 'v0' + end + version 'v0', using: :path mount ApiV0 end
Add a redirect to current active api version.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ license "MIT" description "Installs/Configures New Relic" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.3.1" +version "0.3.2" supports "ubuntu" supports "debian"
Prepare cookbook for upload to community site
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -15,7 +15,7 @@ depends 'osl-nrpe' depends 'osl-postfix' depends 'osl-selinux' -depends 'percona', '~> 2.1.0' +depends 'percona', '~> 3.1.1' supports 'centos', '~> 7.0' supports 'centos_stream', '~> 8.0'
Update percona to Chef 17-compliant version Signed-off-by: Robert Detjens <80088559520001a14c62b25ed86ca3d2c36785e9@osuosl.org>