aptly_cli 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +18 -0
- data/Dockerfile +19 -0
- data/README.md +16 -0
- data/Rakefile +30 -0
- data/bin/aptly-cli +10 -9
- data/lib/aptly_cli/version.rb +1 -1
- data/lib/aptly_publish.rb +13 -8
- data/lib/aptly_repo.rb +0 -1
- data/lib/aptly_snapshot.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWM3OGM4ZGE3MTY0NGZkMzRkMzliNDk5MjE3ZjFhOTUyZjcxMmY2Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2QyYWZlNjdiMmMxMGUzODZjMjZkOTNmYTVjMTAxNTEzMTMwMDBlYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGEwZmI1MTMxNDg4ZDJhNWYwMjI3MDY1MjM3MjJkOTZkYjJhM2Y3YmQ4ZGY5
|
10
|
+
MDNmZDlhNTI4OTY0NDQzMGVkYjA0Y2YyMDI5ZTUxYzBmMDFlZTVmMGY3ZGUz
|
11
|
+
OTgyYmJkNGEyNTdkYTAyNGQ5ZDBjNWNjODJlYjc2ZmZiNzZmMWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzgxN2JlMGY4N2EzYTBiNDExMTAxYTcyMDkwZWMxNjQ5OWRmMzY1ODJmY2Uy
|
14
|
+
YzYxMWU1ZDQ2MTc1ZDhlNWVkMThkZDMzNWUwY2FhNzAzNTVjNjEwNWJjNzk4
|
15
|
+
NDM2MDlkYWFkZmQwYjAxOWZiOWM4MjcxNjFlODQwMDc3NDFiNTE=
|
data/.travis.yml
CHANGED
@@ -1,9 +1,27 @@
|
|
1
|
+
sudo: required
|
2
|
+
|
1
3
|
language: ruby
|
4
|
+
|
5
|
+
services:
|
6
|
+
- docker
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- rake docker_build
|
10
|
+
- rake docker_run
|
11
|
+
- docker ps -a
|
12
|
+
|
13
|
+
script:
|
14
|
+
- bundle exec rake test
|
15
|
+
|
16
|
+
after_script:
|
17
|
+
- rake docker_show_logs
|
18
|
+
|
2
19
|
rvm:
|
3
20
|
- 1.9.3
|
4
21
|
- 2.2.0
|
5
22
|
- 2.2.4
|
6
23
|
- 2.3.0
|
24
|
+
|
7
25
|
deploy:
|
8
26
|
provider: rubygems
|
9
27
|
api_key:
|
data/Dockerfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
FROM debian:jessie
|
2
|
+
|
3
|
+
EXPOSE 8080
|
4
|
+
|
5
|
+
RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list; \
|
6
|
+
apt-key adv --keyserver keys.gnupg.net --recv-keys 2A194991; \
|
7
|
+
apt-get update; \
|
8
|
+
apt-get install aptly curl xz-utils bzip2 gnupg wget graphviz -y --force-yes; \
|
9
|
+
wget --quiet http://mirror.as24220.net/pub/ubuntu-archive/pool/main/z/zeitgeist/zeitgeist_0.9.0-1_all.deb -O /tmp/zeitgeist_0.9.0-1_all.deb; \
|
10
|
+
wget --quiet http://mirror.as24220.net/pub/ubuntu-archive/pool/main/z/zsh/zsh_5.1.1-1ubuntu1_i386.deb -O /tmp/zsh_5.1.1-1ubuntu1_i386.deb
|
11
|
+
|
12
|
+
ADD ./test/fixtures/aptly.conf /etc/aptly.conf
|
13
|
+
|
14
|
+
RUN aptly repo create testrepo
|
15
|
+
RUN aptly repo create testrepo20
|
16
|
+
RUN aptly repo add testrepo /tmp/zeitgeist_0.9.0-1_all.deb
|
17
|
+
RUN aptly repo add testrepo20 /tmp/zsh_5.1.1-1ubuntu1_i386.deb
|
18
|
+
|
19
|
+
CMD /usr/bin/aptly api serve
|
data/README.md
CHANGED
@@ -79,6 +79,22 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
79
79
|
|
80
80
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
81
81
|
|
82
|
+
Ruby Minitest are impleneted using Docker container for functional tests
|
83
|
+
|
84
|
+
Rake tasks available:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
rake build # Build aptly_cli-<version>.gem into the pkg directory
|
88
|
+
rake docker_build # Docker build image
|
89
|
+
rake docker_list_aptly # List Docker Aptly running containers
|
90
|
+
rake docker_run # Start Aptly Docker container on port 8082
|
91
|
+
rake docker_stop # Stop running Aptly Docker containers
|
92
|
+
rake install # Build and install aptly_cli-<version>.gem into system gems
|
93
|
+
rake install:local # Build and install aptly_cli-<version>.gem into system gems without network access
|
94
|
+
rake test # Run tests
|
95
|
+
```
|
96
|
+
|
97
|
+
|
82
98
|
## Contributing
|
83
99
|
|
84
100
|
1. Fork it ( https://github.com/[my-github-username]/aptly_cli/fork )
|
data/Rakefile
CHANGED
@@ -10,3 +10,33 @@ Rake::TestTask.new do |t|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
task default: :test
|
13
|
+
|
14
|
+
desc "Docker build image"
|
15
|
+
task :docker_build do
|
16
|
+
sh %{docker build -t sepulworld/aptly_api .}
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "List Docker Aptly running containers"
|
20
|
+
task :docker_list_aptly do
|
21
|
+
sh %{docker ps --filter ancestor='sepulworld/aptly_api' --format="{{.ID}}"}
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Stop running Aptly Docker containers"
|
25
|
+
task :docker_stop do
|
26
|
+
sh %{docker stop $(docker ps --filter ancestor='sepulworld/aptly_api' --format="{{.ID}}")}
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Start Aptly Docker container on port 8082"
|
30
|
+
task :docker_run do
|
31
|
+
sh %{docker run -d -p 8082:8080 sepulworld/aptly_api /bin/sh -c "aptly api serve"}
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Show running Aptly process Docker stdout logs"
|
35
|
+
task :docker_show_logs do
|
36
|
+
sh %{docker logs $(docker ps --filter ancestor='sepulworld/aptly_api' --format="{{.ID}}")}
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Restart Aptly docker container"
|
40
|
+
task :docker_restart => [:docker_stop, :docker_run] do
|
41
|
+
puts "Restarting docker Aptly container"
|
42
|
+
end
|
data/bin/aptly-cli
CHANGED
@@ -89,7 +89,7 @@ command :repo_edit do |c|
|
|
89
89
|
c.syntax = 'aptly-cli repo_edit [options]'
|
90
90
|
c.summary = 'Edit a local repository metadata, requires --name'
|
91
91
|
c.description = 'Edit a local repository metadata, requires --name'
|
92
|
-
c.example '
|
92
|
+
c.example 'Change default distribution', 'aptly-cli repo_edit --name megatronsoftware --default_distribution trusty'
|
93
93
|
c.option '--name NAME', String, 'Local repository name, required'
|
94
94
|
c.option '--comment COMMENT', String, 'Edit repository comment'
|
95
95
|
c.option '--default_distribution DISTRIBUTION', String, 'Edit DefaultDistribution for repo'
|
@@ -182,7 +182,7 @@ command :publish_drop do |c|
|
|
182
182
|
c.syntax = 'aptly-cli publish_drop [options]'
|
183
183
|
c.summary = 'Delete published repository, clean up files in published directory.'
|
184
184
|
c.description = 'Delete published repository'
|
185
|
-
c.example 'Delete publish repository
|
185
|
+
c.example 'Delete publish repository prefix precisetest', 'aptly-cli publish_drop --distribution precisetest'
|
186
186
|
c.option '--prefix PREFIX', String, 'prefix, optional'
|
187
187
|
c.option '--distribution DISTRIBUTION', String, 'distribution'
|
188
188
|
c.option '--force', 'force published repository removal even if component cleanup fails'
|
@@ -207,19 +207,19 @@ command :publish_repo do |c|
|
|
207
207
|
c.syntax = 'aptly-cli publish_repo [options]'
|
208
208
|
c.summary = 'Publish local repository or snapshot under specified prefix. Storage might be passed in prefix as well, e.g. s3:packages/. To supply empty prefix, just remove last part (POST /api/publish/:prefix/<:repos>or<:snapshots>'
|
209
209
|
c.description = 'Publish local repository or snapshot under specified prefix'
|
210
|
-
c.example '
|
211
|
-
c.example '
|
212
|
-
c.example '
|
210
|
+
c.example 'publish multiple repos as source', 'aptly-cli publish_repo --sourcekind local --name precise/megatronsoftware,trusty/rocksoftware22 --architectures i386 amd64'
|
211
|
+
c.example 'publish one repo, two archs, forceoverwrite', 'aptly-cli publish_repo --sourcekind local --name megatronsoftware --architectures i386 amd64 --forceoverwrite true'
|
212
|
+
c.example 'publish 2 snapshots into one publish point', 'aptly-cli publish_repo --sourcekind snapshot --name precise/rocksoftware300,main/rocksoftware200 --label test_snap'
|
213
213
|
c.example 'description', 'aptly-cli publish_repo --sourcekind snapshot --name precise/rocksoftware300 --origin testorigin'
|
214
214
|
c.example 'publish repo with signing keyring', 'aptly-cli publish_repo --sourcekind snapshot --name precise/rocksoftware300 --origin testorigin --gpg_keyring /etc/apt/trustdb.gpg'
|
215
|
-
c.option '--name NAME',
|
215
|
+
c.option '--name NAME', Array, 'Local repository name with optional component, required'
|
216
216
|
c.option '--sourcekind SOURCEKIND', String, 'Local for local repositories and snapshot for snapshots, required'
|
217
217
|
c.option '--prefix PREFIX', String, 'prefix'
|
218
218
|
c.option '--distribution DISTRIBUTION', String, 'Distribution name, if missing aptly would try to guess from sources'
|
219
219
|
c.option '--label LABEL', String, 'value of Label: field in published repository stanza'
|
220
220
|
c.option '--origin ORIGIN', String, 'value of Origin: field in published repository stanza'
|
221
221
|
c.option '--forceoverwrite', 'when publishing, overwrite files in pool/ directory without notice'
|
222
|
-
c.option '--architectures ARCHITECTURES',
|
222
|
+
c.option '--architectures ARCHITECTURES', Array, 'override list of published architectures'
|
223
223
|
c.option '--gpg_skip', 'Don’t sign published repository'
|
224
224
|
c.option '--gpg_batch', 'should be set if passing passphrase'
|
225
225
|
c.option '--gpg_key GPGKEY', String, 'gpg key name (local to aptly server/user)'
|
@@ -256,10 +256,11 @@ command :publish_update do |c|
|
|
256
256
|
c.option '--gpg_passphrase_file GPGPASSFILE', String, 'gpg passphrase file (local to aptly server/user)'
|
257
257
|
c.action do |args, options|
|
258
258
|
aptly_command = AptlyCli::AptlyPublish.new
|
259
|
-
puts aptly_command.publish_update(
|
259
|
+
puts aptly_command.publish_update({ :prefix => options.prefix, :distribution => options.distribution, :forceoverwrite => options.forceoverwrite,
|
260
260
|
:skip => options.gpg_skip, :batch => options.gpg_batch, :gpgKey => options.gpg_key,
|
261
261
|
:keyring => options.gpg_keyring, :secretKeyring => options.gpg_secret_keyring,
|
262
|
-
:passphrase => options.gpg_passphrase, :passphraseFile => options.gpg_passphrase_file
|
262
|
+
:passphrase => options.gpg_passphrase, :passphraseFile => options.gpg_passphrase_file,
|
263
|
+
:snapshots => options.snapshots})
|
263
264
|
end
|
264
265
|
end
|
265
266
|
|
data/lib/aptly_cli/version.rb
CHANGED
data/lib/aptly_publish.rb
CHANGED
@@ -45,7 +45,15 @@ module AptlyCli
|
|
45
45
|
self.class.get(uri)
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def _parse_snapshots(names)
|
49
|
+
snapshots_to_publish = []
|
50
|
+
names.each_pair do |k, v|
|
51
|
+
snapshots_to_publish << { Component: v.to_s, Name: k.to_s }
|
52
|
+
end
|
53
|
+
return snapshots_to_publish
|
54
|
+
end
|
55
|
+
|
56
|
+
def _parse_names(names, label_type)
|
49
57
|
repos_to_publish = []
|
50
58
|
names = [names] if names.is_a? String
|
51
59
|
names.each do |k|
|
@@ -82,7 +90,7 @@ module AptlyCli
|
|
82
90
|
def publish_repo(names, publish_options={})
|
83
91
|
uri = '/publish'
|
84
92
|
label_type = 'Name'
|
85
|
-
repos =
|
93
|
+
repos = _parse_names(names, label_type)
|
86
94
|
gpg_options = parse_gpg_options(@@available_gpg_options,
|
87
95
|
publish_options)
|
88
96
|
@body = {}
|
@@ -99,16 +107,13 @@ module AptlyCli
|
|
99
107
|
body: @body_json)
|
100
108
|
end
|
101
109
|
|
102
|
-
def publish_update(
|
110
|
+
def publish_update(publish_options={})
|
103
111
|
uri = '/publish'
|
104
|
-
label_type = 'Snapshots'
|
105
112
|
gpg_options = parse_gpg_options(@@available_gpg_options, publish_options)
|
106
113
|
@body = {}
|
107
|
-
unless snapshots.nil?
|
108
|
-
|
109
|
-
@body[:Snapshots] = snapshots
|
114
|
+
unless publish_options[:snapshots].nil?
|
115
|
+
@body[:Snapshots] = _parse_snapshots(publish_options[:snapshots])
|
110
116
|
end
|
111
|
-
|
112
117
|
unless gpg_options.empty?
|
113
118
|
@body[:Signing] = gpg_options
|
114
119
|
end
|
data/lib/aptly_repo.rb
CHANGED
data/lib/aptly_snapshot.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptly_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- .ruby-style.yml
|
126
126
|
- .travis.yml
|
127
127
|
- CODE_OF_CONDUCT.md
|
128
|
+
- Dockerfile
|
128
129
|
- Gemfile
|
129
130
|
- LICENSE.txt
|
130
131
|
- README.md
|
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.4.
|
167
|
+
rubygems_version: 2.4.3
|
167
168
|
signing_key:
|
168
169
|
specification_version: 4
|
169
170
|
summary: Command line client to interact with Aptly package management system
|