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
On Sat, Sep 20, 2008 at 9:52 AM, janus [email protected] 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 G.
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 G.
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.
On Sep 20, 3:47 pm, Michael G. [email protected] wrote:
for system. Rake::Task[‘db:sample_data:remove’].invoke should work if
I recall correctly.HTH,
Michael G.- 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.
Hi Janus,
On Sat, Sep 20, 2008 at 10:37 AM, janus [email protected] 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.
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 G.
On Sun, Sep 21, 2008 at 8:17 AM, janus [email protected] 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.
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 G.
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
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
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
Hi Janus,
On Mon, Sep 22, 2008 at 8:51 AM, janus [email protected] 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
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
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 G.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs