This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
1 Replies Last post: Oct 5, 2011 11:57 AM by Irina Chernushina (JetBrains)  
david w Newbie 5 posts since
Feb 22, 2011
Currently Being Moderated

Oct 4, 2011 9:34 PM

How to automatically add files created by `rails generate` to VCS?

Does anyone know if this is possible?  I'd like the files created by running a generator in the RubyMine IDE to be added to my VCS (mercurial) automatically.  I don't mind writing a plugin or getting fancy if someone can point me in the right direction.

 

Thanks,

Irina Chernushina (JetBrains) JetBrains 190 posts since
Jul 1, 2008
Currently Being Moderated
Oct 5, 2011 11:57 AM in response to: david w
Re: How to automatically add files created by `rails generate` to VCS?

Hello David,

 

If files are generated inside RubyMine and created through VFS, VCS listener will be aware of them and settings in Settings | Version Control | Confirmation

applies to the case.

 

If files are created in other way (not through VFS), you can add them programmatically through:

 

/* public final RefreshSession createSession(boolean async, boolean recursive, @Nullable Runnable finishRunnable) */

!!! finishRunnable is called _under write action_

be careful

 

    final RefreshSession session = RefreshQueue.getInstance().createSession(true, true, new Runnable() {

      public void run() {

 

        // here in callback files are already known to VFS and now we can add them

    final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project));

    changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), unversionedFiles);

// files will be visible in change list manager after its inner update. not synchronously after this call

      }

    });

 

    session.addAllFiles(myFilesToRefresh);

    session.launch();     // starts refresh

More Like This

  • Retrieving data ...