Module: Aptly
- Defined in:
- lib/aptly.rb,
lib/aptly/files.rb,
lib/aptly/errors.rb,
lib/aptly/publish.rb,
lib/aptly/tmpname.rb,
lib/aptly/version.rb,
lib/aptly/snapshot.rb,
lib/aptly/connection.rb,
lib/aptly/repository.rb,
lib/aptly/publishable.rb,
lib/aptly/configuration.rb,
lib/aptly/representation.rb
Overview
Aptly API
Defined Under Namespace
Modules: Errors, Publishable Classes: Configuration, Connection, Files, PublishedRepository, Repository, Representation, Snapshot
Constant Summary collapse
- VERSION =
'0.9.1'.freeze
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
-
.escape_prefix(prefix_path) ⇒ String
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/.
-
.publish(sources, prefix = '', source_kind = 'local', connection = Connection.new, **kwords) ⇒ PublishedRepository
Publish 1 or more sources into a public repository prefix.
Class Method Details
.configuration ⇒ Object
33 34 35 |
# File 'lib/aptly.rb', line 33 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
29 30 31 |
# File 'lib/aptly.rb', line 29 def configure yield configuration end |
.escape_prefix(prefix_path) ⇒ String
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/
62 63 64 |
# File 'lib/aptly.rb', line 62 def escape_prefix(prefix_path) prefix_path.tr('_', '__').tr('/', '_') end |
.publish(sources, prefix = '', source_kind = 'local', connection = Connection.new, **kwords) ⇒ PublishedRepository
Publish 1 or more sources into a public repository prefix.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/aptly.rb', line 43 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 = kwords.merge( SourceKind: source_kind, Sources: sources ) response = connection.send(:post, "/publish/#{prefix}", body: JSON.generate()) PublishedRepository.new(connection, JSON.parse(response.body)) end |