Remove gem and rake support files

This commit is contained in:
Eugen Wissner 2023-11-04 14:13:59 +01:00
parent 0023fe0337
commit 9770cc8829
10 changed files with 27 additions and 214 deletions

View File

@ -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

15
Gemfile
View File

@ -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'

View File

@ -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

View File

@ -416,14 +416,6 @@ main = do
categories <- liftIO $ findCategory repository' categories <- liftIO $ findCategory repository'
liftIO $ print $ splitFileName . makeRelative repository' <$> categories liftIO $ print $ splitFileName . makeRelative repository' <$> categories
pure Nothing 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) CloneCommand repo tarball tagPrefix -> fmap (Text.pack . show)
<$> clone repo tarball tagPrefix <$> clone repo tarball tagPrefix
DownloadAndDeployCommand uri' tarball -> fmap (Text.pack . show)
<$> downloadAndDeploy uri' tarball
Up2DateCommand -> up2Date >> pure Nothing Up2DateCommand -> up2Date >> pure Nothing

View File

@ -21,10 +21,7 @@ import Options.Applicative
data SlackBuilderCommand data SlackBuilderCommand
= CategoryCommand Text = CategoryCommand Text
| ExistsCommand Text
| DownloadCommand Text String
| CloneCommand Text Text Text | CloneCommand Text Text Text
| DownloadAndDeployCommand Text Text
| Up2DateCommand | Up2DateCommand
data PackagistArguments = PackagistArguments data PackagistArguments = PackagistArguments
@ -49,23 +46,13 @@ slackBuilderParser = info slackBuilderCommand fullDesc
slackBuilderCommand :: Parser SlackBuilderCommand slackBuilderCommand :: Parser SlackBuilderCommand
slackBuilderCommand = subparser slackBuilderCommand = subparser
$ command "category" (info categoryCommand mempty) $ command "category" (info categoryCommand mempty)
<> command "exists" (info existsCommand mempty)
<> command "download" (info downloadCommand mempty)
<> command "clone" (info cloneCommand mempty) <> command "clone" (info cloneCommand mempty)
<> command "deploy" (info deployCommand mempty)
<> command "up2date" (info up2DateCommand mempty) <> command "up2date" (info up2DateCommand mempty)
where where
categoryCommand = CategoryCommand categoryCommand = CategoryCommand
<$> argument str (metavar "PKGNAM") <$> argument str (metavar "PKGNAM")
existsCommand = ExistsCommand <$> argument str (metavar "PATH")
downloadCommand = DownloadCommand
<$> argument str (metavar "URI")
<*> argument str (metavar "TARGET")
cloneCommand = CloneCommand cloneCommand = CloneCommand
<$> argument str (metavar "REPO") <$> argument str (metavar "REPO")
<*> argument str (metavar "TARBALL") <*> argument str (metavar "TARBALL")
<*> argument str (metavar "TAG_PREFIX") <*> argument str (metavar "TAG_PREFIX")
deployCommand = DownloadAndDeployCommand
<$> argument str (metavar "URI")
<*> argument str (metavar "TARBALL")
up2DateCommand = pure Up2DateCommand up2DateCommand = pure Up2DateCommand

View File

@ -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

View File

@ -3,7 +3,6 @@ module SlackBuilder.Download
, cloneAndArchive , cloneAndArchive
, commit , commit
, download , download
, downloadAndDeploy
, hostedSources , hostedSources
, remoteFileExists , remoteFileExists
, updateSlackBuildVersion , updateSlackBuildVersion
@ -207,19 +206,3 @@ clone repo tarball tagPrefix = do
in cloneAndArchive repo nameVersion tarballPath tagPrefix in cloneAndArchive repo nameVersion tarballPath tagPrefix
>> uploadCommand tarball remotePath >> uploadCommand tarball remotePath
>> liftIO (runConduitRes go) <&> Just >> 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

View File

@ -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

View File

@ -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

View File

@ -9,7 +9,33 @@ require 'digest/md5'
require 'net/http' require 'net/http'
require_relative 'config/config' require_relative 'config/config'
require_relative 'lib/package' 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 namespace :hhvm do
def filter_set_hhvm_third_party_source_args(tokens) def filter_set_hhvm_third_party_source_args(tokens)