summaryrefslogtreecommitdiffstats
path: root/snapcraft.yaml
blob: eb620c0e1692157ef59724f1b939c515975f9866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: httpie
title: HTTPie
summary: Modern, user-friendly command-line HTTP client for the API era
description: |
  HTTPie *aitch-tee-tee-pie* is a user-friendly command-line HTTP client
  for the API era.
  It comes with JSON support, syntax highlighting, persistent sessions,
  wget-like downloads, plugins, and more.

  The project's goal is to make CLI interaction with web services as
  human-friendly as possible. HTTPie is designed for testing, debugging,
  and generally interacting with APIs & HTTP servers.
  The http & https commands allow for creating and sending arbitrary HTTP
  requests. They use simple and natural syntax and provide formatted and
  colorized output.

  Main features:
    - Built-in JSON support
    - Colorized and formatted terminal output
    - Sensible defaults for the API era
    - Persistent sessions
    - Forms and file uploads
    - HTTPS, proxies, and authentication support
    - Support for arbitrary request data and headers
    - Wget-like downloads
    - Extensions API
    - Expressive and intuitive syntax
    - Linux, macOS, Windows, and FreeBSD support
    - All that & more in 2 simple commands: http + https

  Links
    - Documentation: https://httpie.io/docs
    - Try in browser: https://httpie.io/run
    - GitHub: https://github.com/httpie/httpie
    - Twitter: https://twitter.com/httpie
    - Discord: https://httpie.io/chat
license: BSD-3-Clause-LBNL

# Automatically change the current version based on the source code
adopt-info: httpie

# https://snapcraft.io/docs/snapcraft-top-level-metadata#heading--icon
# icon:

base: core20
confinement: strict
grade: stable
compression: lzo

parts:
  httpie:
    source: .
    plugin: python

    # Guess the current version from sources
    override-pull: |
      snapcraftctl pull
      snapcraftctl set-version $(grep '__version__' httpie/__init__.py | cut -d"'" -f2)

    override-build: |
      snapcraftctl build

      echo "Adding HTTPie plugins ..."
      python -m pip install httpie-unixsocket
      python -m pip install httpie-snapdsocket

    override-prime: |
      snapcraftctl prime

      echo "Removing useless files ..."
      packages=$SNAPCRAFT_PRIME/lib/python3.8/site-packages
      rm -rfv $packages/pkg_resources/tests
      rm -rfv $packages/requests_unixsocket/test*

      echo "Compiling pyc files ..."
      python -m compileall -f $packages

      echo "Copying extra files ..."
      cp $SNAPCRAFT_PART_SRC/extras/httpie-completion.bash $SNAPCRAFT_PRIME/

plugs:
  dot-config-httpie:
    interface: personal-files
    write:
      - $HOME/.config/httpie
  dot-httpie:
    interface: personal-files
    write:
      - $HOME/.httpie

apps:
  http:
    command: bin/http
    plugs: &plugs
      - dot-config-httpie
      - dot-httpie
      - home
      - network
      - removable-media
    completer: httpie-completion.bash
    environment:
      LC_ALL: C.UTF-8

  https:
    command: bin/https
    plugs: *plugs
    completer: httpie-completion.bash
    environment:
      LC_ALL: C.UTF-8

  httpie:
    command: bin/httpie
    plugs: *plugs
    environment:
      LC_ALL: C.UTF-8