danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

Bug using example.md file #8

Closed Neamar closed 10 years ago

Neamar commented 10 years ago

Hello, Using the example markdown provided https://raw.github.com/danielgtaylor/aglio/master/example.md and a default global aglio installation, I get this error:

aglio -i blueprint.md -o doc.html
>> Line 34: resource model can be specified only for a named resource, name your resource, e.g. '# <resource name> []' (error code 3)

Am i doing something wrong, or is the example not valid anymore?

abahdanovich commented 10 years ago

I have the same problem :\

danielgtaylor commented 10 years ago

I can't seem to reproduce this error. The example.md works fine for me after a clean install of all dependencies. Are you using some custom protagonist build? What's your OS?

abahdanovich commented 10 years ago

Ubuntu 13.10 64bit Default global installation, nothing custom (protagonist@0.6.0), node v0.10.21

Neamar commented 10 years ago

Same thing, except for node (v0.10.24)

zdne commented 10 years ago

The https://raw.github.com/danielgtaylor/aglio/master/example.md is indeed valid. Can we see the blueprint.md used in aglio -i blueprint.md -o doc.html.

Note you can also validate a blueprint using the Sublime Text 3 or snowcrash CLI tool or directly at apiblueprint.org. See https://github.com/apiaryio/apiary-client/issues/22#issuecomment-32169018 for details.

Neamar commented 10 years ago

blueprint.md was the exact copy from https://raw.github.com/danielgtaylor/aglio/master/example.md

zdne commented 10 years ago

@Neamar

the blueprint at the https://raw.github.com/danielgtaylor/aglio/master/example.md is valid: https://app.apiary.io/download/editor?from=https://raw.github.com/danielgtaylor/aglio/master/example.md (need to be logged into Apiary).

Are you 100% sure there were no unwanted edits in it? Can you try it again? Also here are some additional valid examples to experiment with...

Neamar commented 10 years ago

Example file (i checked again to be sure):

└[~/Documents/src/papiel/bd/cluestr-doc]> aglio -i example.md -o out.html
>> Line 34: resource model can be specified only for a named resource, name your resource, e.g. '# <resource name> []' (error code 3)

First example 1. Simplest API.md:

┌[neamar@neamar-laptop] [12:22] [blueprints] 
└[~/Documents/src/papiel/bd/cluestr-doc]> aglio -i 1.md -o out.html
[1]    1028 segmentation fault (core dumped)  aglio -i 1.md -o out.html

(probably related to #9)* Same things for samples 2, 3, 4, 5, 6, 7, and 8.

However, for file 9. Resource Model.md:

┌[neamar@neamar-laptop] [12:23] [blueprints ⚡] [139]
└[~/Documents/src/papiel/bd/cluestr-doc]> aglio -i blueprint.md -o out.html
>> {"code":1,"message":"parser exception: 'basic_string::substr'","location":[],"input":"FORMAT: X-1A\n\n# Resource Model API\nResource model is a [resource manifestation](http://www.w3.org/TR/di-gloss/#def-resource-manifestation). One particular represantation of your resource. \n\nFurthermore, in API Blueprint, any `resource model` you have defined can be referenced later saving you lots of time maintaining your API blueprint. You simply define a resource model as any payload (e. g. [request](https://github.com/apiaryio/api-blueprint/blob/master/examples/6.%20Requests.md) or [response](https://github.com/apiaryio/api-blueprint/blob/master/examples/5.%20Responses.md)) and then reference it later where you would normally write a `request` or `response`.\n\n## API Blueprint\n+ [Previous: Headers](8.%20Headers.md)\n+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/9.%20Resource%20Model.md)\n\n# Group Messages\nGroup of all messages-related resources.\n\n## My Message [/message]\n\n+ Model (application/vnd.siren+json)\n  \n    This is the `application/vnd.siren+json` message resource representation.\n\n    + Headers\n    \n            Location: http://api.acme.com/message            \n\n    + Body\n\n            {\n              \"class\": [ \"message\" ],\n              \"properties\": { \n                    \"message\": \"Hello World!\" \n              },\n              \"links\": [\n                    { \"rel\": \"self\" , \"href\": \"/message\" }\n              ]\n            }\n    \n### Retrieve a Message [GET]\nAt this point we will utilize our `Message` resource model and reference it in `Response 200`.\n\n+ Response 200\n\n    [My Message][]\n\n### Update a Message [PUT]\n\n+ Request Update Plain Text Message (text/plain)\n\n        All your base are belong to us.\n\n+ Request Update JSON Message (application/json)\n\n        { \"message\": \"All your base are belong to us.\" }\n\n+ Response 204\n"}
zdne commented 10 years ago

@Neamar

This is looks very fishy. As I can reproduce the crash can us add https://github.com/ddopson/node-segfault-handler somewhere to your local copy of aglio an reproduce the segfaults? The stack trace should help.

Note you need to use the latest segfault from GH repo, not the packaged NPM.

Neamar commented 10 years ago

So, i pulled the latest code from segfault-handler... and here is the stack trace, in all its glory:

┌[neamar@neamar-laptop] [13:56] [blueprints] [130]
└[~/Documents/src/papiel/bd/cluestr-doc]> aglio -i blueprint.md -o /tmp/o.html
/usr/lib/node_modules/aglio/bin
PID 5875 received SIGSEGV for address: 0x0
/usr/lib/node_modules/segfault-handler/build/Release/segfault_handler.node(+0x1035)[0x7fb033dfe035]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfbb0)[0x7fb03846bbb0]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13MapSourceDataERKSsRKSt6vectorINS_15SourceDataRangeESaIS3_EE+0x25d)[0x7fb033be77ed]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash21ParseDescriptionBlockINS_7PayloadEEESt4pairINS_6ResultEN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS6_SaIS6_EEEEERKNS_16BlueprintSectionERKSC_RKSsRT_+0x101)[0x7fb033bdb591]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash11BlockParserINS_7PayloadENS_13SectionParserIS1_EEE5ParseERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS7_SaIS7_EEEESF_RKNS_16BlueprintSectionERNS_19BlueprintParserCoreERS1_+0x7b1)[0x7fb033bddd21]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_6ActionEE13HandlePayloadERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_+0xb1)[0x7fb033bdf221]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_6ActionEE12ParseSectionERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_+0x373)[0x7fb033bdfe33]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_8ResourceEE12HandleActionERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_b+0x262)[0x7fb033be06e2]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_8ResourceEE12ParseSectionERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_+0x266)[0x7fb033be2846]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_13ResourceGroupEE14HandleResourceERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_+0x2d8)[0x7fb033be3308]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash13SectionParserINS_9BlueprintEE19HandleResourceGroupERKNS_16BlueprintSectionERKN9__gnu_cxx17__normal_iteratorIPKNS_13MarkdownBlockESt6vectorIS8_SaIS8_EEEERNS_19BlueprintParserCoreERS1_+0x4fe)[0x7fb033be411e]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash15BlueprintParser5ParseERKSsRKSt6vectorINS_13MarkdownBlockESaIS4_EEjRNS_6ResultERNS_9BlueprintE+0x18e)[0x7fb033be4f4e]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash6Parser5parseERKSsjRNS_6ResultERNS_9BlueprintE+0x295)[0x7fb033bbdda5]
/usr/lib/node_modules/aglio/node_modules/protagonist/build/Release/protagonist.node(_ZN9snowcrash5parseERKSsjRNS_6ResultERNS_9BlueprintE+0x23)[0x7fb033be6df3]
node[0x95cb8d]
node[0x9523b9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7f6e)[0x7fb038463f6e]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb03818e9cd]
[1]    5875 abort (core dumped)  aglio -i blueprint.md -o /tmp/o.html
zdne commented 10 years ago

Good news everyone! I have been able to track down the bug and fix it in the upstream!

@danielgtaylor can you please update to Protagonist v0.6.1 and confirm this issue is fixed?

This should also resolve Aglio Issues #9 and #10

danielgtaylor commented 10 years ago

I've updated the project dependencies, including switching to Protagonist 0.6.1. Can somebody with the problematic GCC version please test?

npm install -g git://github.com/danielgtaylor/aglio.git

If it works, let me know and I'll roll a release.

@zdne thanks for the fix!

Neamar commented 10 years ago

I can check that tomorrow. Great work ! On Jan 30, 2014 7:28 PM, "Daniel G. Taylor" notifications@github.com wrote:

I've updated the project dependencies, including switching to Protagonist 0.6.1. Can somebody with the problematic GCC version please test?

npm install -g git://github.com/danielgtaylor/aglio.git

If it works, let me know and I'll roll a release.

@zdne https://github.com/zdne thanks for the fix!

Reply to this email directly or view it on GitHubhttps://github.com/danielgtaylor/aglio/issues/8#issuecomment-33717280 .

Neamar commented 10 years ago

Hum... i'm on a loosy network and can't investigate much more for now, but here is my output:

└[/tmp/aglio]> sudo npm install -g git://github.com/danielgtaylor/aglio.git
... [npm status]
/usr/bin/aglio -> /usr/lib/node_modules/aglio/bin/aglio.js
aglio@1.11.0 /usr/lib/node_modules/aglio
├── marked@0.3.1
├── highlight.js@8.0.0
├── moment@2.5.1
├── coffee-script@1.7.1 (mkdirp@0.3.5)
├── optimist@0.6.0 (minimist@0.0.5, wordwrap@0.0.2)
├── cli-color@0.2.3 (es5-ext@0.9.2, memoizee@0.2.6)
├── stylus@0.42.2 (css-parse@1.7.0, debug@0.7.4, mkdirp@0.3.5, sax@0.5.8, glob@3.2.8)
├── jade@1.1.5 (character-parser@1.2.0, commander@2.1.0, mkdirp@0.3.5, monocle@1.1.51, transformers@2.1.0, with@2.0.0, constantinople@1.0.2)
└── protagonist@0.6.1
└[/tmp/aglio]> aglio -i example.md -o lol.html

module.js:340
    throw err;
          ^
Error: Cannot find module '../lib/bin'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/aglio/bin/aglio.js:3:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
danielgtaylor commented 10 years ago

Ah shoot, this won't work. You need to git clone and compile the coffeescript to javascript first. The alternative is for me to just roll a new release.

Neamar commented 10 years ago

Damn :p

Maybe we can avoid rolling a new release with potentially unstable code? Could you send me the JS files to run on neamar@neamar \ fr ? (or attach it to this issue)

Thank you for your help

On Mon, Feb 3, 2014 at 7:26 PM, Daniel G. Taylor notifications@github.comwrote:

Ah shoot, this won't work. You need to git clone and compile the coffeescript to javascript first. The alternative is for me to just roll a new release.

Reply to this email directly or view it on GitHubhttps://github.com/danielgtaylor/aglio/issues/8#issuecomment-33983846 .

danielgtaylor commented 10 years ago

@Neamar sorry about that, please just do a git checkout and then npm install and run ./bin/aglio.js to test. Once confirmed, I'll close this and #5 and do a release. Since it has been confirmed fixed upstream I may just do a release if this is too difficult to test.

Neamar commented 10 years ago

It works! Thanks for your help :)

suryassk commented 10 years ago

Hi, I am trying to install aglio and i get the follwoing error. protagonist@0.10.0 install C:\Users\gs1460\AppData\Roaming\npm\node_modules\aglio\node_modules\protagonist node-gyp rebuild

:\Users\gs1460\AppData\Roaming\npm\node_modules\aglio\node_modules\protagonist>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node- uilding the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. SBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 20 e component to the system path if it is installed elsewhere. [C:\Users\gs1460\AppData\Roaming\npm\node_modules\aglio\node_modules\protagonist\build\binding.sln] SBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 20 e component to the system path if it is installed elsewhere. [C:\Users\gs1460\AppData\Roaming\npm\node_modules\aglio\node_modules\protagonist\build\binding.sln] yp ERR! build error yp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1 yp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23) yp ERR! stack at ChildProcess.emit (events.js:98:17) yp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12) yp ERR! System Windows_NT 6.1.7601 yp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" yp ERR! cwd C:\Users\gs1460\AppData\Roaming\npm\node_modules\aglio\node_modules\protagonist yp ERR! node -v v0.10.29 yp ERR! node-gyp -v v0.13.1 yp ERR! not ok pm ERR! protagonist@0.10.0 install: node-gyp rebuild pm ERR! Exit status 1 pm ERR! pm ERR! Failed at the protagonist@0.10.0 install script. pm ERR! This is most likely a problem with the protagonist package, pm ERR! not with npm itself. pm ERR! Tell the author that this fails on your system: pm ERR! node-gyp rebuild pm ERR! You can get their info via: pm ERR! npm owner ls protagonist pm ERR! There is likely additional logging output above.

pm ERR! System Windows_NT 6.1.7601 pm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "aglio" pm ERR! cwd C:\Users\gs1460 pm ERR! node -v v0.10.29 pm ERR! npm -v 1.4.14 pm ERR! code ELIFECYCLE

How do i move forward.

danielgtaylor commented 10 years ago

@suryassk, from your output:

SBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this,
1) install the .NET Framework 2.0 SDK,
2) install Microsoft Visual Studio 20...e component to the system path if it is installed elsewhere. 
suryassk commented 10 years ago

Yes it did fix with thid On Aug 1, 2014 10:32 PM, "Daniel G. Taylor" notifications@github.com wrote:

@suryassk https://github.com/suryassk, from your output:

SBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 20...e component to the system path if it is installed elsewhere.

— Reply to this email directly or view it on GitHub https://github.com/danielgtaylor/aglio/issues/8#issuecomment-50951684.