Hi all,
I need help , why is it that the above code would not run on windows
vista? Is there a known issue why system(".............") does not
work in vista box?
Janus
Hi all,
I need help , why is it that the above code would not run on windows
vista? Is there a known issue why system(".............") does not
work in vista box?
Janus
It is likely that I won't be able to help further, but if you could
provide more information that would be great.
What do you mean when you say it does not run on windows vista?
Does ruby segfault? Do you get an exception with a stacktrace?
More specific information will certainly help you to get your problem solved.
Michael Guterl
On Sat, Sep 20, 2008 at 9:52 AM, janus <emekamicro@gmail.com> wrote:
Hi all,
I need help , why is it that the above code would not run on windows
vista? Is there a known issue why system(".............") does not
work in vista box?
It is likely that I won't be able to help further, but if you could
provide more information that would be great.What do you mean when you say it does not run on windows vista?
Does ruby segfault? Do you get an exception with a stacktrace?
More specific information will certainly help you to get your problem solved.
Michael Guterl
Ok, this is challenge I have . I have a file with
......
task :hoop => :environment do
system("db :sample_data:remove")
system("db :sample_data:hap")
end
When I do rake db :sample_data:hoop nothing happens, however , when I
do rake db :sample_data:remove and rake db:sample_data:hap, I get the
expected results.
Hi Janus,
It is likely that I won't be able to help further, but if you could
provide more information that would be great.
Well maybe I can help.
What do you mean when you say it does not run on windows vista?
Does ruby segfault? Do you get an exception with a stacktrace?
More specific information will certainly help you to get your problem solved.
Michael Guterl
Ok, this is challenge I have . I have a file with
......
task :hoop => :environment do
system("db :sample_data:remove")
system("db :sample_data:hap")
end
When I do rake db :sample_data:hoop nothing happens, however , when I
do rake db :sample_data:remove and rake db:sample_data:hap, I get the
expected results.
You can find more information by invoking rake with the --trace argument.
rake db:sample_data:remove --trace
On another note, I've never seen a rake task delimited with a ' :'
only with a ':'. You may want to check the code above and remove the
space after db.
One last thing, I think you can invoke the rake tasks without the need
for system. Rake::Task['db:sample_data:remove'].invoke should work if
I recall correctly.
HTH,
Michael Guterl
On Sat, Sep 20, 2008 at 10:37 AM, janus <emekamicro@gmail.com> wrote:
my mistake.....it was in the code.
On Sep 20, 3:47 pm, Michael Guterl <mgut...@gmail.com> wrote:
Hi Janus,
On Sat, Sep 20, 2008 at 10:37 AM, janus <emekami...@gmail.com> wrote:
>> It is likely that I won't be able to help further, but if you could
>> provide more information that would be great.Well maybe I can help.
You can find more information by invokingrakewith the --trace argument.
rakedb:sample_data:remove --trace
On another note, I've never seen araketask delimited with a ' :'
only with a ':'. You may want to check the code above and remove the
space after db.One last thing, I think you can invoke theraketasks without the need
for system. Rake::Task['db:sample_data:remove'].invoke should work if
I recall correctly.HTH,
Michael Guterl- Hide quoted text -- Show quoted text -
On another note, I've never seen araketask delimited with a ' :'
only with a ':'. You may want to check the code above and remove the
space after db.
Things have starting moving in the right direction, however,
Rake::Task['db:migrate VERSION=0'].invoke was aborted. What could have
caused this? However, when I did rake db:migrate VERSION=0 on the
console ,I got the expected result.
Janus
n Sep 20, 4:19 pm, janus <emekami...@gmail.com> wrote:
On Sep 20, 3:47 pm, Michael Guterl <mgut...@gmail.com> wrote:
> Hi Janus,
> On Sat, Sep 20, 2008 at 10:37 AM, janus <emekami...@gmail.com> wrote:
> >> It is likely that I won't be able to help further, but if you could
> >> provide more information that would be great.> Well maybe I can help.
> You can find more information by invokingrakewith the --trace argument.
> rakedb:sample_data:remove --trace
> On another note, I've never seen araketask delimited with a ' :'
> only with a ':'. You may want to check the code above and remove the
> space after db.> One last thing, I think you can invoke theraketasks without the need
> for system. Rake::Task['db:sample_data:remove'].invoke should work if
> I recall correctly.> HTH,
> Michael Guterl- Hide quoted text -> - Show quoted text -
> On another note, I've never seen araketask delimited with a ' :'
> only with a ':'. You may want to check the code above and remove the
> space after db.my mistake.....it was in the code.- Hide quoted text -
- Show quoted text -
Once again, the actual error would be helpful. Be sure to include
that with any other future problems.
However, it seems that you're thinking Rake::Task works like
system(). This is not the case, Rake::Task only looks up the
corresponding task with that name. It is likely that there is no
Rake::Task defined with the name 'db:migrate VERSION=0'.
The VERSION=0 part is not a part of the task name, but an environment
variable that Rake reads from in the db:migrate task. I'm not sure of
the recommended method of setting environment variables, when using
the Rake::Task.invoke method.
I cannot test at the moment:
ENV['VERSION'] = 0
Rake::Task["db:migrate"].invoke
but I think that should work.
HTH,
Michael Guterl
On Sun, Sep 21, 2008 at 8:17 AM, janus <emekamicro@gmail.com> wrote:
Things have starting moving in the right direction, however,
Rake::Task['db:migrate VERSION=0'].invoke was aborted. What could have
caused this? However, when I did rake db:migrate VERSION=0 on the
console ,I got the expected result.
ENV['VERSION'] = 0
Rake::Task["db:migrate"].invokebut I think that should work.
It worked, I only changed Fixnum 0 to string. Could you explain the
difference between system("rake.....") and Rake::Task["......"]
Janus
On Sep 21, 2:18 pm, Michael Guterl <mgut...@gmail.com> wrote:
On Sun, Sep 21, 2008 at 8:17 AM, janus <emekami...@gmail.com> wrote:
> Things have starting moving in the right direction, however,
>Rake::Task['db:migrate VERSION=0'].invoke was aborted. What could have
> caused this? However, when I didrakedb:migrate VERSION=0 on the
> console ,I got the expected result.Once again, the actual error would be helpful. Be sure to include
that with any other future problems.However, it seems that you're thinkingRake::Task works like
system(). This is not the case,Rake::Task only looks up the
corresponding task with that name. It is likely that there is noRake::Task defined with the name 'db:migrate VERSION=0'.The VERSION=0 part is not a part of the task name, but an environment
variable thatRakereads from in the db:migrate task. I'm not sure of
the recommended method of setting environment variables, when using
theRake::Task.invoke method.I cannot test at the moment:
ENV['VERSION'] = 0Rake::Task["db:migrate"].invoke
but I think that should work.
HTH,
Michael Guterl
Hi Janus,
On Mon, Sep 22, 2008 at 8:51 AM, janus <emekamicro@gmail.com> wrote:
ENV['VERSION'] = 0
Rake::Task["db:migrate"].invokebut I think that should work.
It worked, I only changed Fixnum 0 to string. Could you explain the
difference between system("rake.....") and Rake::Task["......"]
Great, I'm glad you got things working.
system is a class method that belongs to Kernel. In order to find out
what it does, we can run the following:
macbook:~ michaelguterl$ ri Kernel.system
---------------------------------------------------------- Kernel#system
system(cmd [, arg, ...]) => true or false
------------------------------------------------------------------------------------------------------
Executes _cmd_ in a subshell, returning +true+ if the command was
found and ran successfully, +false+ otherwise. An error status is
available in +$?+. The arguments are processed in the same way as
for +Kernel::exec+.
system("echo *")
system("echo", "*")
------------------------------------------------------------------------------------------------------
Moving along from http://rake.rubyforge.org
Rake::Task#(task_name)
Return a task with the given name. If the task is not currently known,
try to synthesize one from the defined rules. If no rules are found, but an
existing file matches the task name, assume it is a file task with no
dependencies or actions.
So Kernel.system() executes a command in a subshell and Rake::Task#
retrieves the task given name. I hope that clarifies things a bit.
Michael Guterl
Some strange result, on my console Rake::Task["db:migrate"].invoke
prints the list of tables created, however nothing in the database.
When I try system("rake.bat.....") becuase I am using windows, this
creates the tables.
Janus