Skip to content

Instantly share code, notes, and snippets.

@crisptrutski
crisptrutski / kahn.clj
Created March 14, 2017 16:41 — forked from alandipert/kahn.clj
Kahn's topological sort in Clojure
;; Copyright (c) Alan Dipert. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns alandipert.kahn
(:require [clojure.set :refer [difference union intersection]]))
@crisptrutski
crisptrutski / kahn.clj
Last active February 18, 2023 21:28 — forked from alandipert/kahn.clj
Kahn's topological sort in Clojure
;; Copyright (c) Alan Dipert. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns alandipert.kahn
(:require
[clojure.set :refer [union]])
#!/usr/bin/ruby
files = Dir["reports*"]
files.each do |f|
dir = File.join(`cat #{f}|grep DocumentRoot`.lines.first.split(/\s+/).last.split(/\//)[0..-2])
rails_version = `cd #{dir}; rvm exec bundle list|grep ' rack'`.match(/\(([^)]+)\)/)[1]
deployed_version = `cd #{dir}; cat version`
deployed_branch = `cd #{dir}; cat config/environments/capistrano/#{f.to_s.gsub(/reports_/, '')}.rb|grep :branch`
puts "#{f}: #{rails_version}@#{deployed_version} - #{deployed_branch}"
end