rubygems-sing 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
Binary file
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2010-01-20
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,6 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/rubygems/commands/sing_command.rb
6
+ lib/rubygems_plugin.rb
data/README.txt ADDED
@@ -0,0 +1,52 @@
1
+ = rubygems-sing
2
+
3
+ * http://rubyforge.org/projects/seattlerb
4
+
5
+ == DESCRIPTION:
6
+
7
+ "Sings" a gem's implementation.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * "Sings" a gem's lib directory, based on the nesting of the "end" tokens.
12
+ * Currently hard coded to use dls_synth for lack of better examples.
13
+ * Rad drums at the end of each file. :P
14
+ * Special thanks to drbrain for inspiration and bbleything for help with impl.
15
+
16
+ == SYNOPSIS:
17
+
18
+ % gem sing install_gem_name
19
+
20
+ == REQUIREMENTS:
21
+
22
+ * rubygems, duh
23
+ * midiator
24
+
25
+ == INSTALL:
26
+
27
+ * sudo gem install rubygems_sing
28
+
29
+ == LICENSE:
30
+
31
+ (The MIT License)
32
+
33
+ Copyright (c) Ryan Davis, seattle.rb
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining
36
+ a copy of this software and associated documentation files (the
37
+ 'Software'), to deal in the Software without restriction, including
38
+ without limitation the rights to use, copy, modify, merge, publish,
39
+ distribute, sublicense, and/or sell copies of the Software, and to
40
+ permit persons to whom the Software is furnished to do so, subject to
41
+ the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be
44
+ included in all copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.plugin :seattlerb
7
+ Hoe.plugin :rubyforge # for the time being
8
+
9
+ Hoe.spec 'rubygems-sing' do
10
+ developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
11
+
12
+ extra_deps << ['midiator', '~> 0.3.2']
13
+
14
+ self.rubyforge_name = 'seattlerb'
15
+ end
16
+
17
+ # vim: syntax=ruby
@@ -0,0 +1,88 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+ require 'rubygems/text'
4
+
5
+ require 'midiator'
6
+
7
+ ##
8
+ # gem command to "sing" the implementation of a gem.
9
+
10
+ class Gem::Commands::SingCommand < Gem::Command
11
+ VERSION = '1.0.0'
12
+
13
+ include MIDIator::Notes
14
+ include MIDIator::Drums
15
+
16
+ include Gem::VersionOption
17
+ # include Gem::Text
18
+
19
+ def initialize
20
+ super("sing", "\"Sing\" a gem's implementation",
21
+ :version => Gem::Requirement.default)
22
+
23
+ add_version_option
24
+ end
25
+
26
+ def arguments # :nodoc:
27
+ 'GEMNAME name of an installed gem to sing'
28
+ end
29
+
30
+ def defaults_str # :nodoc:
31
+ "--version='>= 0'"
32
+ end
33
+
34
+ def usage # :nodoc:
35
+ "#{program_name} GEMNAME [options]"
36
+ end
37
+
38
+ def execute
39
+ name = get_one_gem_name
40
+
41
+ dep = Gem::Dependency.new name, options[:version]
42
+ specs = Gem.source_index.search dep
43
+
44
+ if specs.empty? then
45
+ alert_error "No installed gem #{dep}"
46
+ terminate_interaction 1
47
+ end
48
+
49
+ spec = specs.last
50
+ base = spec.full_gem_path
51
+
52
+ ##
53
+ # Special thanks to Ben Bleything for midiator and help getting
54
+ # this up and running!
55
+
56
+ midi = MIDIator::Interface.new
57
+ midi.use :dls_synth
58
+
59
+ scale = [ C4, Cs4, D4, Eb4, E4, F4, Fs4, G4, Gs4, A4, Bb4, B4,
60
+ C5, Cs5, D5, Eb5, E5, F5, Fs5, G5, Gs5, A5, Bb5, B5 ]
61
+
62
+ midi.control_change 32, 10, 1 # TR-808 is Program 26 in LSB bank 1
63
+ midi.program_change 10, 26
64
+
65
+ # TODO: eventually add ability to play actual AST
66
+
67
+ spec.lib_files.each do |path|
68
+ full_path = File.join base, path
69
+ warn path
70
+ File.foreach(full_path) do |line|
71
+ if line =~ /^(\s+)end$/ then
72
+ num_spaces = $1.size
73
+ midi.play scale[ num_spaces / 2 ]
74
+ print line
75
+ end
76
+ end
77
+
78
+ [ HighTom1, HighTom2, LowTom1, LowTom2 ].each do |note|
79
+ midi.play note, 0.067, 10
80
+ end
81
+
82
+ midi.play CrashCymbal1, 0.25, 10
83
+ end
84
+
85
+ midi.play CrashCymbal2, 0.25, 10
86
+ sleep 1.0
87
+ end
88
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ Gem::CommandManager.instance.register_command :sing
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-sing
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
+ ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyM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
+ -----END CERTIFICATE-----
32
+
33
+ date: 2010-01-20 00:00:00 -08:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: midiator
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.3.2
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: rubyforge
48
+ type: :development
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.3
55
+ version:
56
+ - !ruby/object:Gem::Dependency
57
+ name: gemcutter
58
+ type: :development
59
+ version_requirement:
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.3.0
65
+ version:
66
+ - !ruby/object:Gem::Dependency
67
+ name: minitest
68
+ type: :development
69
+ version_requirement:
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.5.0
75
+ version:
76
+ - !ruby/object:Gem::Dependency
77
+ name: hoe
78
+ type: :development
79
+ version_requirement:
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.5.0
85
+ version:
86
+ description: "\"Sings\" a gem's implementation."
87
+ email:
88
+ - ryand-ruby@zenspider.com
89
+ executables: []
90
+
91
+ extensions: []
92
+
93
+ extra_rdoc_files:
94
+ - History.txt
95
+ - Manifest.txt
96
+ - README.txt
97
+ files:
98
+ - History.txt
99
+ - Manifest.txt
100
+ - README.txt
101
+ - Rakefile
102
+ - lib/rubygems/commands/sing_command.rb
103
+ - lib/rubygems_plugin.rb
104
+ has_rdoc: true
105
+ homepage: http://rubyforge.org/projects/seattlerb
106
+ licenses: []
107
+
108
+ post_install_message:
109
+ rdoc_options:
110
+ - --main
111
+ - README.txt
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ version:
126
+ requirements: []
127
+
128
+ rubyforge_project: seattlerb
129
+ rubygems_version: 1.3.5
130
+ signing_key:
131
+ specification_version: 3
132
+ summary: "\"Sings\" a gem's implementation."
133
+ test_files: []
134
+
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ � ?0Vn��O)���Fur��|R�b}]�,3� ��
2
+ ɦ��T�)cY�L��dO@)��8[��� 4�� �6FT���&���
3
+ ��27n�|%s��5�mG����aXݔ�R#y�����ↄ H���n�?:��'��$f����c���c4j�M�a��X�_����3��̫m�F�W%�7��)��0?�]���s/i�`O