Hi Raphael,

I finally had a minute to look at this this morning. I've pushed a new
version of the gem (1.4.4) that fixes the bug. I used the failing line
in a test, I hope that's ok. It's here:

https://github.com/peterkeen/ledger-web/commit/aae139f3fadcd26d3e3c4ec0e3139f9fbbb1f4ed#L2R1

--Pete

On Tue, Mar 20, 2012 at 12:58 PM, Raphael Lorenzeto
<[email protected]> wrote:
> Peter, sorry again.
>
> Have you had any chance of looking into the lines I sent before?
>
> Ledger_web stops processing lines somewhere within the following:
>
> "7288","2011/08/30","Tttttttttt Pagamento","Liabilities:Funds:Retirement
> Plan","R$","-88.468","false","true","","R$-88.47"
> "7288","2011/08/30","Tttttttttt Pagamento","Liabilities:Funds:Retirement
> Plan","R$","-1965.95","false","true","","R$-1965.95"
> "7288","2011/08/30","Tttttttttt Pagamento","Liabilities:Funds:Retirement
> Plan","""B PGBL F10""","103.59","false","true","","103.59 ""B PGBL F10""
> {R$4.2701032918} [2011/08/30]"
> "7288","2011/08/30","Tttttttttt Pagamento","Liabilities:Funds:Emergency
> Reserve","R$","-196.595","false","true","","R$-196.60"
> "7297","2011/08/30","Tttttttttt Pagamento","Future
> Assets:FGTS:Tttttttttt","R$","786.38","false","false","","R$786.38"
>
> Do you have any idea of what is happening?
>
> Thanks man!
>
>
> On Tuesday, March 20, 2012 12:00:39 AM UTC-3, Peter Keen wrote:
>>
>> Hi Bill,
>>
>> Thanks for being understanding. Looks like you're very close, but your
>> config isn't quite right. Try this (replace "myname" and "mypassword"
>> with your psql username and password that you set):
>>
>> LedgerWeb::Config.new do |config|
>>   config.set :database_url,
>> "postgres://myname:mypassword@localhost/ledger"
>> end
>>
>> The ":database_url" is a ruby symbol. It's effectively the name of a
>> constant, not something to change. As you surmised, you should
>> probably put  /var/lib/gems/1.8/bin/ledger_web in your path, and
>> you'll hopefully be all set. I have no idea why that's where gem is
>> putting things, but that's where it goes on your system I guess.
>>
>> --Pete
>>
>> On Mon, Mar 19, 2012 at 7:40 PM, Bill Harris
>> <[email protected]> wrote:
>> > Peter Keen <[email protected]> writes:
>> >
>> >> I'm sorry you've had so many problems with ledger_web! It's completely
>> >> my fault, I forgot a line in the gemspec file. If you take a look at
>> >> the commit[1] you'll see exactly what I missed.
>> >
>> > Peter, no problem.  That's what OSS brings sometimes, right?  Part of my
>> > contribution might be helping to debug things.  That said, I'm a bit
>> > busy with other things, so my response is likely to be slow, as you've
>> > seen.
>> >
>> >> I pushed a new version up to rubygems (1.4.2). If you install that you
>> >> should find a ledger_web binary in the appropriate bin directory.
>> >
>> > Thanks; got it.  I had to run gem install as root so it would install
>> > something.
>> >
>> > Unfortunately, I can't find where it went.
>> >
>> > ,----
>> > | # gem install ledger_web
>> > | Successfully installed rspec-core-2.9.0
>> > | Successfully installed diff-lcs-1.1.3
>> > | Successfully installed rspec-expectations-2.9.0
>> > | Successfully installed rspec-mocks-2.9.0
>> > | Successfully installed rspec-2.9.0
>> > | Successfully installed database_cleaner-0.7.1
>> > | Successfully installed ledger_web-1.4.3
>> > | 7 gems installed
>> > | Installing ri documentation for rspec-core-2.9.0...
>> > | Installing ri documentation for diff-lcs-1.1.3...
>> > | Installing ri documentation for rspec-expectations-2.9.0...
>> > | Installing ri documentation for rspec-mocks-2.9.0...
>> > | Installing ri documentation for rspec-2.9.0...
>> > | Installing ri documentation for database_cleaner-0.7.1...
>> > | Installing ri documentation for ledger_web-1.4.3...
>> > | Installing RDoc documentation for rspec-core-2.9.0...
>> > | Installing RDoc documentation for diff-lcs-1.1.3...
>> > | Installing RDoc documentation for rspec-expectations-2.9.0...
>> > | Installing RDoc documentation for rspec-mocks-2.9.0...
>> > | Installing RDoc documentation for rspec-2.9.0...
>> > | Installing RDoc documentation for database_cleaner-0.7.1...
>> > | Installing RDoc documentation for ledger_web-1.4.3...
>> > `----
>> >
>> > and
>> >
>> > ,----
>> > | # find / -name "ledger_web*" -print
>> > |
>> > /home/myname/.gem/specs/rubygems.org%80/quick/Marshal.4.8/ledger_web-1.4.2.gemspec
>> > |
>> > /home/myname/.gem/specs/rubygems.org%80/quick/Marshal.4.8/ledger_web-1.3.gemspec
>> > | /home/myname/.gem/ruby/1.8/cache/ledger_web-1.4.2.gem
>> > | /home/myname/.gem/ruby/1.8/cache/ledger_web-1.3.gem
>> > |
>> > /root/.gem/specs/rubygems.org%80/quick/Marshal.4.8/ledger_web-1.4.3.gemspec
>> > |
>> > /root/.gem/specs/rubygems.org%80/quick/Marshal.4.8/ledger_web-1.3.gemspec
>> > |
>> > /root/.gem/specs/rubygems.org%80/quick/Marshal.4.8/ledger_web-1.4.2.gemspec
>> > | /var/lib/gems/1.8/bin/ledger_web
>> > | /var/lib/gems/1.8/specifications/ledger_web-1.4.3.gemspec
>> > | /var/lib/gems/1.8/specifications/ledger_web-1.3.gemspec
>> > | /var/lib/gems/1.8/specifications/ledger_web-1.4.2.gemspec
>> > | /var/lib/gems/1.8/doc/ledger_web-1.4.2
>> > |
>> > /var/lib/gems/1.8/doc/ledger_web-1.4.2/rdoc/files/lib/ledger_web_rb.html
>> > | /var/lib/gems/1.8/doc/ledger_web-1.4.2/rdoc/files/lib/ledger_web
>> > | /var/lib/gems/1.8/doc/ledger_web-1.3
>> > | /var/lib/gems/1.8/doc/ledger_web-1.3/rdoc/files/lib/ledger_web_rb.html
>> > | /var/lib/gems/1.8/doc/ledger_web-1.3/rdoc/files/lib/ledger_web
>> > | /var/lib/gems/1.8/doc/ledger_web-1.4.3
>> > |
>> > /var/lib/gems/1.8/doc/ledger_web-1.4.3/rdoc/files/lib/ledger_web_rb.html
>> > | /var/lib/gems/1.8/doc/ledger_web-1.4.3/rdoc/files/lib/ledger_web
>> > | /var/lib/gems/1.8/cache/ledger_web-1.4.3.gem
>> > | /var/lib/gems/1.8/cache/ledger_web-1.3.gem
>> > | /var/lib/gems/1.8/cache/ledger_web-1.4.2.gem
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.2
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.2/ledger_web.gemspec
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.2/lib/ledger_web
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.2/lib/ledger_web.rb
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.2/bin/ledger_web
>> > | /var/lib/gems/1.8/gems/ledger_web-1.3
>> > | /var/lib/gems/1.8/gems/ledger_web-1.3/ledger_web.gemspec
>> > | /var/lib/gems/1.8/gems/ledger_web-1.3/lib/ledger_web
>> > | /var/lib/gems/1.8/gems/ledger_web-1.3/lib/ledger_web.rb
>> > | /var/lib/gems/1.8/gems/ledger_web-1.3/bin/ledger_web
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.3
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.3/ledger_web.gemspec
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web.rb
>> > | /var/lib/gems/1.8/gems/ledger_web-1.4.3/bin/ledger_web
>> > `----
>> >
>> > and, as me,
>> >
>> > ,----
>> > | $ ledger_web
>> > | bash: ledger_web: command not found
>> > `----
>> >
>> > On the off chance I really did find it above but not in my path (/var‽),
>> >
>> > ,----
>> > | $ /var/lib/gems/1.8/bin/ledger_web
>> > | /home/myname/.ledger_web/config.rb:4:in `from_file': compile error
>> > (SyntaxError)
>> > | /home/myname/.ledger_web/config.rb:2: syntax error, unexpected ':',
>> > expecting kEND
>> > |    config.set :localhost:9090,
>> > |                          ^
>> > |       from (eval):3:in `eval'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:66:in
>> > `from_file'
>> > |       from (eval):3:in `open_without_potential_path_argument'
>> > |       from (eval):3:in `open'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:65:in
>> > `from_file'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:102:in
>> > `instance'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:22:in
>> > `initialize'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:72:in 
>> > `new'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/config.rb:72:in
>> > `instance'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web/app.rb:9
>> > |       from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
>> > `gem_original_require'
>> > |       from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
>> > `require'
>> > |       from
>> > /var/lib/gems/1.8/gems/ledger_web-1.4.3/lib/ledger_web.rb:10
>> > |       from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
>> > `gem_original_require'
>> > |       from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
>> > `require'
>> > |       from /var/lib/gems/1.8/gems/ledger_web-1.4.3/bin/ledger_web:7
>> > |       from /var/lib/gems/1.8/bin/ledger_web:19:in `load'
>> > |       from /var/lib/gems/1.8/bin/ledger_web:19
>> > `----
>> >
>> > which probably means I misconfigured the system:
>> >
>> > ,----[ config.rb ]
>> > | LedgerWeb::Config.new do |config|
>> > |    config.set :localhost:9090,
>> > | "postgres://myname:mypassword@localhost/ledger"
>> > | end
>> > `----
>> >
>> > Tips?  That's probably easy to fix.
>> >
>> >> With regards to your postgres problem, it looks like your linux
>> >> distribution installed a (very sane) default of requiring passwords
>> >> for all accounts. PostgreSQL accounts are separate from system
>> >> accounts. To set a password on your database account, run the
>> >> following ($ and postgres=# are prompts):
>> >>
>> >> $ sudo su -u postgres psql
>> >
>> > That gave me errors, and I'm not on a sudo system, so I tried
>> >
>> > ,----
>> > | $ su -u postgres psql
>> > | su: invalid option -- 'u'
>> > | Usage: su [options] [LOGIN]
>> > |
>> > | Options:
>> > |   -c, --command COMMAND         pass COMMAND to the invoked shell
>> > |   -h, --help                    display this help message and exit
>> > |   -, -l, --login                make the shell a login shell
>> > |   -m, -p,
>> > |   --preserve-environment        do not reset environment variables,
>> > and
>> > |                                 keep the same shell
>> > |   -s, --shell SHELL             use SHELL instead of the default in
>> > passwd
>> > `----
>> >
>> > So I tried
>> >
>> > ,----
>> > | $ su postgres psql
>> > | Password:
>> > | /usr/bin/psql: line 18: use: command not found
>> > | /usr/bin/psql: line 20: use: command not found
>> > | /usr/bin/psql: line 22: use: command not found
>> > | /usr/bin/psql: line 23: use: command not found
>> > | /usr/bin/psql: psql: line 25: syntax error near unexpected token
>> > `$version,'
>> > | /usr/bin/psql: psql: line 25: `my ($version, $cluster, $db, $port,
>> > | $host);'
>> > `----
>> >
>> >> postgres=# alter role your_user_name with password 'your password';
>> >> postgres=# commit;
>> >> postgres=# \q
>> >
>> > Thinking a _little_ bit, I tried (as me)
>> >
>> > ,----
>> > | $ psql ledger
>> > | psql (9.1.3)
>> > | Type "help" for help.
>> > |
>> > | ledger=> alter role myname with password 'mypassword';
>> > | ALTER ROLE
>> > | ledger=> commit;
>> > | WARNING:  there is no transaction in progress
>> > | COMMIT
>> > | ledger=> \q
>> > `----
>> >
>> > and it seemed mostly happy.
>> >
>> >> To change the database URL that ledger_web uses, put the following
>> >> into ~/.ledger_web/config.rb:
>> >>
>> >> ,--
>> >> | LedgerWeb::Config.new do |config|
>> >> |   config.set :database_url,
>> >> "postgres://username:password@hostname/databasename"
>> >> | end
>> >> `--
>> >>
>> >> Replace the username, password, hostname, and databasename with the
>> >> appropriate values.
>> >
>> > See above.
>> >
>> >> I hope this helps you get up and running! Again, I'm sorry about the
>> >> missed gemspec option.
>> >
>> > I think I'm getting closer!  Perhaps just the config.rb file plus
>> > perhaps putting the executable in something other than /var, unless
>> > that's where it belongs.
>> >
>> > More tips?  I hope this helps others, too.
>> >
>> > Bill
>> > --
>> > Bill Harris
>> > Facilitated Systems
>> > http://makingsense.facilitatedsystems.com/

Reply via email to