language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/caveats.rb
@@ -1,12 +1,14 @@ -class Hbc::Caveats - def initialize(block) - @block = block - end +module Hbc + class Caveats + def initialize(block) + @block = block + end - def eval_and_print(cask) - dsl = Hbc::DSL::Caveats.new(cask) - retval = dsl.instance_eval(&@block) - return if retval.nil? - p...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/checkable.rb
@@ -1,51 +1,53 @@ -module Hbc::Checkable - def errors - Array(@errors) - end +module Hbc + module Checkable + def errors + Array(@errors) + end - def warnings - Array(@warnings) - end + def warnings + Array(@warnings) + end - def add_error(message) - @errors ||= [] - @errors ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli.rb
@@ -1,5 +1,3 @@ -class Hbc::CLI; end - require "optparse" require "shellwords" @@ -28,248 +26,250 @@ class Hbc::CLI; end require "hbc/cli/internal_help" require "hbc/cli/internal_stanza" -class Hbc::CLI - ALIASES = { - "ls" => "list", - "homepage" => "home", - "-S" ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/audit.rb
@@ -1,52 +1,56 @@ -class Hbc::CLI::Audit < Hbc::CLI::Base - def self.help - "verifies installability of Casks" - end - - def self.run(*args) - failed_casks = new(args, Hbc::Auditor).run - return if failed_casks.empty? - raise Hbc::CaskError, "audit failed for casks: #{failed_casks.join(" ")}" - end - - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/base.rb
@@ -1,21 +1,25 @@ -class Hbc::CLI::Base - def self.command_name - @command_name ||= name.sub(%r{^.*:}, "").gsub(%r{(.)([A-Z])}, '\1_\2').downcase - end +module Hbc + class CLI + class Base + def self.command_name + @command_name ||= name.sub(%r{^.*:}, "").gsub(%r{(.)([A-Z])}, '\1_\2').downcase + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/cat.rb
@@ -1,15 +1,19 @@ -class Hbc::CLI::Cat < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - # only respects the first argument - cask_token = cask_tokens.first.sub(%r{\.rb$}i, "") - cask_path = Hbc.path(cask_token) - r...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -1,108 +1,112 @@ -class Hbc::CLI::Cleanup < Hbc::CLI::Base - OUTDATED_DAYS = 10 - OUTDATED_TIMESTAMP = Time.now - (60 * 60 * 24 * OUTDATED_DAYS) - - def self.help - "cleans up cached downloads and tracker symlinks" - end - - def self.needs_init? - true - end +module Hbc + class CLI + class Cleanup < ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/create.rb
@@ -1,37 +1,41 @@ -class Hbc::CLI::Create < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - cask_token = cask_tokens.first.sub(%r{\.rb$}i, "") - cask_path = Hbc.path(cask_token) - odebug "Creating Cask #{cask_token}" +...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -1,205 +1,209 @@ -class Hbc::CLI::Doctor < Hbc::CLI::Base - def self.run - ohai "macOS Release:", render_with_none_as_error(MacOS.full_version) - ohai "Hardware Architecture:", render_with_none_as_error("#{Hardware::CPU.type}-#{Hardware::CPU.bits}") - ohai "Ruby Version:", render_with_none_as_error("#{RUBY...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -1,18 +1,22 @@ -class Hbc::CLI::Edit < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - # only respects the first argument - cask_token = cask_tokens.first.sub(%r{\.rb$}i, "") - cask_path = Hbc.path(cask_token) - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/fetch.rb
@@ -1,19 +1,23 @@ -class Hbc::CLI::Fetch < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - force = args.include? "--force" +module Hbc + class CLI + class Fetch < Base + def self.run(*args) + cask_tokens = ca...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/home.rb
@@ -1,18 +1,22 @@ -class Hbc::CLI::Home < Hbc::CLI::Base - def self.run(*cask_tokens) - if cask_tokens.empty? - odebug "Opening project homepage" - system "/usr/bin/open", "--", "http://caskroom.io/" - else - cask_tokens.each do |cask_token| - odebug "Opening homepage for Cask #{cask_token}...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/info.rb
@@ -1,65 +1,69 @@ -class Hbc::CLI::Info < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - cask_tokens.each do |cask_token| - odebug "Getting info for Cask #{cask_token}" - cask = Hbc.load(cask_token) +module Hbc + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -1,60 +1,63 @@ +module Hbc + class CLI + class Install < Base + def self.run(*args) + cask_tokens = cask_tokens_from(args) + raise CaskUnspecifiedError if cask_tokens.empty? + force = args.include? "--force" + skip_cask_deps = args.include? "--skip-cask-deps" + require_sha...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb
@@ -1,135 +1,139 @@ -class Hbc::CLI::InternalAuditModifiedCasks < Hbc::CLI::InternalUseBase - RELEVANT_STANZAS = %i{version sha256 url appcast}.freeze +module Hbc + class CLI + class InternalAuditModifiedCasks < InternalUseBase + RELEVANT_STANZAS = %i{version sha256 url appcast}.freeze + + class << self ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb
@@ -1,15 +1,19 @@ -class Hbc::CLI::InternalCheckurl < Hbc::CLI::InternalUseBase - def self.run(*args) - casks_to_check = args.empty? ? Hbc.all : args.map { |arg| Hbc.load(arg) } - casks_to_check.each do |cask| - odebug "Checking URL for Cask #{cask}" - checker = Hbc::UrlChecker.new(cask) - checker...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
@@ -1,30 +1,34 @@ -class Hbc::CLI::InternalDump < Hbc::CLI::InternalUseBase - def self.run(*arguments) - cask_tokens = cask_tokens_from(arguments) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - retval = dump_casks(*cask_tokens) - # retval is ternary: true/false/nil +module Hbc + class CLI + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
@@ -1,19 +1,23 @@ -class Hbc::CLI::InternalHelp < Hbc::CLI::InternalUseBase - def self.run(*_ignored) - max_command_len = Hbc::CLI.commands.map(&:length).max - puts "Unstable Internal-use Commands:\n\n" - Hbc::CLI.command_classes.each do |klass| - next if klass.visible - puts " #{klass.command_na...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -1,127 +1,131 @@ -class Hbc::CLI::InternalStanza < Hbc::CLI::InternalUseBase - # Syntax - # - # brew cask _stanza <stanza_name> [ --table | --yaml | --inspect | --quiet ] [ <cask_token> ... ] - # - # If no tokens are given, then data for all Casks is returned. - # - # The pseudo-stanza "artifacts" is avai...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/internal_use_base.rb
@@ -1,9 +1,13 @@ -class Hbc::CLI::InternalUseBase < Hbc::CLI::Base - def self.command_name - super.sub(%r{^internal_}i, "_") - end +module Hbc + class CLI + class InternalUseBase < Base + def self.command_name + super.sub(%r{^internal_}i, "_") + end - def self.visible - false + def ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -1,86 +1,90 @@ -class Hbc::CLI::List < Hbc::CLI::Base - def self.run(*arguments) - @options = {} - @options[:one] = true if arguments.delete("-1") - @options[:versions] = true if arguments.delete("--versions") +module Hbc + class CLI + class List < Base + def self.run(*arguments) + @options...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/search.rb
@@ -1,55 +1,59 @@ -class Hbc::CLI::Search < Hbc::CLI::Base - def self.run(*arguments) - render_results(*search(*arguments)) - end +module Hbc + class CLI + class Search < Base + def self.run(*arguments) + render_results(*search(*arguments)) + end - def self.extract_regexp(string) - if st...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/style.rb
@@ -1,69 +1,73 @@ require "English" -class Hbc::CLI::Style < Hbc::CLI::Base - def self.help - "checks Cask style using RuboCop" - end +module Hbc + class CLI + class Style < Base + def self.help + "checks Cask style using RuboCop" + end - def self.run(*args) - retval = new(args).run -...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
@@ -1,40 +1,44 @@ -class Hbc::CLI::Uninstall < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - force = args.include? "--force" +module Hbc + class CLI + class Uninstall < Base + def self.run(*args) + cask_tok...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/update.rb
@@ -1,16 +1,20 @@ -class Hbc::CLI::Update < Hbc::CLI::Base - def self.run(*_ignored) - result = Hbc::SystemCommand.run(Hbc.homebrew_executable, - args: %w[update]) - # TODO: separating stderr/stdout is undesirable here. - # Hbc::SystemCommand should have an option for ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/cli/zap.rb
@@ -1,15 +1,19 @@ -class Hbc::CLI::Zap < Hbc::CLI::Base - def self.run(*args) - cask_tokens = cask_tokens_from(args) - raise Hbc::CaskUnspecifiedError if cask_tokens.empty? - cask_tokens.each do |cask_token| - odebug "Zapping Cask #{cask_token}" - cask = Hbc.load(cask_token) - Hbc::Installer.ne...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container.rb
@@ -1,5 +1,3 @@ -class Hbc::Container; end - require "hbc/container/base" require "hbc/container/air" require "hbc/container/bzip2" @@ -22,47 +20,49 @@ class Hbc::Container; end require "hbc/container/xz" require "hbc/container/zip" -class Hbc::Container - def self.autodetect_containers - [ - Hbc::Conta...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/air.rb
@@ -1,33 +1,37 @@ require "hbc/container/base" -class Hbc::Container::Air < Hbc::Container::Base - INSTALLER_PATHNAME = - Pathname("/Applications/Utilities/Adobe AIR Application Installer.app" \ - "/Contents/MacOS/Adobe AIR Application Installer") - - def self.me?(criteria) - %w[.air].include?(cr...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/base.rb
@@ -1,37 +1,41 @@ -class Hbc::Container::Base - def initialize(cask, path, command, nested: false) - @cask = cask - @path = path - @command = command - @nested = nested - end +module Hbc + class Container + class Base + def initialize(cask, path, command, nested: false) + @cask = cask + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/bzip2.rb
@@ -2,17 +2,21 @@ require "hbc/container/base" -class Hbc::Container::Bzip2 < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^BZh}n) - end +module Hbc + class Container + class Bzip2 < Base + def self.me?(criteria) + criteria.magic_number(%r{^BZh}n) + end - de...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/cab.rb
@@ -2,25 +2,29 @@ require "hbc/container/base" -class Hbc::Container::Cab < Hbc::Container::Base - def self.me?(criteria) - cabextract = Hbc.homebrew_prefix.join("bin", "cabextract") +module Hbc + class Container + class Cab < Base + def self.me?(criteria) + cabextract = Hbc.homebrew_prefix.joi...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/criteria.rb
@@ -1,18 +1,22 @@ -class Hbc::Container::Criteria - attr_reader :path, :command +module Hbc + class Container + class Criteria + attr_reader :path, :command - def initialize(path, command) - @path = path - @command = command - end + def initialize(path, command) + @path = path + @...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/dmg.rb
@@ -3,123 +3,127 @@ require "hbc/container/base" -class Hbc::Container::Dmg < Hbc::Container::Base - def self.me?(criteria) - !criteria.command.run("/usr/bin/hdiutil", - # realpath is a failsafe against unusual filenames - args: ["imageinfo", Pathname.n...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/generic_unar.rb
@@ -2,25 +2,29 @@ require "hbc/container/base" -class Hbc::Container::GenericUnar < Hbc::Container::Base - def self.me?(criteria) - lsar = Hbc.homebrew_prefix.join("bin", "lsar") - lsar.exist? && - criteria.command.run(lsar, - args: ["-l", "-t", "--", criteria.path], -...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/gzip.rb
@@ -2,17 +2,21 @@ require "hbc/container/base" -class Hbc::Container::Gzip < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^\037\213}n) - end +module Hbc + class Container + class Gzip < Base + def self.me?(criteria) + criteria.magic_number(%r{^\037\213}n) + end...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/lzma.rb
@@ -2,22 +2,26 @@ require "hbc/container/base" -class Hbc::Container::Lzma < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^\]\000\000\200\000}n) - end +module Hbc + class Container + class Lzma < Base + def self.me?(criteria) + criteria.magic_number(%r{^\]\000\000\2...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/naked.rb
@@ -1,19 +1,23 @@ require "hbc/container/base" -class Hbc::Container::Naked < Hbc::Container::Base - # Either inherit from this class and override with self.me?(criteria), - # or use this class directly as "container type: :naked", - # in which case self.me? is not called. - def self.me?(*) - false - end +mo...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/otf.rb
@@ -1,7 +1,11 @@ require "hbc/container/naked" -class Hbc::Container::Otf < Hbc::Container::Naked - def self.me?(criteria) - criteria.magic_number(%r{^OTTO}n) +module Hbc + class Container + class Otf < Naked + def self.me?(criteria) + criteria.magic_number(%r{^OTTO}n) + end + end end ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/pkg.rb
@@ -1,9 +1,13 @@ require "hbc/container/naked" -class Hbc::Container::Pkg < Hbc::Container::Naked - def self.me?(criteria) - criteria.extension(%r{m?pkg$}) && - (criteria.path.directory? || - criteria.magic_number(%r{^xar!}n)) +module Hbc + class Container + class Pkg < Naked + def self.me?(c...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/rar.rb
@@ -1,8 +1,12 @@ require "hbc/container/generic_unar" -class Hbc::Container::Rar < Hbc::Container::GenericUnar - def self.me?(criteria) - criteria.magic_number(%r{^Rar!}n) && - super +module Hbc + class Container + class Rar < GenericUnar + def self.me?(criteria) + criteria.magic_number(%r{^...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/seven_zip.rb
@@ -1,9 +1,13 @@ require "hbc/container/generic_unar" -class Hbc::Container::SevenZip < Hbc::Container::GenericUnar - def self.me?(criteria) - # TODO: cover self-extracting archives - criteria.magic_number(%r{^7z}n) && - super +module Hbc + class Container + class SevenZip < GenericUnar + def se...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/sit.rb
@@ -1,8 +1,12 @@ require "hbc/container/generic_unar" -class Hbc::Container::Sit < Hbc::Container::GenericUnar - def self.me?(criteria) - criteria.magic_number(%r{^StuffIt}n) && - super +module Hbc + class Container + class Sit < GenericUnar + def self.me?(criteria) + criteria.magic_number(%...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/tar.rb
@@ -2,17 +2,21 @@ require "hbc/container/base" -class Hbc::Container::Tar < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^.{257}ustar}n) || - # or compressed tar (bzip2/gzip/lzma/xz) - IO.popen(["/usr/bin/tar", "-t", "-f", criteria.path.to_s], err: "/dev/null") { |io| !io....
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/ttf.rb
@@ -1,10 +1,14 @@ require "hbc/container/naked" -class Hbc::Container::Ttf < Hbc::Container::Naked - def self.me?(criteria) - # TrueType Font - criteria.magic_number(%r{^\000\001\000\000\000}n) || - # Truetype Font Collection - criteria.magic_number(%r{^ttcf}n) +module Hbc + class Container + cl...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/xar.rb
@@ -2,15 +2,19 @@ require "hbc/container/base" -class Hbc::Container::Xar < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^xar!}n) - end +module Hbc + class Container + class Xar < Base + def self.me?(criteria) + criteria.magic_number(%r{^xar!}n) + end - def ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/xip.rb
@@ -1,24 +1,28 @@ require "tmpdir" -class Hbc::Container::Xip < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^xar!}n) && - IO.popen(["/usr/bin/xar", "-t", "-f", criteria.path.to_s], err: "/dev/null") { |io| io.read =~ %r{\AContent\nMetadata\n\Z} } - end - - def extract - Dir...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/xz.rb
@@ -2,22 +2,26 @@ require "hbc/container/base" -class Hbc::Container::Xz < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^\xFD7zXZ\x00}n) - end +module Hbc + class Container + class Xz < Base + def self.me?(criteria) + criteria.magic_number(%r{^\xFD7zXZ\x00}n) + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/container/zip.rb
@@ -1,15 +1,19 @@ require "hbc/container/base" -class Hbc::Container::Zip < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^PK(\003\004|\005\006)}n) - end +module Hbc + class Container + class Zip < Base + def self.me?(criteria) + criteria.magic_number(%r{^PK(\003\004|\...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/download.rb
@@ -1,43 +1,45 @@ require "fileutils" require "hbc/verify" -class Hbc::Download - attr_reader :cask - - def initialize(cask, force: false) - @cask = cask - @force = force - end - - def perform - clear_cache - fetch - downloaded_path - end - - private - - attr_reader :force - attr_accessor :do...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/download_strategy.rb
@@ -6,327 +6,329 @@ # * Our overridden fetch methods are expected to return # a value: the successfully downloaded file. -class Hbc::AbstractDownloadStrategy - attr_reader :cask, :name, :url, :uri_object, :version - - def initialize(cask, command = Hbc::SystemCommand) - @cask = cask - @command = ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -1,7 +1,5 @@ require "set" -class Hbc::DSL; end - require "hbc/dsl/appcast" require "hbc/dsl/base" require "hbc/dsl/caveats" @@ -18,274 +16,276 @@ class Hbc::DSL; end require "hbc/dsl/uninstall_preflight" require "hbc/dsl/version" -class Hbc::DSL - ORDINARY_ARTIFACT_TYPES = [ - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/appcast.rb
@@ -1,17 +1,21 @@ -class Hbc::DSL::Appcast - attr_reader :parameters, :checkpoint +module Hbc + class DSL + class Appcast + attr_reader :parameters, :checkpoint - def initialize(uri, parameters = {}) - @parameters = parameters - @uri = Hbc::UnderscoreSupportingURI.parse(uri) - @chec...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/base.rb
@@ -1,29 +1,33 @@ -class Hbc::DSL::Base - extend Forwardable +module Hbc + class DSL + class Base + extend Forwardable - def initialize(cask, command = Hbc::SystemCommand) - @cask = cask - @command = command - end + def initialize(cask, command = SystemCommand) + @cask = cask + @c...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/caveats.rb
@@ -5,108 +5,112 @@ # ( The return value of the last method in the block is also sent # to the output by the caller, but that feature is only for the # convenience of Cask authors. ) -class Hbc::DSL::Caveats < Hbc::DSL::Base - def path_environment_variable(path) - puts <<-EOS.undent - To use #{@cask}, you...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/conflicts_with.rb
@@ -1,30 +1,34 @@ -class Hbc::DSL::ConflictsWith - VALID_KEYS = Set.new [ - :formula, - :cask, - :macos, - :arch, - :x11, - :java, - ] +module Hbc + cla...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/container.rb
@@ -1,26 +1,30 @@ -class Hbc::DSL::Container - VALID_KEYS = Set.new [ - :type, - :nested, - ] +module Hbc + class DSL + class Container + VALID_KEYS = Set.new [ + :type, + :nested, + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
@@ -1,124 +1,128 @@ require "rubygems" -class Hbc::DSL::DependsOn - VALID_KEYS = Set.new [ - :formula, - :cask, - :macos, - :arch, - :x11, - :java, - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/gpg.rb
@@ -1,43 +1,47 @@ -class Hbc::DSL::Gpg - KEY_PARAMETERS = Set.new [ - :key_id, - :key_url, - ] +module Hbc + class DSL + class Gpg + KEY_PARAMETERS = Set.new [ + :key_id, + ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/installer.rb
@@ -1,28 +1,32 @@ -class Hbc::DSL::Installer - VALID_KEYS = Set.new [ - :manual, - :script, - ] +module Hbc + class DSL + class Installer + VALID_KEYS = Set.new [ + :manual, + :script,...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/license.rb
@@ -1,66 +1,70 @@ -class Hbc::DSL::License - # a generic category can always be given as a license, so - # category names should be given as both key and value - VALID_LICENSES = { - # license category - unknown: :unknown, +module Hbc + class DSL + class Lice...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/postflight.rb
@@ -1,9 +1,13 @@ require "hbc/staged" -class Hbc::DSL::Postflight < Hbc::DSL::Base - include Hbc::Staged +module Hbc + class DSL + class Postflight < Base + include Staged - def suppress_move_to_applications(options = {}) - # TODO: Remove from all casks because it is no longer needed + def suppr...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/preflight.rb
@@ -1,3 +1,7 @@ -class Hbc::DSL::Preflight < Hbc::DSL::Base - include Hbc::Staged +module Hbc + class DSL + class Preflight < Base + include Staged + end + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb
@@ -1,45 +1,49 @@ -class Hbc::DSL::StanzaProxy - attr_reader :type - - def self.once(type) - resolved = nil - new(type) { resolved ||= yield } - end - - def initialize(type, &resolver) - @type = type - @resolver = resolver - end - - def proxy? - true - end - - def to_s - @resolver.call.to_s - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/uninstall_postflight.rb
@@ -1,2 +1,6 @@ -class Hbc::DSL::UninstallPostflight < Hbc::DSL::Base +module Hbc + class DSL + class UninstallPostflight < Base + end + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/uninstall_preflight.rb
@@ -1,5 +1,9 @@ require "hbc/staged" -class Hbc::DSL::UninstallPreflight < Hbc::DSL::Base - include Hbc::Staged +module Hbc + class DSL + class UninstallPreflight < Base + include Staged + end + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/dsl/version.rb
@@ -1,111 +1,115 @@ -class Hbc::DSL::Version < ::String - DIVIDERS = { - "." => :dots, - "-" => :hyphens, - "_" => :underscores, - "/" => :slashes, - }.freeze - - DIVIDER_REGEX = %r{(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})} - - MAJOR...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/exceptions.rb
@@ -1,146 +1,148 @@ -class Hbc::CaskError < RuntimeError; end +module Hbc + class CaskError < RuntimeError; end -class Hbc::AbstractCaskErrorWithToken < Hbc::CaskError - attr_reader :token + class AbstractCaskErrorWithToken < CaskError + attr_reader :token - def initialize(token) - @token = token + def...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/extend/hash.rb
@@ -2,6 +2,6 @@ class Hash def assert_valid_keys(*valid_keys) unknown_keys = keys - valid_keys return if unknown_keys.empty? - raise Hbc::CaskError, %Q{Unknown keys: #{unknown_keys.inspect}. Running "#{UPDATE_CMD}" will likely fix it.} + raise CaskError, %Q{Unknown keys: #{unknown_keys.inspect}. Runn...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/fetcher.rb
@@ -1,22 +1,24 @@ require "open3" -class Hbc::Fetcher - TIMEOUT = 10 +module Hbc + class Fetcher + TIMEOUT = 10 - def self.head(url) - if url.to_s =~ %r{googlecode} - googlecode_fake_head(url) - else - Hbc::SystemCommand.run("/usr/bin/curl", - args: ["--max-time", ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -4,344 +4,346 @@ require "hbc/staged" require "hbc/verify" -class Hbc::Installer - # TODO: it is unwise for Hbc::Staged to be a module, when we are - # dealing with both staged and unstaged Casks here. This should - # either be a class which is only sometimes instantiated, or there - # sho...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/locations.rb
@@ -1,196 +1,198 @@ -module Hbc::Locations - def self.included(base) - base.extend(ClassMethods) - end - - module ClassMethods - def legacy_caskroom - @legacy_caskroom ||= Pathname.new("/opt/homebrew-cask/Caskroom") +module Hbc + module Locations + def self.included(base) + base.extend(ClassMetho...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/macos.rb
@@ -2,377 +2,377 @@ require "os/mac/version" -module OS::Mac - SYSTEM_DIRS = [ - "/", - "/Applications", - "/Applications/Utilities", - "/Incompatible Software", - "/Library", - "/Library/Application Support", - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/options.rb
@@ -1,37 +1,39 @@ -module Hbc::Options - def self.included(base) - base.extend(ClassMethods) - end +module Hbc + module Options + def self.included(base) + base.extend(ClassMethods) + end - module ClassMethods - attr_writer :no_binaries + module ClassMethods + attr_writer :no_binaries -...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/pkg.rb
@@ -1,113 +1,115 @@ -class Hbc::Pkg - def self.all_matching(regexp, command) - command.run("/usr/sbin/pkgutil", args: ["--pkgs=#{regexp}"]).stdout.split("\n").map { |package_id| - new(package_id.chomp, command) - } - end +module Hbc + class Pkg + def self.all_matching(regexp, command) + command.ru...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/qualified_token.rb
@@ -1,37 +1,39 @@ -module Hbc::QualifiedToken - REPO_PREFIX = "homebrew-".freeze +module Hbc + module QualifiedToken + REPO_PREFIX = "homebrew-".freeze - # per https://github.com/Homebrew/homebrew/blob/4c7bc9ec3bca729c898ee347b6135ba692ee0274/Library/Homebrew/cmd/tap.rb#L121 - USER_REGEX = %r{[a-z_\-]+} + #...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/scopes.rb
@@ -1,45 +1,47 @@ -module Hbc::Scopes - def self.included(base) - base.extend(ClassMethods) - end - - module ClassMethods - def all - @all_casks ||= {} - all_tokens.map { |t| @all_casks[t] ||= load(t) } +module Hbc + module Scopes + def self.included(base) + base.extend(ClassMethods) en...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source.rb
@@ -1,5 +1,3 @@ -module Hbc::Source; end - require "hbc/source/gone" require "hbc/source/path_slash_required" require "hbc/source/path_slash_optional" @@ -8,30 +6,32 @@ module Hbc::Source; end require "hbc/source/tapped" require "hbc/source/uri" -module Hbc::Source - def self.sources - [ - Hbc::Source::...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/gone.rb
@@ -1,19 +1,23 @@ -class Hbc::Source::Gone - def self.me?(query) - Hbc::WithoutSource.new(query).installed? - end +module Hbc + module Source + class Gone + def self.me?(query) + WithoutSource.new(query).installed? + end - attr_reader :query + attr_reader :query - def initialize(que...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/path_base.rb
@@ -1,69 +1,73 @@ require "rubygems" -class Hbc::Source::PathBase - # derived classes must define method self.me? +module Hbc + module Source + class PathBase + # derived classes must define method self.me? - def self.path_for_query(query) - query_string = query.to_s - Pathname.new(query_string.en...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/path_slash_optional.rb
@@ -1,8 +1,12 @@ require "hbc/source/path_base" -class Hbc::Source::PathSlashOptional < Hbc::Source::PathBase - def self.me?(query) - path = path_for_query(query) - path.exist? +module Hbc + module Source + class PathSlashOptional < PathBase + def self.me?(query) + path = path_for_query(query)...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/path_slash_required.rb
@@ -1,8 +1,12 @@ require "hbc/source/path_base" -class Hbc::Source::PathSlashRequired < Hbc::Source::PathBase - def self.me?(query) - path = path_for_query(query) - path.to_s.include?("/") && path.exist? +module Hbc + module Source + class PathSlashRequired < PathBase + def self.me?(query) + p...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/tapped.rb
@@ -1,35 +1,39 @@ -class Hbc::Source::Tapped - def self.me?(query) - path_for_query(query).exist? - end +module Hbc + module Source + class Tapped + def self.me?(query) + path_for_query(query).exist? + end - def self.path_for_query(query) - # Repeating Hbc.all_tokens is very slow for ope...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
@@ -1,22 +1,26 @@ require "hbc/source/tapped" -class Hbc::Source::TappedQualified < Hbc::Source::Tapped - def self.me?(query) - return if (tap = tap_for_query(query)).nil? +module Hbc + module Source + class TappedQualified < Tapped + def self.me?(query) + return if (tap = tap_for_query(query)).n...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb
@@ -1,10 +1,14 @@ require "hbc/source/tapped_qualified" -class Hbc::Source::UntappedQualified < Hbc::Source::TappedQualified - def self.me?(query) - return if (tap = tap_for_query(query)).nil? +module Hbc + module Source + class UntappedQualified < TappedQualified + def self.me?(query) + return i...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/source/uri.rb
@@ -1,28 +1,32 @@ -class Hbc::Source::URI - def self.me?(query) - !(query.to_s =~ URI.regexp).nil? - end +module Hbc + module Source + class URI + def self.me?(query) + !(query.to_s =~ ::URI.regexp).nil? + end - attr_reader :uri + attr_reader :uri - def initialize(uri) - @uri = u...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/staged.rb
@@ -1,48 +1,50 @@ -module Hbc::Staged - def info_plist_file(index = 0) - index = 0 if index == :first - index = 1 if index == :second - index = -1 if index == :last - Hbc.appdir.join(@cask.artifacts[:app].to_a.at(index).first, "Contents", "Info.plist") - end - - def plist_exec(cmd) - @command.run!("...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -1,173 +1,179 @@ require "open3" require "shellwords" -class Hbc::SystemCommand - attr_reader :command +module Hbc + class SystemCommand + attr_reader :command - def self.run(executable, options = {}) - new(executable, options).run! - end + def self.run(executable, options = {}) + new(executa...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/topological_hash.rb
@@ -1,12 +1,14 @@ require "tsort" # a basic topologically sortable hashmap -class Hbc::TopologicalHash < Hash - include TSort +module Hbc + class TopologicalHash < Hash + include TSort - alias tsort_each_node each_key + alias tsort_each_node each_key - def tsort_each_child(node, &block) - fetch(nod...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/underscore_supporting_uri.rb
@@ -1,26 +1,28 @@ require "uri" -module Hbc::UnderscoreSupportingURI - def self.parse(maybe_uri) - return nil if maybe_uri.nil? - URI.parse(maybe_uri) - rescue URI::InvalidURIError => e - scheme, host, path = simple_parse(maybe_uri) - raise e unless path && host.include?("_") - URI.parse(without_hos...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/url.rb
@@ -1,37 +1,39 @@ require "forwardable" -class Hbc::URL - FAKE_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10) http://caskroom.io".freeze +module Hbc + class URL + FAKE_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10) http://caskroom.io".freeze - attr_reader :using, :revision, :trust_cert, :...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/url_checker.rb
@@ -1,75 +1,77 @@ require "hbc/checkable" -class Hbc::UrlChecker - attr_accessor :cask, :response_status, :headers +module Hbc + class UrlChecker + attr_accessor :cask, :response_status, :headers - include Hbc::Checkable + include Checkable - def initialize(cask, fetcher = Hbc::Fetcher) - @cask = ca...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/utils.rb
@@ -1,5 +1,3 @@ -module Hbc::Utils; end - require "yaml" require "open3" require "stringio" @@ -43,155 +41,157 @@ def odebug(title, *sput) puts sput unless sput.empty? end -module Hbc::Utils - def self.which(cmd, path = ENV["PATH"]) - unless File.basename(cmd) == cmd.to_s - # cmd contains a directory ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/utils/file.rb
@@ -1,12 +1,14 @@ -module Hbc::Utils - module_function +module Hbc + module Utils + module_function - def file_locked?(file) - unlocked = File.open(file).flock(File::LOCK_EX | File::LOCK_NB) - # revert lock if file was unlocked before check - File.open(file).flock(File::LOCK_UN) if unlocked - !unloc...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/verify.rb
@@ -1,33 +1,33 @@ -module Hbc::Verify; end - require "hbc/verify/checksum" require "hbc/verify/gpg" -module Hbc::Verify - module_function +module Hbc + module Verify + module_function - def verifications - [ - Hbc::Verify::Checksum - # TODO: Hbc::Verify::Gpg - ] - end + def verifications...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/verify/checksum.rb
@@ -1,43 +1,47 @@ require "digest" -class Hbc::Verify::Checksum - def self.me?(cask) - return true unless cask.sha256 == :no_check - ohai "No checksum defined for Cask #{cask}, skipping verification" - false - end - - attr_reader :cask, :downloaded_path - - def initialize(cask, downloaded_path) - @ca...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/verify/gpg.rb
@@ -1,60 +1,64 @@ -class Hbc::Verify::Gpg - def self.me?(cask) - cask.gpg - end +module Hbc + module Verify + class Gpg + def self.me?(cask) + cask.gpg + end - attr_reader :cask, :downloaded_path + attr_reader :cask, :downloaded_path - def initialize(cask, downloaded_path, command =...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/lib/hbc/without_source.rb
@@ -1,15 +1,17 @@ -class Hbc::WithoutSource < Hbc::Cask - # Override from `Hbc::DSL` because we don't have a cask source file to work - # with, so we don't know the cask's `version`. - def staged_path - (caskroom_path.children - [metadata_master_container_path]).first - end +module Hbc + class WithoutSource < C...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/spec/spec_helper.rb
@@ -29,7 +29,9 @@ require "hbc" -class Hbc::TestCask < Hbc::Cask; end +module Hbc + class TestCask < Cask; end +end TEST_TMPDIR = Dir.mktmpdir("homebrew_cask_tests") at_exit do
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/cask/cli/create_test.rb
@@ -1,17 +1,21 @@ require "test_helper" # monkeypatch for testing -class Hbc::CLI::Create - def self.exec_editor(*command) - editor_commands << command - end +module Hbc + class CLI + class Create + def self.exec_editor(*command) + editor_commands << command + end - def self.reset! - ...
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/cask/cli/edit_test.rb
@@ -1,17 +1,21 @@ require "test_helper" # monkeypatch for testing -class Hbc::CLI::Edit - def self.exec_editor(*command) - editor_commands << command - end - - def self.reset! - @editor_commands = [] - end - - def self.editor_commands - @editor_commands ||= [] +module Hbc + class CLI + class Edit ...
true