I want to create a ruby application (not rails). This is a console application that will need to save some data. I use pstore as a database. I want to deploy this application as a gem.
My question is: where do my data live?
Currently, I created the data directory as a sibling in the bin directory in the standard gem layout. Therefore, I expect the gem to store its data “inside itself” after it is deployed. But when I do a local installation of gem for testing, I find that the data is stored locally in the project files, and not somewhere inside the gem directory.
Of course, maybe I just misunderstand what rake install_gem does. In addition, I am vaguely worried that if I need sudo to install the gem, it can really create a data file "inside itself" in the gem directory.
Can someone clarify this a bit?
Thanks. John Schenk
@makevoid - thanks for the answer. Here is my whole main script. In the / bin directory ... (I added it to the main question because I am not familiar with how to format the content in a comment - and the inserted code looked awful.
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
require 'timesheet'
begin
command_hash = TimesheetParser.parse
store = YAML::Store.new("data/time_entries.yaml")
tl = TimeLog.new(store)
ts = Timesheet.new(tl)
ts.process(command_hash)
rescue Exception => e
raise if command_hash[:debug]
puts e.message
source
share