Giter Site home page Giter Site logo

chocolatey-community / chocolatey-packages-template Goto Github PK

View Code? Open in Web Editor NEW
84.0 19.0 349.0 393 KB

A template to use when setting up to create packages both manual and automatic

License: Apache License 2.0

Batchfile 3.48% PowerShell 96.52%
hacktoberfest

chocolatey-packages-template's Introduction

Chocolatey Packages

<!-- EDIT ME-->

[![](https://ci.appveyor.com/api/projects/status/github/YOUR_GITHUB_USERNAME_HERE/chocolatey-packages?svg=true)](https://ci.appveyor.com/project/YOUR_GITHUB_USERNAME_HERE/chocolatey-packages)
[Update status](https://gist.github.com/YOUR_GITHUB_USERNAME_HERE/YOUR_GIST_ID)

<!-- REMOVE THE squiggles "~" surrounding this (this should not be a code block) -->

Chocolatey Packages Template

This contains Chocolatey packages, both manually and automatically maintained.

You can choose to use one or both of the different methods currently supported in the Chocolatey community for automatic packaging. They are AU (Automatic Updater) and Ketarin/ChocolateyPackageUpdater.

Folder Structure

  • automatic - where automatic packaging and packages are kept. These are packages that are automatically maintained using either AU or Ketarin/ChocolateyPackageUpdater combo.
  • icons - Where you keep icon files for the packages. This is done to reduce issues when packages themselves move around.
  • ketarin - where ketarin jobs (aka applications or searches) exported as XML are kept. This is done to allow ease of contribution.
  • manual - where packages that are not automatic are kept.
  • ops - scripts, jobs, and other items for ensuring automatic packaging.
  • setup - items for prepping the system to ensure for auto packaging.

For setting up your own automatic package repository, please see Automatic Packaging

Requirements

  • Chocolatey (choco.exe)

Ketarin / ChocolateyPackageUpdater

  • PowerShell v2+
  • Ketarin
  • Chocolatey Package Updater
  • A Windows box somewhere - to run the updater on - appveyor can't work until the import of the settings can be automated

AU

For daily operations check out the AU packages template README.

Getting started

  1. Fork this repository and rename it to chocolatey-packages (on GitHub - go into Settings, Repository name and rename).
  2. Clone the repository locally.
  3. Head into the setup folder and perform the proper steps for your choice of setup (or both if you plan to use both methods).
  4. Edit this README. Update the badges at the top.

Recommendation on Auto Packaging

AU provides more in the process of being completely automated, sending emails when things go wrong, and providing a nice report at the end. It doesn't have a bolt-on feeling to it that you see with Ketarin / ChocolateyPackageUdater, however the one thing it does lack in comparison is no visual feedback to seeing how searches for installers may be found. Other than that, it provides errors when things go wrong, where Ketarin doesn't consider anything that happens during "before run"/"post run updates" (where chocopkgup and checksumming occur) to be an error, even if those scripts error.

So for best visibility, enjoying the ease of using AppVeyor, and for a nice report of results, we recommend AU over Ketarin. You also don't need to deal with templates as AU works directly with the xml/ps1 files to do replacement.

Adapting your current source repository to this source repository template

You want to bring in all of your packages into the proper folders. We suggest using some sort of diffing tool to look at the differences between your current solution and this solution and then making adjustments to it. Pay special attention to the setup folder.

  1. Bring over the following files to your package source repository:
  • automatic\README.md
  • icons\README.md
  • ketarin\README.md
  • ketarin\_KetarinChocolateyTemplate.xml
  • manual\README.md
  • ops\*.*
  • setup\*.*
  • .appveyor.yml
  1. Inspect the following file and add the differences:
  • .gitignore

Use Both Methodologies

The way this source repository is designed, you can use both AU and Ketarin/ChocolateyPackageUpdater together. This is especially helpful when migrating existing packages from one methodology to the other.

Migrating existing Ketarin packages to AU

  1. Add an update.ps1 to the package folder and determine how to update the package using AU's instructions.
  2. Remove the ketarin.xml file from the ketarin folder.
  3. Ensure you also remove the package job from Ketarin itself as it doesn't automatically remove.

Special Notes

Ketarin

  • In Settings -> Global variables the variable autoPackagesFolder is used to determine where your automatic packages are. It doesn't matter what chocopkgup is using, this folder is passed through. Ensure this is set appropriately.
  • In Settings -> Global variables the variable saveDir is used to determine where to save the downloaded files from Ketarin. Please ensure the folder exists.
  • In Settings -> Global variables the variable nopush is set to --nopush, which allows checksum calculations to occur and then a custom script will push the files.
  • In Settings -> Global variables the variable cscript is set to 2, which means calculate checksums, rebuild, and push the packages. If you set this to 1 it will do everything except push the packages. Setting this to 1 is how you disable package pushing.
  • In Settings -> Global variables the variable checksum is set to {checksum}. Do not change this, this is how the post update script replaces the literal value {checksum}. The same goes for checksumx64, packageGuid, and url64.

chocolatey-packages-template's People

Contributors

elderry avatar ferventcoder avatar gep13 avatar jonasgroeger avatar lackovic avatar majkinetor 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chocolatey-packages-template's Issues

setup\au_setup.ps1 cannot be loaded. The file is not digitally signed

.\au_setup.ps1 : File C:\Users\User\git\chocolatey-packages-template\setup\au_setup.ps1 cannot be loaded. The file
C:\Users\User\git\chocolatey-packages-template\setup\au_setup.ps1 is not digitally signed. You cannot run this script
on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\au_setup.ps1
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

I get this error.

h

v

Improve QOL for Package Development and Testing

The workflow for users building and testing packages could be improved, e.g. with an argument completer for the update and test scripts to allow folk to tab-complete package IDs.

We could, at the same time, improve the readability and maintainability of the scripts by adding some light comment help and possibly doing a quick formatting pass, and switching from aliases to full names where possible.

e.g. chocolatey-community/chocolatey-packages#2498

Update default version of Chocolatey CLI installed.

Appveyor does not always have an updated version of Chocolatey CLI installed in the windows images; see appveyor/ci#3917

This can cause problems, for example pushing non-normalized versions to the Community Repository.

Therefore, it would be good if the default appveyor template had a step to upgrade Chocolatey CLI, potentially based on the chocolatey-community/chocolatey-packages appveyor.yaml:
https://github.com/chocolatey-community/chocolatey-packages/blob/55bf12c43ccc939bd5dd75beb36c31c36306f61b/.appveyor.yml#L58-L71

Add Github issue templates

For people using this template, it would be nice if they had some default github configuration. For example

  • An issue temple for outdated packages
  • An issue template for broken packages
  • An issue template to request a new feature for a package

[Tip] Invoke-WebRequest in AU update script

Just came across this when I was creating some packages using AU.

If you are using Invoke-WebRequest in the AU update script,
and one of the following happens:

  • When invoking the update.ps1 script manually it seems to hang and possibly throws an operation timed out.
  • When launching the update_all.ps1 script certain packages are never updated, they just show an empty version.
  • The following windows security warning dialogbox shows when starting from the PowerShell ISE:
    image

If any of these happen ty changing Invoke-WebRequest to Invoke-WebRequest -UseBasicParsing

Update example packages

The example packages are not completely up to date with best practices for Chocolatey packages.
It would be good to update the examples to best practices and/or switch them out for other packages (maybe from chocolatey-community/chocolatey-packages)
More examples of different types of packages would not be a bad thing as well.

The exe file Is not copied from the source url to the package folder during installation.

I created a package for exe application (exe is not a setup program, it is xcopy) like the template
https://github.com/chocolatey-community/chocolatey-packages-template/tree/master/automatic/1password

Then test the package using the command
Test-Package -Install
and pass ok, then I pushed the package to chocolatey site.
I expect that the exe file will be copied to the package location during the installation, but really the exe not copied and the package is not working.

What I missed to resolve the package installation and enable copying the exe as is on the package folder

Github Gist with 2FA

Hi!

I'm using GitHub with 2FA and in the file appveyor.yml I could not use this line:

- "ruby -e \"require 'gist'; Gist.login! username: ENV['github_user'], password: ENV['github_pass'] if ENV['github_user'] \""

If I do, the job at Appveyor just blocks (asking for a 2FA token).

Instead, I used my local machine, installed ruby, got the gist gem and logged running gist login. There I had to enter username and password. Another query comes up asking for a 2FA token. I enter it using my phone. A valid "Personal Access Token" (see https://github.com/settings/tokens) then is written into a file called ~/.gist.

In the appveyor.yml I added another line next to gist_id that says something like:

gist_token:
    secure: <YOUR_TOKEN_FROM_~/.gist>

Then, I replaced the - "ruby -e \"require ' ... line above with

  - ps: "$Env:gist_token | Out-File ~/.gist -Encoding ascii -NoNewline"

This should work for everybody with 2FA. I'm not sure how to submit this as a pull request since its kind of a special use case for people with 2FA "on" on Github. I'm also not sure how to put this into the appveyor.yml file since I'm not too experienced with Appveyor.

Change Template to Install AU

We should consider changing this template (and associated forks we control) to install AU from a built artifact rather than building it from bleeding edge each time, and taking time to run the tests, etc.

We could then potentially cache that installation, and gain a little speed.

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.