guymanndude

Activity Graph

Page 1 of 1

2017-10-10

[13:03:50] guymanndude: has joined #ruby
[13:08:21] guymanndude: Hi, I've developed a Ruby gem. I want to specify that it requires Ruby v2.0 or above. I know how to do this in my .gemspec file, however I'm wondering if there is a convention for showing this in the project's README
[13:09:15] guymanndude: like, in my *Install* section, can I just have a bulletpoint or line that says "Requires Ruby 2 or above" ?
[13:09:18] guymanndude: or is there a better way
[13:09:53] guymanndude: ok thanks dminuoso_
[13:10:18] guymanndude: wrt updating the gemspec with ' spec.required_ruby_version = ">= 2.0.0"
[13:10:30] guymanndude: do I need to bump up the version on the minor gem then?
[13:10:35] guymanndude: minor version*
[13:12:04] guymanndude: dminuoso_: it's because YAML.safe_load isn't available to Ruby less than v2
[13:12:44] guymanndude: I don't imagine Ruby would remove YAML.safe_load in those later versions...at least I hope not
[13:14:33] guymanndude: so should I bump up the minor version of my gem with this small update dminuoso_ ?
[13:16:37] guymanndude: I tried reading thru this, but it's not clear http://guides.rubygems.org/patterns/#semantic-versioning
[13:16:50] guymanndude: like it's not really a new feature per se
[13:17:30] guymanndude: idk. I guess I'll just ask my team in the PR. thanks tho
[14:01:14] guymanndude: Ping timeout: 260 seconds

2017-09-05

[17:09:17] guymanndude: has joined #ruby
[17:10:39] guymanndude: hi folks, I'm wondering if there's an obvious way of solving my problem I haven't thought of: I want to populate a Ruby file with values from a YAML file
[17:11:07] guymanndude: I've loaded the YAML file, know how to access the keys I need...but how to interpolate that into the actual Ruby script?
[17:16:19] guymanndude: havenwood: sure, https://paste.ee/p/2W20a#5kV8yzWQerCANJPEdQX5lyE1OzXz7f1e
[17:16:57] guymanndude: yup darix. I can change the state of the file by running it through Ruby, but am unsure as to how to "trigger" the interpolation/reading from the YAML file
[17:22:01] guymanndude: havenwood: so file["key"]["value"] is just giving the path to the exact value I want to interpolate there from the YAML file
[17:22:25] guymanndude: there's a key->value in the YAML I'm loading, I want to access the key
[17:22:33] guymanndude: excuse me, I meant I want to access the value**
[17:23:44] guymanndude: havenwood: it's an example key. in practice, it's our different environments in the YAML file (dev, test, qat, prod)
[17:24:02] guymanndude: I don't think it's a syntax error, parses correctly in irb...
[17:24:58] guymanndude: you can ignore all that...here's a simpler example: https://paste.ee/p/fOG2h
[17:25:01] guymanndude: sorry for the confusion
[17:27:04] guymanndude: matthewd: sure, here's a better link https://paste.ee/p/7uJ4T#U02tvHWFNvWkBU9rCRt1ArLBTLskW7Z6
[17:27:30] guymanndude: desired behaviour is STUFF should now equal/be assigned "blah"
[17:28:01] guymanndude: havenwood: right, but I want the value from the YAML file to be interpolated into the ruby file
[17:29:46] guymanndude: right...but how do I get some_file.rb to go from the "templated" value to actually have the value from the YAML file interpolated?
[17:30:04] guymanndude: like literally have STUFF = "blah" in some_file.rb
[17:30:30] guymanndude: trust me, I want to do this
[17:31:50] guymanndude: hmm, I've already written one that modifies YAML files like this...guess I have to have it handle Ruby files as well now
[17:32:57] guymanndude: so I've already written a third script that goes out to the internet and populates a YAML file. Then I want to load data from that modified YAML file into another Ruby file
[17:33:43] guymanndude: the target Ruby file has credentials for talking to a SOAP endpoint
[17:33:55] guymanndude: havenwood: see above^
[17:34:25] guymanndude: it's to setup dev environments with credentials stored in a secure site online (think like lastpass/1password etc)
[17:35:42] guymanndude: because for all intents and purposes the Ruby script is just more data/credentials
[17:36:12] guymanndude: and because my boss added this as a requirement ¯\_(ツ)_/¯
[17:37:06] guymanndude: how would you rewrite the file from the YAML file, essentially is what I'm asking
[17:41:50] guymanndude: just realized what I'm trying to do is self-modifying code and that this is a whole "Thing"
[17:42:11] guymanndude: ok, will continue my research there...apparently there's a thing called closures, sounds promising
[18:51:36] guymanndude: turns out I was way overthinking this
[18:51:42] guymanndude: thanks all havenwood, matthewd
[18:52:27] guymanndude: Quit: Page closed

2017-07-18

[18:14:09] guymanndude: has joined #ruby
[18:14:55] guymanndude: hi, is there a way to both dump with YAML.dump && append to the same file, in one line?
[18:15:49] guymanndude: basically, I'm trying to get this down to a oneliner:
[18:15:52] guymanndude: content = YAML.dump(yml) content << "stuff"
[18:24:04] guymanndude: Papierkorb: thanks, however that would still necessitate doing two lines to write to my content variable
[18:24:25] guymanndude: is there a way to do this in a oneliner? both dump the YAML to content, as well as a string?
[18:25:51] guymanndude: havenwood: thanks! and I agree, but I am trying to appease rubocop...
[18:27:01] guymanndude: havenwood: yeah kindof, apparently my "Assignment Branch Condition size for main is too high"
[18:27:44] guymanndude: I have, this is the last place I can possibly optimize
[18:27:52] guymanndude: to get a perfect score :)
[18:28:07] guymanndude: thanks, I'll that
[18:32:15] guymanndude: havenwood: from 16.4/15 complexity to 16.31/15 ...
[18:33:33] guymanndude: haha yeah. I think this is the point I step back for a sanity check...code looked cleaner before this
[18:33:42] guymanndude: two lines are fine
[18:34:51] guymanndude: I can live with 16.4 :)
[18:44:10] guymanndude: havenwood: naughty naughty
[21:43:49] guymanndude: Ping timeout: 260 seconds

2017-06-15

[21:19:36] guymanndude: has joined #ruby
[21:20:12] guymanndude: hi, I'm working on a Thor::Group script but am having trouble writing tests for it; are there any resources explaining how to approach testing a Thor::Group script with RSpec or something similar?
[21:20:43] guymanndude: basically I'm shelling out to an external application and moving and manipulating files
[21:28:39] guymanndude: ok zenspider, thanks. I guess I can create an instance of my script, call it to manipulate the files and check if they've been created and look right
[21:33:37] guymanndude: zenspider: sorry I misunderstood. I'm not sure I follow by "right command string/arrays"
[22:01:49] guymanndude: Ping timeout: 260 seconds

2017-06-02

[20:41:21] guymanndude: has joined #ruby
[20:42:39] guymanndude: hi, I've noticed a bug in my code where converting a DateTime UNIX epoch time to a formatted string sets the date to 1970-01-01
[20:42:46] guymanndude: any guidance on what I'm doing wrong?
[20:42:54] guymanndude: DateTime.strptime(epoch_date.to_s, '%s').strftime("%Y-%m-%d")
[20:44:20] guymanndude: where epoch_date is Time.now.utc.to_i basically
[21:07:09] guymanndude: pupsicle: here's how I'm using for ref https://0bin.net/paste/iU2tMR-9C9-GkWAK#tst4Pm2vJ8Wk7usGJv1nDlu4dUHVG+sBgynVTwiHfDu
[21:07:48] guymanndude: pupsicle: how I end up calling it is: Time.epoch_to_date(epoch_date: Time.now)
[21:07:56] guymanndude: this always gives me the 1970 date
[21:20:34] guymanndude: al2o3-cr: I believe Time is only localtime and I need utc
[21:20:46] guymanndude: I guess I could do Time.utc.strptime...
[21:21:49] guymanndude: actually that wouldn't work
[21:46:47] guymanndude: hmm, so I've been thinking about how I'd test this with RSpec
[21:47:09] guymanndude: essentially ensuring that a date that I pass to epoch_date is never 1970-01-01
[21:47:20] guymanndude: but I'm a little stumped on how I'd mock this out
[22:22:30] guymanndude: Ping timeout: 260 seconds