<postmodern>
RickHull1, although it contains a generator and rake tasks, which violates SRP
skade has quit [Quit: Computer has gone to sleep.]
Weems has joined #ruby-lang
<RickHull1>
my next project: a service that will tweet regex matches on the github commit message stream
Cakey has quit [Ping timeout: 240 seconds]
<RickHull1>
i'd like to see the /amon tobin/i stream
lcdhoffman has quit [Quit: lcdhoffman]
cofin has quit [Quit: cofin]
julweber has joined #ruby-lang
x0f has quit [Ping timeout: 268 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
x0f has joined #ruby-lang
gja has quit [Quit: This computer has gone to sleep]
mdedetrich has joined #ruby-lang
mdedetrich has quit [Client Quit]
julweber has quit [Ping timeout: 246 seconds]
v0yager has quit [Remote host closed the connection]
<Nilium>
It seems like rdoc ignores call-seq for initialize methods...
<erikh>
can you provide an example?
<Nilium>
Well, I put a :call-seq: on a C function bound to initialize for a class and it just didn't do anything. No easy way to reproduce right now, so I'm going to just assume it's being its usual awful self.
mdedetrich has joined #ruby-lang
<erikh>
eh, maybe you could... provide a code sample?
<Nilium>
I'll do that when I have time to write out a working sample C extension that lets me reproduce it.
<Nilium>
In the meantime, I'm just going to continue working on this and ignore as much of rdoc's awfulness as I can.
<erikh>
so, you're taking the "complain loudly and accomplish and do nothing approach"
<erikh>
gotcha.
<Nilium>
That said, it's probably worth noting that if you alias initialize, the new method (the one aliasing initialize) is hidden in generated docs.
<Nilium>
So my best guess is just that anything pertaining to initialize is hidden.
<Nilium>
Whereas anything pertaining to new is not.
<erikh>
initialize is usually re-routed to new
<erikh>
which might be your problem, but I don't really have time for guess work
<Nilium>
It's probably a bad assumption to make for C bindings.
<Nilium>
At any rate, I'll do it later. Again, I want to get the documentation written first.
vlad_starkov has joined #ruby-lang
jstorimer has joined #ruby-lang
Sambalero has quit [Remote host closed the connection]
<erikh>
call-seq is pretty fiddly and there are a lot of ways to trip the specification up
jstorimer has quit [Read error: Connection reset by peer]
<erikh>
it's very easy to "do it wrong"
CaptainJet_ has joined #ruby-lang
CaptainJet has quit [Disconnected by services]
<erikh>
a use-case would help eliminate if you're just doing that or if there's a genuine bug that needs to be fixed
<Nilium>
More likely it's just me doing something wrong.
vlad_starkov has quit [Ping timeout: 256 seconds]
v0yager has joined #ruby-lang
flip_digits has quit [Remote host closed the connection]
flip_digits has joined #ruby-lang
Bahman has joined #ruby-lang
CaptainJet_ has quit []
thebastl has joined #ruby-lang
_jpb_ has quit [Ping timeout: 246 seconds]
_jpb_ has joined #ruby-lang
Cakey has joined #ruby-lang
hhatch has joined #ruby-lang
tomzx_ has joined #ruby-lang
skade has joined #ruby-lang
tomzx_ has quit [Client Quit]
thebastl has quit [Remote host closed the connection]
mdedetrich has quit [Quit: Computer has gone to sleep.]
Nisstyre has quit [Quit: Leaving]
tomzx_mac has quit [Ping timeout: 246 seconds]
duph1 has quit [Quit: Leaving.]
mislav has joined #ruby-lang
kgrz has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
<dingus_khan>
can't find this answer anywhere: are there options for the File class like there are for the CSV class when opening a text file?
<dingus_khan>
maybe it's a stupid question, actually
<erikh>
like, 'r' and 'w'?
<dingus_khan>
err, besides those, like the ones for CSV-specific objects, like 'headers => true' and such
<dingus_khan>
I'm trying to figure out a way to assign an id to each line of a text file when there already isn't one
<erikh>
not that I know of, sorry
apeiros has quit [Read error: Connection reset by peer]
_jpb_ has quit [Ping timeout: 268 seconds]
apeiros_ has joined #ruby-lang
<erikh>
ri File.open should have some docs though
_jpb_ has joined #ruby-lang
<dingus_khan>
dang. OK, I'll check that out (although last time I tried that, RVM hadn't gotten that installed properly, even after the bugfix)
CaptainJet has joined #ruby-lang
<erikh>
ah
<erikh>
ruby-doc.org has most of the ri content on it.
skade has quit [Ping timeout: 276 seconds]
skade has joined #ruby-lang
<gnufied>
dingus_khan: check CSV::new
<gnufied>
it has several of those options
<dingus_khan>
oh snap, you mean make a CSV out of a text file? what if there isn't already a header line in there? do I just manually make one?
eriklukas has quit [Ping timeout: 240 seconds]
<erikh>
oh, I misunderstood
<erikh>
are you actually dealing with CSV data?
apeiros_ has quit [Remote host closed the connection]
<dingus_khan>
no, it's currently just a text file, straight up, just a list of sentences
<erikh>
what attributes about said list of sentences would be interesting?
<dingus_khan>
so it's a "todo list", one task per line, and it's saved as a txt
<erikh>
I guess I'm missing something important.
<erikh>
oh
<erikh>
I see what you want to do
<erikh>
how big is the file?
<dingus_khan>
ah yeah, it's just supposed to be something I can create task objects out of by going line by line, and I wanted to be able to insert columns like a CSV would
<dingus_khan>
and then I could insert a header row and transform it into a CSV?
<erikh>
let's start small
<dingus_khan>
'cause those CSV object options are really handy, ha
<dingus_khan>
ok, totally
<erikh>
File.read('myfile').split(/\r?\n/)
<erikh>
then you have an array, which you have a number for each one -- the index
<dingus_khan>
whoa, little regex action there?
<dingus_khan>
I did not know that was possible!
<erikh>
the \r?\n says, "if it has a carriage return, swallow it, and split on newlines"
<erikh>
so you're portable between windows and unix.
<erikh>
\r being the carriage return, ? being the "optional" bit, and \n being the newline.
<erikh>
anyhow -- regexes aren't the point here
<erikh>
that turns each line into an array.
<erikh>
err, makes an array out of all the lines.
<erikh>
try it in irb.
<erikh>
or pry or whatever
netShadow has quit [Quit: netShadow]
<erikh>
File.read is shorthand for: f = File.open('myfile', 'r'); f.read; f.close
<erikh>
most of this stuff is on ruby-doc.org so I'm going to urge you to go there and check it out soonish.
saarinen has joined #ruby-lang
<dingus_khan>
crap sorry, got conversationally accosted by friends in the lobby
<dingus_khan>
ok yeah, I was on the ruby-docs before, but I kept getting lost, couldn't distinguish between IO and File classes, guess it was a method search I should've done
mdedetrich has joined #ruby-lang
jstorimer has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
jstorimer has quit [Read error: Connection reset by peer]
<dingus_khan>
holy crap that's genius, never would've thought to chain split onto the initial file read, thank you erikh!
<erikh>
File inherits from IO
<dingus_khan>
yep, but figuring out which had which method was a bit confusing
<erikh>
so, when class A inherits from class B, it gets all its instance methods
<erikh>
might be a good time to hit up one of those tutorials I keep telling you about :)
<gnufied>
trust me, I have ignored erikh advise and I am doing fine
<erikh>
hah
arooni-mobile has quit [Read error: Operation timed out]
thebastl has joined #ruby-lang
<dingus_khan>
wait which tutorials? did we talk about the rubymonk stuff and the hardway ones?
<erikh>
learn to program, probably
<erikh>
corundum: learn to program?
gja has joined #ruby-lang
gja has quit [Changing host]
gja has joined #ruby-lang
<dingus_khan>
the chris pine one?
<erikh>
yes
arooni-mobile__ has quit [Ping timeout: 268 seconds]
thebastl has quit [Remote host closed the connection]
<erikh>
someone removed the factoid
<erikh>
I has a sad
<dingus_khan>
ah yeah, that one was a mix of too slow and too fast with some boring mixed in, lol
<erikh>
eh
<dingus_khan>
the numbers to words solution was confusing
<erikh>
how do you expect to learn without trying?
<erikh>
eh, sorry, cranky.
thebastl has joined #ruby-lang
saarinen has quit [Quit: saarinen]
<dingus_khan>
with another approach? the other tutorials like rubymonk felt like they jived a bit better, and I liked the hardway series too
<dingus_khan>
although I'm realizing the hardway's "just shut up an type this" may not be the most learning-oriented approach, lol
<erikh>
:)
<erikh>
zed's books are good to start, but you have to do the diligence at the end
<dingus_khan>
but I feel ya, I've been running around trying to cover a lot of different things under deadline, so I need to go back and review the chris pine one again at some point
<erikh>
learned python from his book, I feel like I have better reasons to hate it now
<dingus_khan>
lol sweet
<dingus_khan>
wasn't there another tutorial site people referenced all the time? something like tuts + or code academy?
<dingus_khan>
so many of them it seems
bzalasky has quit [Remote host closed the connection]
<erikh>
yeah, dunno
<erikh>
I learned from the pickaxe
<erikh>
corundum: pickaxe?
<erikh>
drbrain: I think ze bot is ze broken
bzalasky has joined #ruby-lang
<gnufied>
lol
<erikh>
dingus_khan: it's on ruby-doc.org -- there's also an updated book on pragprog.com
<erikh>
(that costs money. and it's worth it, and pretty cheap.)
<gnufied>
there is ruby pickaxe book and may be for not absolute beginners but David Flangnan's book is also quite good
workmad3 has joined #ruby-lang
saarinen has joined #ruby-lang
<gnufied>
for*
pkrnj has joined #ruby-lang
<erikh>
yeah, if ruby's your first programming language, the pine book (or perhaps this one) is more along the lines of what you're after
<erikh>
even if it's "boring" in spots.
<dingus_khan>
oh the pickaxe! I haven't gotten to that one, I haven't had a chance to sit down with a book on ruby yet, I've got the well grounded rubyist, beginning ruby, and eloquent ruby sitting on my hard drive still!
<gnufied>
hmm
<dingus_khan>
i first learned some programming with C++, and then I took a LAMP course last year
<erikh>
how many years of C++?
<erikh>
or is this college?
<dingus_khan>
oh like maybe 1
<dingus_khan>
college
<erikh>
ah ok
<dingus_khan>
long time ago
<erikh>
so you understand what a for loop, methods are?
<erikh>
sorry if I'm being overly pedantic, really just want to help
skade has quit [Quit: Computer has gone to sleep.]
<dingus_khan>
for loops! miss those a bit, lol
<erikh>
#each
<erikh>
and ruby has for loops but they're discouraged.
<dingus_khan>
yep, took a minute to get used to that one, but I'm ok now :D
<erikh>
so, hm.
bzalasky has quit [Ping timeout: 246 seconds]
<erikh>
I'm not familiar iwth the flanagan book, but if it's a beginner book give it a shot
<dingus_khan>
flanagan, gonna google now
<erikh>
the emphasis is on beginning programming though, with a ruby focus
<erikh>
codeacademy is a course thing
<erikh>
if web stuff is what you're interested in, they'll probably be able to help there
<dingus_khan>
oh I've got a hard copy of that one! yeah, it was a bit fast paced back when I first started reading it, but I imagine it'll make a lot more sense now
<erikh>
yeah, I'd recommend just giving yourself some problems like that todo list and going through your book with solving that in mind
<erikh>
"what would I use here to accomplish this", etc.
<erikh>
helps me learn at least -- I'm a big "learn by doing" type
<erikh>
ok I'mm play video games now. good luck!
<dingus_khan>
yeah totally, that's sort of the focus of this course I'm doing
<Aiea>
Hi there, I have a string containing data like this : "windows\test\File-0507Jar", I would like to transform this "Jar" into .jar. I tried to so a gsub(/\d+JAR/,".jar") but it doesn't seem to work
<Aiea>
any ideas ?
<yorickpeterse>
use gsub(/(\d+)JAR/, '\\1.jar')
julweber has joined #ruby-lang
<yorickpeterse>
You're not re-inserting the matched numbers
jstorimer has quit [Read error: Connection reset by peer]
<yorickpeterse>
and yeah, make it case insensitive if you must
<Aiea>
Thanks :)
<gnufied>
perhaps worth adding a $ at the end
<gnufied>
but not big deal
<yorickpeterse>
yeah you can definately tighten up that regex
Kero_ is now known as Kero
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
sepp2k has joined #ruby-lang
scholar01 has joined #ruby-lang
scholar01 has quit [Changing host]
scholar01 has joined #ruby-lang
tkuchiki_ has joined #ruby-lang
tkuchiki has quit [Read error: Connection reset by peer]
runeb has quit [Remote host closed the connection]
tkuchiki_ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
mytrile has quit [Remote host closed the connection]
runeb has joined #ruby-lang
codejury has joined #ruby-lang
maxmanders has joined #ruby-lang
<Aiea>
Another question if I may, my data now contain something like "windows\test\File-0507.jar High Threat: Eicar File". I would like to retrieve the path of the file only. I thought about using the split() methods on the "High" substring, but I think it's kinda ugly... Is there a more elegant way of doing this ?
dhruvasagar has quit [Quit: leaving]
dhruvasagar has joined #ruby-lang
<Olipro>
Aiea: what if the file has spaces in its name?
<Aiea>
Not possible
spuk has joined #ruby-lang
<Olipro>
well, there's a few ways to get it then, you could use split, or a regex
benlovell has joined #ruby-lang
<gnufied>
Aiea: what is in the path in that string?
<gnufied>
is "windows\test\File-0507.jar High Threat: Eicar File" full filename and "windows\test\" path?
<Olipro>
e.g. thestring[/^([A-z0-9\/-])/,1]
<Olipro>
obviously, expand the match group with whatever other chars are legal
<Olipro>
and err
<Olipro>
thestring[/^([A-z0-9\/-]+)/,1]
<Aiea>
gnufied: the full name, till the .jar
<Aiea>
gnufied: it can be .jar, .class or anything else
<Olipro>
actually, it could be much simpler
<gnufied>
there is File.basename()
<Olipro>
thestring[/^([^ ]+)/,1]
<Aiea>
gnufied: Actually, I just need to remove everything after the extension
<gnufied>
which handles path separation automatically on windows and *nix
<Olipro>
[4] pry(main)> str[/^([^ ]+)/,1]
<Olipro>
=> "windows\testFile-0507.jar"
<gnufied>
pew pew
<Olipro>
ah curses, it dropped the /
vlad_starkov has quit [Remote host closed the connection]
<Olipro>
oh, no it didn't, it wasn't in the original string I entered, heh
<Olipro>
so yeah, [/^([^ ]+)/,1] should work
Cakey has joined #ruby-lang
<Aiea>
Let's try with a true string then (just analyzing metasploit files ) :
<Aiea>
vmware-host\Shared Folders\metasploit-framework\data\exploits\CVE-2012-0507.jar[>msf\x\Exploit.class High Threat: Java:Agent-AXD [Expl]
<Aiea>
will it work :D
<Olipro>
I don't see whitespace between .jar and [>msf
<Aiea>
Now there is
jstorimer has joined #ruby-lang
<Aiea>
and your thing work :)
<Aiea>
Thanks
<Aiea>
Well I'm not a Ruby developper at all, so I guess my code is nightmarish xD
<Aiea>
Here is what I did : puts line.gsub(/vmware-\w+\\\w+\s+\w+\\/,'').gsub(/(\d+)Jar/, '\\1.jar ')[/^([^ ]+)/,1]
<Aiea>
It does do what I want
Aiea has quit [Ping timeout: 250 seconds]
duph has quit [Quit: Leaving.]
barttenbrinke has quit [Remote host closed the connection]
_jpb_ has quit [Ping timeout: 240 seconds]
fosky__ has quit [Ping timeout: 246 seconds]
_jpb_ has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
dhruvasagar has quit [Ping timeout: 260 seconds]
barttenbrinke has joined #ruby-lang
<injekt>
mother of god
jstorimer has quit [Read error: Connection reset by peer]
<chris2>
oO
<gnufied>
thats exactly what doctor ordered.
<gnufied>
oh hai chris2
kgrz has joined #ruby-lang
tbuehlmann has joined #ruby-lang
lguardiola has joined #ruby-lang
<chris2>
hey gnufied
kgrz has quit [Ping timeout: 246 seconds]
maxmanders has quit [Ping timeout: 268 seconds]
sstrickl has quit [Quit: sstrickl]
kgrz has joined #ruby-lang
pipework has quit [Remote host closed the connection]
sstrickl has joined #ruby-lang
maxmanders has joined #ruby-lang
glebm has joined #ruby-lang
ezkl has quit [Ping timeout: 246 seconds]
scampbell has joined #ruby-lang
ldnunes has joined #ruby-lang
mytrile has joined #ruby-lang
jstorimer has joined #ruby-lang
breakingthings has joined #ruby-lang
jstorimer has quit [Remote host closed the connection]
flip_digits has joined #ruby-lang
pipework has joined #ruby-lang
postmodern has quit [Quit: Leaving]
jstorimer has joined #ruby-lang
tomzx_mac has joined #ruby-lang
Uranio has joined #ruby-lang
w00x has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
pipework has quit [Remote host closed the connection]
wmoxam has joined #ruby-lang
krames has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vlad_starkov has joined #ruby-lang
Guedes1 has quit [Quit: Saindo]
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
vigintas_ has joined #ruby-lang
rickruby has quit [Remote host closed the connection]
vigintas has quit [Ping timeout: 240 seconds]
vlad_starkov has quit [Ping timeout: 268 seconds]
<GarethAdams>
I'm passing a block to a method which is `instance_eval`ing it. Is anything from my outer scope available, or are *all* ivar/method/* lookups done on the target object, out of my control?
adambeynon has joined #ruby-lang
<gnufied>
GarethAdams: no, nothing is available
<gnufied>
look into instance_exec
<gnufied>
if you want to pass something to a block that is executed like that
jstorimer has quit [Remote host closed the connection]
<GarethAdams>
I didn't write the method that is doing the instance_eval, I just wanted to loop inside the callback based on some outside state
<GarethAdams>
but I'll read up on instance_exec anyway
<gnufied>
what you mean by outer scope though?
bgant has joined #ruby-lang
<gnufied>
the place where you are calling the method (which instance_evals the block) or something in the method itself?
<GarethAdams>
the place I'm calling it from
<gnufied>
if you mean place from where you are calling the method, local variables should be captured
mytrile has quit [Remote host closed the connection]
jstorimer has joined #ruby-lang
cofin has joined #ruby-lang
<maloik>
For a gem that exposes some commandline tools for an API wrapper that requires a token, what's a good way to save said token? I thought I could write a method to either get it out of the ENV hash, and if it's not there, fallback to a file and then write it into the ENV vars... but it seems writing isn't an option in ruby, unless with some dirty hacks
<gnufied>
writing isn't an option?
<maloik>
well, each time you use one of the commands specified under /bin it'll spawn a new process I suppose, so it won't remember those variables
<gnufied>
environment variables are inherited between processes?
<gnufied>
s/?//
<maloik>
I just tried, doesn't look like it ?
<maloik>
open irb, ENV['FOO'] = 'bar', exit irb, open new one, returns nil
<cout>
maloik: the modified environment is only passed to _child_ processes of the current process
<maloik>
yea I thought something like that
kstuart has quit [Ping timeout: 276 seconds]
<maloik>
so basically, how can I let the person using that gem 'install' the api token to make it available to that gem? Writing a textfile seems like a bad idea ?
<whitequark>
maloik: ask a person to create a yourgem.yml config file
<whitequark>
so they can put the token there
<toretore>
i've seen some gems write files in ~
<whitequark>
optionally, create it for them
<toretore>
like the heroku app iirc
<toretore>
but if it were me, i'd require the token every time
cofin has quit [Quit: cofin]
<toretore>
export MYGEM_TOKEN=u472364f7uf236472
<toretore>
mygem_dostuff
krames has joined #ruby-lang
<whitequark>
yes, combined with the env var
<whitequark>
env vars are useful for eg CI
<whitequark>
where you don't want to store tokens in the repo
<maloik>
hmm yea the heroku gem could be a good example, lets have a look
<cout>
aha: p ((RString *)(rb_vm_get_ruby_level_next_cfp(ruby_current_vm->main_thread, ruby_current_vm->main_thread->cfp)->iseq->filename))->as.heap.pt
cofin has joined #ruby-lang
<cout>
stuck in abstract_mysql_adapter:98
icesprite has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
mrfoo has joined #ruby-lang
cofin has quit [Client Quit]
sstrickl has joined #ruby-lang
sstrickl has quit [Changing host]
sstrickl has joined #ruby-lang
<icesprite>
qq progrmrs
<maloik>
Heroku uses a .netrc file in homedir, checks for mode and all - great example
<yorickpeterse>
"One thing to notice is that we do not need to set self.class.layout back to our default layout. This is because in MVC, a controller is stateless for each request, so Rails creates an instance of the controller for every request."
<whitequark>
I think .netrc is not heroku-specific
<yorickpeterse>
GOOD THING YOU'RE SETTING IT ON CLASS LEVEL
<whitequark>
what the fuck is that
<yorickpeterse>
something I came across when googling for something rails related
pipework has joined #ruby-lang
<whitequark>
both the snippet (there's a proper way) and the way rails solves this
<whitequark>
oh. >frontend developer
erikgj has joined #ruby-lang
<whitequark>
that explains
cofin has joined #ruby-lang
* yorickpeterse
is trying to find a way to get before_filter to work with render() calls
<yorickpeterse>
because fuck the noise of having to call them all manually
<whitequark>
what exactly do you want?
vlad_starkov has joined #ruby-lang
<yorickpeterse>
Upon calling render(:action => :derp) I want Rails to run the before_filters for the :derp action
<yorickpeterse>
Like it normally does when processing an actual HTTP request
erikgj has quit [Client Quit]
<whitequark>
Given a shitty Rails application / When I call render :action => :derp / Should fuck up all the MVC
<whitequark>
and no, that is not what you want
<whitequark>
that is how you are trying to solve your problem
<gnufied>
.netrc is used by curl and many other things. it is def. not heroku specific
<yorickpeterse>
whitequark: I'm pretty damn sure that is what I want
<whitequark>
and not how you should be solve it. So, once again: what do you want?
<whitequark>
*be solving
<maloik>
whitequark: I don't think it is, indeed... don't find a whole lot on it, but it's pretty selfexplanatory
<yorickpeterse>
whitequark: ...
<yorickpeterse>
I think I made it pretty clear what I want
<whitequark>
yorickpeterse: your business case is "running before_filters when you call render"?
<whitequark>
pretty sure it isn't
<gnufied>
yorickpeterse: how about just render :layout => false
<gnufied>
or in fact render itself takes layout option
<whitequark>
no, it's up to you to explain what you want to do with your code
<yorickpeterse>
So I'm going to say this only once: for once stop being a fucking smartass
<yorickpeterse>
You gain nothing by it
<yorickpeterse>
What I asked is *exactly* what I'm trying to achieve, there's no beating around the bush
<yorickpeterse>
I *am* curious to see if it's even possible, if not I'll resort to manually calling what I need
<gnufied>
a note, if in future you run your app with puma or something you are in for fun
<yorickpeterse>
But it appears you can somehow read my mind over TCP/IP
<gnufied>
and in threaded environment
<yorickpeterse>
and apparently know it better than I do
jstorimer has quit [Remote host closed the connection]
<yorickpeterse>
gnufied: Puma is pretty cool
<whitequark>
yorickpeterse: whatever. if you want to screw yourself, you will
<yorickpeterse>
whitequark: also, the "Smart question" is fucking beating around the bush
<gnufied>
and setting layout at class level will break the underlying assumption about state of controller
<yorickpeterse>
gnufied: exactly
nathanstitt has joined #ruby-lang
<yorickpeterse>
it doesn't work in threaded environments, messes up the next request, etc
<whitequark>
yorickpeterse: if this is exactly what you want, then the answer is: no, there's no way. :action in render is just a shortcut for a particular template path.
<yorickpeterse>
See, that wasn't so hard now was it?
* whitequark
sighs
<yorickpeterse>
Thank you, that's all I was looking for
<whitequark>
it's described in the Rails docs, in the section about render
<whitequark>
I assumed you looked there.
<yorickpeterse>
I already found the answer before on SO
<yorickpeterse>
But the answers were meh so I didn't fully trust them
<whitequark>
...
<yorickpeterse>
Hey, I tried to tell you that what I was asking was actually what I was looking for
<yorickpeterse>
And not some half-assed beating around the bush question (e.g. "How do I do the Rails?")
kgrz has joined #ruby-lang
jstorimer has joined #ruby-lang
<icesprite>
oh
<icesprite>
ahit
<icesprite>
:D
snarfmason has joined #ruby-lang
<cout>
is it a bad idea to fork inside a controller action?
<gnufied>
:-)
<yorickpeterse>
cout: yes
<yorickpeterse>
Because you'll fork the entire Rails app
<cout>
:(
glebm has joined #ruby-lang
<gnufied>
but if you have to do something with your models etc, you will start another process anyways with entire rails env loaded
<gnufied>
fork, if you know what you are doing.
kgrz has quit [Ping timeout: 268 seconds]
<gnufied>
people use system() from actions all the time
<cout>
apparently I don't know what I'm doing, because the fork is what's causing my tests to hang
<gnufied>
wow
<gnufied>
what does the forked process do?
<cout>
sends some messages over SOAP
<cout>
writes to the database (using it's own connection, not the one from the parent process)
<cout>
I think maybe it should be closing all the parent's fds and it's not doing that
<gnufied>
there is an option for that
joshuawscott has joined #ruby-lang
<gnufied>
when you fork, you can specify close all parent's fds
<gnufied>
don't remember the details, will have to look up
joshuawscott has quit [Client Quit]
<gnufied>
how do you ensure, that you get new connection not inherited one?
<cout>
are you thinking of FD_CLOEXEC ?
joshuawscott has joined #ruby-lang
dhruvasagar has joined #ruby-lang
GeissT has quit [Quit: MillBroChat AdIRC User]
<gnufied>
sorry yes, but that works only on fork and exec
<gnufied>
if you have doubts you can always harass injekt
Johz has joined #ruby-lang
mdedetrich has joined #ruby-lang
julweber has quit [Read error: Connection reset by peer]
<maloik>
good point :-)
julweber has joined #ruby-lang
<cout>
maloik: look in lib/optparse.rb
<maloik>
cout: those are the docs I was mentioning
<maloik>
they're a mess if you ask me
<injekt>
:)
<injekt>
maloik: Slop is basically how I want optionparser to look, it's far more simple and it also gathers options which saves you a lot of manual labour
<yorickpeterse>
cout: you'll want to use something like a background worker/queue for that
<maloik>
yep just quickly read through it
<maloik>
gonna have to experiment with it, the cli i'm building will be one with commands and subcommands :/
<maloik>
like 'mycli account create', 'mycli xen host.name.com restart', ...
<injekt>
sure, slop can do all that stuff
hogeo has quit [Remote host closed the connection]
<maloik>
oh I just saw the subcommands part
<maloik>
good stuff
<maloik>
beer on me in october
<maloik>
:-)
<injekt>
:)
<maloik>
this is some seriously brilliant stuff actually, my mess of handling all this is now solved
<injekt>
good to hear, let me know if there's anything I can change/add to help you out
cofin has quit [Quit: cofin]
<maloik>
suppose you can nest those command blocks ?
hashkey has joined #ruby-lang
hashkey has quit [Client Quit]
hashkey has joined #ruby-lang
hashkey has quit [Remote host closed the connection]
Drekonus has joined #ruby-lang
Drekonus has quit [Max SendQ exceeded]
JohnBat26 has joined #ruby-lang
<gnufied>
injekt: recently a gem that uses slop. my only feedback is, it was not clear how to speficy flags/options for subcommands immediately
<gnufied>
released*
<gnufied>
perhaps I will jot down them in a ticket.
<injekt>
gnufied: that would be helpful, thanks
anonymuse has joined #ruby-lang
hashkey has joined #ruby-lang
bougyman has quit [Ping timeout: 268 seconds]
cofin has joined #ruby-lang
krames has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
akurilin has joined #ruby-lang
icesprite has left #ruby-lang [#ruby-lang]
runeb has quit [Remote host closed the connection]
krames has joined #ruby-lang
_jpb_ has quit [Ping timeout: 246 seconds]
<erikh>
fart
_jpb_ has joined #ruby-lang
jstorimer has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
jstorimer has quit [Read error: Connection reset by peer]
thebastl has joined #ruby-lang
havenwood has joined #ruby-lang
thebastl has quit [Remote host closed the connection]
dingus_khan has quit [Remote host closed the connection]
gix has joined #ruby-lang
jstorimer has joined #ruby-lang
NemesisD has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
<NemesisD>
hi guys. i have a gem that needs to behave slightly differently under jruby. it has 1 different dependency in the gemspec and has 1 case statement in the code
_jpb_ has quit [Ping timeout: 256 seconds]
jstorimer has quit [Remote host closed the connection]
_jpb_ has joined #ruby-lang
jkyle_ has left #ruby-lang [#ruby-lang]
<NemesisD>
what's a best practice for generating multiple builds of the same gem for the ruby platform and jruby platform
<NemesisD>
i looked at some example projects but they tend to have entirely separate repos for jruby
verto has quit [Ping timeout: 246 seconds]
jsullivandigs has joined #ruby-lang
mistym has quit [Remote host closed the connection]
mistym has joined #ruby-lang
Akla has quit [Quit: Page closed]
<zenspider>
NemesisD: not separate repos. look at the rake-compiler gem
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
tomzx_mac has joined #ruby-lang
workmad3 has quit [Ping timeout: 264 seconds]
<NemesisD>
zenspider: still getting to this but does this work with projects where the java side has no extensions? it just has different deps
jsullivandigs has quit [Remote host closed the connection]
havenwood has quit [Remote host closed the connection]
maxmanders has quit [Quit: Computer has gone to sleep.]
skade has joined #ruby-lang
vlad_starkov has joined #ruby-lang
JoelMcCracken has joined #ruby-lang
ohcomely has quit [Quit: Leaving...]
<NemesisD>
yeah this does not seem to be a good fit for what i'm doing
fragamus has joined #ruby-lang
<JoelMcCracken>
is there a way to filter rake tasks, e.g. rake -T only lists a few instead of all, possibly with a note that says "use option ... for all"
scholar01 has joined #ruby-lang
scholar01 has quit [Changing host]
scholar01 has joined #ruby-lang
<drbrain>
rake -T [PATTERN]
<JoelMcCracken>
eh. what I mean is that I'd like to have rake -T display "normal, typical" tasks by default, and an extended version which lists "omg all possible tasks"
<JoelMcCracken>
basically the problem is that going back into this octopress project, I cant immediately remember which tasks I was using
<rickhull>
dumb idea, but can you make a rake task that walks/filters rake's task space?
vlad_starkov has quit [Ping timeout: 268 seconds]
<rickhull>
i don't think rake itself has the metadata to know which tasks are common / typical
<JoelMcCracken>
indeed; biggest problem is that it'd need to override the default -T action
<JoelMcCracken>
i'd add the metadata manually somehow
Krimigis has joined #ruby-lang
<rickhull>
it sounds like a rakefile problem moreso than a rake problem, to me
<JoelMcCracken>
yeah, could be
<rickhull>
i.e. solve it in the rakefile, not rake
<JoelMcCracken>
(probably is)
mdedetrich has joined #ruby-lang
pipework has quit [Remote host closed the connection]
diegoviola has quit [Quit: WeeChat 0.4.1]
r0bby has joined #ruby-lang
lun__ has quit [Remote host closed the connection]
tylersmith has quit [Remote host closed the connection]
scholar01 has quit [Quit: Leaving.]
glebm has quit [Ping timeout: 268 seconds]
robbyoconnor has quit [Ping timeout: 260 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
skade has quit [Quit: Computer has gone to sleep.]
flip_digits has joined #ruby-lang
glebm has joined #ruby-lang
realDAB has quit [Quit: realDAB]
mdedetrich has joined #ruby-lang
justinra_ has quit [Remote host closed the connection]
flip_digits has quit [Ping timeout: 256 seconds]
_jpb_ has quit [Ping timeout: 240 seconds]
_jpb_ has joined #ruby-lang
<NemesisD>
drbrain: i think you may have written Gem::PackageTask so i'm guessing you'll be a good resource on this: it looks like that task is built by passing it a full Gem::Specification, why does it need a .gemspec in the directory as well?
maxmanders has joined #ruby-lang
FiXato has quit [Excess Flood]
<rickhull>
NemesisD: i've been working on this stuff recently
<NemesisD>
drbrain: i'm trying to do something like [Gem::Platform::RUBY, Gem::Platform::JAVA].each {|p| spec = base_spec.dup; spec.platform = p; Gem::PackageTask.new(spec) {} }
<rickhull>
Gem::PackageTask just needs a soft gemspec
FiXato has joined #ruby-lang
<rickhull>
not a file
brianpWins has quit [Quit: brianpWins]
<NemesisD>
rickhull: but when you run the tasks it creates, they want a gemspec file
<rickhull>
not in my case
<rickhull>
i'm coming at this from your side, as a Gem::PackageTask user
<NemesisD>
rickhull: i'm looking for the least-trouble way of generating 2 gem files built for different platforms, they have 1 different dependency each
<rickhull>
2 gemspec files
<drbrain>
NemesisD: a) don't use Gem::Platform::JAVA, use Gem::Platform.local
__butch__ has quit [Quit: Leaving.]
<drbrain>
unless you really know what you're doing
<rickhull>
btw, word on the street is that omitting a hard gemspec file breaks Bunder
<rickhull>
Bundler, and you don't want to that
<drbrain>
NemesisD: b) nokogiri does this
duph has joined #ruby-lang
ohcomely has joined #ruby-lang
<drbrain>
NemesisD: it uses Rake::JavaExtensionTask which I think comes from rake-compiler
<NemesisD>
drbrain: the trouble is my use case is much simpler, there are no extensions ot build on either side
<zenspider>
rickhull: it doesn't break bundler. it breaks using git repos with bundler... and honestly, meh.
kgrz has joined #ruby-lang
maxmanders has quit [Ping timeout: 246 seconds]
<rickhull>
oh, that's all?
<NemesisD>
drbrain: i'd prefer a solution where I don't have to change to a different ruby to build it
<NemesisD>
really hoping i can avoid having to do this with sed
<zenspider>
in this case, since you don't have anything built, not doing Platform.local is probably better
<zenspider>
that way you can have one rake task that builds both in one pass
<drbrain>
NemesisD: if you don't have extensions why do you need a separate gem for java?
<zenspider>
drbrain: is that gonna fuck up rubygems.org ?
<zenspider>
different deps
<NemesisD>
drbrain: the cruby dep locks up in jruby
wmoxam has joined #ruby-lang
<NemesisD>
luckily theres a gem that is pretty much api-compatible with it so even the gem's source code is the same, minus one case off of RUBY_PLATFORM
<drbrain>
zenspider: which?
apeiros has quit [Remote host closed the connection]
mike has joined #ruby-lang
r0bby is now known as robbyoconnor
apeiros has joined #ruby-lang
<drbrain>
NemesisD: does Gem::PackageTask.new(spec) not work?
mike is now known as Guest59844
<drbrain>
… twice not work
<drbrain>
zenspider: the different dependencies shouldn't matter
Guest59844 has quit [Client Quit]
<NemesisD>
drbrain: it would work except it wants a .gemspec in the current directory to actually build the gem
kgrz has quit [Ping timeout: 240 seconds]
jonahR has quit [Quit: jonahR]
<drbrain>
NemesisD: it shouldn't
athaeryn has joined #ruby-lang
singpolyma has quit [Ping timeout: 264 seconds]
_jpb_ has quit [Ping timeout: 248 seconds]
<NemesisD>
drbrain: hmm lemme try again, i could have been too raged to notice ;)
<drbrain>
according to the source it only uses the Gem::Specification you pass in
_jpb_ has joined #ruby-lang
<drbrain>
but maybe I'm missing something, rubygems is too big for me to remember all of it
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dingus_khan has quit [Remote host closed the connection]
brianpWins has joined #ruby-lang
<athaeryn>
I have a question which has come up as I've been looking over Rails (briefly), but which I think is more related to Ruby than Rails (and I understand the distinction between the two). I'm not familiar with the syntax behind the way routing is set up, e.g. 'route to: "whatever#route"'
<NemesisD>
drbrain: it complains Don't know how to build task 'event_stream_protocol.gemspec' when i run rake package
<athaeryn>
What is that expression actually doing/
ohcomely has quit [Ping timeout: 240 seconds]
<NemesisD>
drbrain: which indicates to me that it's expecting a filetask for 'event_stream_protocol.gemspec'
<drbrain>
NemesisD: is it in your files list?
<drbrain>
file gem_path => [package_dir, gem_dir] + @gem_spec.files do [build gem] end
<NemesisD>
oh man..
<drbrain>
was that it?
maxmanders has joined #ruby-lang
<NemesisD>
drbrain: well it compiled! is there a way i can unpack or inspec the gem files it generated to make sure they have the right deps?