Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I run ledger-rest? #1

Open
duasfl8r opened this issue Aug 2, 2012 · 3 comments
Open

How do I run ledger-rest? #1

duasfl8r opened this issue Aug 2, 2012 · 3 comments
Labels

Comments

@duasfl8r
Copy link

duasfl8r commented Aug 2, 2012

Hello,

I am a recent user of the ledger-cli app.

While googling for a way to chart my data, I came across your ledger-charts, and ledger-rest repositories.

But how do I use it? I cloned it and I don't really know what to do.

The only thing that came to mind was this:

$ ruby ledger-rest.rb 
Failed to load config file

(I tried copying .ledgerrc to my home folder to no avail).

Thanks!

@profmaad
Copy link
Owner

profmaad commented Aug 2, 2012

Hi,

I have to admit that at the moment, usage is not all that convenient. ^^

To start ledger-charts + ledger-rest, you will need the following gems:

  • git
  • haml
  • rack
  • sinatra
  • thin (or your choice of webserver, but thin is what I use and test with)

Then start the whole package by running
thin -R both.ru -eproduction --threaded start

This will start thin on 0.0.0.0:3000, running both ledger-rest (/rest) and ledger-charts (/charts).
Just go to localhost:3000/charts

@profmaad
Copy link
Owner

profmaad commented Aug 3, 2012

Alright, apparently I was slightly dimwitted yesterday and forgot most of the necessary steps.
My apologies for that.

Here are all the steps (or so I hope):

  • clone ledger-rest someplace
  • enter the cloned directory
  • create a config file called ledger-rest.yml, containing the following (adapt to your setup, of course):
ledger_bin: "/usr/local/bin/ledger"
ledger_file: "/path/to/your/ledger.ledger"
  • go back up a level, into the directory where your ledger-rest directory resides.
  • clone ledger-charts and go into the folder
  • create a config file called ledger-charts.yml, containing the following (adapt to your setup, of course):
ledger_rest_uri: "/rest"
  • start the whole stack via:
    thin -R both.ru -eproduction --threaded start
  • open your browser and go to localhost:3000/charts. You will (hopefully) be greeted by ledger-charts in all its bare-bones glory.

Good luck, ask any questions that might remain. :-)

@johannesjh
Copy link

Some additional notes:

I found I had to additionally install the escape gem. Like so:

gem install git
gem install haml
gem install rack
gem install sinatra
gem install thin
gem install escape

And I had to place the ledger-rest.yml file into the ledger-charts folder (!) in order to be found by `ledger-rest' because I would otherwise get an error message saying "Failed to load config file". This is the resulting folder layout:

ledger/ledger-rest
  /config.ru
  /ledger-rest.rb
leder/ledger-charts
  /public/
  /views/
  both.ru
  config.ru
  ledger-charts.rb
  ledger-charts.yml
  ledger-rest.yml

And I had to uncomment ledger-rest.rb line 23: set :git_repository, File.dirname(settings.ledger_file) because settings.ledger_file evaluates to nil.

Suggestion for improvement:
I think that ledger-chart should use an automated dependency mechanism instead of error-prone manual copy-this-file-here and checkout-this-repo there instructions. This could e.g. be realized through git submodules or ruby gems... just an idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants