deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
_whitelogger has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
<FromGitter>
<3n-k1> how does shards figure out what commit to check out, does it use git tags?
<FromGitter>
<3n-k1> oh it's in the shard.yml file
<FromGitter>
<3n-k1> lmao sorry
zorp has joined #crystal-lang
deavmi has quit [Ping timeout: 256 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<nolyoi> is there a capistrano alternative for deployments with crystal?
<FromGitter>
<nolyoi> or how do you guys deploy your projects?
postmodern has joined #crystal-lang
<FromGitter>
<Blacksmoke16> build a docker imagine a static binary in it and just deploy a new tag
<FromGitter>
<nolyoi> gotcha. was thinking docker. but was just curious if there was a similar option to cap.
postmodern has quit [Quit: Leaving]
postmodern has joined #crystal-lang
<oprypin>
here we go again, Error: expecting identifier 'end', not 'EOF'
<oprypin>
i always stick to correct indentation but i dont know where in the entire program i missed an `end`
<oprypin>
found manually.. but actually my text editor helped with code folding 😊
<FromGitter>
<Blacksmoke16> ansible could prob do it as well? Have a deploy playbook which builds the binary, copies to to remote server starts it and stops the other one :shrug:
<postmodern>
is there an option to just evaluate the macros and output the result? trying to debug a macro issue
<oprypin>
postmodern, {% debug %} at the bottom of the macro
<oprypin>
and then there's `crystal tool expand` but nobody knows how to use it
<postmodern>
nice!
<yxhuvud>
after implementing support for tool expand in the crystal emacs mode, I think I can say that I know how to use it (and of its limitations, which there are many).
<postmodern>
holy cow, totally got video_output working with v4l2.cr and v4l2loopback. can spam MJPEG frames into a loopback video dev and watch the other end with mpv
<postmodern>
probably need to insert some sleeps based on timeperframe fract
<yxhuvud>
bascially it takes two arguments, one which represents the place you want to expand and the other some file that requires everything that needs to be required to expand it.
<postmodern>
don't suppose crystal has something like V4L2Fract for representing fractional values?
sagax has quit [Ping timeout: 246 seconds]
<FromGitter>
<Blacksmoke16> prob be fairly trivial to make a record with that info
<postmodern>
hmm sleep(Float) isn't allowed?
<FromGitter>
<Blacksmoke16> should be?
<postmodern>
ah typo
<postmodern>
is there no fork()?
<postmodern>
trying to be fancy and execute a blocking process (mpv /dev/video0) in the background, but trigger an exit when it exits
<postmodern>
suppose that can be done via Channels?
<oprypin>
postmodern, yea dont do fork
<oprypin>
u can have a fiber that waits for it to finish
<oprypin>
"it" being Process.new
<oprypin>
i have an object of type B which is a subclass of A
<oprypin>
how can I call A's implementation of the method `foo` rather than B's implementation, on an object of type B
<FromGitter>
<Blacksmoke16> does `B` override the method? or is it only defined on `A`?
<oprypin>
yes, overrides
<FromGitter>
<Blacksmoke16> `super` or `previous_def` then
<oprypin>
this works only inside the override
<oprypin>
but i need it elsewhere
<FromGitter>
<Blacksmoke16> then expose it as another method? or conditionally within `B#foo`
<FromGitter>
<Blacksmoke16> idt theres a way to just skip a method implementation on an obj like that
<FromGitter>
<Blacksmoke16> ^ still not following why you need to do this
<postmodern>
for libraries that are meant to only work on a specific OS, what's the best way for that?
<postmodern>
doesn't appear there's an option in the shard.yml to specify OS. I think there's a macro to check OS, but do I guard certain files or certain methods or what?
<oprypin>
postmodern: don't do that here though, like, your binding requires that lib's api to work, but who are you to say that people won't make an implementation for another platform
<postmodern>
oprypin, well this is for the V4L2 UAPI
<postmodern>
oprypin, although it could be possible that someone only wants to use the structs to parse some captured data, and not mess with any of the VIDIOC ioctls() methods.
<oprypin>
seriously though how do i debug these errors "expecting identifier 'end', not 'EOF'"
<oprypin>
aha.. add `end` until it's happy and run `crystal tool format` can sometimes help
<FromGitter>
<alexherbo2> you all walk by defining your own block, yielding the path
<FromGitter>
<alexherbo2> call*
<FromGitter>
<dscottboggs_gitlab> yes, that's a recursive call to the same method. Since the method only yields when it encounters a file, the files in the child directory are yielded to the internal block as `p`.
<FromGitter>
<dscottboggs_gitlab> then yielding inside that block yields to whatever called walk (which might be walk)
<FromGitter>
<dscottboggs_gitlab> sorry recursion is hard and yielding out of a recursive function makes it even more confusing
<FromGitter>
<alexherbo2> I'm lost yep
<FromGitter>
<alexherbo2> I don't understand how my code is executed
<FromGitter>
<dscottboggs_gitlab> sorry I'm typing just a sec
<FromGitter>
<alexherbo2> to me, `yield p` execute my code on every child node
<FromGitter>
<dscottboggs_gitlab> lets say you have a directory like ⏎ ⏎ ```foo ⏎ foo/bar ⏎ foo/baz/boo``` ⏎ ⏎ If you call `walk Path["foo"] do |path|`, walk will check each file in `foo` if it's a directory. When it gets to `bar` it will say "this isn't a directory", go to the else block, and `Path["foo", "bar"]` will be yielded. ... [https://gitter.im/crystal-lang/crystal?at=5f384e6f60892e0c6973fd9a]
<FromGitter>
<dscottboggs_gitlab> > yield p execute my code on every child node ⏎ ⏎ isn't that the idea?
<FromGitter>
<alexherbo2> no
<FromGitter>
<alexherbo2> I wanted that behaviour:
<FromGitter>
<alexherbo2> at each step, yield all children path
<FromGitter>
<alexherbo2> as an array
<FromGitter>
<dscottboggs_gitlab> oh
<FromGitter>
<dscottboggs_gitlab> I see why you were confused now
<FromGitter>
<alexherbo2> your implementation, it executes my block for each file individually, but also dir?
<FromGitter>
<dscottboggs_gitlab> no, only files
<FromGitter>
<alexherbo2> oki
<FromGitter>
<alexherbo2> the `yield p` is delegate
<FromGitter>
<alexherbo2> can you confirm me if I understand your code correctly? At each step, when encountering a directory, you create your own anonymous function, calling *my* function with the child path --there can be file or directory--, but you yield that code only on the file
<FromGitter>
<dscottboggs_gitlab> yes, I think you've got it
<FromGitter>
<alexherbo2> the function definition is growing at each iteration no?
<FromGitter>
<alexherbo2> instead of passing my block, you encapsulate in another function
<FromGitter>
<dscottboggs_gitlab> well, that would be the case, but Crystal inlines all blocks that aren't explicitly cast to a `Proc`
<FromGitter>
<alexherbo2> oh
<FromGitter>
<alexherbo2> your method is quite elegant
<FromGitter>
<dscottboggs_gitlab> thank you!
<FromGitter>
<alexherbo2> so I need to adapt to yield an array
<FromGitter>
<alexherbo2> do you think your method yielding individual will not make hard to build my hash?
<FromGitter>
<alexherbo2> currently it is only <language>, but I want to add subdir for the scope
<FromGitter>
<dscottboggs_gitlab> where does the json come in?
<FromGitter>
<alexherbo2> so if I edit a eruby in rails, I get the "eruby" and "eruby/rails" snippets
<FromGitter>
<alexherbo2> it is easier to work with json
<FromGitter>
<alexherbo2> that manipulate the file structure directly
<FromGitter>
<dscottboggs_gitlab> oh you're outputting the thing you sent me from a dir of JSON docs?
<FromGitter>
<alexherbo2> my goal is to compile an intermediate data easy to manipulate for external editors
<FromGitter>
<alexherbo2> `snippets-build` binary that outputs json from the dir snip paths you give to it
<FromGitter>
<dscottboggs_gitlab> oh ok so `validates_presence` in this case is like a descriptor of the snippet, and `content` is the contents of the file?
<FromGitter>
<alexherbo2> exactly
<FromGitter>
<dscottboggs_gitlab> 👍
<FromGitter>
<alexherbo2> and the parent key, the scope to apply them
<FromGitter>
<dscottboggs_gitlab> actually you'd want to do ⏎ ⏎ ```require "json ⏎ record Snippet, content : String do ⏎ include JSON::Serializable ⏎ end``` ⏎ ⏎ then you could just do `snippets.to_json` [https://gitter.im/crystal-lang/crystal?at=5f385847a1190a2e95f51b00]
<FromGitter>
<dscottboggs_gitlab> gonna play some no man's sky now tho 😛
<FromGitter>
<alexherbo2> struct is the same than class no?
<FromGitter>
<alexherbo2> and record an inline struct
<FromGitter>
<dscottboggs_gitlab> a class is a reference to a struct
<FromGitter>
<dscottboggs_gitlab> structs are passed by copy
<FromGitter>
<alexherbo2> how `snippets[file.parent][file.basename] = Snippet.new File.read file` work?