My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
ContributingToSubstruct  
Guidelines for contributing to Substruct
Phase-Implementation
Updated Feb 4, 2010 by subim...@gmail.com

Introduction

If you'd like to add something to Substruct we'd love to see what you have to offer.

Please follow the following guidelines when proposing any patch.

Respect the original style

Respect the coding style of the original files you're editing.

If a patch is submitted which doesn't satisfy the component's coding conventions, then either a committer will need to rewrite the submission or it will be rejected. Getting it right in this first place will save you having to rewrite it.

Spaces Not Tabs

PLEASE NO TABS!

The source should be indented using spaces rather than tabs. The standard indentation is 2 spaces per indent - but respect the number of spaces used by the original.

Some IDEs include automatic source (re)formatting. If you use an IDE, please check that this feature is either disabled or set to use (2) spaces.

If a patch is submitted which uses tabs rather than spaces, then either a committer will have to reformat it before it's applied or the patch will be rejected. Again, it's easier to get it right in the first place rather than have to reformat and resubmit your patch.

Test Cases

Please include any tests required by your code changes. We expect that any patch should not break the existing tests, or cause them to fail.

Patches with missing and/or broken tests will be rejected.

All tests should pass when you run

rake test:plugins:all PLUGIN=substruct

Creating Patch Files

Please create your patch against the latest revision of the files in the source code repository (TRUNK) since this makes the job of applying the patch much easier. If you don't have a version checked out, then check one out. If you have, then please do a fresh update before you make your changes.

The patch should be in unified format. You can create a patch in this format (from Subversion) by using:

svn diff File >> patchfile

Try to give your patch files meaningful names. This makes it easier for developers who need to apply a number of different patches.

Submitting your Patch

Please use our Issue tracker on Google Code to submit all patch files. Provide a clear description of what the patch file does, and why you're submitting it.

Multiple files should be archived via zip, gzip, or tar.

Comment by bcre...@gmail.com, Feb 22, 2008

Is there any information on creating modules?

Comment by edmundo...@gmail.com, Feb 24, 2008

For those that doesn't know how to work with plugins very well, you can make changes made inside substruct reload automatically with something like that, creating an initializer and saying to reload it always:

/config/initializers/always_load_these_paths.rb

SUBSTRUCT_ROOT="#{RAILS_ROOT}/vendor/plugins/substruct"

Dependencies.load_once_paths.delete("#{SUBSTRUCT_ROOT}/app/controllers")
Dependencies.load_once_paths.delete("#{SUBSTRUCT_ROOT}/app/helpers")
Dependencies.load_once_paths.delete("#{SUBSTRUCT_ROOT}/app/models")
Dependencies.load_once_paths.delete("#{SUBSTRUCT_ROOT}/lib")
Comment by rogerpack2005, Sep 12, 2009

steps: download substruct_xxx.tar.gz file tar -xzf substruct_xxx.tar.gz rm -rf vendor svn co http://substruct.googlecode.com/svn/trunk vendor # replace vendor with the SVN version rake db:create RAILS_ENV=test # if it fails, possibly remove the socket options from config/database.yml rake substruct:db:bootstrap RAILS_ENV=test # load up db # now you can run tests rake test:plugins:all PLUGIN=substruct

Comment by rrc...@gmail.com, May 2, 2010

Errata for errors running rake substruct:db:bootstrap with the current tar.gz source and svn copy of the bleeding edge vendor/ directory when checked out. Sorry for such a long comment but I've seen too many where more hand holding and spoon feeding seems to be required so hope I covered it ok with violating any codes of conduct ;>)

Scenerio: Having built a couple sites with the Substruct framework, I like very much, I thought I'd dig deeper and work with the bleeding edge source in the svn pile. So I proceeded to get the latest tar.gz, delete the vendor/ dir and get the latest svn copy from the project source and then export the read-only copy to my local svn repo.

SVN stuff Start in my Projects directory where all my projects start by collecting the source. In the case of using the bleeding edge svn repo source for Substruct there's a couple steps. First set up a default svn repo tree as recommended in the Subversion docs.

mkdir Projects cd Projects :~/Projects$ mkdir store :~/Projects$ mkdir store/branches :~/Projects$ mkdir store/tags :~/Projects$ mkdir store/trunk

You will need the svn repo tree setup to import into your local svn so add these steps if you haven't setup Subversion and an svn repo base yet. I'm using /usr/local/svn/repos and store all projects in that flat of an arch as the projects aren't that big and there aren't that many these days. Work is slow...
:~/Projects$ sudo mkdir /usr/local/svn
:~/Projects$ sudo mkdir /usr/local/svn/repos :~/Projects$ svnadmin create /usr/local/svn/repos

Get the Substruct base from the links on the Substruct site. Download the released tar ball and untar to the Projects dir

:~/Projects$ tar xvzf substruct_rel_1-1-0.tar.gz :~/Projects$ cd substruct_rel_1-1-0
Otherwise skip to the installation and run rake substruct:db:bootstrap. If your moving to get the bleeding edge stuff continue and delete the substruct_rel_1-1-0/vendor dir and contents.
:~/Projects/substruct_rel_1-1-0$ rm -rf vendor/
get the svn copy of the latest bleeding edge vendor/ dir from the project site (SVN or source) with the svn export tool.
:~/Projects/substruct_rel_1-1-0$ svn export http://substruct.googlecode.com/svn/trunk/ vendor

Ready to import into your local svn repo now.

:~/Projects$ sudo svn import store/ file:///usr/local/svn/repos/store -m "initial import" Adding..... Adding..... Now you should have it under svn control. As said before, don't go looking for the files in the repo dir, you won't see them but they are there and we'll confirm that next by checking out our newly imported svn copy with the newer vendor/ source.

I create a new directory "work" from which I'll import the checked out copy into the Eclipse with Aptana 2 IDE I prefer to work with, your methods or environment will dictate what you do. This is where I perfer to leave the starting files in my Project dir, check in or import that normally into version control and then checkout in my work directory where the files are updated via work done in my IDE or other development environment or where our changes go until we decide a new commit is ready or a good idea.

:~/Projects$ cd :~/$ mkdir work; cd work :~/work$ svn checkout file:///usr/local/svn/repos/store/trunk store .............

Preliminary checks and a couple common errors others are seeing in purusing the Substruct threads.

Set RAILS_ENV 2.1.2 if not done in environment.rb. You can install rails 2.1.2 alongside another 2.3.5 or whatever if you haven't already using "gem install -v=2.1.2 rails"

Errors encountered 05012010

when first running rake substruct:db:bootstrap and script/server both fail

1)after running rake substruct:db:bootstrap --trace undefined method `map' for nil:NilClass? Rails::GemDependency?.add_frozen_gem_path


Files: config/boot.rb Fix: comment out line 47 in config/boot.rb
  1. ########################
  2. class VendorBoot? < Boot
    def load_initializer
    require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" Rails::Initializer.run(:install_gem_spec_stubs)
    1. ails::GemDependency?.add_frozen_gem_path
    end end
    1. #######################

2)ran rake substruct:db:bootstrap --trace again and got the following error

config/initializers/new_rails_defaults.rb:14: undefined method `generate_best_match=' for ActionController?::Routing:Module (NoMethodError?)
Fix: The files effected
found with => fgrep -R --files-with-matches 'generate_best_match' ./
./config/initializers/.svn/text-base/new_rails_defaults.rb.svn-base ./config/initializers/new_rails_defaults.rb

If you try to edit them you can't unless you changed the read-only export version of the vendor/ dir.

chmod -R ug+w config/initializers/.svn/
vi or gedit or whatever the file ./config/initializers/new_rails_defaults.rb and comment out the offending line
  1. ctionController::Routing.generate_best_match = false

Powered by Google Project Hosting