Activity Graph

Page 1 of 1


[05:34:38] BlaDe^: Ping timeout: 245 seconds


[22:00:38] BlaDe^: has joined #ruby
[22:00:48] BlaDe^: with the erb command line tool, how can I define an array?
[22:10:58] BlaDe^: oh, easy. What about an object? .. so foo[:bar]
[22:14:32] BlaDe^: well, right now I'm trying to do erb -r ./env.rb config.erb
[22:14:51] BlaDe^: and I get undefined local variable or method `node' for main:Object (NameError) .. when defining node = {:environment => 'local'} in env.rb
[22:17:03] BlaDe^: it is picking up the .rb for sure because if I make a syntax error it barfs
[22:18:04] BlaDe^: yeah, instead of => if I do = I get: env.rb:2: syntax error, unexpected '=', expecting => (SyntaxError)
[22:18:08] BlaDe^: so it is reading the correct file..
[22:19:45] BlaDe^: I made that on purpose to prove the env.rb is relative and is being loaded by erb
[22:20:09] BlaDe^: the real issue I'm facing is why it thinks `node` is undefined when I'm setting node = { ... } in the .rb file
[22:20:48] BlaDe^: yeah :( any ideas why?
[22:24:54] BlaDe^: al2o3-cr:
[22:25:02] BlaDe^: wow, aggressive bot :p
[22:26:12] BlaDe^: I don't have my 2FA right now to login to github to gist :X
[22:28:04] BlaDe^: how should I go about that? the .erb is fine when I run via my chef cookbook
[22:28:12] BlaDe^: I'm trying to share the .erb with a local setup and just run erb against a .env file
[22:30:09] BlaDe^: it's a huge lua file with <%= node[:var] %> and <% unless node[:environment] == 'prod' %> blocks in it -- i don't _have_ any namespacing in the .erb file itself
[22:30:31] BlaDe^: I didn't setup our chef stuff, so I don't really know how it works.. I'm just trying to make the .erb file render without a full chef run, locally
[22:35:12] BlaDe^: the .env.rb i pasted is raw from my text editor - not changed at all, and I apsted the 3 lines from .config.erb .. Let me play a little
[22:37:15] BlaDe^: $ head -1 env.rb ---> node = {
[22:37:26] BlaDe^: do i have to... export it or something?
[22:44:24] BlaDe^: if I use @node I get config.lua.erb:26:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
[22:44:36] BlaDe^: al2o3-cr: actually I am a dir down.... that matters?!
[22:45:34] BlaDe^: i have .env.rb and app/config.lua.erb ... expect that erb -r .env.rb app/config.lua.erb would work..
[22:47:03] BlaDe^:
[22:48:13] BlaDe^: pwd is /Users/admin/demo/ ... which houses .env.erb and app/config.lua.erb
[22:49:29] BlaDe^: yeah, that's my thinking too?!
[22:49:58] BlaDe^: I just added .env.rb -- @test = 'foo' and <%= @test %> to the .erb and it passes fine, still barfs on the node line
[22:50:31] BlaDe^: but test = 'foo and <%= test %> doesn't work for probably an unrelated reason config.lua.erb:7:in `test': wrong number of arguments (given 0, expected 2..3) (ArgumentError)
[22:53:38] BlaDe^: al2o3-cr: this is actually SUPER easy to repro
[22:54:01] BlaDe^: echo "node = { :environment => 'foo' }" >> foo.rb; echo "<%= node[:environment] %>" >> bar.erb ; erb -r ./foo.rb bar.erb
[22:54:30] BlaDe^: bar.erb:1:in `<main>': undefined local variable or method `node' for main:Object (NameError)
[23:01:08] BlaDe^: al2o3-cr: im glad i'm not crazy, at least
[23:02:46] BlaDe^: yeah... the @ does help - but then I can't use the same file in chef and locally, which is... kind of what im striving for
[23:04:05] BlaDe^: huh? a method can be treated like an object?
[23:04:24] BlaDe^: I basically hammer chef cookbooks until they do what I want, and have no real idea how anything works in ruby land
[23:04:51] BlaDe^: return.. right.. but wouldn't I need to call it to access the resulting object? so it wouldn't be the same erb
[23:04:58] BlaDe^: ACTION tests
[23:05:52] BlaDe^: woah, that works
[23:06:02] BlaDe^: WHY DOES THAT WORK. lol.
[23:09:05] BlaDe^: thanks al2o3-cr & phaul
[23:13:16] BlaDe^: but you provided emotional support in the form of making me feel like less of a dumbass
[23:14:59] BlaDe^: ha ok I am intrigued to hear more


[07:05:55] BlaDe^: Ping timeout: 255 seconds


[02:28:51] BlaDe^: has joined #ruby


[17:36:57] BlaDe^: has joined #ruby
[17:38:58] BlaDe^: hi-- i'm trying to debug an issue right now and really struggling, could somebody take a look?
[17:39:57] BlaDe^: whoops:
[17:41:21] BlaDe^: wondering how my change could so drastically change the stack trace... am I wrong in my exception handling?
[18:23:16] BlaDe^: not a clue jolamb :<
[18:32:48] BlaDe^: jolamb: this is a library i'm using , but haven't written any of the code
[18:33:02] BlaDe^: it's unfortunately broken my product due to (seemingly) having a bug
[18:33:15] BlaDe^: it's been working for 8 months and suddenly is choking on some data but I'm struggling to identify what right now


[07:56:43] BlaDe^: Remote host closed the connection


[14:12:43] BlaDe^: has joined #ruby
[14:13:08] BlaDe^: hi all, trying to debug a build script which is ruby.... i'm getting: in `join': no implicit conversion of nil into String (TypeError)
[14:13:16] BlaDe^: from: File.join(cache_base, *group_id.split('.'), artifact_id, version)
[14:14:12] BlaDe^: can I get a stacktrace or similar, easily?
[14:19:45] BlaDe^: apeiros: yeah, i'm just using puts to debug it but going backwards will take me a while, was wondering if there was a "set -x" or equivalent like bash has
[14:20:08] BlaDe^: version is nil, dunno why yet ;) passes for 40 other dependencies
[14:23:53] BlaDe^: scratch that... found it. Thanks apeiros :)
[14:24:25] BlaDe^: good to know, next time i'll test that


[18:44:40] BlaDe^: hi all... could someone clarify some code for me? I'm bug hunting
[18:45:28] BlaDe^: with
[18:45:31] BlaDe^: can ever fire ?
[18:45:48] BlaDe^: i apologize it's 3rd party code, but the maintainers are never on IRC and I'm no rubyist heh
[18:46:02] BlaDe^: the first function doesn't return anything, so i'm not sure how null && func() will ever execute func()
[18:46:09] BlaDe^: maybe i'm misreading it, but I can't get my custom hook to fire :)
[18:53:53] BlaDe^: xxneolithicxx: ah!
[18:54:42] BlaDe^: xxneolithicxx: i wonder why they would pipe that to /dev/null :x
[19:08:17] BlaDe^: xxneolithicxx: i'm a bad human and just switched the order of the boolean x && y


[02:40:04] BlaDe^: can someone check this out for me?