Custom message to the beginning of OCRA initialization

22 views
Skip to first unread message

Henri Karhatsu

unread,
Feb 27, 2011, 3:53:19 AM2/27/11
to OCRA One-Click Application Builder
I'm using OCRA for Rails 3 application. Besides the normal stuff I
have some additional libraries. This makes the exe file rather big
(11M) and that way the initialization of the application takes some
time.

I would like to add a custom message to the very beginning of the app,
something like: "Initializing the application. Please wait..." This
should be visible in the command prompt as soon as possible when the
exe file is launched. The purpose is to calm down the user so that he
doesn't get worried since nothing is happening for a while.

Is there some way to do this? And to make things clear, the solution
is not to add "p 'Please wait...'" to the my_program.rb file.

Marcin Bazydlo

unread,
Feb 28, 2011, 12:03:02 PM2/28/11
to ruby...@googlegroups.com
Hi!

> I would like to add a custom message to the very beginning of the app,
> something like: "Initializing the application. Please wait..." This
> Is there some way to do this? And to make things clear, the solution
> is not to add "p 'Please wait...'" to the my_program.rb file.
I propose you dirty hack which may or may not help. Simply write small
wrapper application which writes out your message and then it will run
exe file added as resource. Actually it could even first download this
big exe with app from some website and then run it so your user would
only download small app first and big later.
As stated in the beginning it is dirty hack which I didn't test but if
it works for you give some info here.

m.

David Simon

unread,
Feb 28, 2011, 12:25:02 PM2/28/11
to ruby...@googlegroups.com
I recently added a feature to Ocra to generate installers, which makes app startup much faster (since the installer unpacks everything in advance). Check out the latest git commit, and you'll also need to download and install Inno Setup.
--
David Simon

Henri Karhatsu

unread,
Mar 1, 2011, 1:53:13 AM3/1/11
to OCRA One-Click Application Builder
> I recently added a feature to Ocra to generate installers, which makes app
> startup much faster (since the installer unpacks everything in advance).
> Check out the latest git commit, and you'll also need to download and
> install Inno Setup.

Thanks David, this solution sounds much better than I could actually
expect. Very nice!

I have just one question: How will it behave with the database file?
When a user installs the app for the first time, I have to provide a
sqlite3 database file. But when he upgrades, the existing database
should not be overridden.

Henri

David Simon

unread,
Mar 1, 2011, 8:33:59 AM3/1/11
to ruby...@googlegroups.com
That's something that InnoSetup can control: it's the "onlyifdoesntexist" flag on the Files section. Unfortunately there's not currently a way to specify Files sections options; they're automatically generated by Ocra. This might need to be addressed with additional features at some point in the future (maybe an ability to override auto-generated Files lines with lines already provided in the template?)

In the meantime, there are two possible workarounds:

1. Before building the installer, move the sqlite file from the db directory to some other staging directory (or just rename it to "preset.sqlite3" or something). Then, arrange for the sqlite file to be copied to the db directory if and only if it doesn't exist. You could do this by having a frontend ruby script called by Ocra instead of the rails server. It would do the conditional file copy, then "load" the Rails server as normal.

2. Alternately, you could do the same thing using an InnoSetup post-install script, so that the db file is copied at the end of the installation process instead of at the beginning of the first run. There is a convenient FileCopy function that can be told to avoid overwriting existing files.
--
David Simon

Reply all
Reply to author
Forward
0 new messages