module Aptly
Aptly
API
Copyright (C) 2015-2018 Harald Sitter <sitter@kde.org>
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <www.gnu.org/licenses/>.
Aptly
API
Constants
- VERSION
The loaded version of the gem.
Public Class Methods
The global configuration instance.
# File lib/aptly.rb, line 35 def configuration @configuration ||= Configuration.new end
Configures aptly in a block.
# File lib/aptly.rb, line 30 def configure yield configuration end
Translates a pathish prefix (e.g. 'dev/unstable_x') to an API-safe prefix (e.g. 'dev_unstable__x') See prefix format description on www.aptly.info/doc/api/publish/ @return [String] API-safe prefix notation @since 0.7.0
# File lib/aptly.rb, line 71 def escape_prefix(prefix_path) prefix_path.gsub('_', '__').tr('/', '_') end
Publish 1 or more sources into a public repository prefix. @param sources [Array<Repository>] array of repositories to source @param prefix [String] prefix to publish under (i.e. published repo name).
This must be escaped (see {Aptly.escape_prefix})
@see Aptly.escape_prefix
@param source_kind [String] the source kind (local or snapshot) @return [PublishedRepository] newly published repository
# File lib/aptly.rb, line 52 def publish(sources, prefix = '', source_kind = 'local', connection = Connection.new, **kwords) # TODO: 1.0 break compat and invert the assertion to want unescaped raise Errors::InvalidPrefixError if prefix.include?('/') kwords = kwords.map { |k, v| [k.to_s.capitalize, v] }.to_h options = kwords.merge( SourceKind: source_kind, Sources: sources ) response = connection.send(:post, "/publish/#{prefix}", body: JSON.generate(options)) PublishedRepository.new(connection, JSON.parse(response.body)) end
Convenience shorthand for {Repository#get}. @since 0.10.0
# File lib/aptly.rb, line 41 def repo(name, connection = Connection.new, **kwords) Repository.get(name, connection, **kwords) end