Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package de.saumya.mojo.rails3;
  
  import java.io.File;
  
  
goal to run rails command with the given arguments. either to generate a fresh rails application or to run the rails script from within a rails application.

Goal:
new
 
 public class NewMojo extends AbstractRailsMojo {
    
arguments for the rails command

Parameter:
default-value="${rails.args}"
 
     protected String            railsArgs                      = null;

    
the path to the application to be generated

Parameter:
default-value="${app_path}"
 
     protected File              appPath                        = null;

    
the database to use. DEFAULT: sqlite3

Parameter:
default-value="${database}"
 
     protected String            database                       = null;

    
the rails version to use

Parameter:
default-value="3.0.0" expression="${railsVersion}"
 
     // TODO use latest version as default like gemify-plugin
     protected String            railsVersion                   = null;

    
the groupId of the new pom

Parameter:
default-value="rails" expression="${groupId}"
 
     protected String            groupId                        = null;

    
the version of the new pom

Parameter:
default-value="1.0-SNAPSHOT" expression="${version}"
 
     protected String            artifactVersion                = null;
 
     // needs to be the default in mojo parameter as well
     private static final String SMALLEST_ALLOWED_RAILS_VERSION = "3.0.0.rc";
 
     @Override
             IOExceptionGemExceptionRailsException {
         if (this..length() >= .length()
                 && this..compareTo() < 0) {
             getLog().warn("rails version before "
                     +  + " might not work");
         }
         if (!this..startsWith("3.")) {
             throw new MojoExecutionException("given rails version is not rails3: "
                     + this.);
         }
         try {
             if (this. == null) {
                 final Pattern pattern = Pattern.compile(".*-d\\s+([a-z0-9]+).*");
                 final Matcher matcher = pattern.matcher((this. == null
                         ? ""
                         : this.)
                         + (this. == null ? "" : this.));
                 if (matcher.matches()) {
                     this. = matcher.group(1);
                 }
 
                 else {
                     this. = "sqlite3";
                 }
             }
             this..createNew(this.,
                                    this.,
                                    this.,
                                    this.,
                                    this.,
                                   joinArgs(this.this.));
        }
        catch (final RailsException e) {
            throw new MojoExecutionException("error creating new rails application",
                    e);
        }
    }
New to GrepCode? Check out our FAQ X