MooTools Forge / GitHub Plugin Structure Shell Script

By  on  

One thing I love about the MooTools Forge is that it requires a strict structure for its plugins i.e. requiring a README.md file, Source directory, etc. I've created a shell script that I can run that creates the directory structure and files required to add my plugin to GitHub and then the Forge.

The Shell Script & Usage

The first step is creating the repository at GitHub. Once created at GitHub, I run the script, giving it the name of the plugin and repository (they must be the same):

./newPlugin.sh ScrollSpy

The script itself looks like:

#!/bin/sh
mkdir $1
cd $1
git init
touch README.md
mkdir Source
touch Source/$1.js
touch Source/$1-yui-compressed.js
mkdir Docs
touch Docs/$1.md
touch package.yml
echo "name:  $1
author:  davidwalsh
current:  
category:  
tags:  []
docs:  
demo:  " >> package.yml;
cd $1
git add *
git commit -m "First Commit"
git remote add origin git@github.com:darkwing/$1.git

Tada! Done! Now I just need to populate each file with the necessary content. MooTools FTW!

Recent Features

  • By
    Designing for Simplicity

    Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...

  • By
    CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

Incredible Demos

  • By
    HTML5’s window.postMessage API

    One of the little known HTML5 APIs is the window.postMessage API.  window.postMessage allows for sending data messages between two windows/frames across domains.  Essentially window.postMessage acts as cross-domain AJAX without the server shims. Let's take a look at how window.postMessage works and how you...

  • By
    Detect Vendor Prefix with JavaScript

    Regardless of our position on vendor prefixes, we have to live with them and occasionally use them to make things work.  These prefixes can be used in two formats:  the CSS format (-moz-, as in -moz-element) and the JS format (navigator.mozApps).  The awesome X-Tag project has...

Discussion

  1. That is very useful :)

  2. Hmm, Thanks!
    Since I’m on PC, I tend to use TortoiseGit instead of the Bash itself, but the structure can still be quite useful!

    Of course, for the last code line, we have to use our own username…
    git remote add origin git@github.com:USERNAME/$1.git
    No?

  3. @Nickolas Simard: Correct.

  4. Was thinking of making a textmate command to do the same, but a shell script makes more sense. Thanks!

  5. Just so you know, this works just fine with msysgit on windows. You can throw it in a .bat file and run it as shown above.

  6. PaquitoSoft

    Great tip. Thanks!

  7. PaquitoSoft

    @PaquitoSoft: There’s one thing that didn’t worked for me when using your structure for GitHub.
    You suggest to create a minified version of our source code files and put them into the Source folder but the process in MooForge that validates your GitHub repository checks that every file in that folder has a yaml header. It’s not a good idea to put that header into the minified version since this one has to be as little as possible.
    I asked Guillermo Rauch where should we put our minified files, I mean a standard name for a folder that will hold this kind of files, but I didn’t received an answer yet.

  8. Good afternoon, I have a problem with the addition of plug-in Mootools Forge, tell me please, what am I doing wrong?

    The form of adding an error:
    `provides` field missing or empty in PageMooSlider.js

    Although I write in the Header:

    provides:
    – PageMooSlider

    And in the code plug is present class:
    var PageMooSlider = new Class ({});
    http://github.com/Cleverscript/PageMooSlider/blob/master/Source/PageMooSlider.js

    Help with the addition of poalina, thank you.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!