Coder Social home page Coder Social logo

cookiecutter-git's People

Contributors

nathanurwin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cookiecutter-git's Issues

Add note about $PATH

Cookiecutter must be installed with pip rather than system package managers (apt, brew, etc.) or else the invoke bin dir won't be in $PATH. Thanks @dylantyates for the heads up! ๐Ÿ‘

What's the point of the "format_python" and "copy_cookie" tasks?

Hello there, sweet cookie it helped me setup a bunch of repos, thanks ๐Ÿ‘

I had no use for the python tasks though, so I wondered what they're meant for?

Why format python code on an empty directory?
Also why have a script copy static files into the target? Can't it be done manually, beforehand in the repo slug template?

May-be it's to avoid duplicating code between parent/child repos?

Fix cookiecutter overwrite if exists option

$ cookiecutter gh:nathanurwin/cookiecutter-git --no-input -f
Removing '/home/user/Projects/.github/cookiecutter-git-demo/NOTICE'...
git init
Reinitialized existing Git repository in /home/user/Projects/.github/cookiecutter-git-demo/.git/

git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

git add -A
git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

1: ['git', 'commit', '-m', 'Initial commit']
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

Traceback (most recent call last):
  File "/tmp/tmp4emWQB.py", line 201, in <module>
    main()
  File "/tmp/tmp4emWQB.py", line 196, in main
    setup_git_repo()
  File "/tmp/tmp4emWQB.py", line 123, in setup_git_repo
    run(['git', 'commit', '-m', 'Initial commit'])
  File "/tmp/tmp4emWQB.py", line 34, in run
    raise error
subprocess.CalledProcessError: Command '['git', 'commit', '-m', 'Initial commit']' returned non-zero exit status 1
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Add note about forking

Let users know that if they're forking to provide their own default prompt values there are better ways!

  • Using .cookiecutterrc config file #23
  • Using cookiecutter gh:nathanurwin/cookiecutter-git --no-input remote_provider="gitlab.com"
  • Using cookiecutter gh:nathanurwin/cookiecutter-git --replay

Fix local tests with tox

To test different python versions, i.e. 2.7, 3.4, 3.5, 3.6, and 3.7 without having to commit and push.

Fix Windows TypeError

Traceback (most recent call last):
  File "c:\users\user\appdata\local\temp\tmp3fjavw.py", line 138, in <module>
    main()
  File "c:\users\user\appdata\local\temp\tmp3fjavw.py", line 133, in main
    setup_git_repo()
  File "c:\users\user\appdata\local\temp\tmp3fjavw.py", line 125, in setup_git_repo
    create_remote_repo()
  File "c:\users\user\appdata\local\temp\tmp3fjavw.py", line 97, in create_remote_repo
    getpass.getpass(prompt).strip())
  File "c:\python27\lib\getpass.py", line 95, in win_getpass
    msvcrt.putch(c)
TypeError: putch() argument 1 must be char, not unicode

Fix tests on Windows

$ pipenv run inv tests
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov=.
  inifile: None
  rootdir: C:\Users\user\Projects\nathanurwin\cookiecutter-git

Fix urllib2 URLError urlopen error

I put in an empty github password and this happened.

Traceback (most recent call last):
  File "/var/folders/1b/24l2xs_d4yl6kfk37bmv4z740000gn/T/tmpxBSc3r.py", line 207, in <module>
    main()
  File "/var/folders/1b/24l2xs_d4yl6kfk37bmv4z740000gn/T/tmpxBSc3r.py", line 202, in main
    setup_git_repo()
  File "/var/folders/1b/24l2xs_d4yl6kfk37bmv4z740000gn/T/tmpxBSc3r.py", line 165, in setup_git_repo
    requests.post(create_remote_url, data=data, headers=headers)
  File "/var/folders/1b/24l2xs_d4yl6kfk37bmv4z740000gn/T/tmpxBSc3r.py", line 79, in post
    return cls._request(url, headers, data, log)
  File "/var/folders/1b/24l2xs_d4yl6kfk37bmv4z740000gn/T/tmpxBSc3r.py", line 53, in _request
    response = urlopen(req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)>
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Add gitlab_token validation

Currently, the error message does not stand out. Need to add invalid gitlab token exception handling to print a clearer error message.

Fix gitlab.com as remote_provider

Bug report

Fix gitlab.com as remote_provider

Describe the bug

410 Gone: https://gitlab.com/api/v3/namespaces?search=NathanUrwin
{"error":"API V3 is no longer supported. Use API V4 instead."}

To Reproduce

Steps to reproduce the behavior:

  1. Install requirements
  2. Run cookiecutter-git
  3. Choose gitlab.com as remote_provider

Expected behavior

201 created

Desktop (please complete the following information):

  • OS: Debian GNU/Linux
  • Version: 8 Jessie

Add builtin subprocess/urllib support

Use invoke and requests by default, but fallback to the standard library subprocess and urllib packages if possible. This will make cookiecutter the only required dependency, and hopefully allow more users to use the project.

Add example .cookiecutterrc

Feature request

Add example .cookiecutterrc to see default config in shell form.

Is your feature request related to a problem? Please describe.

Would help address .cookiecutterrc problems for noobs like myself.

Describe the solution you'd like

An example .cookiecutterrc on the master branch of this repo.

Bitbucket remote repo failed

After input of password to my account from command line I received exception:

Traceback (most recent call last):
File "/tmp/tmpr61y4z6r.py", line 203, in
main()
File "/tmp/tmpr61y4z6r.py", line 198, in main
setup_git_repo()
File "/tmp/tmpr61y4z6r.py", line 129, in setup_git_repo
auth_base = base64.b64encode('{}:{}'.format(*auth_info))
File "/home/oshcherbyna/PycharmProjects/test_venv/lib/python3.6/base64.py", line 58, in b64encode
encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'
Stopping generation because post_gen_project hook script didn't exit successfully

Refactor cookiecutter.json keys

Keys should be more verbose, make more sense, and generally just be clearer in what is being asked. Such as {{cookiecutter.repository_slug}} over {{cookiecutter.repo_name}}.

Fix codecov on AppVeyor

      _____          _
     / ____|        | |
    | |     ___   __| | ___  ___ _____   __
    | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |  __/ (_| (_) \ V /
     \_____\___/ \____|\___|\___\___/ \_/
                                    v2.0.15
==> Detecting CI provider
    AppVeyor Detected
==> Preparing upload
    Error running `cd 'C:\projects\cookiecutter-git' && git ls-files`: None
==> Processing gcov (disable by -X gcov)
    Executing gcov (find 'C:\projects\cookiecutter-git' -not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**' -type f -name '*.gcno'  -exec gcov -pb  {} +)
    Error running `find 'C:\projects\cookiecutter-git' -not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**' -type f -name '*.gcno'  -exec gcov -pb  {} +`: None
==> Collecting reports
XX> Searching for reports disabled
    Generating coverage xml reports for Python
    + C:\projects\cookiecutter-git\coverage.xml bytes=12690
==> Uploading
    .url https://codecov.io
    .query service=appveyor&package=py2.0.15&job=NathanUrwin%2Fcookiecutter-git%2Fv0.5.1%2Bappveyor.8&build=7bbbwhasw858k7f3&branch=master&commit=758dd04cb92b3b1def7a59639c72c4ad938dc535&slug=NathanUrwin%2Fcookiecutter-git
    Pinging Codecov...
    Direct to s3 failed. Using backup v2 endpoint.
    Uploading to Codecov...
    HTTP 404
Not Found
Error: 404 Client Error: Not Found for url: https://codecov.io/upload/v2?service=appveyor&package=py2.0.15&job=NathanUrwin%2Fcookiecutter-git%2Fv0.5.1%2Bappveyor.8&build=7bbbwhasw858k7f3&branch=master&commit=758dd04cb92b3b1def7a59639c72c4ad938dc535&slug=NathanUrwin%2Fcookiecutter-git

Fix commit GPG signing on Windows

gpg: cannot open tty `no tty': No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Temp\tmpw7r37qjr.py", line 429, in <module>
    main()
  File "C:\Users\user\AppData\Local\Temp\tmpw7r37qjr.py", line 424, in main
    PostGenProjectHook().run()
  File "C:\Users\user\AppData\Local\Temp\tmpw7r37qjr.py", line 416, in run
    self._git_repo()
  File "C:\Users\user\AppData\Local\Temp\tmpw7r37qjr.py", line 368, in _git_repo
    self.git_commit()
  File "C:\Users\user\AppData\Local\Temp\tmpw7r37qjr.py", line 220, in git_commit
    run("git commit --message {}".format(quote(message)))
  File "c:\python37\lib\site-packages\invoke\__init__.py", line 40, in run
    return Context().run(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\context.py", line 93, in run
    return self._run(runner, command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\context.py", line 100, in _run
    return runner.run(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\runners.py", line 268, in run
    return self._run_body(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\runners.py", line 401, in _run_body
    raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!

Command: 'git commit --message ^"Initial commit^"'

Exit code: 128

Stdout: already printed

Stderr: already printed


ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Fix Windows support

Password for 'https://NathanUrwin@github.com':
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Password for 'https://NathanUrwin@github.com': No error
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 384, in <module>
    main()
  File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 379, in main
    PostGenProjectHook().run()
  File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 371, in run
    self._git_repo()
  File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 328, in _git_repo
    self._git_push()
  File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 265, in _git_push
    watchers=watchers,
  File "c:\python37\lib\site-packages\invoke\__init__.py", line 49, in run
    return Context().run(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\context.py", line 94, in run
    return self._run(runner, command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\context.py", line 101, in _run
    return runner.run(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\runners.py", line 271, in run
    return self._run_body(command, **kwargs)
  File "c:\python37\lib\site-packages\invoke\runners.py", line 404, in _run_body
    raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!

Command: 'git push --set-upstream origin master'

Exit code: 128

Stdout: already printed

Stderr: already printed


ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.