boxing 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +17 -3
- data/lib/boxing/command.rb +1 -0
- data/lib/boxing/commands/generate.rb +2 -0
- data/lib/boxing/commands/update.rb +24 -0
- data/lib/boxing/database.rb +73 -5
- data/lib/boxing/version.rb +1 -1
- metadata +3 -8
- data/database/gems/pg/postgresql-dev.yml +0 -2
- data/database/gems/pg/postgresql-libs.yml +0 -2
- data/database/gems/rails/shared-mime-info.yml +0 -2
- data/database/gems/rails/tzdata.yml +0 -2
- data/database/gems/sqlite3/sqlite-dev.yml +0 -2
- data/database/gems/sqlite3/sqlite-libs.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '068827160fc7ffc1cdf5e95a35808275112cd91e60b99495b027fe4421cdfbf9'
|
4
|
+
data.tar.gz: a0135cf5842af935caa075da6571ea746348a72a617b7152db279b81b5d3a297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd230cd0f3f3e3d16395fdd5b5ed30c5ef740aeb1ea5eba80eb48af37d76a85b4f0480f739cbcb8209a2f90fd32983ea9e11f0550c2a2492d6e7f9832329081c
|
7
|
+
data.tar.gz: cec3dc49149dc97d7350c827a5351709c629a20be9fc677ab8b90afe964a7df0559d6a855113501f06c7c44036737cdd4cd924c345f7176daffe89b8624adc04
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -66,9 +66,22 @@ To generate `Dockerfile` for current project
|
|
66
66
|
bundle exec boxing generate
|
67
67
|
```
|
68
68
|
|
69
|
+
### Update
|
70
|
+
|
71
|
+
To update the database for package information
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
bundle exec boxing update
|
75
|
+
```
|
76
|
+
|
77
|
+
> If the generated `Dockerfile` is not satisfy, please try to update it.
|
78
|
+
|
69
79
|
## Roadmap
|
70
80
|
|
71
81
|
* [x] `Dockerfile` generator
|
82
|
+
* [x] `.gitignore` generator
|
83
|
+
* [x] Common ignore files
|
84
|
+
* [ ] Customizable ignore files
|
72
85
|
* [ ] Customize config file `config/boxing.rb`
|
73
86
|
* [ ] Entrypoint Detection
|
74
87
|
* [x] Openbox (Suggested)
|
@@ -77,12 +90,13 @@ bundle exec boxing generate
|
|
77
90
|
* [ ] Ruby
|
78
91
|
* [ ] Package Database
|
79
92
|
* [x] Built-in (Move to standalone repoistory in future)
|
80
|
-
* [
|
81
|
-
* [
|
93
|
+
* [x] Standalone Repoistory
|
94
|
+
* [x] Customize Source
|
82
95
|
* [ ] Base Image
|
83
96
|
* [x] Alpine
|
84
97
|
* [ ] Ubuntu
|
85
|
-
* [ ] Ruby Version
|
98
|
+
* [ ] Filter by Ruby Version
|
99
|
+
* [ ] Filter by Gem Version
|
86
100
|
|
87
101
|
## Development
|
88
102
|
|
data/lib/boxing/command.rb
CHANGED
@@ -21,6 +21,8 @@ module Boxing
|
|
21
21
|
#
|
22
22
|
# @since 0.1.0
|
23
23
|
def execute
|
24
|
+
Database.download! unless Database.exist?
|
25
|
+
|
24
26
|
template('templates/Dockerfile.tt', 'Dockerfile', context: context.to_binding)
|
25
27
|
template('templates/dockerignore.tt', '.dockerignore', context: context.to_binding)
|
26
28
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boxing
|
4
|
+
# :nodoc:
|
5
|
+
module Commands
|
6
|
+
# The Database Updater
|
7
|
+
#
|
8
|
+
# @since 0.3.0
|
9
|
+
class Update < Thor::Group
|
10
|
+
# Update Database
|
11
|
+
#
|
12
|
+
# @since 0.3.0
|
13
|
+
def execute
|
14
|
+
if Database.exist?
|
15
|
+
Database.new.update!
|
16
|
+
else
|
17
|
+
Database.download!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Boxing::Command.register(Update, 'update', 'update', 'Update Database')
|
23
|
+
end
|
24
|
+
end
|
data/lib/boxing/database.rb
CHANGED
@@ -9,12 +9,80 @@ module Boxing
|
|
9
9
|
# @since 0.1.0
|
10
10
|
class Database
|
11
11
|
class << self
|
12
|
-
#
|
12
|
+
# Check for the database exists
|
13
13
|
#
|
14
|
-
# @
|
15
|
-
|
16
|
-
|
14
|
+
# @param [String] path
|
15
|
+
#
|
16
|
+
# @return [TrueClass\FalseClass]
|
17
|
+
#
|
18
|
+
# @since 0.3.0
|
19
|
+
def exist?(path = DEFAULT_PATH)
|
20
|
+
File.directory?(path) && !(Dir.entries(path) - %w[. ..]).empty?
|
21
|
+
end
|
22
|
+
|
23
|
+
# Download Database
|
24
|
+
#
|
25
|
+
# @since 0.3.0
|
26
|
+
def download!(path = DEFAULT_PATH)
|
27
|
+
command = %w[git clone --quiet]
|
28
|
+
command << URL << path.to_s
|
29
|
+
|
30
|
+
raise DownloadFailed, "failed to download #{URL} to #{path}" unless system(*command)
|
31
|
+
|
32
|
+
new(path)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @since 0.3.0
|
37
|
+
class DownloadFailed < RuntimeError; end
|
38
|
+
|
39
|
+
# @since 0.3.0
|
40
|
+
class UpdateFailed < RuntimeError; end
|
41
|
+
|
42
|
+
# Git URL of the ruby-boxing-db
|
43
|
+
#
|
44
|
+
# @since 0.3.0
|
45
|
+
URL = 'https://github.com/elct9620/ruby-boxing-db.git'
|
46
|
+
|
47
|
+
# Path to the user's copy of ruby-boxing-db
|
48
|
+
#
|
49
|
+
# @since 0.3.0
|
50
|
+
USER_PATH = Pathname.new(Gem.user_home).join('.local/share/ruby-boxing-db')
|
51
|
+
|
52
|
+
# @since 0.3.0
|
53
|
+
DEFAULT_PATH = ENV['BOXING_DB'] || USER_PATH
|
54
|
+
|
55
|
+
# @since 0.3.0
|
56
|
+
attr_reader :path
|
57
|
+
|
58
|
+
# Initialize Database
|
59
|
+
#
|
60
|
+
# @since 0.3.0
|
61
|
+
def initialize(path = DEFAULT_PATH)
|
62
|
+
@path = path
|
63
|
+
end
|
64
|
+
|
65
|
+
# The Database is Git Repoistory
|
66
|
+
#
|
67
|
+
# @return [TrueClass|FalseClass]
|
68
|
+
#
|
69
|
+
# @since 0.3.0
|
70
|
+
def git?
|
71
|
+
File.directory?(File.join(@path, '.git'))
|
72
|
+
end
|
73
|
+
|
74
|
+
# Update the database
|
75
|
+
#
|
76
|
+
# @since 0.3.0
|
77
|
+
def update!
|
78
|
+
return unless git?
|
79
|
+
|
80
|
+
Dir.chdir(@path) do
|
81
|
+
command = %w[git pull --quiet origin master]
|
82
|
+
raise UpdateFailed, "failed to update #{@path}" unless system(*command)
|
17
83
|
end
|
84
|
+
|
85
|
+
true
|
18
86
|
end
|
19
87
|
|
20
88
|
# Find packages for rubygems
|
@@ -41,7 +109,7 @@ module Boxing
|
|
41
109
|
#
|
42
110
|
# @since 0.1.0
|
43
111
|
def each_package_path_for(name, &block)
|
44
|
-
Dir.glob(
|
112
|
+
Dir.glob(File.join(@path, 'gems', name, '*.yml'), &block)
|
45
113
|
end
|
46
114
|
end
|
47
115
|
end
|
data/lib/boxing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,16 +57,11 @@ files:
|
|
57
57
|
- bin/console
|
58
58
|
- bin/setup
|
59
59
|
- boxing.gemspec
|
60
|
-
- database/gems/pg/postgresql-dev.yml
|
61
|
-
- database/gems/pg/postgresql-libs.yml
|
62
|
-
- database/gems/rails/shared-mime-info.yml
|
63
|
-
- database/gems/rails/tzdata.yml
|
64
|
-
- database/gems/sqlite3/sqlite-dev.yml
|
65
|
-
- database/gems/sqlite3/sqlite-libs.yml
|
66
60
|
- exe/boxing
|
67
61
|
- lib/boxing.rb
|
68
62
|
- lib/boxing/command.rb
|
69
63
|
- lib/boxing/commands/generate.rb
|
64
|
+
- lib/boxing/commands/update.rb
|
70
65
|
- lib/boxing/context.rb
|
71
66
|
- lib/boxing/database.rb
|
72
67
|
- lib/boxing/package.rb
|