readorder 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/tasks/config.rb ADDED
@@ -0,0 +1,107 @@
1
+ require 'configuration'
2
+
3
+ require 'rake'
4
+ require 'tasks/utils'
5
+
6
+ #-----------------------------------------------------------------------
7
+ # General project configuration
8
+ #-----------------------------------------------------------------------
9
+ Configuration.for('project') {
10
+ name "readorder"
11
+ version Readorder::Version.to_s
12
+ author "Jeremy Hinegardner"
13
+ email "jeremy@copiousfreetime.org"
14
+ homepage "http://copiousfreetime.rubyforge.org/readorder"
15
+ description Utils.section_of("README", "description")
16
+ summary description.split(".").first
17
+ history "HISTORY"
18
+ license FileList["LICENSE"]
19
+ readme "README"
20
+ }
21
+
22
+ #-----------------------------------------------------------------------
23
+ # Packaging
24
+ #-----------------------------------------------------------------------
25
+ Configuration.for('packaging') {
26
+ # files in the project
27
+ proj_conf = Configuration.for('project')
28
+ files {
29
+ bin FileList["bin/*"]
30
+ ext FileList["ext/*.{c,h,rb}"]
31
+ lib FileList["lib/**/*.rb"]
32
+ test FileList["spec/**/*.rb", "test/**/*.rb"]
33
+ data FileList["data/**/*"]
34
+ tasks FileList["tasks/**/*.r{ake,b}"]
35
+ rdoc FileList[proj_conf.readme, proj_conf.history,
36
+ proj_conf.license] + lib
37
+ all bin + ext + lib + test + data + rdoc + tasks
38
+ }
39
+
40
+ # ways to package the results
41
+ formats {
42
+ tgz true
43
+ zip true
44
+ rubygem Configuration::Table.has_key?('rubygem')
45
+ }
46
+ }
47
+
48
+ #-----------------------------------------------------------------------
49
+ # Gem packaging
50
+ #-----------------------------------------------------------------------
51
+ Configuration.for("rubygem") {
52
+ spec "gemspec.rb"
53
+ Configuration.for('packaging').files.all << spec
54
+ }
55
+
56
+ #-----------------------------------------------------------------------
57
+ # Testing
58
+ # - change mode to 'testunit' to use unit testing
59
+ #-----------------------------------------------------------------------
60
+ Configuration.for('test') {
61
+ mode "spec"
62
+ files Configuration.for("packaging").files.test
63
+ options %w[ --format profile --color ]
64
+ ruby_opts %w[ ]
65
+ }
66
+
67
+ #-----------------------------------------------------------------------
68
+ # Rcov
69
+ #-----------------------------------------------------------------------
70
+ Configuration.for('rcov') {
71
+ output_dir "coverage"
72
+ libs %w[ lib ]
73
+ rcov_opts %w[ --html ]
74
+ ruby_opts %w[ ]
75
+ test_files Configuration.for('packaging').files.test
76
+ }
77
+
78
+ #-----------------------------------------------------------------------
79
+ # Rdoc
80
+ #-----------------------------------------------------------------------
81
+ Configuration.for('rdoc') {
82
+ files Configuration.for('packaging').files.rdoc
83
+ main_page files.first
84
+ title Configuration.for('project').name
85
+ options %w[ ]
86
+ output_dir "doc"
87
+ }
88
+
89
+ #-----------------------------------------------------------------------
90
+ # Extensions
91
+ #-----------------------------------------------------------------------
92
+ Configuration.for('extension') {
93
+ configs Configuration.for('packaging').files.ext.find_all { |x|
94
+ %w[ mkrf_conf.rb extconf.rb ].include?( File.basename(x) )
95
+ }
96
+ }
97
+ #-----------------------------------------------------------------------
98
+ # Rubyforge
99
+ #-----------------------------------------------------------------------
100
+ Configuration.for('rubyforge') {
101
+ project "copiousfreetime"
102
+ user "jjh"
103
+ host "rubyforge.org"
104
+ rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}/readorder"
105
+ }
106
+
107
+
@@ -0,0 +1,38 @@
1
+ require 'tasks/config'
2
+
3
+ #-------------------------------------------------------------------------------
4
+ # Distribution and Packaging
5
+ #-------------------------------------------------------------------------------
6
+ if pkg_config = Configuration.for_if_exist?("packaging") then
7
+
8
+ require 'gemspec'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/contrib/sshpublisher'
11
+
12
+ namespace :dist do
13
+
14
+ Rake::GemPackageTask.new(Readorder::GEM_SPEC) do |pkg|
15
+ pkg.need_tar = pkg_config.formats.tgz
16
+ pkg.need_zip = pkg_config.formats.zip
17
+ end
18
+
19
+ desc "Install as a gem"
20
+ task :install => [:clobber, :package] do
21
+ sh "sudo gem install pkg/#{Readorder::GEM_SPEC.full_name}.gem"
22
+ end
23
+
24
+ desc "Uninstall gem"
25
+ task :uninstall do
26
+ sh "sudo gem uninstall -x #{Readorder::GEM_SPEC.name}"
27
+ end
28
+
29
+ desc "dump gemspec"
30
+ task :gemspec do
31
+ puts Readorder::GEM_SPEC.to_ruby
32
+ end
33
+
34
+ desc "reinstall gem"
35
+ task :reinstall => [:uninstall, :repackage, :install]
36
+
37
+ end
38
+ end
@@ -0,0 +1,32 @@
1
+ require 'tasks/config'
2
+
3
+ #-----------------------------------------------------------------------
4
+ # Documentation
5
+ #-----------------------------------------------------------------------
6
+
7
+ if rdoc_config = Configuration.for_if_exist?('rdoc') then
8
+
9
+ namespace :doc do
10
+
11
+ require 'rdoc'
12
+ require 'rake/rdoctask'
13
+
14
+ # generating documentation locally
15
+ Rake::RDocTask.new do |rdoc|
16
+ rdoc.rdoc_dir = rdoc_config.output_dir
17
+ rdoc.options = rdoc_config.options
18
+ rdoc.rdoc_files = rdoc_config.files
19
+ rdoc.title = rdoc_config.title
20
+ rdoc.main = rdoc_config.main_page
21
+ end
22
+
23
+ if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
24
+ desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
25
+ task :deploy => :rerdoc do
26
+ sh "rsync -zav --delete #{rdoc_config.output_dir}/ #{rubyforge_config.rdoc_location}"
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+
data/tasks/rspec.rake ADDED
@@ -0,0 +1,29 @@
1
+
2
+ require 'tasks/config'
3
+
4
+ #--------------------------------------------------------------------------------
5
+ # configuration for running rspec. This shows up as the test:default task
6
+ #--------------------------------------------------------------------------------
7
+ if spec_config = Configuration.for_if_exist?("test") then
8
+ if spec_config.mode == "spec" then
9
+ namespace :test do
10
+
11
+ task :default => :spec
12
+
13
+ require 'spec/rake/spectask'
14
+ Spec::Rake::SpecTask.new do |r|
15
+ r.ruby_opts = spec_config.ruby_opts
16
+ r.libs = [ Readorder.lib_path,
17
+ Readorder.root_dir ]
18
+ r.spec_files = spec_config.files
19
+ r.spec_opts = spec_config.options
20
+
21
+ if rcov_config = Configuration.for_if_exist?('rcov') then
22
+ r.rcov = true
23
+ r.rcov_dir = rcov_config.output_dir
24
+ r.rcov_opts = rcov_config.rcov_opts
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,51 @@
1
+ require 'tasks/config'
2
+
3
+ #-----------------------------------------------------------------------
4
+ # Rubyforge additions to the task library
5
+ #-----------------------------------------------------------------------
6
+ if rf_conf = Configuration.for_if_exist?("rubyforge") then
7
+
8
+ abort("rubyforge gem not installed 'gem install rubyforge'") unless Utils.try_require('rubyforge')
9
+
10
+ proj_conf = Configuration.for('project')
11
+
12
+ namespace :dist do
13
+ desc "Release files to rubyforge"
14
+ task :rubyforge => [:clean, :package] do
15
+
16
+ rubyforge = RubyForge.new
17
+
18
+ config = {}
19
+ config["release_notes"] = proj_conf.description
20
+ config["release_changes"] = Utils.release_notes_from(proj_conf.history)[Readorder::VERSION]
21
+ config["Prefomatted"] = true
22
+
23
+ rubyforge.configure
24
+
25
+ # make sure this release doesn't already exist
26
+ releases = rubyforge.autoconfig['release_ids']
27
+ if releases.has_key?(Readorder::GEM_SPEC.name) and releases[Readorder::GEM_SPEC.name][Readorder::VERSION] then
28
+ abort("Release #{Readorder::VERSION} already exists! Unable to release.")
29
+ end
30
+
31
+ puts "Uploading to rubyforge..."
32
+ files = FileList[File.join("pkg","#{Readorder::GEM_SPEC.name}-#{Readorder::VERSION}*.*")].to_a
33
+ rubyforge.login
34
+ rubyforge.add_release(Readorder::GEM_SPEC.rubyforge_project, Readorder::GEM_SPEC.name, Readorder::VERSION, *files)
35
+ puts "done."
36
+ end
37
+ end
38
+
39
+ namespace :announce do
40
+ desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
41
+ task :rubyforge do
42
+ info = Utils.announcement
43
+ rubyforge = RubyForge.new
44
+ rubyforge.configure
45
+ rubyforge.login
46
+ rubyforge.post_news(rf_conf.project, info[:subject], "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}")
47
+ puts "Posted to rubyforge"
48
+ end
49
+
50
+ end
51
+ end
data/tasks/utils.rb ADDED
@@ -0,0 +1,80 @@
1
+ require 'readorder/version'
2
+
3
+ #-------------------------------------------------------------------------------
4
+ # Additions to the Configuration class that are useful
5
+ #-------------------------------------------------------------------------------
6
+ class Configuration
7
+ class << self
8
+ def exist?( name )
9
+ Configuration::Table.has_key?( name )
10
+ end
11
+
12
+ def for_if_exist?( name )
13
+ if self.exist?( name ) then
14
+ self.for( name )
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ #-------------------------------------------------------------------------------
21
+ # some useful utilitiy methods for the tasks
22
+ #-------------------------------------------------------------------------------
23
+ module Utils
24
+ class << self
25
+
26
+ # Try to load the given _library_ using the built-in require, but do not
27
+ # raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
28
+ # successfully loaded; returns +false+ otherwise.
29
+ #
30
+ def try_require( lib )
31
+ require lib
32
+ true
33
+ rescue LoadError
34
+ false
35
+ end
36
+
37
+ # partition an rdoc file into sections, and return the text of the section
38
+ # given.
39
+ def section_of(file, section_name)
40
+ File.read(file).split(/^(?==)/).each do |section|
41
+ lines = section.split("\n")
42
+ return lines[1..-1].join("\n").strip if lines.first =~ /#{section_name}/i
43
+ end
44
+ nil
45
+ end
46
+
47
+ # Get an array of all the changes in the application for a particular
48
+ # release. This is done by looking in the history file and grabbing the
49
+ # information for the most recent release. The history file is assumed to
50
+ # be in RDoc format and version release are 2nd tier sections separated by
51
+ # '== Version X.Y.Z'
52
+ #
53
+ # returns:: A hash of notes keyed by version number
54
+ #
55
+ def release_notes_from(history_file)
56
+ releases = {}
57
+ File.read(history_file).split(/^(?==)/).each do |section|
58
+ lines = section.split("\n")
59
+ md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
60
+ next unless md
61
+ releases[md[1]] = lines[1..-1].join("\n").strip
62
+ end
63
+ return releases
64
+ end
65
+
66
+ # return a hash of useful information for the latest release
67
+ # urls, subject, title, description and latest release notes
68
+ #
69
+ def announcement
70
+ cfg = Configuration.for("project")
71
+ {
72
+ :subject => "#{cfg.name} #{Readorder::VERSION} Released",
73
+ :title => "#{cfg.name} version #{Readorder::VERSION} has been released.",
74
+ :urls => "#{cfg.homepage}",
75
+ :description => "#{cfg.description.rstrip}",
76
+ :release_notes => Utils.release_notes_from(cfg.history)[Readorder::VERSION].rstrip
77
+ }
78
+ end
79
+ end
80
+ end # << self
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: readorder
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Hinegardner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-27 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: configuration
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.5
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rbtree
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: main
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.8.3
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: logging
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.4
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: hitimes
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.1
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: rake
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: 0.8.3
74
+ version:
75
+ description: Readorder orders a list of files into a more effective read order. You would possibly want to use readorder in a case where you know ahead of time that you have a large quantity of files on disc to process. You can give that list off those files and it will report back to you the order in which you should process them to make most effective use of your disc I/O. Given a list of filenames, either on the command line or via stdin, readorder will output the filenames in an order that should increase the I/O throughput when the files corresponding to the filenames are read off of disc. The output order of the filenames can either be in inode order or physical disc block order. This is dependent upon operating system support and permission level of the user running readorder.
76
+ email: jeremy@copiousfreetime.org
77
+ executables:
78
+ - readorder
79
+ extensions: []
80
+
81
+ extra_rdoc_files:
82
+ - README
83
+ - HISTORY
84
+ - LICENSE
85
+ - lib/readorder/analyzer.rb
86
+ - lib/readorder/cli.rb
87
+ - lib/readorder/command.rb
88
+ - lib/readorder/commands/analyze.rb
89
+ - lib/readorder/commands/sort.rb
90
+ - lib/readorder/commands/test.rb
91
+ - lib/readorder/datum.rb
92
+ - lib/readorder/filelist.rb
93
+ - lib/readorder/log.rb
94
+ - lib/readorder/paths.rb
95
+ - lib/readorder/runner.rb
96
+ - lib/readorder/version.rb
97
+ - lib/readorder.rb
98
+ files:
99
+ - bin/readorder
100
+ - lib/readorder/analyzer.rb
101
+ - lib/readorder/cli.rb
102
+ - lib/readorder/command.rb
103
+ - lib/readorder/commands/analyze.rb
104
+ - lib/readorder/commands/sort.rb
105
+ - lib/readorder/commands/test.rb
106
+ - lib/readorder/datum.rb
107
+ - lib/readorder/filelist.rb
108
+ - lib/readorder/log.rb
109
+ - lib/readorder/paths.rb
110
+ - lib/readorder/runner.rb
111
+ - lib/readorder/version.rb
112
+ - lib/readorder.rb
113
+ - spec/analyzer_spec.rb
114
+ - spec/command_spec.rb
115
+ - spec/filelist_spec.rb
116
+ - spec/log_spec.rb
117
+ - spec/paths_spec.rb
118
+ - spec/runner_spec.rb
119
+ - spec/spec_helper.rb
120
+ - spec/version_spec.rb
121
+ - README
122
+ - HISTORY
123
+ - LICENSE
124
+ - tasks/announce.rake
125
+ - tasks/distribution.rake
126
+ - tasks/documentation.rake
127
+ - tasks/rspec.rake
128
+ - tasks/rubyforge.rake
129
+ - tasks/config.rb
130
+ - tasks/utils.rb
131
+ - gemspec.rb
132
+ has_rdoc: true
133
+ homepage: http://readorder.rubyforge.org/
134
+ post_install_message:
135
+ rdoc_options:
136
+ - --main
137
+ - README
138
+ require_paths:
139
+ - lib
140
+ - ext
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: "0"
146
+ version:
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: "0"
152
+ version:
153
+ requirements: []
154
+
155
+ rubyforge_project: copiousfreetime
156
+ rubygems_version: 1.3.1
157
+ signing_key:
158
+ specification_version: 2
159
+ summary: Readorder orders a list of files into a more effective read order
160
+ test_files: []
161
+