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/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
- #From where to download packages
20
- "https://github.com/Luiji/Secret-Maryo-Chronicles-Contributed-Levels/raw/master/",
21
- #Where to install packages (your SMC installation)
22
- "/usr/local/share/smc"
23
- )
24
- #Get a package
25
- pkg = SmcGet::Package.new("mypackage")
26
- #Install it!
27
- pkg.install
28
- #...or remove it.
29
- pkg.uninstall
30
-
31
- = Description
32
- smc-get is a library and command-line tool for installing, uninstalling, etc.
33
- level packages from the Secret Maryo Chronicles Contributed Levels Repository.
34
-
35
- == Prototype Notice
36
-
37
- This program is a prototype for functionality that will eventually be merged
38
- with Secret Maryo Chronicles. It is subject to change and should not be used
39
- for anything other then testing.
40
-
41
- = Usage
42
-
43
- == Using it as a command-line
44
- smc-get's main purpose is to be used as a command-line utility. It should be
45
- executed in the syntax:
46
- smc-get COMMAND [PARAMETERS...]
47
- Where <tt>COMMAND</tt> is the command and <tt>PARAMATERS...</tt> are the
48
- parameters for that command.
49
-
50
- To get help on the various commands, use the help command.
51
- smc-get help [COMMAND]
52
- Ommit the +COMMAND+ if you want general usage information.
53
-
54
- === Configuration file
55
- smc-get requires a configuration file when used as a commandline tool.
56
- By default it searches for <tt>smc-get.yml</tt> in the <b>config/</b>
57
- subdirectory of your smc-get installation, then for <tt>smc-get-conf.yml</tt>
58
- in the user's home directory and then for the file specified via the <tt>-c</tt>
59
- commandline switch, if existant. Values set in later evaluated configuration
60
- files override those in prevously evaluated ones; see
61
- smc-get help
62
- for more explanation. If you want to use the CUI from your scripts, you
63
- can specify a config file via <tt>-c</tt>, but make sure it contains all
64
- possible options, otherwise those in the global or user-level config files
65
- may affect your program. See below for an example.
66
-
67
- Be careful when using +sudo+, because it changes the environment variables.
68
- smc-get may not find your user-level configuration file when using sudo,
69
- because it derives the path from the +USER+ environment variable which may
70
- get set to +root+ when using +sudo+.
71
-
72
- In the configuration file you can set some general options, look into
73
- the file which is quite self-explanatory. A sample configuration may
74
- look like this:
75
- data_directory: "/usr/local/share/smc"
76
- repo_url: "https://github.com/Luiji/Secret-Maryo-Chronicles-Contributed-Levels/raw/master/"
77
-
78
- == Using it as a library
79
- smc-get, although mainly targetted at being a command-line utility, may also be
80
- used as a library. This is useful when, for instance, creating a GUI front-end.
81
-
82
- To initialize the library, indicate which repository you are using and
83
- where you want smc-get to install the packages to (which is usually your
84
- SMC installation path)
85
- SmcGet.setup(
86
- "https://github.com/Luiji/Secret-Maryo-Chronicles-Contributed-Levels/raw/master/",
87
- "/usr/local/share/smc"
88
- )
89
-
90
- For interacting with the SMC repository, smc-get exposes an object-oriented API
91
- centered around the SmcGet::Package class. After you initialized the library
92
- as explained above, you can query, install and uninstall packages.
93
- pkg = SmcGet::Package.new("mypackage")
94
- pkg.install
95
-
96
- If the function fails, it will raise various exceptions. When creating a GUI,
97
- you should catch these exceptions and present them as message boxes.
98
- begin
99
- Package.new("mypackage").install
100
- rescue SmcGet::Errors::NoSuchPackageError
101
- alert 'No such package "mypackage"!'
102
- end
103
-
104
- All errors smc-get raises are subclasses of SmcGet::Errors::SmcGetError. That
105
- means, if you rescue from this exception, you can handle all package-related
106
- errors at once:
107
- begin
108
- Package.new("mypackage").install
109
- rescue SmcGet::Errors::SmcGetError => e
110
- alert e.message
111
- end
112
-
113
- Furhtermore, these error messages should have a pretty informative message set,
114
- so unless you want to localize the error messages you can just reach them
115
- through (the messages, not the whole exceptions, of course).
116
-
117
- The configuration file only contains settings for the commandline user
118
- interface, so you don't need it here. If you want to use the CUI from
119
- your scripts, do
120
- require "smc_get"
121
- require "smc_get/cui"
122
-
123
- cui = SmcGet::CUI.new(ARGV)
124
- cui.start
125
- The configuration file from the <b>config/</b> directory will automatically
126
- be loaded as well as the user-level configuration file; you may specify another
127
- configuration file by placing the appropriate option in ARGV:
128
- ARGV.unshift("-c")
129
- ARGV.unshift("YOURCONFIGFILE.yml")
130
-
131
- cui = SmcGet::CUI.new(ARGV)
132
- cui.start
133
-
134
- = License
135
-
136
- smc-get is licensed under the GNU General Public License. For more information,
137
- see COPYING.
138
-
139
- = Website
140
-
141
- This software was written by Entertaining Software, Inc. Visit us at
142
- http://www.entertainingsoftware.com.
143
-
144
- This software is hosted at GitHub. The project page can be found at
145
- http://github.com/Luiji/smc-get.
146
-
147
- This software was written for Secret Maryo Chronicles. Visit them at
148
- http://www.secretmaryo.org.
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
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