frem has quit [Quit: Connection closed for inactivity]
gix has quit [Ping timeout: 272 seconds]
dviola has quit [Ping timeout: 248 seconds]
zapata has quit [Ping timeout: 264 seconds]
cako has joined #ruby
zapata has joined #ruby
bruce_lee has quit [Remote host closed the connection]
cako has quit [Ping timeout: 244 seconds]
sylario has quit [Quit: Connection closed for inactivity]
<RetroPunk>
hey all, if i wanted to make a new codebase for a current gem could i just make a new gem template (bundle gem) and copy over the gemspec file?
<havenwood>
RetroPunk: You'd not be preserving much of the gem.
<havenwood>
RetroPunk: What do you mean by new codebase? You're replacing ALL the code?
<RetroPunk>
yeah, start from scratch
<havenwood>
RetroPunk: Why preserve anything?
<havenwood>
RetroPunk: Just start with a fresh folder.
<RetroPunk>
and just name it the same?
<havenwood>
RetroPunk: I personally like the exercise of starting from nothing. That way you won't have anything you don't need.
<havenwood>
RetroPunk: Why name it the same?
<havenwood>
RetroPunk: It's typically nice to have your gem name be unique.
<havenwood>
RetroPunk: Maybe say more about why you're doing what you're doing?
<RetroPunk>
because i just started it, i'm very new to Ruby and have noticed a lot of things i could do better, i'd like to update my existing gem with a new codebase if that makes sense
<havenwood>
RetroPunk: The typical thing you'd do in that case is a major version bump of your gem.
<havenwood>
RetroPunk: Release a new version.
<RetroPunk>
definitely yeah, that's the plan. i just am trying to figure out the best practice for doing this
<havenwood>
RetroPunk: Use git, update the things, release the new version.
<havenwood>
RetroPunk: I like to tag the commit for the version release too, and push that to GitHub.
<RetroPunk>
yeah i'm using GitLab right now for the project
<havenwood>
RetroPunk: same steps there
<havenwood>
RetroPunk: make your updates, push to GitLab, release gem
<RetroPunk>
yeah i understand that, i just want to make sure i do it right. i'm familiar with all the git steps. but, for example, i will be changing the folder name under the lib/ directory in the gem and the require statements would change as well
<havenwood>
RetroPunk: You just make the commits to reflect your changes, then when you're done, tag the release and cut the gem version.
<RetroPunk>
yeah i totally understand all that and sem ver, my question is more Ruby/bundle specific. if i create a NEW folder with bundle gem, could i push to rubygems.org on a current project?
<havenwood>
RetroPunk: Have you already released your gem?
<RetroPunk>
yeah
<havenwood>
RetroPunk: To release a new version, you make your changes, then push the new gem version to RubyGems.
AJA4350 has quit [Ping timeout: 244 seconds]
<havenwood>
RetroPunk: For example, if I wanted to make a change, say move a file in that gem above ^ - I can make that change, bump the gem version, commit those changes to git, then: gem release --tag --push
<RetroPunk>
but can i do this from a new folder? say i want to delete everything i currently have and start completely new, what would be the steps in the new gem directory for linking it with the current gem on rubygems.org? would it just be the same process as before?
<havenwood>
RetroPunk: Normally you don't regenerate from scratch, you just make your changes. But you can do it however you want.
<RetroPunk>
alright, maybe i won't regenerate then. i just wanted a completely clean start is all. i could probably finagle something
<havenwood>
RetroPunk: If you want, start with a blank gemspec, add your gem name and new version and start from there.
<havenwood>
RetroPunk: It's totally up to you. RubyGems doesn't care about anything but the code you push.
<havenwood>
RetroPunk: The process you use to get there doesn't matter.
<RetroPunk>
got ya. ok thank you very much for the help havenwood :)
<havenwood>
RetroPunk: No prob! Have a good time gem cutting!
GodFather_ has quit [Ping timeout: 248 seconds]
GodFather has quit [Ping timeout: 268 seconds]
cako has joined #ruby
cako has quit [Client Quit]
bmurt has joined #ruby
SeepingN has joined #ruby
poontangmessiah has quit [Ping timeout: 272 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
poontangmessiah has joined #ruby
poontangmessiah has quit [Remote host closed the connection]
<tsujp>
Lovely, I'll need to refresh some Ruby and then I shall get into that
<tsujp>
What should I do for type safety in Ruby? That is floating point operations. If I was using Javascript I'd use BigNumber or Typescript, if I was in C I'd have access to data types as it's statically-typed
suukim has joined #ruby
code_zombie has quit [Ping timeout: 276 seconds]
jenrzzz has quit [Ping timeout: 258 seconds]
kyrylo has quit [Read error: Connection reset by peer]
code_zombie has joined #ruby
kyrylo has joined #ruby
kyrylo has quit [Read error: Connection reset by peer]
kyrylo has joined #ruby
user1_ has joined #ruby
<user1_>
how much ram is needed for redmine?
user1_ is now known as Intelo
<havenwood>
tsujp: An Integer is backed by Fixnum and Bignum under the hood with auto-promotion so you don't have to worry about it.
<havenwood>
tsujp: Floats are plain old double-precision floats.
<havenwood>
tsujp: Then BigDecimal and Rational.
tdy has quit [Ping timeout: 245 seconds]
<tsujp>
If I was doing financial calculations I might use BigDecimal then
<havenwood>
tsujp: BigDecimal is arbitrary precision floats.
<tsujp>
Not even floats are usually precise enough for that, I think I remember using `double` whenever I did things in C that involved money
<havenwood>
I don't quite grok it yet, and it's a bunch of Python, so may or may not attempt.
<havenwood>
Maybe someone else will do it. :)
fphilipe has quit [Ping timeout: 245 seconds]
<RetroPunk>
hello again. having a strange issue. i am trying to create a new class within a module and include it in my main file but i'm getting an error: ./tracklist:38:in `<main>': uninitialized constant Tracklist::TrackParser (NameError)
<Intelo>
can we just use rails internal server to run redmine instead of ngnix or apache
<qbrd[m]>
why does `var1 = 'boz'` work, but `var2 << 'biz'` errors?
<qbrd[m]>
shouldn't they both error as we're modifying an immutable string?
<qbrd[m]>
or is it only the value that's assigned to `var` that's immutable.
duderonomy has quit [Client Quit]
<qbrd[m]>
can I `var1.freeze = 'foo'`?
<qbrd[m]>
(obviously that doesn't work...)
<adam12>
qbrd[m]: I'm not an expert on this, but the value itself is frozen ("bar") but not the reference to it (var2)
<adam12>
qbrd[m]: You're best bet for a frozen variable would be a constant, but even then, it's only intent revealing (I'm a constant and shouldn't be modified) vs Ruby saying you can't modify it.
kyrylo has quit [Read error: Connection reset by peer]
kyrylo has joined #ruby
<qbrd[m]>
I'm teaching a Chef class and the question about "immutable strings" came up, so we were discussing what that means/how they work.
<qbrd[m]>
I of course opened with "you can't do string concatenation without a new variable", which I then proved to be a lie... lol.
<qbrd[m]>
So, immutable strings are only good for disabling `gsub!` lol.
mikecmpbll has quit [Quit: inabit. zz.]
kyrylo has quit [Read error: Connection reset by peer]
RougeRR has quit [Ping timeout: 245 seconds]
sytherax has joined #ruby
kyrylo has joined #ruby
<adam12>
qbrd[m]: I believe they help reduce load on the GC as well
chalkmonster has quit [Quit: WeeChat 2.5]
involans has quit [Quit: involans]
sytherax has quit [Ping timeout: 245 seconds]
FastJack has quit [Ping timeout: 264 seconds]
poontangmessiah has joined #ruby
duderonomy has joined #ruby
FastJack has joined #ruby
kyrylo has quit [Read error: Connection reset by peer]
kyrylo_ has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
kyrylo_ has quit [Read error: Connection reset by peer]
<qbrd[m]>
also, it seems my `'foo'.freeze` is redundant... lol
poontangmessiah has quit [Remote host closed the connection]
<adam12>
qbrd[m]: There's a good post somewhere on the ruby-talk mailing list from normalperson (eric wong) who talks about it too.
<havenwood>
qbrd[m]: That article's example isn't a good one, since it's already optimized and doesn't dup.
<adam12>
qbrd[m]: Not allowing gsub! is handy tho. I once mutated the Rails params hash (let's call it, params[:state_abbr].upcase!), which caused a ton of grief trying to track down (pre frozen strings)
donofrio has quit [Remote host closed the connection]
GodFather has joined #ruby
GodFather_ has joined #ruby
gix has joined #ruby
sdu has joined #ruby
jenrzzz has quit [Quit: Lost terminal]
leitz has joined #ruby
jenrzzz has joined #ruby
ukd1 has joined #ruby
ukd1 has quit [Client Quit]
ukd1 has joined #ruby
zapata has quit [Quit: WeeChat 2.5]
nfip^ has quit []
<brool>
i'm making a chatroom with sinatra and ajax, how do i keep a server-side list of active nicks? should i just have the app read/write to a file on every login/logout?
<brool>
i just want something quick & dirty
glosoli has joined #ruby
SeepingN has joined #ruby
erk^ has joined #ruby
impermanence has quit [Ping timeout: 245 seconds]
RetroPunk has joined #ruby
deepredsky has joined #ruby
<RetroPunk>
hey all, hope to get some help with this stupid issue i am having. i am trying to create a new class within a module and include it in my main file but i'm getting an error:
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ascarter has joined #ruby
<havenwood>
brool: Serializing and writing to a file can sometimes result in transactional issues where changes don't occur together. The Ruby stdlib has PStore for Marshal and YAML::Store for Psych that provide transactional guarantees.
<havenwood>
brool: Alternatively, you could use an in-memory cache. I've rolled my own with Rinda::TupleSpace from the stdlib before and kinda liked that.
<havenwood>
brool: Or DBM (Berkley DB) ships with the Ruby stdlib as well. For values more complex than a String, there's YAML::DBM - which would probably work for your case.
<leftylink>
RetroPunk: possible to check whether the right files are getting `require` d ? for example just adding a `puts __FILE__` at the bottom of each file? it would be disastrous if , for example, a stray `-I .` got into the command line flags and caused `bin/tracklist.rb` to require itself instead of `lib/tracklist.rb`...
AJA4350 has quit [Ping timeout: 258 seconds]
<leftylink>
actually, that's not even a reasonable suggestion for me to make
<RetroPunk>
i can do that, though
<RetroPunk>
i just figured it was being required because i didn't get an error for that
<leftylink>
if bin/tracklist were requiring itself, it would be Tracklist that was undefined, not TrackParser
<havenwood>
RetroPunk: 'bin' is the default bindir
<RetroPunk>
leitz: did you check the TrackParser branch?
<havenwood>
it's just Bundler that can't accept that default ;P
<havenwood>
they keep generating gems that change it
<RetroPunk>
ah ok, i'll just remove that line then :)
<leitz>
RetroPunk, I was on master. Lemme go check.
AJA4350 has joined #ruby
<leftylink>
with that exact directory structure, one certainly would expect that `ruby -I lib bin/tracklist` would work. so something tricky is going on
<RetroPunk>
i am wondering if it has to do with renaming the gem, i will try to explain what happened in detail
<leitz>
leftylink, I'm thinking it's not finding the lib. Poking at it now.
<RetroPunk>
last night i created a gem called "tracklist" and wanted to push it to rubygems.org. this gem was already taken, so i renamed it to ruby-tracklist. however, after doing so i couldn't require 'ruby-tracklist', i could only require 'tracklist' and it still worked
<RetroPunk>
i hope this makes sense
<leftylink>
`ruby -I` doesn't really care what the gem is called
<RetroPunk>
btw, i don't get an error when running ruby -I lib bin/tracklist .
<leitz>
Cartoon with color.
<RetroPunk>
leitz: gem "taglib-ruby"
<leitz>
RetroPunk, then the issue is that it can't find your library.
<leitz>
While bad form, I tend to add: $LOAD_PATH << File.expand_path('../../lib', __FILE__) to my command programs. You won't need it once you have the gem installed.
<RetroPunk>
leitz: i lied, i'm sorry, different error...
<leitz>
Which explains the "uninitialized constant".
<leitz>
Which line of which file?
<RetroPunk>
wait hold on i'm sorry
<leitz>
Yeah...I *never* make mistakes...
jefffrails35 has joined #ruby
<RetroPunk>
that link havenwood sent got me confused :P i changed the require to ruby/tracklist/track_parser
* leitz
chokes on his own words...
<RetroPunk>
haha the life of the perfect dev
<RetroPunk>
yeah so i'm confused, it doesn't *error* with the -I command
<RetroPunk>
so that's something
<leitz>
Like I said, it can't find your library, because your ~/lib isn't in the LOAD_PATH.
<leitz>
-I lib fixes that for you.
<RetroPunk>
so what you're doing there with the $LOAD_PATH is basically concatenating onto the $LOAD_PATH with the lib directory i am assuming
<leitz>
Adding it to the LOAD_PATH, yes.
<RetroPunk>
i added this to my bin/tracklist file and i am still getting the error
<leitz>
If you open up an irb session you can "puts $LOAD_PATH" and it should show you the path.
<leitz>
Hmmm...try adding it to lib/tracklist.rb as well. I'll check my notes.
ukd1 has quit [Quit: leaving]
ukd1 has joined #ruby
<RetroPunk>
yeah i see the $LOAD_PATH in irb, it's all stuff in the .rvm folder
<RetroPunk>
leftylink: sorry didn't see that, it's bitmoji i think?
<leitz>
what if you all the load path to the main program, and then add a "puts $LOAD_PATH" there? Does it see your lib directory?
eddof13 has joined #ruby
<RetroPunk>
yeah the lib directory is there
<RetroPunk>
but not lib/tracklist
jefffrails35 has quit [Quit: Leaving]
jefffrails35 has joined #ruby
code_zombie has joined #ruby
<leitz>
The lib should work, it should look in lib/tracklist for track_parser.
<leftylink>
bitmoji, that looks like that is te term I was looking for, thank you
<RetroPunk>
np
<leitz>
Have you tried putting it in tracklist.rb as well?
<RetroPunk>
the $LOAD_PATH code you sent? yeah
<RetroPunk>
i can do a puts $LOAD_PATH there though
teardown has joined #ruby
<leitz>
Try, but it should show the lib.
<leitz>
Granted, I'm still a Ruby-Newbie, but this usually works for me.
<RetroPunk>
the puts isn't even outputting from the tracklist.rb
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz>
That's a clue.
<RetroPunk>
let me try removing the initialization
<RetroPunk>
yeah it's just not outputting anything to the terminal hmm
<RetroPunk>
even puts "hello" doesn't work in that file
sytherax has joined #ruby
involans has quit [Quit: involans]
jefffrails35 has quit [Quit: Leaving]
<RetroPunk>
does that mean that the require is only requiring the class tracklist and not the module?
<RetroPunk>
or the file, rather
Rapture has joined #ruby
Rapture has quit [Client Quit]
eddof13 has quit [Quit: eddof13]
<leftylink>
maybe it is worth doing `puts $LOADED_FEATURES.grep(/tracklist/)` to see what exactly got `require`d, and see if that matches up w/ expectations
sdu has quit [Quit: bye]
sytherax has quit [Ping timeout: 246 seconds]
<RetroPunk>
it looks like tracklist/version.rb and tracklist.rb are being loaded
deepredsky has quit [Ping timeout: 248 seconds]
ukd1 has quit [Read error: Connection reset by peer]
matt76 has joined #ruby
Fusl has quit [Max SendQ exceeded]
<leftylink>
isn't tat inconsistent with the earlier statement tat putting a `puts` in tracklist.rb had no effect?
Fusl has joined #ruby
<RetroPunk>
hmm actually
<RetroPunk>
it looks like it's loading these files from the .rvm directory
<RetroPunk>
so that means that it's not even reading anything in the local folder? lol
ukd1 has joined #ruby
<RetroPunk>
i bet if i built the gem and installed it it would work, but that's counter productive
hutch has joined #ruby
matt76 has quit [Remote host closed the connection]
<leftylink>
also TIL `$LOADED_FEATURES` for this express purpose
<RetroPunk>
thank you this is really helpful... any idea on how to go about getting it to load locally?
ellcs has joined #ruby
<leftylink>
I thought you already said it yourself - you saw that `-I lib` worked. isn't that the way to go? it's not like Ruby is magic. It's not going to know where to `require` the files from unless explicitly told so
<RetroPunk>
i suppose so
<RetroPunk>
thank you all for your help, i really appreciate it
<RetroPunk>
i will just use the -I flag from now on
<leftylink>
hmm. although maybe it is customary for `bin/` to prepend its own `lib` to the $LOAD_PATH ? I'm not sure what is the convention among gem authors
AJA4350 has quit [Ping timeout: 272 seconds]
<leftylink>
or maybe it's customary to require_relative ???
Sithembewena has joined #ruby
<leftylink>
those are some options to explore. I cannot advise on wheter that would break some convention that gem authors adhere to, but they are options
<leftylink>
eh, the require_relative is mostly unsatisfying since things directly required by `bin/whatever` will be affected, but if we assume that files in `lib` will continue to `require` instead of `require_relative`, then there will be no dice there
bmurt has quit [Ping timeout: 245 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
<havenwood>
RetroPunk: I'd really recommend following RubyGems naming convention.
<RetroPunk>
havenwood: so restart the gem and name it ruby_tracklist?
<havenwood>
RetroPunk: There's no track_list gem. Why not use that name?
<RetroPunk>
yeah i could do that
<havenwood>
RetroPunk: TrackList is solid.
sytherax has quit [Ping timeout: 248 seconds]
<RetroPunk>
so basically create a new template gem (totally fine with starting over) and name it track_list?
<havenwood>
RetroPunk: TrackList is lib/track_list.rb, which is super simple.
<RetroPunk>
for sure yeah
<RetroPunk>
could i still name the "binary" tracklist?
<havenwood>
RetroPunk: Yes, I'd suggest starting with a new gem name that follows convention to the T. You might also consider starting from a blank folder and only adding back what you need.
<havenwood>
RetroPunk: Yes, you can still name the binary tracklist
<RetroPunk>
great i'm going to do this
<leftylink>
as I read it, jrochkind's most compelling argument is that if I need to split a gem into two, then suddenly I won't be able to use some of the `require_relative` anymore and will be forced to change them to `require`. that is a fair point, so should be evaluated against te probability of te gem ever having to split in two in the future
<havenwood>
RetroPunk: that's actually no problem whatsoever
<havenwood>
RetroPunk: executable names are properly more arbitrary. namespaces should match names.
<RetroPunk>
for sure
<RetroPunk>
i didn't know about the conventions, that is my bad for not looking into it first
<RetroPunk>
still learning so much
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
jenrzzz has quit [Ping timeout: 244 seconds]
admin123 has joined #ruby
drnerdius has joined #ruby
AJA4350 has joined #ruby
houhoulis has quit [Remote host closed the connection]
houhoulis has joined #ruby
involans has joined #ruby
<RetroPunk>
havenwood: i'm getting another error now about it not being able to load the file... if i push this up to gitlab would you mind taking a quick look for me?
<havenwood>
RetroPunk: You'll just need to install the gem for that to work.
chalkmon1 has joined #ruby
<RetroPunk>
havenwood: do you mean i need to install my own gem every time i make a change or something else?
<havenwood>
RetroPunk: rake install
<havenwood>
RetroPunk: If you want to test the binary and not use a require_relative or modify the load path, yes.
chalkmonster has quit [Ping timeout: 248 seconds]
<RetroPunk>
is this the best practice?
greengriminal has quit [Quit: Leaving]
<havenwood>
RetroPunk: yes
<havenwood>
RetroPunk: If you install the gem, does it work?
<havenwood>
RetroPunk: rake install
<havenwood>
RetroPunk: The binary won't be available when the gem isn't installed.
<havenwood>
RetroPunk: Gem binaries usually don't work if you try to use them directly, since they tend to rely on load path.
<RetroPunk>
this all makes sense now
Ryctolagus has quit [Quit: Leaving]
<RetroPunk>
ok i thought i would be able to save and just test locally like that
<RetroPunk>
but i need to rake install first
ellcs has quit [Ping timeout: 264 seconds]
<RetroPunk>
and yes, it works :)
<havenwood>
RetroPunk: thum👍🏽
<RetroPunk>
thanks a lot man, that explains so much
<havenwood>
no probb!
quesker has joined #ruby
<quesker>
on mac I did gem install thor. looks like it installed. but I don't know where it put it
<havenwood>
quesker: gem env gemdir
<havenwood>
quesker: gem which thor
<quesker>
ok thanks
involans has quit [Ping timeout: 272 seconds]
<havenwood>
quesker: you can also: gem open thor
<quesker>
nice
<mjacob>
is there a way to define a "data class" with additional methods that works similar to inheriting from a anonymous struct ("class X < Struct.new(:foo, :bar)") but doesn't use inheritance?
<havenwood>
quesker: or: gem contents thor
drincruz has quit [Ping timeout: 248 seconds]
<havenwood>
mjacob: X = Struct.new(:foo, :bar)
<havenwood>
mjacob: If you're on a modern Ruby, also consider using: keyword_init: true
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RetroPunk has quit [Quit: Leaving]
RetroPunk_ is now known as RetroPunk
RetroPunk is now known as Retr0Punk
ascarter has joined #ruby
wildtrees has quit [Quit: Leaving]
x86sk has joined #ruby
eddof13 has quit [Quit: eddof13]
AJA4350 has quit [Ping timeout: 245 seconds]
dviola has quit [Ping timeout: 245 seconds]
dviola has joined #ruby
eddof13 has joined #ruby
Frobozz has quit [Read error: Connection reset by peer]
dviola has quit [Client Quit]
<Retr0Punk>
havenwood: i'm getting there i think. just having another load issue... again... i followed your advice and created a new class file and then did rake install but i'm getting a load error again. the repo is https://gitlab.com/DomenicF/track_list
Frobozz has joined #ruby
<Retr0Punk>
in track_list.rb i am doing require 'track_list/directory_parser'
<Retr0Punk>
and then rake install
<Retr0Punk>
then i get cannot load such file -- track_list/directory_parser (LoadError)
m27frogy has quit [Read error: Connection reset by peer]
m27frogy has joined #ruby
<Retr0Punk>
havenwood: idk why but it works now, after doing rake install like 5 times
chalkmonster has quit [Quit: WeeChat 2.5]
yqt has quit [Ping timeout: 268 seconds]
drincruz has quit [Ping timeout: 248 seconds]
quesker has left #ruby [#ruby]
AJA4350 has joined #ruby
morenoh149 has joined #ruby
admin123 has quit [Ping timeout: 244 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
sytherax has joined #ruby
sytherax has quit [Remote host closed the connection]
sytherax has joined #ruby
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fusl has quit [Max SendQ exceeded]
sytherax has quit [Ping timeout: 268 seconds]
Fusl has joined #ruby
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
code_zombie has quit [Quit: Leaving]
ukd1_ has joined #ruby
ukd1 has quit [Ping timeout: 248 seconds]
poontangmessiah has joined #ruby
eddof13 has quit [Quit: eddof13]
morenoh149 has quit [Read error: Connection reset by peer]
morenoh149 has joined #ruby
involans has quit [Quit: involans]
morenoh149 has quit [Ping timeout: 258 seconds]
sytherax has joined #ruby
sytherax has quit [Ping timeout: 244 seconds]
lucasb has quit [Quit: Connection closed for inactivity]