How to version control a rails plugin and the testing app together

I’m in the process of creating my first rails plugin and am finding managing version control of the plugin and testing app rather annoying.

Here’s my problem:

  • Missing Git Configuration Dot files
  • Branch or tag before, or else prepare a potential build failure after successful git pull?
  • Weird message on .git commit with exclamation point
  • git status is showing “Changes not staged for commit” for files listed in .gitignore?
  • How do I interactively unstage a particular hunk in git?
  • Is it possible to access a Github Wiki via SSH?
  • To actually test my plugin in action I need to run it within a test application (which is basically just a scaffold app where I install the plugin)

    When I’m making changes to the plugin, it’s convenient for me to change it within the test application so i can immediately see the changes come through. However, when I want to commit and push my changes back to github I end up copying all the files out of the test app back into my “naked plugin” folder and doing my commits.

    Is there a better way to manage this without copying files back and forth? I’m interested to hear from other plugin developers if possible on how you manage this situation.

    One potential solution I’ve conceived of is to have another git repository within the vendor/plugins/myplugin directory (which will have the remote repo of github). Im not sure if this is best though (and so far I haven’t been very successful in making it work…)

  • Using GitHub as a Version Control Tool for a hosted Drupal Site
  • Git repo not updating github.io content
  • Does another version control system have a ClearCase-like filesystem access to file versions?
  • Getting started with Git Python
  • Build git log statement using bash script, throws ambiguous argument '%an' error
  • Handling git on a shared user account
  • 4 Solutions collect form web for “How to version control a rails plugin and the testing app together”

    I recommend to use git submodules, check a detailed description.

    I create a soft link in the vendor/plugin directory to point to the plugin source code.
    If you are on Windows you can use the junction tool to create a softlink.
    E.g:

    c:\test_app
         vendor
           plugin
             foo_plugin -> points to c:\foo_plugin
    
    c:\foo_plugin
      lib
    

    Submodules are going work best I think. What I don’t like about developing plugins is that you’re always starting/stopping the script/server. Without knowing what kind of plugin you’re building, I’ll just assume that you’re building an abstracted class of some kind.

    I personally think the best way to go is to develop the class in the lib directory of your rails app. Once you get it about 99% done, then move the class into the lib directory of your plugin. Then commit the changes to the plugin repo.

    If you’re willing to package your final plugin as a gem, then there is a much easier way. In your basic scaffold app, inside your Gemfile you can point to a local path:

    gem ‘foo’, :path => “../foo”

    This way your scaffold app and engine/plugin are in two separate directories; two completely unrelated git repos. You don’t even have to start & stop your scaffold web server when you make changes to the plugin (at least in rails 3).

    I just wrote up a tutorial for how I created my first rails engine and I extracted the foundation into a good starting point for other engine builders:

    http://keithschacht.com/creating-a-rails-3-engine-plugin-gem

    As an end user of a plugin, I think it’s much easier if it’s packaged as a gem. Not only is more functionality possible with a gem, developers can install it once and use it in many apps, dependencies can be easily handled, upgrades are as simple as changing a version number, and you don’t have to store the entire plugin in your main app’s repo.

    Git Baby is a git and github fan, let's start git clone.