Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Forked from postspectacular/1-project.clj
Created March 31, 2014 13:01
Show Gist options
  • Save miguelbermudez/9891791 to your computer and use it in GitHub Desktop.
Save miguelbermudez/9891791 to your computer and use it in GitHub Desktop.
(defproject profiletest "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]]
:main profiletest.core
:profiles {
:dev {:source-paths ["src" "src.dev"]}
:prod {:source-paths ["src" "src.prod"]}
})
;; the main/shared ns pulling in the correct version of profiletest.foo,
;; based on current lein profile settings
(ns profiletest.core
(:require [profiletest.foo :as foo]))
(defn -main [] (println "active profile " (foo/blah)))
;; src.dev/profiletest/foo.clj
;; implementation of profiletest.foo for :dev profile
(ns profiletest.foo)
(defn blah [] :dev)
;; src.prod/profiletest/foo.clj
;; implementation of profiletest.foo for :prod profile
(ns profiletest.foo)
(defn blah [] :prod)
$ lein with-profile dev run
Performing task 'run' with profile(s): 'dev'
active profile :dev
$ lein with-profile prod run
Performing task 'run' with profile(s): 'prod'
active profile :prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment