gemrage 0.3.2 → 0.4.0

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.
Files changed (165) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +6 -0
  3. data/VERSION +1 -1
  4. data/gemrage.gemspec +160 -2
  5. data/lib/rubygems/commands/scan_command.rb +26 -7
  6. data/spec/spec_helper.rb +2 -1
  7. data/vendor/ruby/1.8/bin/launchy +19 -0
  8. data/vendor/ruby/1.8/bin/rake +19 -0
  9. data/vendor/ruby/1.8/cache/configuration-1.1.0.gem +0 -0
  10. data/vendor/ruby/1.8/cache/launchy-0.3.7.gem +0 -0
  11. data/vendor/ruby/1.8/cache/rake-0.8.7.gem +0 -0
  12. data/vendor/ruby/1.8/gems/configuration-1.1.0/README +197 -0
  13. data/vendor/ruby/1.8/gems/configuration-1.1.0/README.erb +69 -0
  14. data/vendor/ruby/1.8/gems/configuration-1.1.0/Rakefile +241 -0
  15. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/a.rb +5 -0
  16. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/b.rb +19 -0
  17. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/c.rb +8 -0
  18. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/d.rb +5 -0
  19. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/e.rb +13 -0
  20. data/vendor/ruby/1.8/gems/configuration-1.1.0/configuration.gemspec +28 -0
  21. data/vendor/ruby/1.8/gems/configuration-1.1.0/lib/configuration.rb +199 -0
  22. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/a.rb +11 -0
  23. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/b.rb +11 -0
  24. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/c.rb +11 -0
  25. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/d.rb +14 -0
  26. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/e.rb +12 -0
  27. data/vendor/ruby/1.8/gems/launchy-0.3.7/HISTORY +71 -0
  28. data/vendor/ruby/1.8/gems/launchy-0.3.7/LICENSE +16 -0
  29. data/vendor/ruby/1.8/gems/launchy-0.3.7/README +53 -0
  30. data/vendor/ruby/1.8/gems/launchy-0.3.7/Rakefile +62 -0
  31. data/vendor/ruby/1.8/gems/launchy-0.3.7/bin/launchy +12 -0
  32. data/vendor/ruby/1.8/gems/launchy-0.3.7/gemspec.rb +41 -0
  33. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/application.rb +178 -0
  34. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/browser.rb +98 -0
  35. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/command_line.rb +48 -0
  36. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/paths.rb +53 -0
  37. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/version.rb +17 -0
  38. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy.rb +53 -0
  39. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/application_spec.rb +62 -0
  40. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/browser_spec.rb +58 -0
  41. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/launchy_spec.rb +18 -0
  42. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/paths_spec.rb +15 -0
  43. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/spec_helper.rb +5 -0
  44. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/tattle-host-os.yml +427 -0
  45. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/version_spec.rb +11 -0
  46. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/announce.rake +39 -0
  47. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/config.rb +107 -0
  48. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/distribution.rake +46 -0
  49. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/documentation.rake +32 -0
  50. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/rspec.rake +37 -0
  51. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/rubyforge.rake +52 -0
  52. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/utils.rb +80 -0
  53. data/vendor/ruby/1.8/gems/rake-0.8.7/CHANGES +440 -0
  54. data/vendor/ruby/1.8/gems/rake-0.8.7/MIT-LICENSE +21 -0
  55. data/vendor/ruby/1.8/gems/rake-0.8.7/README +196 -0
  56. data/vendor/ruby/1.8/gems/rake-0.8.7/Rakefile +430 -0
  57. data/vendor/ruby/1.8/gems/rake-0.8.7/TODO +20 -0
  58. data/vendor/ruby/1.8/gems/rake-0.8.7/bin/rake +31 -0
  59. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/command_line_usage.rdoc +102 -0
  60. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/Rakefile1 +38 -0
  61. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/Rakefile2 +35 -0
  62. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/a.c +6 -0
  63. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/b.c +6 -0
  64. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/main.c +11 -0
  65. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/glossary.rdoc +51 -0
  66. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/jamis.rb +591 -0
  67. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/proto_rake.rdoc +127 -0
  68. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rake.1.gz +0 -0
  69. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rakefile.rdoc +534 -0
  70. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rational.rdoc +151 -0
  71. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +23 -0
  72. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +35 -0
  73. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +53 -0
  74. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +78 -0
  75. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +46 -0
  76. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +141 -0
  77. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +119 -0
  78. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +59 -0
  79. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +121 -0
  80. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +47 -0
  81. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +114 -0
  82. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +165 -0
  83. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +112 -0
  84. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +147 -0
  85. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +53 -0
  86. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +55 -0
  87. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +55 -0
  88. data/vendor/ruby/1.8/gems/rake-0.8.7/install.rb +88 -0
  89. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/alt_system.rb +108 -0
  90. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/classic_namespace.rb +8 -0
  91. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/clean.rb +33 -0
  92. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +24 -0
  93. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/ftptools.rb +153 -0
  94. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/publisher.rb +75 -0
  95. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  96. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +47 -0
  97. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/sys.rb +209 -0
  98. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb +97 -0
  99. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/loaders/makefile.rb +42 -0
  100. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb +184 -0
  101. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb +5 -0
  102. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb +209 -0
  103. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +23 -0
  104. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/runtest.rb +23 -0
  105. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/tasklib.rb +23 -0
  106. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb +161 -0
  107. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/win32.rb +55 -0
  108. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake.rb +2506 -0
  109. data/vendor/ruby/1.8/gems/rake-0.8.7/test/capture_stdout.rb +26 -0
  110. data/vendor/ruby/1.8/gems/rake-0.8.7/test/check_expansion.rb +5 -0
  111. data/vendor/ruby/1.8/gems/rake-0.8.7/test/check_no_expansion.rb +5 -0
  112. data/vendor/ruby/1.8/gems/rake-0.8.7/test/contrib/test_sys.rb +47 -0
  113. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/chains/Rakefile +15 -0
  114. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/default/Rakefile +19 -0
  115. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/dryrun/Rakefile +22 -0
  116. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/file_creation_task/Rakefile +33 -0
  117. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/imports/Rakefile +19 -0
  118. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/imports/deps.mf +1 -0
  119. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/multidesc/Rakefile +17 -0
  120. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/namespace/Rakefile +57 -0
  121. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/rakelib/test1.rb +3 -0
  122. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/rbext/rakefile.rb +3 -0
  123. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/sample.mf +14 -0
  124. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/statusreturn/Rakefile +8 -0
  125. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/unittest/Rakefile +1 -0
  126. data/vendor/ruby/1.8/gems/rake-0.8.7/test/filecreation.rb +32 -0
  127. data/vendor/ruby/1.8/gems/rake-0.8.7/test/functional.rb +15 -0
  128. data/vendor/ruby/1.8/gems/rake-0.8.7/test/in_environment.rb +30 -0
  129. data/vendor/ruby/1.8/gems/rake-0.8.7/test/rake_test_setup.rb +24 -0
  130. data/vendor/ruby/1.8/gems/rake-0.8.7/test/reqfile.rb +3 -0
  131. data/vendor/ruby/1.8/gems/rake-0.8.7/test/reqfile2.rb +3 -0
  132. data/vendor/ruby/1.8/gems/rake-0.8.7/test/session_functional.rb +339 -0
  133. data/vendor/ruby/1.8/gems/rake-0.8.7/test/shellcommand.rb +3 -0
  134. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_application.rb +675 -0
  135. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_clean.rb +14 -0
  136. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_definitions.rb +85 -0
  137. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_earlytime.rb +35 -0
  138. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_extension.rb +63 -0
  139. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_file_creation_task.rb +62 -0
  140. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_file_task.rb +143 -0
  141. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_filelist.rb +623 -0
  142. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_fileutils.rb +251 -0
  143. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_ftp.rb +59 -0
  144. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_invocation_chain.rb +81 -0
  145. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_makefile_loader.rb +26 -0
  146. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_multitask.rb +45 -0
  147. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_namespace.rb +55 -0
  148. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_package_task.rb +118 -0
  149. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_pathmap.rb +210 -0
  150. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_pseudo_status.rb +26 -0
  151. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rake.rb +41 -0
  152. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rdoc_task.rb +88 -0
  153. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_require.rb +35 -0
  154. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rules.rb +349 -0
  155. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_task_arguments.rb +89 -0
  156. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_task_manager.rb +173 -0
  157. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_tasklib.rb +12 -0
  158. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_tasks.rb +374 -0
  159. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb +77 -0
  160. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_top_level_functions.rb +86 -0
  161. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_win32.rb +72 -0
  162. data/vendor/ruby/1.8/specifications/configuration-1.1.0.gemspec +27 -0
  163. data/vendor/ruby/1.8/specifications/launchy-0.3.7.gemspec +44 -0
  164. data/vendor/ruby/1.8/specifications/rake-0.8.7.gemspec +32 -0
  165. metadata +163 -5
@@ -0,0 +1,241 @@
1
+ This.author = "Ara T. Howard"
2
+ This.email = "ara.t.howard@gmail.com"
3
+ This.homepage = "http://github.com/ahoward/#{ This.lib }/tree/master"
4
+ This.rubyforge_project = 'codeforpeople'
5
+
6
+ task :default do
7
+ puts(Rake::Task.tasks.map{|task| task.name} - ['default'])
8
+ end
9
+
10
+ task :spec do
11
+ require 'spec/rake/spectask'
12
+ Spec::Rake::SpecTask.new do |t|
13
+ t.spec_files = FileList['spec/*_spec.rb']
14
+ end
15
+ end
16
+
17
+ task :gemspec do
18
+ ignore_extensions = 'git', 'svn', 'tmp', /sw./, 'bak', 'gem'
19
+ ignore_directories = 'pkg'
20
+ ignore_files = 'test/log'
21
+
22
+ shiteless =
23
+ lambda do |list|
24
+ list.delete_if do |entry|
25
+ next unless test(?e, entry)
26
+ extension = File.basename(entry).split(%r/[.]/).last
27
+ ignore_extensions.any?{|ext| ext === extension}
28
+ end
29
+ list.delete_if do |entry|
30
+ next unless test(?d, entry)
31
+ dirname = File.expand_path(entry)
32
+ ignore_directories.any?{|dir| File.expand_path(dir) == dirname}
33
+ end
34
+ list.delete_if do |entry|
35
+ next unless test(?f, entry)
36
+ filename = File.expand_path(entry)
37
+ ignore_files.any?{|file| File.expand_path(file) == filename}
38
+ end
39
+ end
40
+
41
+ lib = This.lib
42
+ version = This.version
43
+ files = shiteless[Dir::glob("**/**")]
44
+ executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
45
+ has_rdoc = true #File.exist?('doc')
46
+ test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
47
+
48
+ extensions = This.extensions
49
+ if extensions.nil?
50
+ %w( Makefile configure extconf.rb ).each do |ext|
51
+ extensions << ext if File.exists?(ext)
52
+ end
53
+ end
54
+ extensions = [extensions].flatten.compact
55
+
56
+ template =
57
+ if test(?e, 'gemspec.erb')
58
+ Template{ IO.read('gemspec.erb') }
59
+ else
60
+ Template {
61
+ <<-__
62
+ ## #{ lib }.gemspec
63
+ #
64
+
65
+ Gem::Specification::new do |spec|
66
+ spec.name = #{ lib.inspect }
67
+ spec.version = #{ version.inspect }
68
+ spec.platform = Gem::Platform::RUBY
69
+ spec.summary = #{ lib.inspect }
70
+
71
+ spec.files = #{ files.inspect }
72
+ spec.executables = #{ executables.inspect }
73
+
74
+ <% if test(?d, 'lib') %>
75
+ spec.require_path = "lib"
76
+ <% end %>
77
+
78
+ spec.has_rdoc = #{ has_rdoc.inspect }
79
+ spec.test_files = #{ test_files.inspect }
80
+ #spec.add_dependency 'lib', '>= version'
81
+ #spec.add_dependency 'fattr'
82
+
83
+ spec.extensions.push(*#{ extensions.inspect })
84
+
85
+ spec.rubyforge_project = #{ This.rubyforge_project.inspect }
86
+ spec.author = #{ This.author.inspect }
87
+ spec.email = #{ This.email.inspect }
88
+ spec.homepage = #{ This.homepage.inspect }
89
+ end
90
+ __
91
+ }
92
+ end
93
+
94
+ open("#{ lib }.gemspec", "w"){|fd| fd.puts template}
95
+ This.gemspec = "#{ lib }.gemspec"
96
+ end
97
+
98
+ task :gem => [:clean, :gemspec] do
99
+ Fu.mkdir_p This.pkgdir
100
+ before = Dir['*.gem']
101
+ cmd = "gem build #{ This.gemspec }"
102
+ `#{ cmd }`
103
+ after = Dir['*.gem']
104
+ gem = ((after - before).first || after.first) or abort('no gem!')
105
+ Fu.mv gem, This.pkgdir
106
+ This.gem = File.basename(gem)
107
+ end
108
+
109
+ task :readme do
110
+ samples = ''
111
+ prompt = '~ > '
112
+ lib = This.lib
113
+ version = This.version
114
+
115
+ Dir['sample*/*'].sort.each do |sample|
116
+ samples << "\n" << " <========< #{ sample } >========>" << "\n\n"
117
+
118
+ cmd = "cat #{ sample }"
119
+ samples << Util.indent(prompt + cmd, 2) << "\n\n"
120
+ samples << Util.indent(`#{ cmd }`, 4) << "\n"
121
+
122
+ cmd = "ruby #{ sample }"
123
+ samples << Util.indent(prompt + cmd, 2) << "\n\n"
124
+
125
+ cmd = "ruby -e'STDOUT.sync=true; exec %(ruby -Ilib -Iconfig #{ sample })'"
126
+ samples << Util.indent(`#{ cmd } 2>&1`, 4) << "\n"
127
+ end
128
+
129
+ template =
130
+ if test(?e, 'readme.erb')
131
+ Template{ IO.read('readme.erb') }
132
+ else
133
+ Template {
134
+ <<-__
135
+ NAME
136
+ #{ lib }
137
+
138
+ DESCRIPTION
139
+
140
+ INSTALL
141
+ gem install #{ lib }
142
+
143
+ SAMPLES
144
+ #{ samples }
145
+ __
146
+ }
147
+ end
148
+
149
+ open("README", "w"){|fd| fd.puts template}
150
+ end
151
+
152
+
153
+ task :clean do
154
+ Dir[File.join(This.pkgdir, '**/**')].each{|entry| Fu.rm_rf(entry)}
155
+ end
156
+
157
+
158
+ task :release => [:clean, :gemspec, :gem] do
159
+ gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
160
+ raise "which one? : #{ gems.inspect }" if gems.size > 1
161
+ raise "no gems?" if gems.size < 1
162
+ cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.pkgdir }/#{ This.gem }"
163
+ puts cmd
164
+ system cmd
165
+ end
166
+
167
+
168
+
169
+
170
+
171
+ BEGIN {
172
+ $VERBOSE = nil
173
+
174
+ require 'ostruct'
175
+ require 'erb'
176
+ require 'fileutils'
177
+
178
+ Fu = FileUtils
179
+
180
+ This = OpenStruct.new
181
+
182
+ This.file = File.expand_path(__FILE__)
183
+ This.dir = File.dirname(This.file)
184
+ This.pkgdir = File.join(This.dir, 'pkg')
185
+
186
+ lib = ENV['LIB']
187
+ unless lib
188
+ lib = File.basename(Dir.pwd)
189
+ end
190
+ This.lib = lib
191
+
192
+ version = ENV['VERSION']
193
+ unless version
194
+ name = lib.capitalize
195
+ library = "./lib/#{ lib }.rb"
196
+ program = "./bin/#{ lib }"
197
+ if test(?e, library)
198
+ require library
199
+ version = eval(name).send(:version)
200
+ elsif test(?e, program)
201
+ version = `#{ program } --version`.strip
202
+ end
203
+ abort('no version') if(version.nil? or version.empty?)
204
+ end
205
+ This.version = version
206
+
207
+ abort('no lib') unless This.lib
208
+ abort('no version') unless This.version
209
+
210
+ module Util
211
+ def indent(s, n = 2)
212
+ s = unindent(s)
213
+ ws = ' ' * n
214
+ s.gsub(%r/^/, ws)
215
+ end
216
+
217
+ def unindent(s)
218
+ indent = nil
219
+ s.each do |line|
220
+ next if line =~ %r/^\s*$/
221
+ indent = line[%r/^\s*/] and break
222
+ end
223
+ indent ? s.gsub(%r/^#{ indent }/, "") : s
224
+ end
225
+ extend self
226
+ end
227
+
228
+ class Template
229
+ def initialize(&block)
230
+ @block = block
231
+ @template = block.call.to_s
232
+ end
233
+ def expand(b=nil)
234
+ ERB.new(Util.unindent(@template)).result(b||@block)
235
+ end
236
+ alias_method 'to_s', 'expand'
237
+ end
238
+ def Template(*args, &block) Template.new(*args, &block) end
239
+
240
+ Dir.chdir(This.dir)
241
+ }
@@ -0,0 +1,5 @@
1
+ Configuration.for('a'){
2
+ a 40
3
+ b 4
4
+ c 2
5
+ }
@@ -0,0 +1,19 @@
1
+ Configuration.for('b'){
2
+ host "codeforpeople.com"
3
+
4
+ www {
5
+ port 80
6
+ url "http://#{ host }:#{ port }"
7
+ }
8
+
9
+ db {
10
+ port 5342
11
+ url "db://#{ host }:#{ port }"
12
+ }
13
+
14
+ mail {
15
+ host "gmail.com"
16
+ port 25
17
+ url "mail://#{ host }:#{ port }"
18
+ }
19
+ }
@@ -0,0 +1,8 @@
1
+ %w( development production testing ).each do |environment|
2
+
3
+ Configuration.for(environment){
4
+ adapter "sqlite3"
5
+ db "db/#{ environment }"
6
+ }
7
+
8
+ end
@@ -0,0 +1,5 @@
1
+ Configuration.for('d'){
2
+ object_id 42
3
+ inspect 'forty-two'
4
+ p 42.0
5
+ }
@@ -0,0 +1,13 @@
1
+ Configuration.for('e'){
2
+ foo 42
3
+
4
+ if Send('respond_to?', 'foo')
5
+ bar 'forty-two'
6
+ end
7
+
8
+ respond_to = Method('bar')
9
+
10
+ if respond_to.call()
11
+ foobar 42.0
12
+ end
13
+ }
@@ -0,0 +1,28 @@
1
+ ## configuration.gemspec
2
+ #
3
+
4
+ Gem::Specification::new do |spec|
5
+ spec.name = "configuration"
6
+ spec.version = "1.1.0"
7
+ spec.platform = Gem::Platform::RUBY
8
+ spec.summary = "configuration"
9
+
10
+ spec.files = ["config", "config/a.rb", "config/b.rb", "config/c.rb", "config/d.rb", "config/e.rb", "configuration.gemspec", "lib", "lib/configuration.rb", "Rakefile", "README", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb"]
11
+ spec.executables = []
12
+
13
+
14
+ spec.require_path = "lib"
15
+
16
+
17
+ spec.has_rdoc = true
18
+ spec.test_files = nil
19
+ #spec.add_dependency 'lib', '>= version'
20
+ #spec.add_dependency 'fattr'
21
+
22
+ spec.extensions.push(*[])
23
+
24
+ spec.rubyforge_project = "codeforpeople"
25
+ spec.author = "Ara T. Howard"
26
+ spec.email = "ara.t.howard@gmail.com"
27
+ spec.homepage = "http://github.com/ahoward/configuration/tree/master"
28
+ end
@@ -0,0 +1,199 @@
1
+ class Configuration
2
+ Configuration::Version = '1.1.0'
3
+ def Configuration.version() Configuration::Version end
4
+
5
+ Path = [
6
+ if defined? CONFIGURATION_PATH
7
+ CONFIGURATION_PATH
8
+ else
9
+ ENV['CONFIGURATION_PATH']
10
+ end
11
+ ].compact.flatten.join(File::PATH_SEPARATOR).split(File::PATH_SEPARATOR)
12
+
13
+ Table = Hash.new
14
+ Error = Class.new StandardError
15
+ Import = Class.new Error
16
+
17
+ module ClassMethods
18
+ def for name, options = nil, &block
19
+ name = name.to_s
20
+ if Table.has_key?(name)
21
+ if options or block
22
+ configuration = Table[name]
23
+ Table[name] = DSL.evaluate(configuration, options || {}, &block)
24
+ else
25
+ Table[name]
26
+ end
27
+ else
28
+ if options or block
29
+ Table[name] = new name, options || {}, &block
30
+ else
31
+ load name
32
+ end
33
+ end
34
+ end
35
+
36
+ def path *value
37
+ return self.path = value.first unless value.empty?
38
+ Path
39
+ end
40
+
41
+ def path= value
42
+ Path.clear
43
+ Path.replace [value].compact.flatten.join(File::PATH_SEPARATOR).split(File::PATH_SEPARATOR)
44
+ end
45
+
46
+ def load name
47
+ name = name.to_s
48
+ name = name + '.rb' unless name[%r/\.rb$/]
49
+ key = name.sub %r/\.rb$/, ''
50
+ load_path = $LOAD_PATH.dup
51
+ begin
52
+ $LOAD_PATH.replace(path + load_path)
53
+ ::Kernel.load name
54
+ ensure
55
+ $LOAD_PATH.replace load_path
56
+ end
57
+ Table[key]
58
+ end
59
+ end
60
+ send :extend, ClassMethods
61
+
62
+ module InstanceMethods
63
+ attr 'name'
64
+
65
+ def initialize *argv, &block
66
+ options = Hash === argv.last ? argv.pop : Hash.new
67
+ @name = argv.shift
68
+ DSL.evaluate(self, options, &block)
69
+ end
70
+
71
+ def method_missing m, *a, &b
72
+ return(Pure[@__parent].send m, *a, &b) rescue super if @__parent
73
+ super
74
+ end
75
+ end
76
+ send :include, InstanceMethods
77
+
78
+ class DSL
79
+ Protected = %r/^__|^object_id$/
80
+
81
+ instance_methods.each do |m|
82
+ undef_method m unless m[Protected]
83
+ end
84
+
85
+ Kernel.methods.each do |m|
86
+ next if m[Protected]
87
+ module_eval <<-code
88
+ def #{ m }(*a, &b)
89
+ method_missing '#{ m }', *a, &b
90
+ end
91
+ code
92
+ end
93
+
94
+ def Send(m, *a, &b)
95
+ Method(m).call(*a, &b)
96
+ end
97
+
98
+ def Method m
99
+ @__configuration.method(m)
100
+ end
101
+
102
+ def self.evaluate configuration, options = {}, &block
103
+ dsl = new configuration
104
+ Pure[dsl].instance_eval(&block) if block
105
+ options.each{|key, value| Pure[dsl].send key, value}
106
+ Pure[dsl].instance_eval{ @__configuration }
107
+ end
108
+
109
+ def initialize configuration, &block
110
+ @__configuration = configuration
111
+ @__singleton_class =
112
+ class << @__configuration
113
+ self
114
+ end
115
+ end
116
+
117
+ def __configuration__
118
+ @__configuration
119
+ end
120
+
121
+ undef_method(:method_missing) rescue nil
122
+ def method_missing(m, *a, &b)
123
+ if(a.empty? and b.nil?)
124
+ return Pure[@__configuration].send(m, *a, &b)
125
+ end
126
+ if b
127
+ raise ArgumentError unless a.empty?
128
+ parent = @__configuration
129
+ name = m.to_s
130
+ configuration =
131
+ if @__configuration.respond_to?(name) and Configuration === @__configuration.send(name)
132
+ @__configuration.send name
133
+ else
134
+ Configuration.new name
135
+ end
136
+ Pure[configuration].instance_eval{ @__parent = parent }
137
+ DSL.evaluate configuration, &b
138
+ value = configuration
139
+ end
140
+ unless a.empty?
141
+ value = a.size == 1 ? a.first : a
142
+ end
143
+ @__singleton_class.module_eval do
144
+ define_method(m){ value }
145
+ end
146
+ end
147
+
148
+ verbose = $VERBOSE
149
+ begin
150
+ $VERBOSE = nil
151
+ def object_id(*args)
152
+ unless args.empty?
153
+ verbose = $VERBOSE
154
+ begin
155
+ $VERBOSE = nil
156
+ define_method(:object_id){ args.first }
157
+ ensure
158
+ $VERBOSE = verbose
159
+ end
160
+ else
161
+ return Pure[@__configuration].object_id
162
+ end
163
+ end
164
+ ensure
165
+ $VERBOSE = verbose
166
+ end
167
+ end
168
+
169
+ class Pure
170
+ Instance_Methods = Hash.new
171
+ Protected = %r/^__|^object_id$/
172
+
173
+ ::Object.instance_methods.each do |m|
174
+ Instance_Methods[m.to_s] = ::Object.instance_method m
175
+ undef_method m unless m[Protected]
176
+ end
177
+
178
+ def method_missing m, *a, &b
179
+ Instance_Methods[m.to_s].bind(@object).call(*a, &b)
180
+ end
181
+
182
+ def initialize object
183
+ @object = object
184
+ end
185
+
186
+ def Pure.[] object
187
+ new object
188
+ end
189
+ end
190
+ end
191
+
192
+ def Configuration(*a, &b)
193
+ if a.empty? and b.nil?
194
+ const_get :Configuration
195
+ else
196
+ Configuration.new(*a, &b)
197
+ end
198
+ end
199
+
@@ -0,0 +1,11 @@
1
+ #
2
+ # basic usage is quite, simple, load the config and use it's values. the
3
+ # config syntax is fairly obvious, i think, but note that it *is* ruby and any
4
+ # ruby can be included. also note that each config is named, allowing
5
+ # multiple configs to be places in one file
6
+ #
7
+ require 'configuration'
8
+
9
+ c = Configuration.load 'a'
10
+
11
+ p c.a + c.b - c.c
@@ -0,0 +1,11 @@
1
+ #
2
+ # configuration.rb supports a very natural nesting syntax. note how values
3
+ # are scoped in a POLS fashion
4
+ #
5
+ require 'configuration'
6
+
7
+ c = Configuration.for 'b'
8
+
9
+ p c.www.url
10
+ p c.db.url
11
+ p c.mail.url
@@ -0,0 +1,11 @@
1
+ #
2
+ # configuration.rb let's you keep code very dry.
3
+ #
4
+
5
+ require 'configuration'
6
+
7
+ Configuration.load 'c'
8
+
9
+ p Configuration.for('development').db
10
+ p Configuration.for('production').db
11
+ p Configuration.for('testing').db
@@ -0,0 +1,14 @@
1
+ #
2
+ # configuration.rb makes use of an external blank slate dsl, this means that
3
+ # you Configuration objects do, in fact, have all built-in ruby methods such
4
+ # as #inspect, etc, *unless* you configure over the top of them. the effect
5
+ # is a configuration object that behaves like a nice ruby object, but which
6
+ # allows *any* key to be configured
7
+ #
8
+ require 'configuration'
9
+
10
+ c = Configuration.for 'd'
11
+
12
+ p c.object_id
13
+ p c.inspect
14
+ p c.p
@@ -0,0 +1,12 @@
1
+ #
2
+ # configuration.rb uses a totally clean slate dsl for the block. if you need
3
+ # to access base Object methods you can do this
4
+ #
5
+
6
+ require 'configuration'
7
+
8
+ c = Configuration.for 'e'
9
+
10
+ p c.foo
11
+ p c.bar
12
+ p c.foobar
@@ -0,0 +1,71 @@
1
+ = Launchy Changlog
2
+
3
+ == Version 0.3.7 - 2010-07-19
4
+
5
+ * Fix launchy on windows (mikefarmer)
6
+
7
+ == Version 0.3.6 - 2010-02-22
8
+
9
+ * add a test:spec task to run tests without rcov support
10
+ * added 'testing' os family for running tests
11
+
12
+ == Version 0.3.5 - 2009-12-17
13
+
14
+ * clarify that launchy is under ISC license
15
+ * fix missing data file in released gem needed for running specs
16
+
17
+ == Version 0.3.3 - 2009-02-19
18
+
19
+ * pass command line as discrete items to system() to avoid string
20
+ interpretation by the system shell. (Suraj N. Kurapati)
21
+ * rework project layout and tasks
22
+
23
+ == Version 0.3.2 - 2008-05-21
24
+
25
+ * detect aix and mingw as known operating systems.
26
+
27
+ == Version 0.3.1 - 2007-09-08
28
+
29
+ * finalize the command line wrapper around the launchy library.
30
+ * added more tests
31
+
32
+ == Version 0.3.0 - 2007-08-30
33
+
34
+ * reorganize the code structure, removing Spawnable namespace
35
+ * removed 'do_magic' method, changed it to 'open'
36
+ * added override environment variable LAUNCHY_HOST_OS for testing
37
+ * fix broken cygwin support [Bug #13472]
38
+
39
+ == Version 0.2.1 - 2007-08-18
40
+
41
+ * fix inability to find windows executables [Bug #13132]
42
+
43
+ == Version 0.2.0 - 2007-08-11
44
+
45
+ * rework browser finding
46
+ * manual override with LAUNCHY_BROWSER environment variable
47
+ * on *nix use desktop application launcher with fallback to list of browsers
48
+ * On windows, switch to 'start' command and remove dependency on win32-process
49
+ * removed win32 gem
50
+ * Add debug output by setting LAUNCHY_DEBUG environment variable to 'true'
51
+
52
+ == Version 0.1.2 - 2007-08-11
53
+
54
+ * forked child exits without calling at_exit handlers
55
+
56
+ == Version 0.1.1
57
+
58
+ * fixed rubyforge task to release mswin32 gem also
59
+
60
+ == Version 0.1.0
61
+
62
+ * Initial public release
63
+ * switched to using fork to spawn process and require 'win32/process' if on windows
64
+
65
+ == Version 0.0.2
66
+
67
+ * First attempt at using systemu to spawn processes
68
+
69
+ == Version 0.0.1
70
+
71
+ * Initially working release
@@ -0,0 +1,16 @@
1
+ ISC LICENSE - http://opensource.org/licenses/isc-license.txt
2
+
3
+ Copyright (c) 2007-2009 Jeremy Hinegardner
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+