I'm setting up my first Rails 4.1 app, which comes with Spring, their new preloader. When I try to install Devise using their generator ($ rails generate devise:install), the command line just hangs and nothing gets generated.
If I remove Spring from the gem file and try again, the Devise generator works.
Anyone have any insight?
Check directories of some other projects that you were working on at that time, chances are that the generated files ended up there.
spring seems to get confused when you work with more than one rails app at a time. That's probably what caused your problem
spring runs as a server and keeps a rails environment loaded. I think what happens is that if you work with more than one project at a time then spring system seems to get confused and uses wrong environment.
I have had a situation where I was running rails g ... in one project and the files were getting generated in another project. What was crazy was that I kept renaming and moving that other folder, and still the generator kept putting the files in that folder. As if spring had latched on the the inode of that folder.
Try DISABLE_SPRING=1 rails g devise:install
or ps aux |grep spring and kill all the processes you see and then run rails g devise:install
We are taking out spring from the Gemfile for now while this broken behavior persists, and in the future use rails new --skip-spring
If you want to keep using spring, then try following these rules
Use new shells for each new project
Use a new directory name for each new project (If you do rails new blog, work on it, then mv blog blog.old and rails new blog again, it might not work.
From time to time keep on killing all the spring servers, for safety's (and sanity's) sake.
You can disable spring for any $ rails command by passing the environment variable DISABLE_SPRING=1.
$ DISABLE_SPRING=1 rails generate devise:install
Alternatively, you can try $ spring stop to spin down the spring processes. Running $ rails generate afterwards will spin up a new spring process, which might solve the temporary issue.
There is same problem on rails 5.1.4 for responders gem
I listed solutions along with previous ones:
close terminal and open new one
run command with DISABLE_SPRING=1 bundle exec rails generate responders:install
or export it as environment variable
export DISABLE_SPRING=1
kill running spring process for your app
ps ax | grep spring | grep YOUR_APP_NAME | cut -f1 -d' ' | xargs kill
This is an old post, but i think my experience might help someone...
rails 5.0.1
I was facing same issue after i messed up some devise generated files(i am new to rails and learning) and than i tried rails destroy devise model and i was stuck, tried many time and nothing worked.
Googled, got here, tried excluding spring gems, and it worked, again added spring gems, and devise was again stuck on everything.
I just closed the terminal and opened new one, and it worked.
Related
From time to time STS seems to bog down or free while working in a Spring Root webapp. It can sometimes be ten or twenty minutes before the UI allows you to really do anything, other than go slow and queue up actions.
We've traced all the the postings/bug reports about "JPA change handler (waiting)" messages and AspectJ issues - but no real permanent solution appears. Sometimes when we upgrade Eclipse or Roo things get better for a while.
We are hoping to figure out if this is really a Roo problem or more of an a Spring/AspectJ issue.
Question: Is it possible to disable Roo in the IDE but still have it build and work OK in the IDE, just not Roo smarts going on?
I thought I just had to remove the "Roo Nature" for the project but that does not seem to completely do it - the Roo Shell keeps popping open when I do a Maven Update.
If not we'll probably look at the push-in refactoring route - but that seem to really be a one-way street.
Our webapp has about 20 domain objects and 30 controllers - it's not tiny but not huge either. We use JPA/Hibernate too.
Thank you - Richard
We ran into the same problem. It seems the JPA Daly support for Eclipse, included in the WTP, generates of a lot of JPA Event Change notifications while compiling a project. It seems in projects with aspects, like the Roo ones, this behavior is even worse and makes using the IDE very slow and even hangs sometimes.
As there is not any way to disable it through configuration, you have to remove or move the related files. Ex:
Go to the STS/Eclipse installation folder.
Run the following command::
rm -rf plugins/org.eclipse.jpt. features/org.eclipse.jpt.**
We found also another problem with the Eclipse AspectJ plugin (https://issuetracker.springsource.com/browse/STS-4037) that caused to compile all the project on each modification to any Java class in the project with Aspects applied. It is solved in the recent STS versions, but check it just in case by performing the following steps:
Go to the Project > Properties > AspectJ Compiler menu.
Check the Other > Outxml configuration property is disabled.
Is anyone aware of a mechanism to get hot deployment for resources and template working under IntelliJ 14.0.2 for a Spring Boot application.
I know that full Spring Boot support is scheduled for 14.1 but I have a project that I converted over from a standard WAR project to a Spring Boot project and I really miss the hot deployment.
At the moment I have to manually build the project that the resources are in to get hot deployment and even then it is a bit flaky sometimes. I would prefer to just save a template or a javascript/css file and get it picked up as I did when I was running my app using a local tomcat server via IntelliJ.
I could switch back to Eclipse to get this working, but my project is Scala based and IntelliJ Scala support is far superior.
So after some testing I came to few conclusions I think someone arriving here may find useful:
If you are running embedded spring boot application from IntelliJ IDEA (myself on 14 at the moment) in debug mode and you want to hot re-deploy resources you can do that via: Run -> Reload changed classes. Setting a keyboard shortcut much recommended.
Don't get fooled by Loaded classes are up to date. Nothing to reload. message. Your static resources have been updated (tested on .js files and Thymeleaf templates).
As pointed out in comments for thymeleaf templates hot-redeploy you would need:
spring.thymeleaf.cache=false
If you are running in external container IntelliJ provides extra features like action on Frame deactivation which is extremely handy for web development. This works fine as well just beware that external Jetty container on 9.2.7 will cause troubles, i.e. unload the resources on Update resources action breaking your webapp. The only fix was app restart for me. Works nicely in Tomcat 8 though.
As instructed here adding spring-boot-devtools dependency will enable static resources reloading (templates and css).
Beware that you need to select Build -> Compile for this to work.
Install jetbrains-ide-support
Start your Spring Boot app
Go in browser and open your_project_page(http://localhost:8080/)
right mouse click(on your page) -> choose "Inspect in IDEA"
I'm new to rails and I'm actually reading a tutorial on it but unfortunately it's a very old one (2007). They talk about temporary scaffolding which is a one-line addition to a controller for example:
class StoryController < ApplicationController
scaffold :story
end
I tried it in my project but I'be got this error:
Routing Error
No route matches [GET] "/story"
Try running rake routes for more information on available routes.
I thought maybe it's because I'm running a different rails version, maybe the syntax have changed... So my question is how do we perform temporary scaffolding on rails 3.
I previously had to set config.assets.enabled to false because I had a route error.
I'm running under:
Rails 3.2.13
Windows 8 pro 32-bits
I'm very surprised to see this, because I wasn't around when Rails had this scaffold method you show. I've never heard of it before.
I searched the API documentation (and Rails source) and there is nothing like this now. Instead, there is the rails generate scaffold command. You can find more information at http://guides.rubyonrails.org/command_line.html.
As a suggestion: If you want to use a version of Rails from 2007, the tutorial you have now is fine. If you want to use a modern version, find a modern tutorial. The Ruby on Rails Guides site is good.
I have almost finished the development of a project developed with Symfony2, and wish to put the project online.
However, I suppose there are a lot of things that need to be done so that everything works ok. I suppose, the dev mode needs to be disabled etc....What needs to be done and how?
What are the most important things to do on a Symfony2 project that will be available to everyone on the web?
I suggest you to use Capifony for deployment. It does a lot of stuff out of the box and you can make it run any custom commands you need. See its documentation for details.
Regarding the dev mode, unless you've removed the IP checks from app_dev.php, you don't have to worry about deploying it. Of course, if you wish, you can tell Capifony to delete it on deployment.
The best way to handle deployment is to create "build" script, which will:
Remove all folders and files with tests from your bundles and vendors.
Remove app_dev.php file
Make sure that app/cache and app/logs are fully writable/readable.
Packs your project into archive (rpm f.e.)
Then, before deployment, you should create tag in your project - so it will mean, that certain version of your application is released (I recommend to follow this git branching model).
Create tag.
Run your build script
Upload archive to host
Unpack
Enjoy your project
Im currently researching the same thing.
The first thing you have to consider is "how professional" you want to deploy. There are a lot of tools you can use:
Continous Integration Server ( e.g. Hudson, Jenkins)
Build Tools (e.g. Phing, Capistrano --> Capifony, Shell scripts)
Versioning Tools (e.g. Git, SVN)
I think the simplest setup is using only a Build tool and i guess you are already using some kind of versioning.
Depending on which tool you use, the setup is different, but I think there are some things you should consider with your application (maybe not all are applicable to your application)
Creating a Tag in your Versioning
Copying the new Code in an folder on production
--> if you are in a new folder you dont need to clear the cache and logs, since these shouldnt be in your versioning the first time.
loading composer (if youre using it)
installing vendors
updating database schema
install assets from your bundles
move symlink from current version to the folder of the new site
These are the things I currently need for my application for production deployment, if you deploy to an test environment you should load fixtures and run your testscripts as well.
One other option that is very well described here is to deploy the Symfony2 application with Apache Ant. Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other.
After migrating from my old Macbook Pro to my new one, I find that my project will no longer run. Grails keeps giving me a "Error /Users/Michael/{proj}/{proj} does not appear to be part of a Grails application". Refresh dependencies does seem to run successfully.
I have verified the following:
there exists a folder grails-app in the project folder at the same location as on the old machine.
I did run a grails clean followed by a grails upgrade to 2.0.4
The one thing it could be is that the user directory name has changed between the two machines, but I do not see the old user directory name in either .project or application.properties or in any settings.
I solved this by deleting workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\<project>.launch. It had cached the old absolute path.
Open the command line from within STS and executed a "run-app". There is sometime a problem with he workspace caches.
oops, saw that I had left this question unanswered.
The answer was to erase everything and rebuild from github. When in doubt, nuke it until it glows....
Armand's answer above was the simplest solution - thanks Armand
This has been my experience - when working with the Grails in the IDE - in certain cases it's better to use the command line to issue grails commands (this was a good reminder)
Related to this, it seems better to run-app from cmd line as well (as opposed to using the IDE Project->Run As), since you can just stop the server easily with ctrl-c