This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-07
Channels
- # alda (7)
- # beginners (4)
- # boot (108)
- # cljsrn (40)
- # clojure (24)
- # clojure-berlin (1)
- # clojure-dev (20)
- # clojure-russia (21)
- # clojurescript (115)
- # clojurescript-ios (1)
- # cursive (8)
- # data-science (5)
- # datascript (3)
- # hoplon (313)
- # jobs (1)
- # ldnclj (2)
- # off-topic (19)
- # om (115)
- # portland-or (3)
- # re-frame (9)
- # yada (2)
does anyone else get errors like
WARNING: Required namespace not provided for cljs.estimate-work.vectors null
that kind of thing?
I’m trying to google it but not getting much relevant info
would :require
have a similar problem?
i get it in different places actually
when i run (cljs :optimizations :advanced)
during boot
i pretty much always get it for files that have (page foo)
instead of (ns foo)
sometimes, i’m not sure when because it’s not 100% of the time
i get it for things that i’m requiring inside the page
name of the project
what am i conflicting with?
well right now i’m trying to get tests running
so this is the third place i’m seeing it
i couldn’t find good examples of how to structure my folders/files/namespaces for testing
everything i saw just said “oh, assuming you’re using a folder called test
add this config…"
yeah but, how do namespaces work for testing?
well, when I use phpunit with PSR I just mirror the namespace of the classes i want to test
but with tests in the namespace or something
but don’t namespaces have to match folder structure to get included properly?
so if i have a directory in root called src/cljs
with .cljs
files inside it
src/cljs/estimate_work/vectors.cljs
has (ns estimate-work.vectors)
in it
then how do i match up a testing directory/file structure to test thigns in that
that came from the hoplon castra template though
i don’t think i set that up
i’ll find it
i looked for a template specifically to avoid this kind of noob mistakes 😛
like suppose you want to organize your source code in such a way that tests are separate from the working code
yes well
want that
so, test inside src
that’s one thing i did wrong
my gf actually put sass in the top level to make it easier for her to compile into assets
but i don’t think that matters here
:resource-paths #{"assets" "src/clj"}
:source-paths #{"src/cljs" "src/hl" "test”}
ok, i just checked
lein new hoplon-castra foo
run that
you’ll see what i ended up with
you get src/clj
src/cljs
and src/hl
.
├── sass
│ └── _application.scss
├── src
│ └── cljs
│ └── adzerk
│ └── foop.cljs
└── test
└── adzerk
└── foop-test.cljs
so i didn’t mean to clobber cljs
if that’s what i did...
just x-referencing your nice diagram against my current setup
shuffling a few things around
yeah i know
but i wanted to start with one working example
commit that
then experiment from there
oooh my tests ran without errors!
the tests failed
but they ran
then when you move things around you can use boot show -f
to see how your changes affected the way the tasks see the files
~/zzz/foop
barp $ tree .
.
├── assets
│ └── app.css
├── boot.properties
├── build.boot
├── README.md
└── src
├── clj
│ └── foop
│ ├── api.clj
│ ├── core.clj
│ └── handler.clj
├── cljs
│ └── foop
│ └── rpc.cljs
└── hl
└── foop
└── index.cljs.hl
8 directories, 9 files
~/zzz/foop
barp $ boot show -f
app.css
foop
├── api.clj
├── core.clj
├── handler.clj
├── index.cljs.hl
└── rpc.cljs
tdm:estimate-work thedavidmeister$ boot show -f
app.css
estimate_work
├── api.clj
├── core.clj
├── elements
│ ├── bucket.cljs.hl
│ ├── estimate
│ │ └── fixed.cljs.hl
│ ├── form
│ │ └── atom
│ │ └── textfield.cljs.hl
│ ├── nav
│ │ └── support.cljs.hl
│ └── outer-dom.cljs.hl
├── handler.clj
├── index.cljs.hl
├── rpc.cljs
├── style-guide.cljs.hl
├── vectors.cljs
└── vectors_test.cljs
ie.css
print.css
screen.css
here i thought you drew me that nice diagram by hand
but it was all the machine
if i wanted to make some tests i can put them anywhere, as long as i add the correct entry to :source-paths
or :resource-paths
yeah sure, so comparing tree
against show -f
seems like something important to debugging from time to time
so how do i know what goes in source paths and what goes in resource paths?
because it was recommended to me to move src/clj
from source to resource as part of deploying a war to heroku
but i didn’t really get why at the time
some of those you want to propagate to whatever the final artifact is that you're building
but some of the source files that will be part of the build process are not supposed to end up on the webserver
like maybe your uncompiled cljs namespace files are not intended to be served from the web server
good document
so there’s a bit of assumed knowledge about the JVM in there
what does the AOT do? for example
other than stopping a file from being a resource
and most of the time you run clojure in such a way that it compiles your program as it runs
but sometimes you need to precompile some things into bytecode before the program can run
this doesn’t apply to clojurescript though does it?
you wouldn’t need to aot JS?
yeah i think that’s what i meant
you don’t really have a choice
because it always has to be JS before it’s useful
right, so why would i not want to aot before deploying something?
wouldn’t it be a bit faster to get the byte code as part of making my war?
faster to run the program i mean
so aot = no eval
is that macros as well?
so when you say exposing java classes, you don’t mean just calling methods on the classes do you?
because that would come up a bunch i assume
i mean like if i make a clojure library that i want to expose to java developers to use in their java programs
for going back the other way
yeah, like, if it wasn’t so crazy i could tell someone i wrote the JS myself that cljs made
and they’d have no way to prove i didn't
does the aot for java actually make code that someone would find legible?
or is that not the point?
mmmk, i really am not planning to learn much java if possible
so maybe i’ll leave that for now
i don’t love needing to learn about the JVM to get clojure stuff working
this document helped a bunch
i didn’t really know about the classpath or the different types of files
any idea why assets
ends up listed as a resource-path
instead of asset-path
?
also, am i right in saying, because the .cljs
files get compiled to JS before being dumped in target/
that is what makes them source-path
and not resource-path
?
and because the src/clj
ends up powering the server backend for castra, and we don’t want to AOT it, to keep all the lispy goodness working, we put it in resource-path
?
and because we don’t actually ever want our tests to hit production, because that’s pointless, we leave them in source-path
?
@meeli: micha gave me some really good info about the file structure ^^
you should read over it when you get a chance
@micha: is there any benefit to using asset-path
over resource-path
? or is it just easier to use resource-path
everywhere you might want something to end up as an artifact
it looks like assets are just less flexible versions of resources
well if you were using something other than boot to generate the assets?
like rake or something?
pretty sure we’re still using ruby to do the sass compiling
haven’t looked at other ways to get sass compiling yet
but i did see there was a lein sass
just haven’t migrated to it yet
one thing at a time
but you know, wouldn’t image files be assets?
boot wouldn’t really be doing anything with the images other than moving them into place
but at the same time
you just limit yourself by making it an asset not a resource
for what gain?
is it somehow more efficient under the hood?
or if not now, could it be in the future?
if boot knew it would never need to do certain things with your asset files, maybe it wouldn’t need to load as much into memory, or something...
well it would just really need to keep a reference to where the file lives on the file system
and that’s it
then right at the end, just copy and paste from the reference to the target
but yeah...
i wouldn’t bother implementing that unless you’d profiled some real issues on a real project >.<
oh yeah?
i did blow up the 4GB memory limit while trying to build pretty much the base template on circle ci
dunno if that’s related to what you’re doing
not sure if boot even finished pulling down the dependencies
it freaked out and i couldn’t even download the artifacts containing the memory info
oh, maybe that impacted me
i got my project deploying to heroku
but it’s still manual, wanted merges to master to auto deploy
had to shelve it for now until i learn more about what’s going on
was getting errors about clojars not being git repos or something...
and circle ci maxed out memory before i got very far through seeing if they could help
actually i’ve used travis more
from what i understand
ci runs your tests, then optionally does a deploy task as well
yeah travis worked for me so far
in theory circle ci is travis + deploy
in practice, it looks like they have pretty different setups/limits on the hardware/environments
so i’m sure for lots of people it’s awesome, didn’t work out for me this time though...
i really don’t know
i’m just throwing shit at the wall to see what sticks
too noob to have an informed opinion about what really should or shouldn’t work
if you’re curious and profiling things anyway
+dependencies:
+ post:
+ - wget -O boot
+ - chmod 755 boot
+ - ./boot -V
+ - ./boot checkout
+test:
+ override:
+ - ./boot test
i stuck that in my circle.yml
@micha: see ya, thanks again for helping out!
@micha can you describe how .inc.js used to work in hoplon5? i wonder if a task to do that on h6 would be cool
.inc.js files were added to the top of the compiled js file, in dependency order if they came from dep jars, lexical order for .inc.js files in the fileset
i think it's handier for 1-off jq plugins from an vendor/ dir
then if you like them you may cljsjs them
i was looking into that, can thye be their own externs?
right
it's nice to have your cljs :advance compiled but then load up the jq libs dynamically
unmunged
right