Class: PuppetX::Aptly::CliHelper
- Inherits:
-
Object
- Object
- PuppetX::Aptly::CliHelper
- Defined in:
- lib/puppet_x/voxpupuli/aptly/cli_helper.rb
Class Attribute Summary collapse
-
.aptly ⇒ Object
Returns the value of attribute aptly.
Class Method Summary collapse
- .mirror_create(name, url, distribution, options = {}) ⇒ Object
- .mirror_drop(name, options = {}) ⇒ Object
- .mirror_edit(name, options = {}) ⇒ Object
- .mirror_list(options = {}) ⇒ Object
- .mirror_update(name, options = {}) ⇒ Object
- .publish_drop(distribution, prefix, options = {}) ⇒ Object
- .publish_list(options = {}) ⇒ Object
- .publish_repo(names, prefix, options = {}) ⇒ Object
- .publish_snapshot(names, prefix, options = {}) ⇒ Object
- .publish_switch(distribution, prefix, snapshots, options = {}) ⇒ Object
- .publish_update(distribution, prefix, options = {}) ⇒ Object
- .repo_add(name, package_or_directory, options = {}) ⇒ Object
- .repo_create(name, options = {}) ⇒ Object
- .repo_drop(name, options = {}) ⇒ Object
- .repo_list(options = {}) ⇒ Object
- .repo_remove(name, package_query, options = {}) ⇒ Object
- .snapshot_create(name, from, options = {}) ⇒ Object
- .snapshot_drop(name, options = {}) ⇒ Object
- .snapshot_list(options = {}) ⇒ Object
Class Attribute Details
.aptly ⇒ Object
Returns the value of attribute aptly.
17 18 19 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 17 def aptly @aptly end |
Class Method Details
.mirror_create(name, url, distribution, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 20 def self.mirror_create(name, url, distribution, = {}) cmd = [@aptly, 'mirror', 'create'] cmd += () cmd << "-filter=#{[:filter]}" if [:filter] cmd << '-filter-with-deps' if [:filter_with_deps] cmd << '-force-architectures' if [:force_architectures] cmd << '-force-components' if [:force_components] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << "-max-tries=#{[:max_tries]}" if [:max_tries] cmd << '-with-installer' if [:with_installer] cmd << '-with-sources' if [:with_sources] cmd << '-with-udebs' if [:with_udebs] cmd += [name, url, distribution] cmd += Array([:component]) execute(cmd) end |
.mirror_drop(name, options = {}) ⇒ Object
57 58 59 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 57 def self.mirror_drop(name, = {}) something_drop('mirror', name, ) end |
.mirror_edit(name, options = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 61 def self.mirror_edit(name, = {}) cmd = [@aptly, 'mirror', 'edit'] cmd += () cmd << "-archive-url=#{[:archive_url]}" if [:archive_url] cmd << "-filter=#{[:filter]}" if [:filter] cmd << '-filter-with-deps' if [:filter_with_deps] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << '-with-installer' if [:with_installer] cmd << '-with-sources' if [:with_sources] cmd << '-with-udebs' if [:with_udebs] cmd << name execute(cmd) end |
.mirror_list(options = {}) ⇒ Object
53 54 55 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 53 def self.mirror_list( = {}) something_list('mirror', ) end |
.mirror_update(name, options = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 38 def self.mirror_update(name, = {}) cmd = [@aptly, 'mirror', 'update'] cmd += () cmd << "-download-limit=#{[:download_limit]}" if [:download_limit] cmd << "-downloader=#{[:downloader]}" if [:downloader] cmd << '-force' if [:force] cmd << '-ignore-checksums' if [:ignore_checksums] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << "-max-tries=#{[:max_tries]}" if [:max_tries] cmd << '-skip-existing-packages' if [:skip_existing_packages] cmd << name execute(cmd) end |
.publish_drop(distribution, prefix, options = {}) ⇒ Object
170 171 172 173 174 175 176 177 178 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 170 def self.publish_drop(distribution, prefix, = {}) cmd = [@aptly, 'publish', 'drop'] cmd += () cmd << '-force-drop' if [:force_drop] cmd << '-skip-cleanup' if [:skip_cleanup] cmd << distribution cmd << prefix execute(cmd) end |
.publish_list(options = {}) ⇒ Object
166 167 168 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 166 def self.publish_list( = {}) something_list('publish', ) end |
.publish_repo(names, prefix, options = {}) ⇒ Object
154 155 156 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 154 def self.publish_repo(names, prefix, = {}) publish_something('repo', names, prefix, ) end |
.publish_snapshot(names, prefix, options = {}) ⇒ Object
150 151 152 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 150 def self.publish_snapshot(names, prefix, = {}) publish_something('snapshot', names, prefix, ) end |
.publish_switch(distribution, prefix, snapshots, options = {}) ⇒ Object
158 159 160 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 158 def self.publish_switch(distribution, prefix, snapshots, = {}) publish_somehow('switch', distribution, prefix, snapshots, ) end |
.publish_update(distribution, prefix, options = {}) ⇒ Object
162 163 164 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 162 def self.publish_update(distribution, prefix, = {}) publish_somehow('update', distribution, prefix, nil, ) end |
.repo_add(name, package_or_directory, options = {}) ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 91 def self.repo_add(name, package_or_directory, = {}) cmd = [@aptly, 'repo', 'add'] cmd += () cmd << '-force-replace' if [:force_replace] cmd << '-remove-files' if [:remove_files] cmd << name cmd << package_or_directory execute(cmd) end |
.repo_create(name, options = {}) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 77 def self.repo_create(name, = {}) cmd = [@aptly, 'repo', 'create'] cmd += () cmd << "-comment=#{[:comment]}" if [:comment] cmd << "-component=#{[:component]}" if [:component] cmd << "-distribution=#{[:distribution]}" if [:distribution] cmd << "-uploaders-file=#{[:uploaders_file]}" if [:uploaders_file] cmd << name cmd += ['from', 'snapshot', [:snapshot]] if [:snapshot] execute(cmd) end |
.repo_drop(name, options = {}) ⇒ Object
115 116 117 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 115 def self.repo_drop(name, = {}) something_drop('repo', name, ) end |
.repo_list(options = {}) ⇒ Object
111 112 113 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 111 def self.repo_list( = {}) something_list('repo', ) end |
.repo_remove(name, package_query, options = {}) ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 102 def self.repo_remove(name, package_query, = {}) cmd = [@aptly, 'repo', 'remove'] cmd += () cmd << name cmd += Array(package_query) execute(cmd) end |
.snapshot_create(name, from, options = {}) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 119 def self.snapshot_create(name, from, = {}) cmd = [@aptly, 'snapshot', 'create'] cmd += () cmd << name case from when 'mirror' raise PuppetX::Aptly::Error, '`mirror` option should be defined' unless [:mirror] cmd += ['from', 'mirror', [:mirror]] when 'repo' raise PuppetX::Aptly::Error, '`repo` option should be defined' unless [:repo] cmd += ['from', 'repo', [:repo]] when 'empty' cmd += %w[empty] else raise PuppetX::Aptly::Error, '`from` argument must be one of: mirror, repo, empty' end execute(cmd) end |
.snapshot_drop(name, options = {}) ⇒ Object
146 147 148 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 146 def self.snapshot_drop(name, = {}) something_drop('snapshot', name, ) end |
.snapshot_list(options = {}) ⇒ Object
142 143 144 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 142 def self.snapshot_list( = {}) something_list('snapshot', ) end |