Git Product home page Git Product logo

cb-module-template's Introduction

Hi there, I'm Eric Peterson πŸ‘‹

I'm a Web Developer, Open Source Enthusiast, Father, and Husband. (In reverse order)

🏒 I currently work as a Senior Web Developer for Ortus Solutions.

πŸ‘¨β€πŸ‘©β€πŸ‘¦ I live in Utah with my wife and three children.

πŸŽ“ I have a Bachelors Degree in Information Systems from the University of Utah.

πŸ’» I maintain several popular open-source packages for the ColdBox ecosystem:


More can be found onΒ ForgeBox.

πŸš€ Skills

Languages


Backend Frameworks

JS Frameworks

Style Frameworks

Databases


elpete github profile trophy

elpete github readme stats


Β elpete most used

cb-module-template's People

Contributors

bdw429s avatar elpete avatar gpickin avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cb-module-template's Issues

Ask User for GitHub user/pass if nothing is saved instead of erroring

To help people out on their first use of the module, assume they want to go ahead and set up a GitHub token if they don't have one saved already. Instead of throwing the error, just go ahead and ask them for their GitHub username and then proceed as though it had been set.

Still output the same message of the 3 options that need to happen and mention that they can just hit Ctrl-C if they don't want to create a new GitHub token right then.

Override beforeAll() instead of using annotations to set up tests

I just tried to add a beforeAll() method in my scaffolded test that looked like this:

function beforeAll() {
	super.beforeAll();		
	myModel = getInstance( 'myModel@myModule' );
}

The idea was to create an instance of a service in my model once when the test started up so I could call methods on it. The instance wasn't found in WireBox because the Coldbox app doesn't load the module until your registerModuleUnderTest() method runs, which is annotated with @beforeAll. Since I called super.beforeAll(), my expectation was that all other setup would be complete, but TestBox runs my beforeAll() prior to your method.

Change to just overriding the base beforeAll() method for your setup, so the tests implementations can decide when their setup runs in comparison.

Add build to Travis CI automatically

I don't really know if this is possible or not and it may require some separate auth token from Travis, but it would be cool if the travis.yml file was just automatically picked up and the Travis CI build started running right away without needing to go to the Travis site and activating the build. This would probably require the user to already have a Travis account connected to Github.

Error pushing repo to Github

I received the following error when the scaffold command tried to push to GitHub:

Error Cloning Git repository
org.eclipse.jgit.api.errors.TransportException: [email protected]:bdw429s/bradprivate.git: UnknownHostKey: github.com. RSA key fingerprint is xxxxxxxx

This happens when using SSH keys and you don't have an entry for github.com in your ~/.ssh/known_hosts file. The workaround with jGit is to use a custom setting that turns off strict hostname checking.
http://stackoverflow.com/questions/2003419/com-jcraft-jsch-jschexception-unknownhostkey

I've done this in CommandBox for the Git_SSH endpoint with a custom SSH Callback. However, I think this module actually shouldn't even be using SSH, but instead the security Token that we've already generated for the user. This requires a UsernamePasswordCredentialsProvider to work as described here.

http://stackoverflow.com/questions/28073266/how-to-use-jgit-to-push-changes-to-remote-with-oauth-access-token

I'll give it a shot locally and send a pull if it works.

Fix Adobe relative path mapping issues

Either expand the paths from relative paths correctly or use my hacky upOneLevel function

function upOneLevel( path ) {
    var p = expandPath( path );
    var pArray = listToArray( p, "/" );
    arrayDeleteAt( pArray, arrayLen( pArray ) );
    return "/" & arrayToList( pArray , "/" ) & "/";
}

404 received while setting up Travis

This didn't happen the second time I tried to run it so I'm not sure if it was a transient error or something that happens to everyone the first time. I figured I'm create this ticket in case anyone else ran into it so we'd know to look into it further.

Here's the full output of the command:

CommandBox:sandbox> module scaffold bradprivate "my private package"

Copying template over....

Installing dependencies....

Installing package [forgebox:coldbox@^4.3.0+188]

Installing package [forgebox:testbox@^2.4.0+80]

Setting up your Git repo....
Git repo initialized with an initial commit.

Creating GitHub repo....

I couldn't find a GitHub token for you.  Let's create one now!
Username: bdw429s
Password: *******************************
Token created!.

Repo created on Github.


I couldn't find a Travis token for you.  Creating one from your GitHub token now.
Token created!.

Syncing GitHub repos with Travis....
ERROR (@build.version@[email protected]@)

404 Not Found

D:\.Command Box\cfml\modules\cb-module-template\commands\module\scaffold.cfc: line 330
328:             // "MyClient/1.0.0" is used because Travis is bonkers with anything else
329:             cfhttpparam( type="header", name="User-Agent", value="MyClient/1.0.0" );
330:             cfhttpparam( type="header", name="Accept", value="application/vnd.travis-ci.2+json" );
331:         }
332:
called from D:\.Command Box\cfml\system\services\CommandService.cfc: line 303
301:                    // Run the command
302:                    try {
303:                            var result = commandInfo.commandReference.CFC.run( argumentCollection = parameterInfo.namedParameters );
304:                            lastCommandErrored = commandInfo.commandReference.CFC.hasError();
305:                    } catch( any e ){
called from D:\.Command Box\cfml\system\services\CommandService.cfc: line 133
131:            var commandChain = resolveCommand( line );
132:
133:            return runCommand( commandChain, line );
134:    }
135:
called from D:\.Command Box\cfml\system\Shell.cfc: line 479
477:                            }
478:                    } else {
479:                            var result = variables.commandService.runCommandLine( arguments.command );
480:                    }
481:
called from D:\.Command Box\cfml\system\Shell.cfc: line 428
426:                // If there's input, try to run it.
427:                            if( len( trim( line ) ) ) {
428:                                    callCommand( command=line, initialCommand=true );
429:                            }
430:
called from D:\.Command Box\cfml\system\Bootstrap.cfm: line 113
111:
112:            // Running the "reload" command will enter this while loop once
113:            while( shell.run( silent=silent ) ){
114:                    clearScreen = shell.getDoClearScreen();
115:
404 Not Found
        at lucee.runtime.tag.Http41._doEndTag(Http41.java:1265):1265
        at lucee.runtime.tag.Http41.doEndTag(Http41.java:636):636
        at lucee.runtime.tag.HttpImpl.doEndTag(HttpImpl.java:223):223
        at modules.cb_module_template585.commands.module.scaffold_cfc$cf.udfCall(/commandbox/modules/cb-module-template/commands/module/scaffold.cfc:330):33
0
        at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
        at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
        at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
        at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
        at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
        at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
        at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:303):303
        at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc):-1
        at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
        at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
        at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
        at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:766):766
        at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
        at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1599):1599
        at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:133):133
        at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc):-1
        at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
        at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
        at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:642):642
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
        at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1761):1761
        at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
        at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1599):1599
        at system.shell_cfc$cf.udfCall3(/commandbox/system/Shell.cfc:479):479
        at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc):-1
        at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
        at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
        at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
        at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:775):775
        at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
        at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
        at system.shell_cfc$cf.udfCall2(/commandbox/system/Shell.cfc:428):428
        at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc):-1
        at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
        at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
        at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
        at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
        at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
        at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
        at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
        at _command_box334.cfml.system.bootstrap_cfm$cf.call(/.Command Box/cfml/system/Bootstrap.cfm:113):113
        at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:957):957
        at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:909):909
        at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:225):225
        at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:37):37
        at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2271):2271
        at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2234):2234
        at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456
        at lucee.runtime.engine.CFMLEngineImpl.cli(CFMLEngineImpl.java:760):760
        at lucee.loader.engine.CFMLEngineWrapper.cli(CFMLEngineWrapper.java:267):267
        at luceecli.CLIMain.run(CLIMain.java:223):223
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):-2
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62):62
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43):43
        at java.lang.reflect.Method.invoke(Method.java:483):483
        at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:205):205
        at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:699):699

Tidy up command line help

From @bdw429s:

I'd recommend reducing the amount of content in your parameter arg hits and putting more in the command help (cfc hint)
If for nothing else, readability.
You can wrap your command help codes samples with {code} and they'll be more readable there anyway.
Which permissions does the Github access token need?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.