This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest AS workbench | |
RUN apk --no-cache add curl libarchive-tools | |
FROM workbench AS tapo_control | |
RUN curl -L -o addon.zip https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/archive/refs/tags/4.2.4.zip | |
RUN mkdir -p addon | |
RUN bsdtar --strip-components=1 -C addon -xvf addon.zip | |
FROM workbench AS roborock | |
RUN curl -L -o addon.zip https://github.com/humbertogontijo/homeassistant-roborock/archive/refs/tags/0.0.28.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
js_extend: false | |
translations: | |
- file: "app/javascript/i18n/translations.js" | |
+++ except: ["*.faker", "*.devise"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define :finish_within do |timeout| | |
match do |block| | |
begin | |
Timeout.timeout(timeout) do | |
Benchmark.realtime{ block.call } <= timeout | |
end | |
rescue TimeoutError | |
false | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git-current-branch { | |
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/\1 /' | |
} | |
function cap-current { | |
cap -s branch=git-current-branch $* | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module NamedSubmodules | |
def named_submodules | |
constants.map{ |c| const_get c }.select{ |c| c.is_a?(Module) && c.const_defined?('SUBMODULE_NAME') } | |
end | |
def named_submodule_list | |
named_submodules.inject({}) do |hash, mod| | |
hash[mod.to_s] = mod.const_get('SUBMODULE_NAME') | |
hash | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :log do | |
desc "Search from log files on server" | |
task :grep, :roles => :app do | |
run "cd #{current_path}/log && grep #{ENV['str']} -B #{ENV['before'] || 5} -A #{ENV['after'] || 35} #{rails_env}.log*" | |
end | |
desc "Tail log files on servers" | |
task :tail, :roles => :app do | |
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data| | |
puts "#{data}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
class Base | |
class << self | |
if respond_to? :none | |
puts "ActiveRecord::Base already has a method 'none'. Remove the implementation from #{__FILE__}" | |
else | |
# In Rails 4 this creates a noop query. Until then, use a query that never returns data. | |
def none | |
where '1=2' | |
end |