class Cli
Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Public Class Methods
settings=(s)
click to toggle source
# File lib/cli.rb, line 25 def self.settings= s @@settings = s end
Public Instance Methods
create(name, version=nil, release_date=nil)
click to toggle source
# File lib/cli.rb, line 200 def create name, version=nil, release_date=nil @@settings.manifest_path = "." creator = Creator.new @@settings, name if creator.is_new? if !version && release_date || version && !release_date STDERR.puts "You need to specify both, version and release date" exit 1 end if version && release_date if options[:kf5] creator.create_kf5 version, release_date else creator.create version, release_date end else creator.create_generic end else if !version || !release_date STDERR.puts "Updating manifest requires version and release_date" exit 1 end creator.validate_directory creator.update version, release_date end end
create_kde_frameworks(checkout_dir, output_dir)
click to toggle source
# File lib/cli.rb, line 240 def create_kde_frameworks checkout_dir, output_dir k = KdeFrameworksCreator.new if options["ignore-errors-homepage"] k.parse_checkout checkout_dir, :ignore_errors => [ "link_home_page" ] else k.parse_checkout checkout_dir end k.create_manifests output_dir k.errors.each do |error| puts "#{error[:name]}: #{error[:issue]}" end if options["show-warnings"] k.warnings.each do |warning| puts "#{warning[:name]}: #{warning[:issue]} (#{warning[:details]})" end end end
download(name)
click to toggle source
# File lib/cli.rb, line 299 def download(name) handler = ManifestHandler.new(@@settings) handler.read_remote manifest = handler.manifest(name) if !manifest STDERR.outs "Manifest for '#{name}' not found" exit 1 else Downloader.new(handler, STDOUT).download(name, Dir.pwd) end end
get_involved()
click to toggle source
# File lib/cli.rb, line 270 def get_involved Upstream.print_info end
global()
click to toggle source
# File lib/cli.rb, line 30 def global if options[:version] CliController.print_versions(Distro.detect) else Cli.help shell end end
install(name)
click to toggle source
# File lib/cli.rb, line 288 def install name handler = ManifestHandler.new @@settings manifest = handler.manifest name if !manifest STDERR.puts "Manifest for '#{name}' not found" else Distro.detect.install manifest, :dry_run => options[:dry_run] end end
list()
click to toggle source
# File lib/cli.rb, line 41 def list process_global_options options handler = ManifestHandler.new @@settings handler.read_remote if options[:remote] handler.libraries.each do |library| puts library.name + " (" + library.versions.join(", ") + ")" end else manifests = Distro.detect.installed handler manifests.each do |manifest| puts manifest["name"] end end end
parse_kde_readme(path)
click to toggle source
# File lib/cli.rb, line 228 def parse_kde_readme path k = KdeFrameworksCreator.new k.parse_readme(path) pp k.framework(k.frameworks.first) end
release_kde_frameworks(release_date, version)
click to toggle source
# File lib/cli.rb, line 260 def release_kde_frameworks release_date, version process_global_options options handler = ManifestHandler.new @@settings k = KdeFrameworksRelease.new handler k.read_generic_manifests k.write_release_manifests release_date, version end
review(repo, action = nil)
click to toggle source
# File lib/cli.rb, line 164 def review repo, action = nil if !action GitHubTool.review repo elsif action == "accept" GitHubTool.accept repo else STDERR.puts "Unknown review action: '#{action}'" exit 1 end end
show(name)
click to toggle source
# File lib/cli.rb, line 103 def show name Upstream.get_involved "Add command for showing library details", 1 end
system_scan()
click to toggle source
# File lib/cli.rb, line 182 def system_scan m = RpmManifestizer.new @@settings m.dry_run = options[:dry_run] if options[:recreate_source_cache] m.create_source_cache end if options[:recreate_qt_source_cache] m.create_qt_source_cache end m.process_all_rpms end
uninstall(name)
click to toggle source
# File lib/cli.rb, line 275 def uninstall name handler = ManifestHandler.new @@settings manifest = handler.manifest name if !manifest STDERR.puts "Manifest for '#{name}' not found" else Distro.detect.uninstall manifest end end
verify(filename=nil)
click to toggle source
# File lib/cli.rb, line 110 def verify filename=nil process_global_options options v = Verifier.new @@settings if options[:check_links] Upstream.get_involved "Implement --check-links option", 11 exit 1 end errors = [] if filename result = v.verify_file filename result.print_result else handler = ManifestHandler.new @@settings handler.read_remote count_ok = 0 count_warning = 0 handler.libraries.each do |library| library.manifests.each do |manifest| result = v.verify manifest result.print_result if result.valid? count_ok += 1 else errors.push result end if result.has_warnings? count_warning +=1 end end end puts puts "#{handler.manifests.count} manifests checked. #{count_ok} ok, " + "#{errors.count} with error, " + "#{count_warning} #{count_warning == 1 ? "has warning." : "have warnings."}" if !errors.empty? puts puts "Errors:" errors.each do |error| puts " #{error.name}" error.errors.each do |e| puts " #{e}" end end exit 1 end end end
view()
click to toggle source
# File lib/cli.rb, line 71 def view process_global_options options output_dir = options[:output_dir] if options[:manifest_dir] @@settings.manifest_path = options[:manifest_dir] end manifest_handler = ManifestHandler.new(@@settings) manifest_handler.read_remote view = View.new(manifest_handler) view.templates = options[:templates] if !view.template_directory_exists? STDERR.puts "Error: Templates directory doesn't exist" exit 1 else puts "Creating web site in '#{output_dir}' from '#{manifest_handler.settings.manifest_path}'" view.enable_disqus = options[:enable_disqus] view.enable_search = !options[:disable_search] view.create output_dir end end
Private Instance Methods
process_global_options(options)
click to toggle source
# File lib/cli.rb, line 313 def process_global_options options @@settings.offline = options[:offline] if options[:manifest_dir] @@settings.manifest_path = options[:manifest_dir] end end