Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.saumya.mojo.rails3;
 
 import java.io.File;
 
 
abstract rails mojo which provides a few helper methods and the rails.args parameter.
public abstract class AbstractRailsMojo extends AbstractGemMojo {

    

Parameter:
expression="${rails.dir}" default-value="${project.basedir}/src/main/rails"
    protected File                    railsDir;

    
either development or test or production or whatever else is possible with your config

Parameter:
expression="${rails.env}"
    protected String                  env;

    

Parameter:
default-value="${repositorySystemSession}"
Readonly:
    protected Object repoSession;

    

Component:
    protected RailsManager            railsManager;
    protected String[] joinArgs(final String args1final String args2) {
        final String args = ((args1 == null ? "" : args1) + " " + (args2 == null
                ? ""
                : args2)).trim();
        if ("".equals(args)) {
            return new String[0];
        }
        else {
            return args.split("\\s+");
        }
    }
    @Override
    public void executeWithGems() throws MojoExecutionException,
            ScriptExceptionIOExceptionGemException {
        try {
            this..initInstaller(this.launchDirectory());
            executeRails();
        }
        catch (final RailsException e) {
            throw new MojoExecutionException("error executing rails"e);
        }
    }
    abstract void executeRails() throws MojoExecutionException,
    @Override
    protected File launchDirectory() {
        if (this..exists()) {
            return this.;
        }
        else {
            return super.launchDirectory();
        }
    }
    protected File railsScriptFile() {
        return new File(new File(launchDirectory(), "script"), "rails");
    }
New to GrepCode? Check out our FAQ X