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
| { | |
| "run_list":["role[mysql]","role[rails]"], | |
| "mysql": { | |
| "server_debian_password": "our_secret_debian_password", | |
| "server_root_password": "our_secret_root_password", | |
| "server_repl_password": "our_secret_repl_password", | |
| }, | |
| "authorization": { | |
| "sudo": { | |
| "users": ["intercity"], |
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
| class Organization | |
| has_many :organization_histories | |
| history_methods = [ | |
| :coc_number, | |
| :coc_office | |
| ] | |
| history_methods.each do |method| |
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
| class DashboardMetrics < MetricsDefinition | |
| metric "github stargazers" do |m| | |
| m.reason = "Hallo!" | |
| m.fetch_with do | |
| 5 | |
| 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
| class Metric | |
| attr_accessor :reason | |
| end | |
| class MetricsLoader | |
| def self.load | |
| file = File.open(Rails.root.join('app','metrics.rb'), 'r') | |
| contents = file.read |
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
| if ENV['BRANCH'] | |
| before "deploy", "deploy:check_branch" | |
| end | |
| after "deploy:finalize_update", "deploy:put_branch" | |
| namespace :deploy do | |
| task :check_branch do | |
| current_branch = capture("cat #{current_path}/BRANCH; true") |
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
| user = User.where(email: row['email']).first || User.new(email: row['email']) |
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
| class OrganizationsController < ApplicationController | |
| include ProductSortableListing | |
| def show | |
| @notification = notification_for_current_user | |
| @categories = Category.top_level | |
| @category = nil |
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 ProductSortableListing | |
| extend ActiveSupport::Concern | |
| private | |
| def sort_products_from_params(products) | |
| if params[:sort] == "product_name" | |
| if params[:direction] == "desc" | |
| products = products.order("products.name desc") | |
| else |
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
| class OrganizationsController < ApplicationController | |
| def show | |
| @notification = notification_for_current_user | |
| @categories = Category.top_level | |
| @category = nil | |
| if params[:category_id] |
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
| def index | |
| @organization = current_user.organization || Organization.new | |
| if params[:q] | |
| page_number = params[:page] || 1 | |
| per_page = 50 | |
| @products = Product.search(params[:q]).active.includes(:product_prices).where('product_prices.active = 1', true) | |
| if current_user.searches_are_not_logged == false |