ampt 0.2.0.pre1 → 0.2.0.pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +5 -5
- data/ampt.gemspec +14 -9
- data/lib/ampt.rb +37 -42
- metadata +35 -11
- data/.autotest +0 -23
data/Rakefile
CHANGED
@@ -7,14 +7,14 @@ begin
|
|
7
7
|
Jeweler::Tasks.new do |gem|
|
8
8
|
gem.name = "ampt"
|
9
9
|
gem.version = Ampt::VERSION
|
10
|
-
gem.summary = %Q{
|
11
|
-
gem.description = %Q{This is a command line client for the Acoustics Media Player (amp).
|
12
|
-
Amp is available here: http://www.github.com/avuserow/amp
|
13
|
-
|
14
|
-
This is a work in progress.}
|
10
|
+
gem.summary = %Q{acoustics media player command line client}
|
11
|
+
gem.description = %Q{This is a command line client for the Acoustics Media Player (amp).}
|
15
12
|
gem.email = "rich@interhacktive.com"
|
16
13
|
gem.homepage = "http://github.com/capslock/ampt"
|
17
14
|
gem.authors = ["Rich"]
|
15
|
+
gem.add_dependency 'curb'
|
16
|
+
gem.add_dependency 'trollop'
|
17
|
+
gem.add_dependency 'json'
|
18
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
data/ampt.gemspec
CHANGED
@@ -5,16 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ampt}
|
8
|
-
s.version = "0.2.0.
|
8
|
+
s.version = "0.2.0.pre2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rich"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-09}
|
13
13
|
s.default_executable = %q{ampt}
|
14
|
-
s.description = %q{This is a command line client for the Acoustics Media Player (amp).
|
15
|
-
Amp is available here: http://www.github.com/avuserow/amp
|
16
|
-
|
17
|
-
This is a work in progress.}
|
14
|
+
s.description = %q{This is a command line client for the Acoustics Media Player (amp).}
|
18
15
|
s.email = %q{rich@interhacktive.com}
|
19
16
|
s.executables = ["ampt"]
|
20
17
|
s.extra_rdoc_files = [
|
@@ -22,8 +19,7 @@ This is a work in progress.}
|
|
22
19
|
"README.rdoc"
|
23
20
|
]
|
24
21
|
s.files = [
|
25
|
-
".
|
26
|
-
".document",
|
22
|
+
".document",
|
27
23
|
".gitignore",
|
28
24
|
"LICENSE",
|
29
25
|
"README.rdoc",
|
@@ -40,7 +36,7 @@ This is a work in progress.}
|
|
40
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
41
37
|
s.require_paths = ["lib"]
|
42
38
|
s.rubygems_version = %q{1.3.5}
|
43
|
-
s.summary = %q{
|
39
|
+
s.summary = %q{acoustics media player command line client}
|
44
40
|
s.test_files = [
|
45
41
|
"test/helper.rb",
|
46
42
|
"test/test_ampt.rb"
|
@@ -51,9 +47,18 @@ This is a work in progress.}
|
|
51
47
|
s.specification_version = 3
|
52
48
|
|
53
49
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_runtime_dependency(%q<curb>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
54
53
|
else
|
54
|
+
s.add_dependency(%q<curb>, [">= 0"])
|
55
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
56
|
+
s.add_dependency(%q<json>, [">= 0"])
|
55
57
|
end
|
56
58
|
else
|
59
|
+
s.add_dependency(%q<curb>, [">= 0"])
|
60
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
61
|
+
s.add_dependency(%q<json>, [">= 0"])
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
data/lib/ampt.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'trollop'
|
3
3
|
|
4
4
|
module Ampt
|
5
|
-
VERSION = '0.2.0.
|
5
|
+
VERSION = '0.2.0.pre2'
|
6
6
|
# This is the module that holds the API for the current music player. Defined in
|
7
7
|
# ampt_api/acoustics.rb
|
8
8
|
module API
|
@@ -10,9 +10,22 @@ module Ampt
|
|
10
10
|
|
11
11
|
# The typical entry point for an Ampt app. Configures a new instance of ampt
|
12
12
|
# using the specified block, and runs that configuration.
|
13
|
-
def self.init args = ARGV, *a, &b
|
13
|
+
def self.init args = ARGV.dup, *a, &b
|
14
14
|
@c = Config.new(*a, &b)
|
15
|
-
@c.run(
|
15
|
+
@c.run(args)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Class to hold all of the user-defined functions and variables
|
19
|
+
module User
|
20
|
+
def self.parent_config=(p)
|
21
|
+
p.public_methods(false).each do |m|
|
22
|
+
(class << self; self; end).class_eval do
|
23
|
+
define_method m do |*args, &b|
|
24
|
+
p.send m, *args, &b
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
16
29
|
end
|
17
30
|
|
18
31
|
# Class containing all of the configuration details for Ampt.
|
@@ -31,6 +44,10 @@ module Ampt
|
|
31
44
|
@extras.send(s, *a, &b)
|
32
45
|
end
|
33
46
|
|
47
|
+
def user
|
48
|
+
@extras
|
49
|
+
end
|
50
|
+
|
34
51
|
# Specify a file path from which to load the config from. If a relative path
|
35
52
|
# is provided, the path is taken as relative to the Ampt library directory.
|
36
53
|
def load_config file
|
@@ -45,31 +62,14 @@ module Ampt
|
|
45
62
|
# from the user's .amptrc, which may not exist.
|
46
63
|
begin
|
47
64
|
File.open(name, 'r') do |f|
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# that ugly Ampt::Config::Extra nonsense; neither here, nor in the
|
51
|
-
# config file. Yes, I am an hero.
|
52
|
-
# This is the heart of the operation. It reads the config file into
|
53
|
-
# an anonymous object of anonymous class (what kind of trickery...).
|
54
|
-
# From there, it saves that object into this configuration object
|
55
|
-
# that we're in, also passing a reference to itself into the object,
|
56
|
-
# so that we can continue our trickery from there.
|
65
|
+
# Create a new copy of the User module for holding our
|
66
|
+
# user-defined methods and variables.
|
57
67
|
unless @extras
|
58
|
-
@extras =
|
59
|
-
@extras.
|
60
|
-
end
|
61
|
-
# Now that we have an object, we can use it to store any user-defined
|
62
|
-
# functions in the config, and have it forward to us anything that it
|
63
|
-
# isn't aware of (i.e., all of those pesky command definitions).
|
64
|
-
@extras.class.send(:define_method, :method_missing) do |s, *a, &b|
|
65
|
-
begin
|
66
|
-
@__p__.send(s, *a, &b)
|
67
|
-
rescue e
|
68
|
-
super
|
69
|
-
end
|
68
|
+
@extras = User.dup
|
69
|
+
@extras.parent_config = self
|
70
70
|
end
|
71
|
-
#
|
72
|
-
@extras.
|
71
|
+
# Read in the configuration file.
|
72
|
+
@extras.module_eval(f.read)
|
73
73
|
end
|
74
74
|
rescue Errno::ENOENT => e
|
75
75
|
end
|
@@ -79,7 +79,7 @@ module Ampt
|
|
79
79
|
begin
|
80
80
|
require @api
|
81
81
|
rescue
|
82
|
-
puts "Couldn't load API #{@api}"
|
82
|
+
$stderr.puts "Couldn't load API #{@api}"
|
83
83
|
exit
|
84
84
|
end
|
85
85
|
else
|
@@ -123,7 +123,7 @@ module Ampt
|
|
123
123
|
|
124
124
|
# Run the config. Usually not called manually.
|
125
125
|
def run args
|
126
|
-
Trollop::options args, [@commands, @alias] do |cmds, *
|
126
|
+
Trollop::options args, [@commands, @alias] do |cmds, *a|
|
127
127
|
commands, aliases = cmds
|
128
128
|
banner "Usage ampt [command] [options] [args]"
|
129
129
|
banner "\nCommands include:\n"
|
@@ -136,14 +136,15 @@ module Ampt
|
|
136
136
|
# Stop parsing if we reach a command
|
137
137
|
stop_on(commands.keys + aliases.keys)
|
138
138
|
end
|
139
|
-
cmd =
|
139
|
+
cmd = args.shift
|
140
140
|
# Try to figure out if it's an alias or a command or nothing or invalid
|
141
141
|
if @commands[cmd]
|
142
|
-
@commands[cmd].run(
|
142
|
+
@commands[cmd].run(args)
|
143
143
|
elsif @alias[cmd]
|
144
|
-
|
145
|
-
cmd = @alias[cmd]
|
146
|
-
|
144
|
+
begin
|
145
|
+
cmd, *a = @alias[cmd].split(' ')
|
146
|
+
args = a + args
|
147
|
+
end until @alias[cmd].nil?
|
147
148
|
@commands[cmd].run(ARGV)
|
148
149
|
elsif cmd.nil? and not @default.nil?
|
149
150
|
@commands[@default].run(ARGV)
|
@@ -171,7 +172,6 @@ module Ampt
|
|
171
172
|
# Create a new command. This is usually not called directly; it is invoked by
|
172
173
|
# Ampt::Config::on_run.
|
173
174
|
def initialize config, name, &b
|
174
|
-
@config = config
|
175
175
|
@name = name
|
176
176
|
@desc = []
|
177
177
|
@arg = ['']
|
@@ -179,15 +179,10 @@ module Ampt
|
|
179
179
|
@conflicts = []
|
180
180
|
@depends = []
|
181
181
|
@on_run = lambda {}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
def method_missing s, *a, &b
|
186
|
-
begin
|
187
|
-
@config.extras(s, *a, &b)
|
188
|
-
rescue
|
189
|
-
super
|
182
|
+
(class << self; self; end).instance_eval do
|
183
|
+
include config.user
|
190
184
|
end
|
185
|
+
cloaker(&b).bind(self).call
|
191
186
|
end
|
192
187
|
|
193
188
|
# Specify that a command takes an argument without flags. This is only used
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ampt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich
|
@@ -9,15 +9,40 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-09 00:00:00 -06:00
|
13
13
|
default_executable: ampt
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: curb
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: trollop
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: json
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description: This is a command line client for the Acoustics Media Player (amp).
|
21
46
|
email: rich@interhacktive.com
|
22
47
|
executables:
|
23
48
|
- ampt
|
@@ -27,7 +52,6 @@ extra_rdoc_files:
|
|
27
52
|
- LICENSE
|
28
53
|
- README.rdoc
|
29
54
|
files:
|
30
|
-
- .autotest
|
31
55
|
- .document
|
32
56
|
- .gitignore
|
33
57
|
- LICENSE
|
@@ -67,7 +91,7 @@ rubyforge_project:
|
|
67
91
|
rubygems_version: 1.3.5
|
68
92
|
signing_key:
|
69
93
|
specification_version: 3
|
70
|
-
summary:
|
94
|
+
summary: acoustics media player command line client
|
71
95
|
test_files:
|
72
96
|
- test/helper.rb
|
73
97
|
- test/test_ampt.rb
|
data/.autotest
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'autotest/restart'
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.extra_files << "../some/external/dependency.rb"
|
7
|
-
#
|
8
|
-
# at.libs << ":../some/external"
|
9
|
-
#
|
10
|
-
# at.add_exception 'vendor'
|
11
|
-
#
|
12
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
-
# at.files_matching(/test_.*rb$/)
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# %w(TestA TestB).each do |klass|
|
17
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
|
21
|
-
# Autotest.add_hook :run_command do |at|
|
22
|
-
# system "rake build"
|
23
|
-
# end
|