litestream 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +14 -0
- data/exe/litestream +13 -0
- data/lib/litestream/commands.rb +77 -0
- data/lib/litestream/upstream.rb +14 -0
- data/lib/litestream/version.rb +3 -0
- data/lib/litestream.rb +8 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 60979647f5eca2f096efea3c10abe98da7d22c7e02812c9469956f92b91832bb
|
4
|
+
data.tar.gz: 7c751a710d4172bf8deed8ffeb7d6e6f26491072ea7957b0630f36a44d258c9e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 862071835454435147ab3d1b1ad88daa13582965366dae36672e2db14f2d1dda22b35e8332fcdf61e42ad0598e21d425e75f5fbd135dba592eb86cc8069a1852
|
7
|
+
data.tar.gz: e17d706f5bc463b02ab885609fb07f66777ae910de4ed5520e88057149503835e27fd6ec7d7c164f6a129cd83e06b65d189d04a7fc6b22b0041b965c0d1b560c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Stephen Margheim
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Litestream
|
2
|
+
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
4
|
+
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/litestream`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
+
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
+
|
17
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/litestream. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/litestream/blob/main/CODE_OF_CONDUCT.md).
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
36
|
+
|
37
|
+
## Code of Conduct
|
38
|
+
|
39
|
+
Everyone interacting in the Litestream project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/litestream/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "standard/rake"
|
13
|
+
|
14
|
+
task default: %i[test standard]
|
data/exe/litestream
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# because rubygems shims assume a gem's executables are Ruby
|
3
|
+
|
4
|
+
require "litestream/commands"
|
5
|
+
|
6
|
+
begin
|
7
|
+
command = [Litestream::Commands.executable, *ARGV]
|
8
|
+
puts command.inspect
|
9
|
+
exec(*command)
|
10
|
+
rescue Litestream::Commands::UnsupportedPlatformException, Litestream::Commands::ExecutableNotFoundException => e
|
11
|
+
STDERR.puts("ERROR: " + e.message)
|
12
|
+
exit 1
|
13
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative "upstream"
|
2
|
+
|
3
|
+
module Litestream
|
4
|
+
module Commands
|
5
|
+
DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
|
6
|
+
GEM_NAME = "litestream"
|
7
|
+
|
8
|
+
# raised when the host platform is not supported by upstream litestream's binary releases
|
9
|
+
class UnsupportedPlatformException < StandardError
|
10
|
+
end
|
11
|
+
|
12
|
+
# raised when the litestream executable could not be found where we expected it to be
|
13
|
+
class ExecutableNotFoundException < StandardError
|
14
|
+
end
|
15
|
+
|
16
|
+
# raised when LITESTREAM_INSTALL_DIR does not exist
|
17
|
+
class DirectoryNotFoundException < StandardError
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def platform
|
22
|
+
[:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
|
23
|
+
end
|
24
|
+
|
25
|
+
def executable(exe_path: DEFAULT_DIR)
|
26
|
+
litestream_install_dir = ENV["LITESTREAM_INSTALL_DIR"]
|
27
|
+
if litestream_install_dir
|
28
|
+
if File.directory?(litestream_install_dir)
|
29
|
+
warn "NOTE: using LITESTREAM_INSTALL_DIR to find litestream executable: #{litestream_install_dir}"
|
30
|
+
exe_path = litestream_install_dir
|
31
|
+
exe_file = File.expand_path(File.join(litestream_install_dir, "litestream"))
|
32
|
+
else
|
33
|
+
raise DirectoryNotFoundException, <<~MESSAGE
|
34
|
+
LITESTREAM_INSTALL_DIR is set to #{litestream_install_dir}, but that directory does not exist.
|
35
|
+
MESSAGE
|
36
|
+
end
|
37
|
+
else
|
38
|
+
if Litestream::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
|
39
|
+
raise UnsupportedPlatformException, <<~MESSAGE
|
40
|
+
litestream-ruby does not support the #{platform} platform
|
41
|
+
Please install litestream following instructions at https://litestream.io/install
|
42
|
+
MESSAGE
|
43
|
+
end
|
44
|
+
|
45
|
+
exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "litestream"))).find do |f|
|
46
|
+
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
if exe_file.nil? || !File.exist?(exe_file)
|
51
|
+
raise ExecutableNotFoundException, <<~MESSAGE
|
52
|
+
Cannot find the litestream executable for #{platform} in #{exe_path}
|
53
|
+
|
54
|
+
If you're using bundler, please make sure you're on the latest bundler version:
|
55
|
+
|
56
|
+
gem install bundler
|
57
|
+
bundle update --bundler
|
58
|
+
|
59
|
+
Then make sure your lock file includes this platform by running:
|
60
|
+
|
61
|
+
bundle lock --add-platform #{platform}
|
62
|
+
bundle install
|
63
|
+
|
64
|
+
See `bundle lock --help` output for details.
|
65
|
+
|
66
|
+
If you're still seeing this message after taking those steps, try running
|
67
|
+
`bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
|
68
|
+
https://github.com/fractaledmind/litestream-ruby#check-bundle_force_ruby_platform
|
69
|
+
for more details.
|
70
|
+
MESSAGE
|
71
|
+
end
|
72
|
+
|
73
|
+
exe_file
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Litestream
|
2
|
+
# constants describing the upstream tailwindcss project
|
3
|
+
module Upstream
|
4
|
+
VERSION = "v0.3.13"
|
5
|
+
|
6
|
+
# rubygems platform name => upstream release filename
|
7
|
+
NATIVE_PLATFORMS = {
|
8
|
+
"arm64-darwin" => "litestream-#{VERSION}-darwin-arm64.zip",
|
9
|
+
"arm64-linux" => "litestream-#{VERSION}-linux-arm64.tar.gz",
|
10
|
+
"x86_64-darwin" => "litestream-#{VERSION}-darwin-amd64.zip",
|
11
|
+
"x86_64-linux" => "litestream-#{VERSION}-linux-amd64.tar.gz",
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
data/lib/litestream.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: litestream
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Margheim
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyzip
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- stephen.margheim@gmail.com
|
30
|
+
executables:
|
31
|
+
- litestream
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- exe/litestream
|
39
|
+
- lib/litestream.rb
|
40
|
+
- lib/litestream/commands.rb
|
41
|
+
- lib/litestream/upstream.rb
|
42
|
+
- lib/litestream/version.rb
|
43
|
+
homepage: https://github.com/fractaledmind/litestream-ruby
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata:
|
47
|
+
homepage_uri: https://github.com/fractaledmind/litestream-ruby
|
48
|
+
rubygems_mfa_required: 'true'
|
49
|
+
source_code_uri: https://github.com/fractaledmind/litestream-ruby
|
50
|
+
changelog_uri: https://github.com/fractaledmind/litestream-ruby/CHANGELOG.md
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.0.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.4.19
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Integrate Litestream with the RubyGems infrastructure.
|
70
|
+
test_files: []
|