jonschlinkert / grunt-readme

DEPRECATED. Use Verb instead
https://github.com/assemble/verb
Other
30 stars 10 forks source link

Can the task handle the repo without git? #35

Closed qcgm1978 closed 10 years ago

qcgm1978 commented 10 years ago

Hello: I try grunt-readme, but powershell prompts me like following:

The code at the last line of trace is:

 return config.repository.url.replace(/^git@([^:]+):(.+)(?:.git)/, 'https://$1/$2');

I doubt the error derives from no git in my repo.

Best Regards.

jonschlinkert commented 10 years ago

Ah, thanks for reporting this. I think this would be resolved by adding the following object to your package.json file:

  "repository": {
    "type": "git",
    "url": "git://github.com/assemble/handlebars-helpers-examples.git"
  },

The function is trying to find a repository object with a url property. Any url can be in the url prop.

I'll add some better error messages for this, and probably a try/catch or some logic to skip over it if the property doesn't exist

hariadi commented 10 years ago

Or just put your homepage url?

"homepage": "https://example.com/your/project"
jonschlinkert commented 10 years ago

I think the error is pointing to line 104 of mixins.js: return config.repository.url.replace(/^git@([^:]+):(.+)(?:.git)/, 'https://$1/$2');, which specifies repository.url.

jonschlinkert commented 10 years ago

Should be resolved, please reopen if this is still an issue

qcgm1978 commented 10 years ago

I installed the newest version 0.3.2, but command line prompts me

can't find module 'frep'

detailed info:

PS F:\PHPnow-1.5.6\htdocs\map> grunt readme -g gruntfile.js -t
Loading "readme.js" tasks...ERROR
>> Error: Cannot find module 'frep'

path.js:204
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at f (path.js:204:15)
    at Object.filter (native)
    at Object.exports.join (path.js:209:40)
    at Object.file.exists (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\file.js:371:28)
    at task.loadTasks (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\task.js:358:18)
    at Array.forEach (native)
    at Task.task.init (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\task.js:444:33)
    at Object.grunt.tasks (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt.js:113:8)
    at Object.module.exports [as cli] (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\cli.js:38:9)
    at Object.<anonymous> (C:\Users\qcgm1978\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:41:20)
jonschlinkert commented 10 years ago

Sorry! In trying to fix the first issue I caused another. It should be working now (I hope!)

qcgm1978 commented 10 years ago

Now one of my projects can generate readme file, but the other project can't until added author property in package.json. Thank you very much. It meets my demands now.

PS F:\PHPnow-1.5.6\htdocs\map> grunt readme -g gruntfile.js -s
Running "readme" task
Warning: name is not defined Use --force to continue.
ReferenceError: name is not defined
    at Function.exports.copyright (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt-readme\tasks\lib\mixins.js:77:72)
    at Object.<anonymous> (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt-readme\tasks\readme.js:75:24)
    at Object.thisTask.fn (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\task.js:78:16)
    at Object.<anonymous> (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\util\task.js:282:30)
    at Task.runTaskFn (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\util\task.js:235:24)
    at Task.<anonymous> (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\util\task.js:281:12)
    at Task.start (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\util\task.js:290:5)
    at Object.grunt.tasks (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt.js:155:8)
    at Object.module.exports [as cli] (F:\PHPnow-1.5.6\htdocs\map\node_modules\grunt\lib\grunt\cli.js:38:9)
    at Object.<anonymous> (C:\Users\qcgm1978\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:41:20)
jonschlinkert commented 10 years ago

I'm about to push up another fix for the copyright logic based on your error message, thanks.

jonschlinkert commented 10 years ago

fwiw, when I originally created this project I didn't realize others would find it useful lol. So some of the logic was somewhat specific to my own projects. your feedback is very helpful in making this more flexible and useful for projects besides my own, since use cases differ so much

qcgm1978 commented 10 years ago

I've seen your project info on twitter. I think it is very good for those who haven't time creat a simple but standard readme file.