s4t-utils 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ Version 1.0.4 -- in progress
2
+ * Merged two Rakefiles into one concise one.
3
+ * Added "hoelike" - extensions to hoe tasks.
4
+
1
5
  Version 1.0.3
2
6
  * Added with_stdin and capturing_stdout
3
7
  * Added set_test_paths and set_script_lib_path
@@ -14,4 +18,4 @@ Version 1.0.1
14
18
 
15
19
  Version 1.0.0
16
20
  * Made into a gem.
17
- * Minor improvements to some methods.
21
+ * Minor improvements to some methods.
@@ -4,7 +4,6 @@ Manifest.txt
4
4
  NOTES.txt
5
5
  README.txt
6
6
  Rakefile
7
- Rakefile.hoe
8
7
  bin/make-s4t-project.rb
9
8
  bin/s4t-script-location-file
10
9
  data/make-s4t-project/README-skeleton
@@ -24,6 +23,7 @@ lib/s4t-utils/command-line.rb
24
23
  lib/s4t-utils/error-handling.rb
25
24
  lib/s4t-utils/friendly-format.rb
26
25
  lib/s4t-utils/hacks.rb
26
+ lib/s4t-utils/hoelike.rb
27
27
  lib/s4t-utils/load-path-auto-adjuster.rb
28
28
  lib/s4t-utils/more-assertions.rb
29
29
  lib/s4t-utils/os.rb
data/Rakefile CHANGED
@@ -1,18 +1,31 @@
1
- $started_from_rakefile=true
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Brian Marick on 2007-07-03.
4
+ # Copyright (c) 2007. All rights reserved.
2
5
 
3
- PACKAGE_ROOT = Dir.pwd
4
- $:.unshift("#{PACKAGE_ROOT}/lib")
5
- require 's4t-utils'
6
- include S4tUtils
6
+ require 'hoe'
7
+ $:.unshift(File.join(Dir.pwd, "lib"))
8
+ require 's4t-utils/version'
7
9
 
8
- MyFileSystemName='s4t-utils' # No ".rb" extension.
9
- MyModuleName='S4tUtils'
10
- MyRdocFiles = FileList.new("lib/#{MyFileSystemName}.rb",
11
- "lib/#{MyFileSystemName}/*.rb").exclude('**/third-party/**')
12
-
13
- require 's4t-utils/rakefile-common'
10
+ PROJECT='s4t-utils'
11
+ THIS_RELEASE=S4tUtils::Version
14
12
 
15
- desc "Push new version of project homepage."
16
- task 'homepage' do
17
- `cd homepage; scp * marick@rubyforge.org:/var/www/gforge-projects/#{MyFileSystemName}/`
18
- end
13
+ Hoe.new(PROJECT, THIS_RELEASE) do |p|
14
+ p.rubyforge_name = PROJECT
15
+ p.changes = "See History.txt"
16
+ p.author = "Brian Marick"
17
+ p.description = "Unified interface to command-line, environment, and configuration files."
18
+ p.summary = p.description
19
+ p.email = "marick@exampler.com"
20
+ p.extra_deps = []
21
+ p.test_globs = "test/**/*tests.rb"
22
+ p.rdoc_pattern = %r{README.txt|History.txt|lib/s4t-utils.rb|lib/s4t-utils/.+\.rb}
23
+ p.url = "http://s4t-utils.rubyforge.org"
24
+ p.remote_rdoc_dir = 'rdoc'
25
+ end
26
+
27
+ require 's4t-utils/hoelike'
28
+ HoeLike.new(:project => PROJECT, :this_release => THIS_RELEASE,
29
+ :login => "marick@rubyforge.org",
30
+ :web_site_root => 'homepage',
31
+ :export_root => "#{S4tUtils.find_home}/tmp/exports")
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Brian Marick on 2007-10-03.
4
+ # Copyright (c) 2007. All rights reserved.
5
+ require 's4t-utils/rake-task-helpers'
6
+ require 's4t-utils/os'
7
+
8
+ # These are at the top level so that they can be available in the context
9
+ # of a running task.
10
+ def assert_in(dir, taskname) # :nodoc:
11
+ unless Dir.pwd == dir
12
+ puts "Run task '#{taskname}' from directory '#{dir}'."
13
+ exit 1
14
+ end
15
+ end
16
+
17
+ def confirmed_step(name) # :nodoc:
18
+ STDOUT.puts "** #{name} **"
19
+ STDOUT.puts `rake #{name}`
20
+ STDOUT.print 'OK? > '
21
+ exit if STDIN.readline =~ /[nN]/
22
+ end
23
+
24
+
25
+
26
+ # HoeLike is intended to be used with the Hoe gem. It adds some
27
+ # Rake tasks.
28
+ #
29
+ # * slow: Runs tests whose filenames are '*-slowtests.rb'
30
+ # * fast: Runs all tests, skipping slow tests.
31
+ # * upload_pages: copy website pages up to Rubyforge
32
+ # * export_and_upload_pages: upload_pages without any garbage or .svn
33
+ # files lying around.
34
+ # * tag_release: Make a Subversion tag called rel-X.Y.Z. Release number
35
+ # is gotten from lib/name/version.rb.
36
+ # * export: export entire project to pristine temp directory.
37
+ # * release_everything: Release code, rdoc, and website to rubyforge.
38
+ class HoeLike
39
+
40
+ def initialize(keys)
41
+ @keys = keys
42
+ project = pull(:project)
43
+ this_release = pull(:this_release)
44
+ login = pull(:login)
45
+ web_site_root = pull(:web_site_root)
46
+ export_root = pull(:export_root)
47
+
48
+ root = "svn+ssh://#{login}/var/svn/#{project}"
49
+ project_exports = "#{export_root}/#{project}"
50
+
51
+ desc "Run fast tests."
52
+ task 'fast' do
53
+ S4tUtils.run_particular_tests('test', 'fast')
54
+ end
55
+
56
+ desc "Run slow tests."
57
+ task 'slow' do
58
+ S4tUtils.run_particular_tests('test', 'slow')
59
+ end
60
+
61
+ desc "Upload all the web pages (as part of release)"
62
+ task 'upload_pages' do | task |
63
+ assert_in(project_exports, task.name)
64
+ exec = "scp -r #{web_site_root}/* #{login}:/var/www/gforge-projects/#{project}/"
65
+ puts exec
66
+ system(exec)
67
+ end
68
+
69
+ desc "Upload all the web pages (not as part of release)"
70
+ task 'export_and_upload_pages' => 'export' do | task |
71
+ Dir.chdir(project_exports) do
72
+ exec = "scp -r #{web_site_root}/* #{login}:/var/www/gforge-projects/#{project}/"
73
+ puts exec
74
+ system(exec)
75
+ end
76
+ end
77
+
78
+ desc "Tag release with current version."
79
+ task 'tag_release' do
80
+ from = "#{root}/trunk"
81
+ to = "#{root}/tags/rel-#{this_release}"
82
+ message = "Release #{this_release}"
83
+ exec = "svn copy -m '#{message}' #{from} #{to}"
84
+ puts exec
85
+ system(exec)
86
+ end
87
+
88
+ desc "Export to #{project_exports}"
89
+ task 'export' do
90
+ Dir.chdir(export_root) do
91
+ rm_rf project
92
+ exec = "svn export #{root}/trunk #{project}"
93
+ puts exec
94
+ system exec
95
+ end
96
+ end
97
+
98
+
99
+ desc "Complete release of everything - asks for confirmation after steps"
100
+ # Because in Ruby 1.8.6, Rake doesn't notice subtask failures, so it
101
+ # won't stop for us.
102
+ task 'release_everything' do
103
+ confirmed_step 'check_manifest'
104
+ confirmed_step 'export'
105
+ Dir.chdir(project_exports) do
106
+ puts "Working in #{Dir.pwd}"
107
+ confirmed_step 'test'
108
+ confirmed_step 'upload_pages'
109
+ confirmed_step 'publish_docs'
110
+ ENV['VERSION'] = this_release
111
+ confirmed_step 'release'
112
+ end
113
+ confirmed_step 'tag_release'
114
+ end
115
+
116
+ end
117
+
118
+ private
119
+
120
+ def pull(key)
121
+ @keys[key] || raise("Missing key #{key.inspect}")
122
+ end
123
+ end
@@ -1,3 +1,3 @@
1
1
  module S4tUtils
2
- Version = '1.0.3'
2
+ Version = '1.0.4'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # This file should be copied into a test ending in 'tests.rb' so that
2
2
  # the Rakefile knows it's a test.
3
3
 
4
- require "set-standalone-test-paths.rb" unless $started_from_rakefile
4
+ require "set-standalone-test-paths.rb"
5
5
  require 'test/unit'
6
6
  require 's4t-utils'
7
7
  include S4tUtils
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: s4t-utils
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2007-09-27 00:00:00 -05:00
8
- summary: _Everyday Scripting with Ruby_ utilities.
6
+ version: 1.0.4
7
+ date: 2007-11-19 00:00:00 -06:00
8
+ summary: Unified interface to command-line, environment, and configuration files.
9
9
  require_paths:
10
10
  - lib
11
11
  email: marick@exampler.com
12
12
  homepage: http://s4t-utils.rubyforge.org
13
13
  rubyforge_project: s4t-utils
14
- description: _Everyday Scripting with Ruby_ utilities.
14
+ description: Unified interface to command-line, environment, and configuration files.
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -35,7 +35,6 @@ files:
35
35
  - NOTES.txt
36
36
  - README.txt
37
37
  - Rakefile
38
- - Rakefile.hoe
39
38
  - bin/make-s4t-project.rb
40
39
  - bin/s4t-script-location-file
41
40
  - data/make-s4t-project/README-skeleton
@@ -55,6 +54,7 @@ files:
55
54
  - lib/s4t-utils/error-handling.rb
56
55
  - lib/s4t-utils/friendly-format.rb
57
56
  - lib/s4t-utils/hacks.rb
57
+ - lib/s4t-utils/hoelike.rb
58
58
  - lib/s4t-utils/load-path-auto-adjuster.rb
59
59
  - lib/s4t-utils/more-assertions.rb
60
60
  - lib/s4t-utils/os.rb
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Created by Brian Marick on 2007-07-03.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
- require 'hoe'
7
- require 'lib/s4t-utils/version'
8
-
9
-
10
- Hoe.new("s4t-utils", S4tUtils::Version) do |p|
11
- p.rubyforge_name = "s4t-utils"
12
- p.changes = "See History.txt"
13
- p.author = "Brian Marick"
14
- p.description = "_Everyday Scripting with Ruby_ utilities."
15
- p.summary = p.description
16
- p.email = "marick@exampler.com"
17
- p.extra_deps = []
18
- p.test_globs = "test/**/*-tests.rb"
19
- p.rdoc_pattern = %r{README.txt|History.txt|lib/s4t-utils.rb|lib/s4t-utils/.+\.rb}
20
- p.url = "http://s4t-utils.rubyforge.org"
21
- p.remote_rdoc_dir = 'rdoc'
22
- end
23
-
24
- desc "Tag release with current version."
25
- task 'tag_release' do
26
- root = "svn+ssh://marick@rubyforge.org/var/svn/s4t-utils"
27
- from = "#{root}/trunk"
28
- to = "#{root}/tags/rel-#{S4tUtils::Version}"
29
- message = "Release #{S4tUtils::Version}"
30
- exec = "svn copy -m '#{message}' #{from} #{to}"
31
- puts exec
32
- system(exec)
33
- end