Fork me on GitHub
#boot
<
2016-10-02
>
flyboarder03:10:14

Hey Everyone, here is a link to today's FreeCodeCamp session: https://youtu.be/zrbGAxF8jYU Topics include Clojure Boot and Hoplon. An edited version will be posted later that actually has all the desktop stuff, it seems our recording app couldn't handle all the codes.

danielsz12:10:30

Silly question maybe. At the REPL, in a running application (with boot), I would like to inspect the fileset object. What is the API call I want?

danielsz12:10:27

Found it! (boot (fileset-debug))

danielsz12:10:34

Thanks anyway!

danielsz12:10:14

LOL. That's not in Boot. It was something I added to my profile.boot ages ago. Forgot about it completely.

danielsz12:10:08

Still not what I want. A task can't return a value, since it's integrated in the call chain, returning a fileset. What I would like is something like (get-env), but for the fileset, say (get-fileset).

anmonteiro12:10:57

@danielsz: probably worth looking into the show task, maybe

anmonteiro12:10:27

It has the show -f option which shows the fileset

anmonteiro12:10:38

I mean, look in Boot's source

danielsz12:10:39

Yes, but I want to grab the data structure.

anmonteiro12:10:55

Yeah I understood

anmonteiro12:10:13

Look in Boot's source for ideas is what I was suggesting

danielsz12:10:22

Sure. thanks.

danielsz12:10:24

Ah, I got somewhere. @boot.tmpdir/state

danielsz12:10:26

The whole gut of it wrapped in an atom.

bcbradley13:10:20

Here is my build.boot

(set-env!
  :source-paths #{"src"}
  :dependencies '[[adzerk/bootlaces "0.1.13"]]
  :repositories [["" {:url ""}]])
(require '[adzerk.bootlaces :refer :all])
(task-options!
  pom {:project 'html
       :version "1.0.0"
       :description "Tools for writing html as clojure"
       :url ""
       :scm {:url ""}
       :license {"Public Domain" "Public Domain"}})

bcbradley13:10:11

When I use

boot build-jar push-release
it says
Writing pom.xml and pom.properties...
Writing html-1.0.0.jar...
Installing html-1.0.0.jar...
CLOJARS_USER and CLOJARS_PASS were not set; please enter your Clojars credentials.
Username: bcbradle
Password:     clojure.lang.ExceptionInfo:
    data: {:file
           "C:\\Users\\brian\\AppData\\Local\\Temp\\boot.user5953030130723587153.clj",
           :line 13}
java.lang.NullPointerException:
  adzerk.bootlaces/eval131/fn/fn/fn  bootlaces.clj:   52
  adzerk.bootlaces/eval171/fn/fn/fn  bootlaces.clj:   62
     boot.task.built-in/fn/fn/fn/fn   built_in.clj:  815
     boot.task.built-in/fn/fn/fn/fn   built_in.clj:  717
     boot.task.built-in/fn/fn/fn/fn   built_in.clj:  433
                boot.core/run-tasks       core.clj:  938
                  boot.core/boot/fn       core.clj:  948
clojure.core/binding-conveyor-fn/fn       core.clj: 1938

bcbradley13:10:25

nvm looks like its becuase of some kind of streaming error on git bash in windows

bcbradley13:10:32

works fine in normal command prompt

onetom15:10:28

@micha have you seen the http://gittup.org/tup/ex_a_first_tupfile.html build system? what do u make of it?

micha15:10:41

looks like the standard makefile type thing, no?

micha15:10:06

make DAG, serialize, etc.

onetom15:10:24

they claim it's better because the dependency graph is directed bottom to up instead of up to bottom...

micha15:10:16

i feel like the effectiveness of the DAG approach is limited because you need to be able to express to the bool all the weird ways things can depend on each other

micha15:10:31

that's why i prefer the pipeline with caching in each task

micha15:10:44

because now each task only needs to know what it depends on

micha15:10:29

my opinion is that lisp is the ultimate DSL, so i just want a lisp program

micha15:10:39

i can make anything then

onetom15:10:50

they have a paper about it too http://gittup.org/tup/build_system_rules_and_algorithms.pdf but anyway i was just curious wether u came across it before or not

micha15:10:11

it looks cool, i hadn't seen it befoer

mathiasx15:10:56

When you have to ask yourself how your boot plugin works. 😆

mathiasx15:10:19

(Trying to get boot-sassc to run with a perun project. So far, it is working.. except I don’t get CSS out in the end. lol.)

micha15:10:59

show -f might help debug that

mathiasx15:10:49

Seems like I have failed to output anything from boot-sassc, which might help me

mathiasx15:10:34

Hmm. I’m not even sure where things are compiling to in Perun. target is empty. That’s odd.

mathiasx15:10:59

I’ve been just inspecting source in the browser, so I didn’t even think to figure out where the files are going before they get served by boot-http

micha15:10:26

are you using the target task?

micha15:10:46

the implicit writing to target dir has been removed in 2.6.0

micha15:10:00

it was causing a lot of confusion

mathiasx15:10:31

I’m just confused because I’m easily confused 🙂

mathiasx15:10:46

Where do the files go without target task?

onetom15:10:11

mathiasx: into the temp dirs under ~/.boot/cache/tmp/Users/<your-user>/...

bcbradley15:10:24

hey guys I'm trying to depend on and require https://github.com/bcbradle/html but I can't seem to get it to work, are you able to require it?

mathiasx15:10:03

@bcbradley It looks like your jar didn’t build right.

bcbradley15:10:10

how can i fix that?

mathiasx15:10:17

The java parts of my brain have atrophied so I forget how to confirm >.<

micha15:10:26

@bcbradley interesting project, have you seen hoplon?

bcbradley15:10:32

no i haven't

bcbradley15:10:38

i'm completely new to all this

bcbradley15:10:47

it took me a day and a half just to figure out how to push to clojars

bcbradley15:10:06

i kept going in circles with gpg

mathiasx15:10:44

yeah, gpg is not user friendly 😞

micha15:10:25

which version of boot are you using

mathiasx15:10:48

Make sure you’re requiring '[html.core :refer :all] or your html.parser namespace?

bcbradley15:10:07

wait so you made it work?

mathiasx15:10:15

s/parser/parse/

mathiasx15:10:27

I was able to require it from this, yeah

bcbradley15:10:03

i can't get it to work from my side

mathiasx15:10:56

Did you maybe install it locally while you were developing?

mathiasx15:10:18

In which case, if it didn’t get a SNAPSHOT release, you might have to go clear it out of your maven

mathiasx15:10:27

because it’ll try that before it goes and fetches from clojars

bcbradley15:10:01

i don't have a local maven repository

bcbradley15:10:18

the build.boot file on github contains the method i used to push it to clojars

bcbradley15:10:35

i pushed from origin to master with git

bcbradley15:10:43

in order to get it on github

bcbradley15:10:54

right now i'm in a different directory

bcbradley15:10:05

with a sandbox / garbage project

bcbradley15:10:22

(defproject garb "0.0.1-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [html "1.0.1"]])

mathiasx15:10:25

Yeah, your system Java keeps around a cache of installed dependencies

mathiasx15:10:40

It’s ~/.m2 usually

bcbradley15:10:43

how do i tell it to stop being smart and start being stupid

micha15:10:03

what are you wanting to do?

bcbradley15:10:34

all i want to do is verify that I can depend on the html library that you see on github through lein

mathiasx15:10:10

@bcbradley try removing ~/.m2/repository/bcbradley/html/1.0.1/ — it sounds like you installed it locally while working on it, and it isn’t the “complete” version that is on clojars.

mathiasx15:10:59

Sometimes it takes a try or two, to get it right. The fun of depending on the JVM 🙂

bcbradley15:10:18

write once debug forever

micha15:10:55

see the problem:

micha15:10:03

barp $ jar tf ~/.m2/repository/html/html/1.0.1/html-1.0.1.jar 
META-INF/
META-INF/maven/
META-INF/maven/html/
META-INF/maven/html/html/
META-INF/maven/html/html/pom.xml
META-INF/maven/html/html/pom.properties
META-INF/MANIFEST.MF

mathiasx15:10:18

there’s no src’s getting added?

micha15:10:19

i love how slack bothers me with the snipped bullshit whenever i paste anything

bcbradley15:10:38

how is there no source being added

micha15:10:54

you want :resource-paths #{"src"}

micha15:10:04

not :source-paths #{"src"}

mathiasx15:10:09

@micha is bootlaces still a thing? I am probably out of date here.

micha15:10:16

yeah i use that

mathiasx15:10:21

Because I use bootlaces to handle this all for me

mathiasx15:10:33

Didn’t realize https://github.com/bcbradle/html/blob/master/build.boot was manual version of what bootlaces does

micha15:10:41

yeah that's what i do also

mathiasx15:10:11

not sure what version of boot that is meant for, though. You might want to grab the latest bootlaces version number off clojars.

mathiasx15:10:14

all my stuff is ancient 😛

micha15:10:25

@bcbradley i'd recommend testing with your local maven repo before pushing to clojars

micha15:10:35

you can use the install task for that

bcbradley15:10:54

i don't even know what a local repo is

bcbradley15:10:00

i feel frustrated

micha15:10:01

or you can just inspect the jar with boot pom jar target

bcbradley15:10:09

the difference between college and real lyfe

micha15:10:15

and then jar tf target/html-1.0.1.jar or whatever

micha15:10:26

ok no worrkes

mathiasx15:10:27

@bcbradley Your local source directory with .git/ dir is the local repo

mathiasx15:10:34

Don’t worry, there’s a lot of context

micha15:10:43

so with java projects you will end up with a lot of dependencies

micha15:10:03

you can manage that all manually by having a lib dir with all your jar files and then add them to the classpath and whatnot

micha15:10:11

but that becomes a hassle very quickly

micha15:10:19

there are dependencies of dependencies and so on

micha15:10:24

(transitive deps)

micha15:10:34

so it's nice to have some package manager to manage that

micha15:10:38

that's where maven comes in

micha15:10:47

or more specifically the apache aether library

micha15:10:07

this library resolves dependencies by their "coordinates" in "repositories"

micha15:10:22

coordinates are like [org.clojure/clojure "1.2.3"]

micha15:10:49

that is [<organization>/<artifact> <version>]

micha15:10:41

aether does other things like resolve dependency conflicts

micha15:10:50

like if your project depends on A and B

micha15:10:57

and both A and B depend on C

micha15:10:01

but different versions

micha15:10:16

the aether logic will resolve that as best it can and choose one version of C

micha15:10:54

also because there are a lot of dependencies, and because jars in maven are immutable, it keeps a local cache, usually in ~/.m2/

micha15:10:15

you can look in there and see what it does

micha15:10:40

your local ~/.m2/repository/ directory has the same exact structure oas the clojars repo

micha15:10:49

it's just your local cache

micha15:10:27

so to get back to your immediate problem: your jar is missing sources because you did (set-env! :source-paths #{"src"})

micha15:10:39

you want to do (set-env! :resource-paths #{"src"})

bcbradley15:10:48

alright i did that

micha15:10:07

so now do boot pom jar install

bcbradley15:10:07

but i'm getting CompilerException java.lang.ClassNotFoundException

micha15:10:31

when you have done that do this

micha15:10:43

boot -BP repl

micha15:10:00

that will start a clojure repl, ignoreing build.boot etc

micha15:10:08

a clean repl

micha15:10:16

then you can test if your jar is ok by doing:

micha15:10:02

boot.user=> (set-env! :dependencies '[[html "1.0.1"]])
...
boot.user=> (require 'html.core)

bcbradley15:10:10

alright seems to work

bcbradley15:10:35

so now I just update github and boot push release?

micha15:10:00

should work, you'll need to increment the version

micha15:10:04

clojars is immutable

micha15:10:12

you can't update an artifact there

micha15:10:40

you also can't delete anything

bcbradley15:10:16

(deftask push-release!
  "Deploy release version to Clojars with no gpg."
  [f file PATH str "The jar file to deploy."]
  (comp
    (pom)
    (jar)
    (install)
    (fn [next-handler]
      (fn [fileset]
        (let [creds (atom {})]
          (print "Username:")
          (#(swap! creds assoc :username %) (apply str (.readPassword (System/console))))
          (print "Password:")
          (#(swap! creds assoc :password %) (apply str (.readPassword (System/console))))
          (merge-env! :repositories [["deploy-clojars" (merge @creds {:url ""})]])
          (next-handler fileset))))
    (push
      :file file
      :gpg-sign false
      :ensure-release true
      :repo "deploy-clojars")))

bcbradley15:10:26

this is a boot tast with pom jar and install

bcbradley15:10:33

if i just invoke that, would that work?

micha15:10:40

yep looks good to me

bcbradley15:10:01

i don't understand

bcbradley15:10:22

if that works, then I should be able to require it through lein from clojars

bcbradley15:10:27

nothing has changed

bcbradley15:10:46

i changed :source-paths to :resource-paths for version 1.0.2

bcbradley15:10:54

then ran push-release!

bcbradley15:10:00

it should have built the jar file

micha15:10:31

works for me

micha15:10:45

i was able to depend on it here

micha15:10:27

those warnings are just because you're defining names that collide with names in clojure.core namespace

micha15:10:37

in hoplon we changed those to like html-map

bcbradley15:10:50

when i try it in nightcode i get "illegalArgumentException No value supplied for key: true clojure.lang.PersistentHashMap.create (PersistentHashMap.java: 77)

bcbradley16:10:06

let me try it on the command line

micha16:10:15

looks like a clojure version issue

micha16:10:42

or some kind of dependency conflict

bcbradley16:10:46

well it works on the command line with a repl

mathiasx16:10:46

@juhoteperi sass4clj is great. I’m tempted to mark boot-sassc as deprecated in favor of it. (I think I broke boot-sassc at some point, but not sure. It’s too fickle with its shelling-out to be debuggable)

mathiasx16:10:27

I haven’t really written Clojure at all in the past year 😞

juhoteperi16:10:05

I just got Windows CI tests working on both less4clj & sass4clj and pushed new snapshots for both projects

juhoteperi16:10:26

New sass4clj snapshot should be a lot better as it is using much newer jsass version, as I don't use sass myself it would be good for someone to check the snapshot

mathiasx16:10:56

I’ll give it a try since I’m currently fighting to make http://bulma.io compile better 🙂

mathiasx16:10:04

err, the framework, not that particular site

mathiasx16:10:08

honestly, I think my problem is that in an attempt to be modular (and depending on most sass compiler behavior where things @imported in one file are available to all subsequent files) I keep hitting sub-files in bulma that don’t have mixins or whatever. So I might just end up rewriting the @import structure

mathiasx16:10:18

The compile errors look better, @juhoteperi 😉

alandipert17:10:13

@mathiasx oh man now that you're back in the mix, you gotta check out https://github.com/hoplon/ui

mathiasx17:10:27

I want to bring back hophack

alandipert17:10:29

almost totally subsumes CSS

mathiasx17:10:36

because the world doesn’t have enough roguelikes 🙂

alandipert17:10:57

agreed, it needs way more

mathiasx17:10:07

@juhoteperi working great btw

mathiasx17:10:56

@juhoteperi any interest in something like :ignore-paths #{“scss/someframework”} so I can get around compile errors without having to go maintain an edit / fork of a framework?

mathiasx17:10:07

Basically only want to include bits of it, not have every file get compiled.

mathiasx17:10:14

And it’s not in that bower packages repo.

juhoteperi17:10:30

Huh, why would all files get compiled?

mathiasx17:10:44

They’re not _includes.sass named, they’re just includes.sass files

mathiasx17:10:57

And I have it checked out into my source tree, because there isn’t a good package for me to import

mathiasx17:10:16

There’s probably a better way to do this.

juhoteperi17:10:32

[org.webjars.bower/bulma "0.2.1"]?

juhoteperi17:10:54

All bower packages should be available from webjars

mathiasx17:10:58

hah, dang. I searcher http://bower.io and it wasn’t on there

mathiasx17:10:24

@alandipert so hoplon/ui is all constraint-based styling?

juhoteperi17:10:50

(I would like to avoid such options if possible, and I think using Maven deps is preferable instead of adding bower etc. stuff to fileset)

mathiasx17:10:16

I’ve had to resort to so many hacks in the past

mathiasx17:10:30

I have some old hoplon apps that have both npm node_packages and bower_components repos, for example

mathiasx17:10:31

@juhoteperi is there any step to require webjars then, or is it just known and something that sass4clj will look in per https://github.com/Deraen/sass4clj#import-load-order ?

juhoteperi17:10:01

Just add the maven dep and @import

mathiasx17:10:31

Yeah, saw it pull the webjar in. I suspect I have the path wrong inside the package

juhoteperi17:10:05

It is just special case of importing files from classpath, with handling to remove package version etc. from path so it is easier to import files

juhoteperi17:10:28

You can easily check the package file contents using http://webjars.org

mathiasx17:10:07

cheers. the webjars thing is new to me.

juhoteperi17:10:12

Bulma for example contains META-INF/resources/webjars/bulma/0.2.1/bulma.sass and to import that you would use @import "bulma/bulma.sass";

mathiasx17:10:09

Yeah, I’m not importing that specifically because it doesn’t compile cleanly due to above @import assumptions

mathiasx17:10:18

I’m pulling in the files in /sass/foo/bar.sass

mathiasx17:10:37

Which should be imports like I’ve got: @import "bulma/sass/utilities/variables.sass”;

mathiasx17:10:29

Yeah, if I simplify I still get the error:

mathiasx17:10:55

and build.boot contains [org.webjars.bower/bulma "0.2.1”]

mathiasx17:10:17

I may put down the front-end stuff for awhile. I already got tired of fighting CSS for today for this little personal site 😉

mathiasx17:10:13

It does work for importing local files, though. Weird.

juhoteperi17:10:13

I got enough of dealing with java.net.URI and just wrote simple URL normalization function myself: https://github.com/Deraen/sass4clj/blob/master/src/sass4clj/core.clj#L20-L41

mathiasx18:10:06

I want a tshirt that says I’d rather be writing Lisp

mathiasx18:10:56

I also want an “alien technology” logo tshirt and haven’t found one, yet.

mathiasx18:10:50

lol, of course someone put one on one of those “print your logo on a shirt” sites: https://www.zazzle.com/lisp_made_with_secret_alien_technology_t_shirt-235474742020769821

mathiasx18:10:18

haha, love that the text on the back is the attribution link

micha18:10:39

haha land of lisp

micha18:10:46

"there is nothing cooler than a macro"

mathiasx18:10:51

Apparently I need a boot tshirt

micha18:10:15

the cons cell, classic

mathiasx18:10:54

If you guys decide to put this on a tshirt, let me know and I’ll order one 😉 https://github.com/boot-clj/boot-clj.github.io/blob/master/assets/images/logos/Boot-logo-trans.svg

mikebelanger20:10:11

Hi guys - I have a question about the sift command. Can the :to-resource flag take a single filename regex as an argument? Or can it only be a path regex?