diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b7ca95b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# JS files must always use LF for tools to work +*.js eol=lf diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..479c2b8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +Welcome! Thanks for your interest in contributing to plugins.jquery.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](http://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [to our websites](http://contribute.jquery.org/web-sites/) and [code](http://contribute.jquery.org/code). + +You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla). + +You can find us on [IRC](http://irc.jquery.org), specifically in #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/). diff --git a/LICENSE-MIT.txt b/LICENSE.txt similarity index 72% rename from LICENSE-MIT.txt rename to LICENSE.txt index 1b5c731..8ec0732 100644 --- a/LICENSE-MIT.txt +++ b/LICENSE.txt @@ -1,8 +1,13 @@ -Copyright (c) 2013 jQuery Foundation, http://jquery.org/ +Copyright jQuery Foundation and other contributors, https://jquery.org/ This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history -and logs, available at http://github.com/jquery/plugins.jquery.com +available at https://github.com/jquery/plugins.jquery.com + +The following license applies to all parts of this software except as +documented below: + +==== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -22,3 +27,10 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +All files located in the node_modules directory are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/config-sample.json b/config-sample.json index dc4f393..90bce25 100644 --- a/config-sample.json +++ b/config-sample.json @@ -2,7 +2,7 @@ "repoDir": "/tmp/plugin-repos", "pluginsDb": "plugins.db", "wordpress": { - "url": "local.plugins.jquery.com", + "url": "vagrant.plugins.jquery.com", "username": "admin", "password": "secret" } diff --git a/grunt.js b/grunt.js index 6e5c9f6..9dbff99 100644 --- a/grunt.js +++ b/grunt.js @@ -1,19 +1,16 @@ -var config = require( "./lib/config" ); -var path = require( "path" ); +var path = require( "path" ), + rimraf = require( "rimraf" ), + config = require( "./lib/config" ); module.exports = function( grunt ) { var async = grunt.utils.async; grunt.loadNpmTasks( "grunt-wordpress" ); -grunt.loadNpmTasks( "grunt-clean" ); grunt.loadNpmTasks( "grunt-jquery-content" ); grunt.loadNpmTasks( "grunt-check-modules" ); grunt.initConfig({ - clean: { - wordpress: "dist/" - }, lint: { grunt: "grunt.js", src: [ "lib/**", "scripts/**" ] @@ -22,12 +19,6 @@ grunt.initConfig({ grunt: { options: grunt.file.readJSON( ".jshintrc" ) }, src: { options: grunt.file.readJSON( ".jshintrc" ) } }, - watch: { - docs: { - files: "pages/**", - tasks: "docs" - } - }, test: { files: [ "test/**/*.js" ] }, @@ -42,6 +33,10 @@ grunt.initConfig({ }, config.wordpress ) }); +grunt.registerTask( "clean", function() { + rimraf.sync( "dist" ); +}); + // We only want to sync the documentation, so we override wordpress-get-postpaths // to only find pages. This ensures that we don't delete all of the plugin posts. grunt.registerHelper( "wordpress-get-postpaths", function( fn ) { @@ -113,8 +108,7 @@ grunt.registerTask( "sync-docs", function() { // clean-all will delete EVERYTHING, including the plugin registery. This is // useful only for development if you want a clean slate to test from. grunt.registerTask( "clean-all", function() { - var rimraf = require( "rimraf" ), - retry = require( "./lib/retrydb" ); + var retry = require( "./lib/retrydb" ); // clean repo checkouts rimraf.sync( config.repoDir ); diff --git a/lib/hook.js b/lib/hook.js index f0f825e..954fd05 100644 --- a/lib/hook.js +++ b/lib/hook.js @@ -135,7 +135,16 @@ function processRelease( repo, tag, file, manifest, fn ) { name: manifest.name, owner: owner }); - return fn( null, null ); + + // track the tag so we don't process it on the next update + pluginsDb.addTag( repo.id, tag, function( error ) { + if ( error ) { + return fn( error ); + } + + fn( null, null ); + }); + return; } return owner; diff --git a/lib/service.js b/lib/service.js index 40d04f3..d676f62 100644 --- a/lib/service.js +++ b/lib/service.js @@ -65,6 +65,11 @@ extend( Repo.prototype, { function( error, tags ) { if ( error ) { + if ( /Repository not found/.test( error.message ) ) { + repo.informRepoNotFound(); + return fn( null, [] ); + } + return fn( error ); } @@ -186,6 +191,9 @@ extend( Repo.prototype, { informOtherOwner: function( data ) { this.inform( this.id + " " + data.tag + " cannot publish " + data.name + " which is owned by " + data.owner ); }, + informRepoNotFound: function() { + this.inform( this.id + " repo not found on remote server." ); + }, informSuccess: function( data ) { this.inform( this.id + " SUCCESSFULLY ADDED " + data.name + " v" + data.version + "!" ); } diff --git a/package.json b/package.json index 338ce28..088f01f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plugins.jquery.com", - "version": "1.2.1", + "version": "1.3.1", "author": "jQuery Project", "description": "The official jQuery plugins site", "homepage": "https://github.com/jquery/plugins.jquery.com", @@ -11,15 +11,14 @@ "dependencies": { "mkdirp": "0.3.4", "semver": "1.1.2", - "sqlite3": "2.1.5", + "sqlite3": "2.1.7", "step": "0.0.5", "rimraf": "2.1.1", "wordpress": "0.1.3", "grunt": "0.3.17", - "grunt-wordpress": "1.0.7", + "grunt-wordpress": "1.2.1", "grunt-check-modules": "0.1.0", - "grunt-jquery-content": "0.9.0", - "grunt-clean": "0.3.0", - "simple-log": "1.0.1" + "grunt-jquery-content": "0.13.0", + "simple-log": "1.1.0" } } diff --git a/pages/docs/names.md b/pages/docs/names.md index c1d0295..00263fd 100644 --- a/pages/docs/names.md +++ b/pages/docs/names.md @@ -7,7 +7,7 @@ your plugin. The name is a unique identifier that distinguishes your plugin from all other plugins. This is different from the title of your plugin, which you can think of as the display name. -**Plugin names may only contain letters, numbers, hypens, dots, and underscores.** +**Plugin names may only contain letters, numbers, hyphens, dots, and underscores.** We encourage you to follow a few simple tips as well: diff --git a/pages/docs/package-manifest.md b/pages/docs/package-manifest.md index 8b11131..8a41b02 100644 --- a/pages/docs/package-manifest.md +++ b/pages/docs/package-manifest.md @@ -16,25 +16,25 @@ The files must be actual JSON, not just a JavaScript object literal. ### Required Fields -* name -* version -* title -* author -* licenses -* dependencies +* name +* version +* title +* author +* licenses +* dependencies ### Optional Fields -* description -* keywords -* homepage -* docs -* demo -* download -* bugs -* maintainers +* description +* keywords +* homepage +* docs +* demo +* download +* bugs +* maintainers -### name +### name The *most* important things in your manifest file are the name and version fields. The name and version together form an identifier that is assumed @@ -54,7 +54,7 @@ to see if there's something by that name already, before you get too attached to Site, either consider renaming your plugin or namespacing it. For example, jQuery UI plugins are listed with the "ui." prefix (e.g. ui.dialog, ui.autocomplete). -### version +### version The *most* important things in your manifest file are the name and version fields. The name and version together form an identifier that is assumed @@ -64,19 +64,19 @@ per [node-semver](https://github.com/isaacs/node-semver). See [Specifying Versions](#specifying-versions). -### title +### title A nice complete and pretty title of your plugin. This will be used for the page title and top-level heading on your plugin's page. Include jQuery (if you want) and -spaces and mixed case, unlike [name](#field-name). +spaces and mixed case, unlike [name](#name). -### author +### author One person. See [People Fields](#people-fields). -### licenses +### licenses Array of licenses under which the plugin is provided. Each license is a hash with a url property linking to the actual text and an optional "type" property specifying the type of license. If the license is one of the [official open source licenses](http://www.opensource.org/licenses/alphabetical), the official license name or its abbreviation may be explicated with the "type" property. @@ -90,7 +90,7 @@ a url property linking to the actual text and an optional "type" property specif ] ``` -### dependencies +### dependencies Dependencies are specified with a simple hash of package name to version range. The version range is EITHER a string which has one or more @@ -106,46 +106,46 @@ of each library you depend on. You must list at least one dependency, `jquery` (note that it's lower-case). -### description +### description Put a description in it. It's a string. This helps people discover your plugin, as it's listed on the jQuery Plugins Site. -### keywords +### keywords Put keywords in it. It's an array of strings. This helps people discover your plugin as it's listed on the jQuery Plugins Site. Keywords may only contain letters, numbers, hyphens, and dots. -### homepage +### homepage The url to the plugin homepage. -### docs +### docs The url to the plugin documentation. -### demo +### demo The url to the plugin demo or demos. -### download +### download The url to download the plugin. A download URL will be automatically generated based on the tag in GitHub, but you can specify a custom URL if you'd prefer to send users to your own site. -### bugs +### bugs The url to the bug tracker for the plugin. -### maintainers +### maintainers An array of people. See [People Fields](#people-fields). -## People Fields +## People Fields A "person" is an object with a "name" field and optionally "url" and "email", like this: @@ -162,7 +162,7 @@ Both the email and url are optional. --- -## Specifying Versions +## Specifying Versions Version range descriptors may be any of the following styles, where "version" is a semver compatible version identifier. @@ -198,7 +198,7 @@ For example, these are all valid: } ``` -### Tilde Version Ranges +### Tilde Version Ranges A range specifier starting with a tilde `~` character is matched against a version in the following fashion. @@ -212,7 +212,7 @@ For example, the following are equivalent: * `"~1.2" = ">=1.2.0 <1.3.0"` * `"~1" = ">=1.0.0 <2.0.0"` -### X Version Ranges +### X Version Ranges An "x" in a version range specifies that the version number must start with the supplied digits, but any digit may be used in place of the x. @@ -228,7 +228,7 @@ The following are equivalent: You may not supply a comparator with a version containing an x. Any digits after the first "x" are ignored. -### Sample manifest +### Sample manifest **color.jquery.json** diff --git a/pages/docs/publish.md b/pages/docs/publish.md index f80023f..b3b3cb5 100644 --- a/pages/docs/publish.md +++ b/pages/docs/publish.md @@ -2,25 +2,30 @@ "title": "Publishing Your Plugin" } +
+ The jQuery Plugin Registry is in read-only mode. New plugin releases will not be processed. We recommend moving to npm, using "jquery-plugin" as the keyword in your package.json. The npm blog has instructions for publishing your plugin to npm. +
+ Publishing your plugin on the site is a three step process: -## Add a Post-Receive Hook +## Add a Service Hook -First, you'll need to create a post-receive hook on GitHub. Just follow the -[step-by-step guide for adding a -webhook](https://help.github.com/articles/post-receive-hooks) and set the URL -to `http://plugins.jquery.com/postreceive-hook`. +First, you'll need to enable the jQuery Plugins service hook on GitHub. On the +settings page for your repository, click the Webhooks & Services link, then +click the Configure services button. Scroll down to find the jQuery Plugins +service and enable it (there's no config, just check the Active checkbox and +click the Update settings button). ## Add a Manifest to your Repository The jQuery Plugins Registry will look in the root level of your repository for -any files named `*.jquery.json`. You will want to create -yourplugin.jquery.json according to the [package manifest +any files named `*.jquery.json`. You will want to create +`*yourplugin*.jquery.json` according to the [package manifest specification](/docs/package-manifest/). Use an online JSON verifier such as [JSONlint](http://jsonlint.com) to make sure the file is valid. You are now ready to publish your plugin! -

Validate Your Manifest File Here

+## Validate Your Manifest File Here
Upload your manifest file to check for common errors: @@ -35,9 +40,9 @@ ready to publish your plugin! ## Publishing a Version -After the post-receive hook is setup and your manifest has been added, +After the service hook is setup and your manifest has been added, publishing your plugin is as simple as tagging the version in git and pushing -the tag to GitHub. The post-receive hook will notify the plugins site that a +the tag to GitHub. The service hook will notify the plugins site that a new tag is available and the plugins site will take care of the rest! ```bash diff --git a/scripts/manager.js b/scripts/manager.js index 9f70173..d2373fd 100644 --- a/scripts/manager.js +++ b/scripts/manager.js @@ -1,3 +1,8 @@ +function wait() { + setTimeout( wait, 1000 ); +} +return wait(); + var path = require( "path" ), spawn = require( "child_process" ).spawn, logger = require( "../lib/logger" ), diff --git a/scripts/retry.js b/scripts/retry.js index cbe5fde..64c0b4d 100644 --- a/scripts/retry.js +++ b/scripts/retry.js @@ -87,6 +87,9 @@ var processFailures = function( fn ) { processFailures(function( error ) { if ( error ) { logger.error( "Error during retry: " + error.stack ); + + // Kill the process with an error code and let the manager restart it + process.exit( 1 ); } }); diff --git a/scripts/wordpress-update.js b/scripts/wordpress-update.js index 50df195..5abf49a 100644 --- a/scripts/wordpress-update.js +++ b/scripts/wordpress-update.js @@ -16,6 +16,13 @@ process.on( "uncaughtException", function( error ) { function isStable( version ) { return (/^\d+\.\d+\.\d+$/).test( version ); } +function extend( a, b ) { + for ( var p in b ) { + a[ p ] = b[ p ]; + } + + return a; +} var actions = {}; @@ -134,7 +141,10 @@ actions.addRelease = function( data, fn ) { // main page is constructed from the new version since pretty much // anything can change between versions. if ( versions.latest === manifest.version ) { - mainPage = Object.create( pageDetails ); + extend( mainPage, pageDetails ); + // don't update the post date on main page, and let it be set + // to whenever we processed it, no harm here. + delete mainPage.date; mainPage.name = manifest.name; mainPage.customFields = mergeCustomFields( existingCustomFields, pageDetails.customFields ); @@ -285,6 +295,9 @@ function processNextAction( actionId, fn ) { processActions(function( error ) { if ( error ) { logger.error( "Error updating WordPress: " + error.stack ); + + // Kill the process with an error code and let the manager restart it + process.exit( 1 ); } });