Inference Error: controllers/application_controller.mirah:3: Cannot find class ActionController

25 views
Skip to first unread message

amitava

unread,
Feb 13, 2011, 10:38:44 AM2/13/11
to The Mirah Programming Language
I am trying to bootstrap my dubious environment by building from git-
cloned sources.

The following are the list of issues I have encountered so far
1. Permission denied - app/controllers/application_controller.mirah

2. (erb):6:in `instance_eval': uninitialized constant
ActiveSupport::SecureRandom (NameError)

3. Inference Error:
controllers/application_controller.mirah:3: Cannot find class
ActionController
class ApplicationController < ActionController
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I resolved 1. above as follows
1. Make the suggested change in mirah source (lib/mirah_task.rb) from
http://groups.google.com/group/mirah/browse_thread/thread/cd9906d745b54997

2. Rebuild dubious by changing dependency on mirah from 0.0.5 to
0.0.6.dev in $DUBIOUS/dubious.gemspec

s.add_dependency("mirah", "0.0.6.dev")

I am now stuck with error 2 and 3. Please advise

Thanks,
Amitava Shee

Andrew Myers

unread,
Feb 13, 2011, 3:29:09 PM2/13/11
to mi...@googlegroups.com
Hi Amitava,

I think I can help with issue 3...

If you change your rakefile like this:

mirah_compile_options :dest_path => OUTDIR,
:source_paths => ['lib', 'app' ],
:compiler_options => ['--classpath',
[File.expand_path(OUTDIR),
*FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join('/:')
+ ':' + CLASSPATH ]

Does it work then?

Apparently you need to add the "/" to the end of all the paths for it
to compile.

Andrew.

amitava

unread,
Feb 14, 2011, 8:41:05 AM2/14/11
to The Mirah Programming Language
Thanks for the reply. Unfortunately, it did not work for me - I get
the same error

Inference Error:
controllers/application_controller.mirah:3: Cannot find class
ActionController
class ApplicationController < ActionController
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I should mention that I first reverted back my changes in $MIRAH/lib/
mirah_task.rb which resulted in "Permission denied - app/controllers/
application_controller.mirah"

So, I re-applied the following change to $MIRAH/lib/mirah_task.rb and
also made changes suggested by you to the Rakefile in my app

files = files.map {|f| File.expand_path(f).sub(/^#{source_dir}\//,
'')}
as opposed to
files = files.map {|f| f.sub(/^#{source_dir}\//, '')}

-Amitava

On Feb 13, 3:29 pm, Andrew Myers <am2...@gmail.com> wrote:
> Hi Amitava,
>
> I think I can help with issue 3...
>
> If you change your rakefile like this:
>
> mirah_compile_options :dest_path => OUTDIR,
>                       :source_paths => ['lib', 'app' ],
>                       :compiler_options => ['--classpath',
> [File.expand_path(OUTDIR),
> *FileList["WEB-INF/lib/*.jar"].map{|f|File.expand_path(f)}].join('/:')
> + ':' + CLASSPATH ]
>
> Does it work then?
>
> Apparently you need to add the "/" to the end of all the paths for it
> to compile.
>
> Andrew.
>
> On 14 February 2011 02:38, amitava <amitava.s...@gmail.com> wrote:
>
> > I am trying to bootstrap my dubious environment by building from git-
> > cloned sources.
>
> > The following are the list of issues I have encountered so far
> > 1. Permission denied - app/controllers/application_controller.mirah
>
> > 2. (erb):6:in `instance_eval': uninitialized constant
> > ActiveSupport::SecureRandom (NameError)
>
> > 3. Inference Error:
> > controllers/application_controller.mirah:3: Cannot find class
> > ActionController
> > class ApplicationController < ActionController
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> > I resolved 1. above as follows
> > 1. Make the suggested change in mirah source (lib/mirah_task.rb) from
> >http://groups.google.com/group/mirah/browse_thread/thread/cd9906d745b...

amitava

unread,
Feb 14, 2011, 5:18:39 PM2/14/11
to The Mirah Programming Language
I finally figured out what was happening.

"dubious new" uses thor to create the application skeleton. In
particular, it uses "directory" task to do so.
directory will treat *.tt as erb template and expand it.

While expanding $DUBYROOT/lib/dubious/templates/config/
application.properties.tt, it encounters
session.secret=<%= ActiveSupport::SecureRandom.hex(64) %>

This is the error # 2. in my post earlier (erb):6:in `instance_eval':
uninitialized constant ActiveSupport::SecureRandom (NameError)

ActiveSupport::SecureRandom.hex is defined in activesupport but cli.rb
requires just core_ext as follows
require 'active_support/core_ext'

So Thor#directory was carping out before building out the full
skeleton (like copying the jars etc.) - no WEB-INF/lib/dubious.jar.
This was producing the compilation error in #3 reported earlier

So I ended up adding
require 'active_support'

This seems to have done the trick.

Here are the patches, one each for mirah and dubious

https://gist.github.com/826680
https://gist.github.com/826677

-Amitava

John Woodell

unread,
Feb 14, 2011, 5:30:09 PM2/14/11
to mi...@googlegroups.com
Great, please send a pull request.

Nick Howard

unread,
Feb 14, 2011, 6:00:34 PM2/14/11
to mi...@googlegroups.com
Thanks for finding the bug

+1 on the pull request.


On Mon, Feb 14, 2011 at 3:30 PM, John Woodell <mando....@gmail.com> wrote:
Great, please send a pull request.



Andrew Myers

unread,
Feb 14, 2011, 6:05:11 PM2/14/11
to mi...@googlegroups.com
Nice work Amitava.

amitava

unread,
Feb 15, 2011, 9:52:37 AM2/15/11
to The Mirah Programming Language
I have posted the pull requests.

One last note that I discovered this AM while building dubious -

ashee:dubious amitava$ rake gem && gem install pkg/dubious* fails to
copy dubious.jar to $GEM/dubious-0.0.2/lib

So I had to manually build and install the gem

ashee:dubious amitava$ gem build dubious.gemspec
WARNING: no rubyforge_project specified
Successfully built RubyGem
Name: dubious
Version: 0.0.2
File: dubious-0.0.2-java.gem
ashee:dubious amitava$ gem install dubious-0.0.2-java.gem
Successfully installed dubious-0.0.2-java
1 gem installed
Installing ri documentation for dubious-0.0.2-java...
Installing RDoc documentation for dubious-0.0.2-java...

-Amitava

On Feb 14, 6:05 pm, Andrew Myers <am2...@gmail.com> wrote:
> Nice work Amitava.
>

Nick Howard

unread,
Feb 15, 2011, 10:36:11 AM2/15/11
to mi...@googlegroups.com
Which versions of JRuby/rubygems are you using?

amitava

unread,
Feb 15, 2011, 12:20:38 PM2/15/11
to The Mirah Programming Language
ashee:mirah amitava$ jruby -v
jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-03 9cf97c3) (Java
HotSpot(TM) 64-Bit Server VM 1.6.0_22) [x86_64-java]


ashee:mirah amitava$ which jruby
/Users/amitava/.rvm/rubies/jruby-1.5.6/bin/jruby

ashee:mirah amitava$ gem --version
1.3.6

ashee:mirah amitava$ gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.9)
actionpack (2.3.9)
activerecord (2.3.9)
activeresource (2.3.9)
activesupport (2.3.9)
appengine-sdk (1.4.0)
bitescript (0.0.7)
blankslate (2.1.2.3)
bouncy-castle-java (1.5.0145.2)
bundler (1.0.10)
columnize (0.3.1)
dubious (0.0.2)
i18n (0.5.0)
jruby-launcher (1.0.3)
jruby-openssl (0.7.1)
mirah (0.0.6.dev, 0.0.5)
rack (1.1.0)
rails (2.3.9)
rake (0.8.7)
rdoc (2.5.11)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)
thor (0.14.6, 0.13.8)


-Amitava

Nick Howard

unread,
Feb 15, 2011, 1:55:36 PM2/15/11
to mi...@googlegroups.com
I just remembered that including lib/dubious.jar was something I added as part of my "get things compiling again" commit.


The rubygems issue is only a problem with rubygems >= 1.3.7 and  < 1.5.0, so you shouldn't have that problem.
Reply all
Reply to author
Forward
0 new messages