From 9770cc8829d6fdacd1ae02e1f78fcf270e5a5503 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 4 Nov 2023 14:13:59 +0100 Subject: [PATCH] Remove gem and rake support files --- .rubocop.yml | 41 ---------------------------- Gemfile | 15 ----------- Gemfile.lock | 48 --------------------------------- app/Main.hs | 8 ------ app/SlackBuilder/CommandLine.hs | 13 --------- config/config.rb.example | 7 ----- lib/SlackBuilder/Download.hs | 17 ------------ lib/download.rb | 40 --------------------------- lib/package.rb | 24 ----------------- Rakefile => private/hhvm.rb | 28 ++++++++++++++++++- 10 files changed, 27 insertions(+), 214 deletions(-) delete mode 100644 .rubocop.yml delete mode 100644 Gemfile delete mode 100644 Gemfile.lock delete mode 100644 config/config.rb.example delete mode 100644 lib/download.rb delete mode 100644 lib/package.rb rename Rakefile => private/hhvm.rb (87%) diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 02cb8ff..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,41 +0,0 @@ -AllCops: - Exclude: - - 'vendor/**/*' - - '.git/**/*' - - 'slackbuilds/**/*' - - 'bin/bundle' - - 'bin/cap*' - - 'bin/rake' - - 'bin/rspec' - - 'bin/rubocop' - - 'bin/setup' - - 'bin/spring' - - 'bin/update' - - 'pkg/**/*' - - TargetRubyVersion: '3.0' - NewCops: enable - SuggestExtensions: false - -Style/Documentation: - Enabled: false - -# False-Positive: non-string-variable + 'some string' -Style/StringConcatenation: - Enabled: false - -Layout/MultilineMethodCallIndentation: - EnforcedStyle: indented - -Layout/MultilineOperationIndentation: - EnforcedStyle: indented - -Layout/ArgumentAlignment: - EnforcedStyle: with_fixed_indentation - -Layout/EndAlignment: - EnforcedStyleAlignWith: variable - -Metrics/BlockLength: - AllowedMethods: - - namespace diff --git a/Gemfile b/Gemfile deleted file mode 100644 index f760775..0000000 --- a/Gemfile +++ /dev/null @@ -1,15 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -# frozen_string_literal: true - -source 'https://rubygems.org' - -git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } - -gem 'rake', '~> 13.0' -gem 'rubocop', '~> 1.53.1', require: false - -gem 'progressbar', '~> 1.11' -gem 'term-ansicolor', '~> 1.7' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 80f2329..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,48 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - ast (2.4.2) - json (2.6.3) - language_server-protocol (3.17.0.3) - parallel (1.23.0) - parser (3.2.2.3) - ast (~> 2.4.1) - racc - progressbar (1.13.0) - racc (1.7.1) - rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.2.6) - rubocop (1.53.1) - json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) - parser (>= 3.2.2.3) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - ruby-progressbar (1.13.0) - sync (0.5.0) - term-ansicolor (1.7.1) - tins (~> 1.0) - tins (1.32.1) - sync - unicode-display_width (2.4.2) - -PLATFORMS - ruby - -DEPENDENCIES - progressbar (~> 1.11) - rake (~> 13.0) - rubocop (~> 1.53.1) - term-ansicolor (~> 1.7) - -BUNDLED WITH - 2.2.33 diff --git a/app/Main.hs b/app/Main.hs index 5c18a7e..535b655 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -416,14 +416,6 @@ main = do categories <- liftIO $ findCategory repository' liftIO $ print $ splitFileName . makeRelative repository' <$> categories pure Nothing - ExistsCommand urlPath -> pure . Text.pack . show - <$> remoteFileExists urlPath - DownloadCommand url target - | Just uri' <- mkURI url -> fmap (Text.pack . show) - <$> download uri' target - | otherwise -> pure Nothing CloneCommand repo tarball tagPrefix -> fmap (Text.pack . show) <$> clone repo tarball tagPrefix - DownloadAndDeployCommand uri' tarball -> fmap (Text.pack . show) - <$> downloadAndDeploy uri' tarball Up2DateCommand -> up2Date >> pure Nothing diff --git a/app/SlackBuilder/CommandLine.hs b/app/SlackBuilder/CommandLine.hs index 9b26671..7cfe747 100644 --- a/app/SlackBuilder/CommandLine.hs +++ b/app/SlackBuilder/CommandLine.hs @@ -21,10 +21,7 @@ import Options.Applicative data SlackBuilderCommand = CategoryCommand Text - | ExistsCommand Text - | DownloadCommand Text String | CloneCommand Text Text Text - | DownloadAndDeployCommand Text Text | Up2DateCommand data PackagistArguments = PackagistArguments @@ -49,23 +46,13 @@ slackBuilderParser = info slackBuilderCommand fullDesc slackBuilderCommand :: Parser SlackBuilderCommand slackBuilderCommand = subparser $ command "category" (info categoryCommand mempty) - <> command "exists" (info existsCommand mempty) - <> command "download" (info downloadCommand mempty) <> command "clone" (info cloneCommand mempty) - <> command "deploy" (info deployCommand mempty) <> command "up2date" (info up2DateCommand mempty) where categoryCommand = CategoryCommand <$> argument str (metavar "PKGNAM") - existsCommand = ExistsCommand <$> argument str (metavar "PATH") - downloadCommand = DownloadCommand - <$> argument str (metavar "URI") - <*> argument str (metavar "TARGET") cloneCommand = CloneCommand <$> argument str (metavar "REPO") <*> argument str (metavar "TARBALL") <*> argument str (metavar "TAG_PREFIX") - deployCommand = DownloadAndDeployCommand - <$> argument str (metavar "URI") - <*> argument str (metavar "TARBALL") up2DateCommand = pure Up2DateCommand diff --git a/config/config.rb.example b/config/config.rb.example deleted file mode 100644 index c23023d..0000000 --- a/config/config.rb.example +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -CONFIG = { - remote_path: 'example.com:/srv/httpd/some/path', - download_url: 'https://example.com/some/path', - repository: '../slackbuilds' -}.freeze diff --git a/lib/SlackBuilder/Download.hs b/lib/SlackBuilder/Download.hs index 4003afd..7729b0b 100644 --- a/lib/SlackBuilder/Download.hs +++ b/lib/SlackBuilder/Download.hs @@ -3,7 +3,6 @@ module SlackBuilder.Download , cloneAndArchive , commit , download - , downloadAndDeploy , hostedSources , remoteFileExists , updateSlackBuildVersion @@ -207,19 +206,3 @@ clone repo tarball tagPrefix = do in cloneAndArchive repo nameVersion tarballPath tagPrefix >> uploadCommand tarball remotePath >> liftIO (runConduitRes go) <&> Just - -downloadAndDeploy :: Text -> Text -> SlackBuilderT (Maybe (Digest MD5)) -downloadAndDeploy uri tarball = do - repository' <- SlackBuilderT $ asks repository - let tarballPath = Text.unpack tarball - remotePath = Text.pack $ joinPath $ ("/" :) $ drop 1 $ splitPath tarballPath - localPath = repository' tarballPath - remoteFileExists' <- remoteFileExists remotePath - - if remoteFileExists' - then - hostedSources remotePath >>= flip download localPath - else do - checksum <- liftIO (mkURI uri) >>= flip download localPath - uploadCommand tarball remotePath - pure checksum diff --git a/lib/download.rb b/lib/download.rb deleted file mode 100644 index 17b119b..0000000 --- a/lib/download.rb +++ /dev/null @@ -1,40 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -# frozen_string_literal: true - -require_relative '../config/config' -require_relative 'package' -require 'net/http' -require 'pathname' -require 'progressbar' -require 'term/ansicolor' - -module SlackBuilder - extend Rake::FileUtilsExt - - def self.clone(repo, tarball, tag_prefix = 'v') - `./bin/slackbuilder clone #{repo} #{tarball} #{tag_prefix}` - end - - def self.download(uri, target) - `./bin/slackbuilder download #{uri} #{target}`.strip - end - - def self.hosted_sources(absolute_url) - CONFIG[:download_url] + absolute_url - end - - def self.remote_file_exists?(url) - `./bin/slackbuilder exists #{url}`.strip == 'True' - end - - def self.download_and_deploy(uri, tarball) - `./bin/slackbuilder deploy #{uri} #{tarball}`.strip - end - - private_class_method def self.upload_command(local_path, remote_path) - ['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path] - end -end diff --git a/lib/package.rb b/lib/package.rb deleted file mode 100644 index b5c44bb..0000000 --- a/lib/package.rb +++ /dev/null @@ -1,24 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -# frozen_string_literal: true - -class Package - attr_reader :path, :version, :homepage, :requires - - def initialize(path, version:, homepage:, requires: []) - @path = path - @version = version - @homepage = homepage - @requires = requires - end - - def name - File.basename @path - end - - def name_version - "#{name}-#{@version}" - end -end diff --git a/Rakefile b/private/hhvm.rb similarity index 87% rename from Rakefile rename to private/hhvm.rb index 06b6fa4..85e78b7 100644 --- a/Rakefile +++ b/private/hhvm.rb @@ -9,7 +9,33 @@ require 'digest/md5' require 'net/http' require_relative 'config/config' require_relative 'lib/package' -require_relative 'lib/download' + +class Package + attr_reader :path, :version, :homepage, :requires + + def initialize(path, version:, homepage:, requires: []) + @path = path + @version = version + @homepage = homepage + @requires = requires + end + + def name + File.basename @path + end + + def name_version + "#{name}-#{@version}" + end +end + +module SlackBuilder + extend Rake::FileUtilsExt + + def self.clone(repo, tarball, tag_prefix = 'v') + `./bin/slackbuilder clone #{repo} #{tarball} #{tag_prefix}` + end +end namespace :hhvm do def filter_set_hhvm_third_party_source_args(tokens)