Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization of metadata blocks #717

Merged
merged 1 commit into from
Aug 24, 2015

Conversation

Martii
Copy link
Member

@Martii Martii commented Aug 24, 2015

Second attempt... needed the other boogs fixed first plus found one and missed UI metas

  • Use pegjs synchronously... I do have a portion of the routine for asynchronous (done first) but (sync) seems safer in the event of a production failure
  • Establish the OpenUserJS metadata block and migrate all (future) collaboration there
  • Store localized @name and @description... not currently in use but available
  • Some, but not all, line lengths in affected files wrapped according to STYLEGUIDE.md (very partial in this redo)
  • If no script description don't create the p tag on script lists
  • Some stray trailing commas removed Will mitigate this later
  • Some string constants shortened for error messages.. type 400 is Bad Request by standards and we shouldn't need to say that again. Will mitigate this later
  • Some DOC/UI changes to match

NOTE: Still needs mongoose DB migration otherwise all the meta values used don't show up

  • Bumping project version... e.g. once the mongoose (DB data) migration occurs there is no going back to a prior project version otherwise there will be possible DB corruption/failures (most notably the meta.js route) in older commit HEADS

Applies to #285


After some slumber and rechecks the modified migration routine should be able to knock things out on production... however I will need to take it offline later this evening to do this.

Second attempt... needed the other boogs fixed first plus found one and missed UI metas

* Use *pegjs* synchronously... I do have a portion of the routine for asynchronous *(done first)* but *(sync)* seems safer in the event of a production failure
* Establish the `OpenUserJS` metadata block and migrate all collaboration there
* Store localized `@name` and `@description`... not currently in use but available
* Some, but not all, line lengths in affected files wrapped according to STYLEGUIDE.md
* If no script description don't create the `p` tag on script lists
* Some stray trailing commas removed
* Some string constants shortened for error messages.. type 400 is Bad Request by standards and we shouldn't need to say that again.
* Some DOC/UI changes to match

**NOTE**: Still needs *mongoose* DB migration otherwise all the meta values used don't show up

* Bumping project version... e.g. once the *mongoose* *(DB data)* migration occurs there is no going back to a prior project version otherwise there will be possible DB corruption/failures *(most notably the meta.js route)* in older commit HEADS

Applies to OpenUserJS#285
@Martii Martii added UI Pertains inclusively to the User Interface. DB Pertains inclusively to the Database operations. migration Use this to indicate that it may apply to an existing or announced migration. DOC Pertains inclusively to the Documentation operations. CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. labels Aug 24, 2015
@Martii Martii added this to the #285 milestone Aug 24, 2015
@Martii Martii added the PR READY This is used to indicate that a pull request (PR) is ready for evaluation. label Aug 24, 2015
Martii added a commit that referenced this pull request Aug 24, 2015
Localization of metadata blocks

Auto-merge... dry run with migration on local pro and seems good to go... already did my account... taking production down to do this.
@Martii Martii merged commit 4d333d6 into OpenUserJS:master Aug 24, 2015
@Martii Martii deleted the Issue-285LocalizationOfMeta branch August 24, 2015 21:20
@Martii Martii removed the PR READY This is used to indicate that a pull request (PR) is ready for evaluation. label Aug 24, 2015
if (supportURL) {
script.hasSupport = true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw this was the boog I found...

@Martii
Copy link
Member Author

Martii commented Aug 24, 2015

Here is the asynchronous routine I did about two months ago for loading pegjs so I can delete this branch locally:

var parsers = null;
async.parallel([

  // Read in the UserScript pegjs grammar file and parse the content
  function (aCallback) {
    var filename = './public/pegjs/blockUserScript.pegjs';

    fs.readFile(filename, { encoding: 'utf8' }, function (aErr, aGrammar) {
        var parserUserScript = null;

        if (aErr) {
          return aCallback(aErr);
        }

        try {
          parserUserScript = PEG.buildParser(aGrammar, { allowedStartRules: ['line'] });
        } catch (aE) {
          return aCallback(aE);
        }

        aCallback(null, { UserScript: parserUserScript });
      });
  },

  // Read in the OpenUserJS pegjs grammar file and parse the content
  function (aCallback) {
    var filename = './public/pegjs/blockOpenUserJS.pegjs';

    fs.readFile(filename, { encoding: 'utf8' }, function (aErr, aGrammar) {
        var parserOpenUserJS = null;

        if (aErr) {
          return aCallback(aErr);
        }

        try {
          parserOpenUserJS = PEG.buildParser(aGrammar, { allowedStartRules: ['line'] });
        } catch (aE) {
          return aCallback(aE);
        }

        aCallback(null, { OpenUserJS : parserOpenUserJS });
      });
  }

], function (aErr, aParsers) {
  if (aErr) {
    throw aErr;
  }

  parsers = aParsers;
  exports.parsers = aParsers;
});

... this uses async to establish the parsers... I'm still a bit leery about doing that especially since it only helps startup time on VPS and gives the potential of parsers being null if there's a boog... would rather have dev/pro tell me straight out if there's a grammar issue.

Martii pushed a commit to Martii/UserScripts that referenced this pull request Aug 25, 2015
* End focusing on peg and restore half/half viewing
* Stop simulating the OpenUserJS metadata block since OUJS has support natively from OpenUserJS/OpenUserJS.org#285 via OpenUserJS/OpenUserJS.org#717

**NOTE** This will need some tweaking to dynamically handle any other blocks we may add for other sites should they choose to evolve this route just like OUJS is set up to do.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. DB Pertains inclusively to the Database operations. DOC Pertains inclusively to the Documentation operations. migration Use this to indicate that it may apply to an existing or announced migration. UI Pertains inclusively to the User Interface.
Development

Successfully merging this pull request may close these issues.

1 participant