smc-get 0.1.0 → 0.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +674 -674
- data/HISTORY.rdoc +31 -0
- data/README.rdoc +163 -148
- data/VERSION.txt +1 -1
- data/bin/smc-checksum +44 -0
- data/bin/smc-get +31 -31
- data/config/smc-get.yml +32 -32
- data/lib/smc_get.rb +23 -21
- data/lib/smc_get/cui.rb +325 -289
- data/lib/smc_get/cui_commands/build.rb +329 -0
- data/lib/smc_get/cui_commands/command.rb +117 -81
- data/lib/smc_get/cui_commands/getinfo.rb +92 -91
- data/lib/smc_get/cui_commands/help.rb +65 -64
- data/lib/smc_get/cui_commands/install.rb +101 -91
- data/lib/smc_get/cui_commands/list.rb +101 -80
- data/lib/smc_get/cui_commands/search.rb +106 -109
- data/lib/smc_get/cui_commands/uninstall.rb +80 -78
- data/lib/smc_get/cui_commands/update.rb +119 -0
- data/lib/smc_get/cui_commands/version.rb +58 -57
- data/lib/smc_get/errors.rb +140 -113
- data/lib/smc_get/gui.rb +20 -19
- data/lib/smc_get/local_repository.rb +277 -0
- data/lib/smc_get/package.rb +260 -279
- data/lib/smc_get/package_archive.rb +80 -0
- data/lib/smc_get/package_specification.rb +253 -0
- data/lib/smc_get/remote_repository.rb +272 -0
- data/lib/smc_get/repository.rb +10 -0
- data/lib/smc_get/smc_get.rb +117 -139
- data/smcpak.rdoc +332 -0
- data/test/test_smc-get-cui.rb +123 -121
- data/test/test_smc-get-lib.rb +172 -170
- metadata +71 -36
data/HISTORY.rdoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
This file documents the the changes that have been made
|
2
|
+
to smc-get between versions. It's *not* intended to serve
|
3
|
+
as a full-blown changelog, for this you have to install git
|
4
|
+
and issue a <tt>git log</tt> command in the project directory.
|
5
|
+
|
6
|
+
Bugfixes are written in <i>italic</i>, mayor changes in <b>bold</b> font.
|
7
|
+
|
8
|
+
== 0.2.0-beta1
|
9
|
+
|
10
|
+
* <b>Added a completely new SMC package format: smcpak. These are XZ-compressed
|
11
|
+
tarballs allowing for easy deployment of packages. See the smcpak.rdoc file
|
12
|
+
for further information.</b>
|
13
|
+
* <b>Rewrote nearly the full API. This release is 100%
|
14
|
+
incompatible with anything released so far.</b>
|
15
|
+
* <b>New classes LocalRepository and RemoteRepository for
|
16
|
+
managing downloads and installations.</b>
|
17
|
+
* <b><tt>smc-get list</tt> without arguments works a little different now.
|
18
|
+
Instead of showing the installation time of a package it now shows the
|
19
|
+
time of the last update, which allows you to better keep track of
|
20
|
+
what is out of date.</b>
|
21
|
+
* <b>Added <tt>smc-get update</tt> for a fully automated update of all (or
|
22
|
+
selected) installed packages.</b>
|
23
|
+
* <b>Added <tt>smc-get build</tt> to automatically build SMC packages either
|
24
|
+
interactively or as an automated process.</b>
|
25
|
+
* Added modification detection via SHA1 checksums.
|
26
|
+
* New dependency on the {ruby-xz gem}[http://rubygems.org/gems/ruby-xz].
|
27
|
+
* New dependency on the {minitar gem}[http://rubygems.org/gems/minitar].
|
28
|
+
* New dependency on liblzma[http://tukaani.org/xz/].
|
29
|
+
* Official bugtracker is now at GitHub: https://github.com/Luiji/smc-get/issues.
|
30
|
+
* Added this file (HISTORY.rdoc) for collecting change information.
|
31
|
+
|
data/README.rdoc
CHANGED
@@ -1,148 +1,163 @@
|
|
1
|
-
= SMC-GET -- level repository manager for Secret Maryo Chronicles
|
2
|
-
smc-get - Library and command-line for managing SMC level packages.
|
3
|
-
|
4
|
-
Author:: Luiji Maryo (mailto:luiji@users.sourceforge.net)
|
5
|
-
Contributor:: Marvin Gülker (mailto:sutniuq@gmx.net)
|
6
|
-
Copyright:: Copyright (C) 2010-2011 Entertaining Software, Inc.
|
7
|
-
Copyright:: Copyright (C) 2011 Marvin Gülker
|
8
|
-
License:: GNU General Public License (see COPYING)
|
9
|
-
|
10
|
-
= Synopsis for use as a command-line tool
|
11
|
-
smc-get install mypackage
|
12
|
-
smc-get uninstall mypackage
|
13
|
-
smc-get help
|
14
|
-
|
15
|
-
= Synopsis for use as a library
|
16
|
-
require 'smc_get'
|
17
|
-
#Initialize the library
|
18
|
-
SmcGet.setup
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#Get a package
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
pkg
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
smc
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
1
|
+
= SMC-GET -- level repository manager for Secret Maryo Chronicles
|
2
|
+
smc-get - Library and command-line for managing SMC level packages.
|
3
|
+
|
4
|
+
Author:: Luiji Maryo (mailto:luiji@users.sourceforge.net)
|
5
|
+
Contributor:: Marvin Gülker (mailto:sutniuq@gmx.net)
|
6
|
+
Copyright:: Copyright (C) 2010-2011 Entertaining Software, Inc.
|
7
|
+
Copyright:: Copyright (C) 2011 Marvin Gülker
|
8
|
+
License:: GNU General Public License (see COPYING)
|
9
|
+
|
10
|
+
= Synopsis for use as a command-line tool
|
11
|
+
smc-get install mypackage
|
12
|
+
smc-get uninstall mypackage
|
13
|
+
smc-get help
|
14
|
+
|
15
|
+
= Synopsis for use as a library
|
16
|
+
require 'smc_get'
|
17
|
+
# Initialize the library
|
18
|
+
SmcGet.setup
|
19
|
+
|
20
|
+
# Bind to local and remote repositories
|
21
|
+
rr = SmcGet::RemoteRepository.new("http://example.org/smc-repo")
|
22
|
+
lr = SmcGet::LocalRepository.new("/usr/share/smc")
|
23
|
+
|
24
|
+
# Get a package
|
25
|
+
path = rr.fetch_package("mypackage")
|
26
|
+
pkg = SmcGet::Package.from_file(pkg)
|
27
|
+
|
28
|
+
# Install it!
|
29
|
+
lr.install(pkg)
|
30
|
+
|
31
|
+
#...or remove it.
|
32
|
+
lr.uninstall("mypackage")
|
33
|
+
|
34
|
+
= Description
|
35
|
+
smc-get is a library and command-line tool for installing, uninstalling, etc.
|
36
|
+
level packages from the Secret Maryo Chronicles Contributed Levels Repository.
|
37
|
+
|
38
|
+
== Prototype Notice
|
39
|
+
|
40
|
+
This program is a prototype for functionality that will eventually be merged
|
41
|
+
with Secret Maryo Chronicles. It is subject to change and should not be used
|
42
|
+
for anything other then testing.
|
43
|
+
|
44
|
+
= Usage
|
45
|
+
|
46
|
+
== Using it as a command-line
|
47
|
+
smc-get's main purpose is to be used as a command-line utility. It should be
|
48
|
+
executed in the syntax:
|
49
|
+
smc-get COMMAND [PARAMETERS...]
|
50
|
+
Where <tt>COMMAND</tt> is the command and <tt>PARAMATERS...</tt> are the
|
51
|
+
parameters for that command.
|
52
|
+
|
53
|
+
To get help on the various commands, use the help command.
|
54
|
+
smc-get help [COMMAND]
|
55
|
+
Ommit the +COMMAND+ if you want general usage information.
|
56
|
+
|
57
|
+
=== Configuration file
|
58
|
+
smc-get requires a configuration file when used as a commandline tool.
|
59
|
+
By default it searches for <tt>smc-get.yml</tt> in the <b>config/</b>
|
60
|
+
subdirectory of your smc-get installation, then for <tt>smc-get-conf.yml</tt>
|
61
|
+
in the user's home directory and then for the file specified via the <tt>-c</tt>
|
62
|
+
commandline switch, if existant. Values set in later evaluated configuration
|
63
|
+
files override those in prevously evaluated ones; see
|
64
|
+
smc-get help
|
65
|
+
for more explanation. If you want to use the CUI from your scripts, you
|
66
|
+
can specify a config file via <tt>-c</tt>, but make sure it contains all
|
67
|
+
possible options, otherwise those in the global or user-level config files
|
68
|
+
may affect your program. See below for an example.
|
69
|
+
|
70
|
+
Be careful when using +sudo+, because it changes the environment variables.
|
71
|
+
smc-get may not find your user-level configuration file when using sudo,
|
72
|
+
because it derives the path from the +USER+ environment variable which may
|
73
|
+
get set to +root+ when using +sudo+.
|
74
|
+
|
75
|
+
In the configuration file you can set some general options, look into
|
76
|
+
the file which is quite self-explanatory. A sample configuration may
|
77
|
+
look like this:
|
78
|
+
data_directory: "/usr/local/share/smc"
|
79
|
+
repo_url: "ftp://ftp.example.org/smc
|
80
|
+
|
81
|
+
== Using it as a library
|
82
|
+
smc-get, although mainly targetted at being a command-line utility, may also be
|
83
|
+
used as a library. This is useful when, for instance, creating a GUI front-end.
|
84
|
+
|
85
|
+
To initialize the library, call SmcGet.setup which will do some basic initialization
|
86
|
+
needed for use of the library.
|
87
|
+
SmcGet.setup
|
88
|
+
For interacting with the SMC repository, smc-get exposes an object-oriented API
|
89
|
+
centered around the Package and repository classes. Before you can do anything,
|
90
|
+
you have to "establish" connections to a remote and a local repository, where
|
91
|
+
remote repositories are repositories where <tt>smc-get</tt> downloads from,
|
92
|
+
and local repositories are repositories where <tt>smc-get</tt> installs
|
93
|
+
into, i.e. usually your SMC installation. You can use multiple repositories
|
94
|
+
if you know how to manage it.
|
95
|
+
|
96
|
+
rr = SmcGet::RemoteRepository.new("http://example.org/smc-repo")
|
97
|
+
lr = SmcGet::LocalRepository.new("/usr/local/share/smc")
|
98
|
+
|
99
|
+
After you initialized the library
|
100
|
+
as explained above, you can query, install and uninstall packages.
|
101
|
+
|
102
|
+
path = rr.fetch_package("mypackage")
|
103
|
+
pkg = SmcGet::Package.from_file(path)
|
104
|
+
lr.install(pkg)
|
105
|
+
|
106
|
+
If any of the methods fails, it will raise various exceptions. When creating a GUI,
|
107
|
+
you should catch these exceptions and present them as message boxes.
|
108
|
+
|
109
|
+
begin
|
110
|
+
rr.fetch_package("mypackage")
|
111
|
+
rescue SmcGet::Errors::NoSuchPackageError => e
|
112
|
+
alert "No such package: #{e.package_name}!"
|
113
|
+
end
|
114
|
+
|
115
|
+
All errors smc-get raises are subclasses of SmcGet::Errors::SmcGetError. That
|
116
|
+
means, if you rescue from this exception, you can handle all package-related
|
117
|
+
errors at once:
|
118
|
+
|
119
|
+
begin
|
120
|
+
lr.install(pkg)
|
121
|
+
rescue SmcGet::Errors::SmcGetError => e
|
122
|
+
alert e.message
|
123
|
+
end
|
124
|
+
|
125
|
+
Furthermore, these error messages should have a pretty informative message set,
|
126
|
+
so unless you want to localize the error messages you can just reach them
|
127
|
+
through (the messages, not the whole exceptions, of course).
|
128
|
+
|
129
|
+
The configuration file only contains settings for the commandline user
|
130
|
+
interface, so you don't need it here. If you want to use the CUI from
|
131
|
+
your scripts, do
|
132
|
+
require "smc_get"
|
133
|
+
require "smc_get/cui"
|
134
|
+
|
135
|
+
cui = SmcGet::CUI.new(ARGV)
|
136
|
+
cui.start
|
137
|
+
The configuration file from the <b>config/</b> directory will automatically
|
138
|
+
be loaded as well as the user-level configuration file; you may specify another
|
139
|
+
configuration file by placing the appropriate option in ARGV:
|
140
|
+
ARGV.unshift("-c")
|
141
|
+
ARGV.unshift("YOURCONFIGFILE.yml")
|
142
|
+
|
143
|
+
cui = SmcGet::CUI.new(ARGV)
|
144
|
+
cui.start
|
145
|
+
|
146
|
+
= License
|
147
|
+
|
148
|
+
smc-get is licensed under the GNU General Public License version 3 or later. For
|
149
|
+
more information, see COPYING.
|
150
|
+
|
151
|
+
= Website
|
152
|
+
|
153
|
+
This software was written by Entertaining Software, Inc. Visit us at
|
154
|
+
http://www.entertainingsoftware.com.
|
155
|
+
|
156
|
+
This software is hosted at GitHub. The project page can be found at
|
157
|
+
https://github.com/Luiji/smc-get.
|
158
|
+
|
159
|
+
This software was written for Secret Maryo Chronicles. Visit them at
|
160
|
+
http://www.secretmaryo.org.
|
161
|
+
|
162
|
+
Bugs related to this software may be reported at
|
163
|
+
https://github.com/Luiji/smc-get/issues.
|
data/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0-beta1
|
data/bin/smc-checksum
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Encoding: UTF-8
|
3
|
+
|
4
|
+
require "pathname"
|
5
|
+
require "digest/sha1"
|
6
|
+
|
7
|
+
PROG = File.basename($0)
|
8
|
+
|
9
|
+
if ARGV.include?("-h") or ARGV.include?("--help")
|
10
|
+
puts(<<HELP)
|
11
|
+
USAGE:
|
12
|
+
#{PROG} [FILES...]
|
13
|
+
|
14
|
+
Prints out all SHA1 checksums of the FILES given at the commandline.
|
15
|
+
FILES that are directories are listed recursively. If no FILES
|
16
|
+
are given, recursively lists the current directory.
|
17
|
+
HELP
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
Signal.trap("SIGINT"){exit}
|
22
|
+
Signal.trap("SIGTERM"){exit}
|
23
|
+
|
24
|
+
ARGV.unshift(".") if ARGV.empty?
|
25
|
+
|
26
|
+
ARGV.each do |arg|
|
27
|
+
begin
|
28
|
+
path = Pathname.new(arg)
|
29
|
+
|
30
|
+
if path.file?
|
31
|
+
puts "#{path}: #{Digest::SHA1.hexdigest(File.read(path))}"
|
32
|
+
else
|
33
|
+
path.find do |sub_path|
|
34
|
+
puts "#{sub_path}: #{Digest::SHA1.hexdigest(File.read(sub_path))}" if sub_path.file?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
rescue Errno::ENOENT => e
|
38
|
+
$stderr.puts("WARNING: Not found: #{arg}.")
|
39
|
+
$stderr.puts("Skipping.")
|
40
|
+
rescue Errno::EACCES => e
|
41
|
+
$stderr.puts("WARNING: Permission denied: #{arg}.")
|
42
|
+
$stderr.puts("Skipping.")
|
43
|
+
end
|
44
|
+
end
|
data/bin/smc-get
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#Encoding: UTF-8
|
3
|
-
################################################################################
|
4
|
-
# This file is part of smc-get.
|
5
|
-
# Copyright (C) 2010-2011 Entertaining Software, Inc.
|
6
|
-
# Copyright (C) 2011 Marvin Gülker
|
7
|
-
#
|
8
|
-
# This program is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
################################################################################
|
21
|
-
|
22
|
-
if RUBY_VERSION =~ /^1.8/ #1.8 doesn't have require_relative
|
23
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "smc_get", "smc_get")
|
24
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "smc_get", "cui")
|
25
|
-
else
|
26
|
-
require_relative "../lib/smc_get/smc_get"
|
27
|
-
require_relative "../lib/smc_get/cui"
|
28
|
-
end
|
29
|
-
|
30
|
-
cui = SmcGet::CUI.new(ARGV)
|
31
|
-
cui.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Encoding: UTF-8
|
3
|
+
################################################################################
|
4
|
+
# This file is part of smc-get.
|
5
|
+
# Copyright (C) 2010-2011 Entertaining Software, Inc.
|
6
|
+
# Copyright (C) 2011 Marvin Gülker
|
7
|
+
#
|
8
|
+
# This program is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
################################################################################
|
21
|
+
|
22
|
+
if RUBY_VERSION =~ /^1.8/ #1.8 doesn't have require_relative
|
23
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "smc_get", "smc_get")
|
24
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "smc_get", "cui")
|
25
|
+
else
|
26
|
+
require_relative "../lib/smc_get/smc_get"
|
27
|
+
require_relative "../lib/smc_get/cui"
|
28
|
+
end
|
29
|
+
|
30
|
+
cui = SmcGet::CUI.new(ARGV)
|
31
|
+
cui.start
|