generating WAR file for ruby on rails application - ruby-on-rails

I am using Warbler to generate a WAR file for my ruby on rails application. I don't use anything special in my application, and i only run the "warble war" command.
In the WAR generation i am getting those 2 warnings
warning: skipping minitest
warning: skipping json
Upon the importing of the WAR in eclipse, the project can't be built and it says
Archive for required library: '/WebContent/WEB-INF/lib/gems-gems-warbler-1.4.1-spec-sample_war-some.jar'cannot be read or is not a valid ZIP file
I tried to follow some workarounds from https://github.com/jruby/warbler/issues/199 but without any clue. I am using Rails version 4.0.2 and warbler version 1.4.1 .I am new to deployment so i would be grateful if somebody can help me. Thanks

A better way to exclude the offending file : the warble config.
Generate the configuration with
warble config
Then uncomment the following line to fix it :
config.gem_excludes = [/^(test|spec)\//]

Let me warn you that this is a complete butcher job and I only used this because I was perplexed as to why I was also getting the same errors and Tomcat died when trying to deploy my jruby/rails application. Here's what I did:
$ ls -l /usr/local/opt/tomcat/libexec/webapps/workspace/WEB-INF/lib/*sample*
You will see some warbler sample jars there. gems-gems-warbler-1.4.1-spec-sample_war-some.jar has a size of 0. It's the problem, but I figure I don't really need any sample jars, thank you. So:
$ bundle show warbler
/PATH/.rvm/gems/jruby-1.7.10#rails4/gems/warbler-1.4.1
$ rm -rf /PATH/.rvm/gems/jruby-1.7.10#rails4/gems/warbler-1.4.1/spec/*sample*
$ bundle exec warble war
Deploy to Tomcat, and the context starts just fine. Less than ideal and probably there is a "correct" solution. This got me moving forward, tho.

Related

Module build failed: Error: spawn bin/rails ENOENT

After adding the ERB loader and adding the .erb file extension to my application pack (with webpacker), I am getting the following error:
ERROR in ./app/webpack/packs/application.js.erb
Module build failed: Error: spawn bin/rails ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
# multi (webpack)-dev-server/client?http://localhost:3035 ./app/webpack/packs/application.js.erb
it is also happening with the sample hello_erb.js.erb pack.
Here is an example app that reproduces the problem: https://github.com/jonhue/test_app
You may be missing generated files
If you are missing the bin/rails executable maybe you have cloned from a repository that followed the steps on this issue
Your enviroment should be good to go if you have rails installed correctly and then run:
Rails < 5
$ bundle exec rake rails:update:bin
Rails >= 5
$ rails app:update:bin
You may have issues with webpack installation and/or configuration
If those files on bin\ exists, you may have ran into problems when installing and/or configuring webpack.
Try creating a project installing everything following the documentation, commiting it with a versioning system like GitHub, copy/paste your project configuration and git diff it, I bet you will find differences between them.
You are using Windows or some enviroment that is problematic
If that is the case there is already a discussion to fix it in an open issue in webpacker github. But you could try stuff like using webpacker directly from github to get latest fixes, downgrading to other versions to see if the result is different, or use webpack from source and change the file install.rake that makes you call ./bin/rails app:template... to just rails app:template....
The ERB runner configuration contains a setting that must be changed for it to work on Windows. Open config\webpack\loaders\erb.js and replace this line:
runner: "bin/rails runner"
with this line:
runner: "ruby bin\\rails runner

grails 3.0.3 with asset-pipeline-gradle:2.3.8 is not working after unzip the deploy war file

I create a new grails app
I change the asset-pipeline-gradle version to 2.3.8
I deploy the application with command
grails dev war
I just run command
java -jar App.0.1.war
and it works fun, the css js and images all work ok
and if i unzip the war file and copy all the files to my custom tomcat fold, the tomcat startup normally, but the css, js can not display
Can anyone help me, the speed me 2 days to reappear the issue
according to issues from asset-pipeline and grails-core, you can specify the asset-pipeline verion in build.gradle
runtime "org.grails.plugins:asset-pipeline:3.0.1"
or wait for grails 3.0.6
I believe this is a grails 3 or asset-pipeline bug. I've been having the same problem with 3.0.3 and 3.0.4, so I ended up opening https://github.com/grails/grails-core/issues/9151 (would have simply commented on your question, but I do not have enough rep).

Ruby 2.0.0-p353, Rails 4.0.2, Netbeans 7.4 - Cannot start webrick

I am trying to use netbeans 7.4 with Ruby 2.0.0-p353 and Rails 4.0.2. Plugin seems to work ok. I am able to generate project and everything is there, but when I try to run project I receive following message and server is not started:
C:\Ruby200-x64\bin\ruby.exe: No such file or directory -- script/rails (LoadError)
There is a comment under official plugin page that says:
I found a simple workaround, I'm using Windows 7 and created a
symbolic link between directories like this: mklink /D script bin
Now I can start and debug my Rails 4 project in Netbeans. Posted by
mgard on Aug 19, 2013
I have tried to do this but it still doesn't solve a problem. Is there anybody that can help?
The proposed solution works well from what I have seen. What is the error you are getting? Are you able to create directory link? You would need Admin rights for that and should start the command prompt "Run as Administrator". Alternatively, try right-clicking on the "bin" directory and execute "Create shortcut" that must be renamed to "script" later.
I'm using Aptana on Win 8 and came to the problem.
Now rails 4 doesn't have script/rails in the folder. We will need to create it manually in your application folder. You can simply create the folder, then mklink or copy the file in the script folder. Please take caution that your IDE will have proper access to the file you create, otherwise, you will come to the error:
c:\Ruby200\bin\rubyw.EXE: No such file or directory -- C:/Users/Zhou/Documents/GitHub/HR-SNA/script/rails (LoadError)
Go to project's root directory and execute from a console following command:
ln -s ./bin ./script
In Rails 4, script has been replaced with bin

Installing RubyMine on Windows 7 persistent error: "Could not find "README" in any of your source paths."

I installed ruby 1.9.3 w/ rubyinstaller-1.9.3-p194.exe, and then installed RubyMine right after, as per directions:
http://www.jetbrains.com/ruby/quickstart/index.html
and
http://rubyinstaller.org/
I have git hub for windows already installed which I don't know if that could cause the problem.
I have also installed ruby and rails several times but I looked through the PATH environment variable for any no longer existing installations and removed them (after having already had this error) which didn't help.
Here are the settings I select in RubyMine.
The error message:
"C:\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby193\bin/rails 3.2.6 new "D:/Program Files (x86)/Git/Rails App/asfasf" --skip-test-unit --javascript=jquery --skip --database=postgresql
exist D:/Program Files (x86)/Git/Rails App/asfasf
Could not find "README" in any of your source paths. Your current source paths are:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/generators/rails/app/templates
Process finished with exit code 1"
I apologize if I come across as angry / frustrated (I edited this several times to remove it) as I have been trying to get RubyMine to work on Windows 7 or Ubuntu 12.04 and neither have been successful.
Any advice would be greatly appreciated!
I continued searching through the web for information and remembered somewhere installing rails on windows previously that for some reasons files couldn't have spaces in them.
Long story short: make sure your path doesn't have spaces in the name because it breaks rubymine or rails or something along the way.
Changing my project folder to a destination with no spaces solved the problem.

"Can't initialize a new Rails application within the directory of another, please Type 'rails' for help."

I'm just starting out with rails and I'm practicing the basic ruby commands, one of which is the rails new myproject command.
My projects are under the Aptana workspace directory where I've used the command line and Aptana both to create projects there. After a few creations and rails s commands and deletions, I've started getting this error message when I try to generate a new rails project:
"Can't initialize a new Rails application within the directory of
another, please Type 'rails' for help."
This doesn't just happen when I create a new project (rails new myproject) under the Aptana workspace directory, but also when I use the command rails new . directly inside the workspace directory. Can someone explain to me what I need to do to flush rails so it knows I don't have a project there anymore? What did I do to make this happen?
I don't remember what rails looking for. The quickest way to solve this issue is to completely empty the affected directory.
Most likely there are some hidden files or directories which prevents rails from creating a new project. Look at that with ls -a probably there is a .bundle folder inside that dir.
I got same problem since I failed to create rails project. I tried to remove Aptana plug-in and Eclipe that include ./eclipse, ./metadata but not sloved the problem until I removed Ruby and Devkit and reinstall them again.
So, I think the root cause may in Devkit or Ruby. The problem work out after I reinstall Ruby(rubyinstaller-2.2.3-x64.exe) and DevKit(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe).
If you are under Windows, you must install Aptana Studio as administrator or it will not work properly. Uninstall and install it as administrator and the terminal folder will be set correctly

Resources