bones 2.4.0 → 2.5.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.
data/.autotest ADDED
@@ -0,0 +1 @@
1
+ require 'autotest/redgreen'
data/History.txt CHANGED
@@ -1,3 +1,21 @@
1
+ == 2.5.0 / 2009-04-05
2
+
3
+ * 1 minor enhancement
4
+ - added support for ZenTest autotest
5
+ * 1 bug fix
6
+ - files without extensions are picked up when generating a new project
7
+
8
+ == 2.4.2 / 2009-03-02
9
+
10
+ * 2 bug fixes
11
+ - SMTP/TLS will not be used if openssl is not present
12
+ - fixed rdoc title generation
13
+
14
+ == 2.4.1 / 2009-03-02
15
+
16
+ * 1 minor enhancement
17
+ - jruby 1.2 compatability
18
+
1
19
  == 2.4.0 / 2009-02-01
2
20
 
3
21
  * 1 minor enhancement
data/README.rdoc CHANGED
@@ -17,6 +17,7 @@ Mr Bones provides the following rake tasks:
17
17
  ann # Alias to ann:announcement
18
18
  ann:announcement # Create an announcement file
19
19
  ann:email # Send an email announcement
20
+ autotest # Run the autotest loop
20
21
  bones:debug # Show the PROJ open struct
21
22
  clean # Remove any temporary products.
22
23
  clobber # Remove any generated file.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ PROJ.authors = 'Tim Pease'
9
9
  PROJ.email = 'tim.pease@gmail.com'
10
10
  PROJ.url = 'http://codeforpeople.rubyforge.org/bones'
11
11
  PROJ.version = Bones::VERSION
12
- PROJ.release_name = 'Zygomatic'
12
+ PROJ.release_name = 'Maxilla'
13
13
  PROJ.ruby_opts = %w[-W0]
14
14
  PROJ.readme_file = 'README.rdoc'
15
15
  PROJ.ignore_file = '.gitignore'
@@ -81,8 +81,7 @@ class Command
81
81
  def mrbones_dir
82
82
  return @mrbones_dir if defined? @mrbones_dir
83
83
 
84
- path = (::Bones::WIN32 ? ENV['HOMEPATH'].tr("\\", "/") : ENV['HOME'])
85
- path = File.join(path, '.mrbones')
84
+ path = File.join(::Bones::HOME, '.mrbones')
86
85
  @mrbones_dir = File.expand_path(path)
87
86
  end
88
87
 
@@ -30,7 +30,7 @@ class CreateCommand < Command
30
30
  begin
31
31
  FileUtils.cd output_dir
32
32
  @out.puts "Now you need to fix these files"
33
- system "rake notes"
33
+ system "#{::Bones::RUBY} -S rake notes"
34
34
  ensure
35
35
  FileUtils.cd pwd
36
36
  end
@@ -140,7 +140,7 @@ class FileManager
140
140
  rgxp = %r/\A#{source}\/?/
141
141
  exclude = %r/tmp$|bak$|~$|CVS|\.svn/
142
142
 
143
- ary = Dir.glob(File.join(source, '**', '*.*'), File::FNM_DOTMATCH).map do |filename|
143
+ ary = Dir.glob(File.join(source, '**', '*'), File::FNM_DOTMATCH).map do |filename|
144
144
  next if exclude =~ filename
145
145
  next if test(?d, filename)
146
146
  filename.sub rgxp, ''
data/lib/bones/debug.rb CHANGED
@@ -24,6 +24,7 @@ module Debug
24
24
 
25
25
  h = ostruct.instance_variable_get(:@table)
26
26
  h.keys.map {|k| k.to_s}.sort.each do |k|
27
+ sio.seek 0
27
28
  sio.truncate 0
28
29
  next if k =~ %r/^_/o
29
30
 
@@ -6,70 +6,75 @@
6
6
  # http://d.hatena.ne.jp/zorio/20060416
7
7
  # http://www.jamesbritt.com/2007/12/18/sending-mail-through-gmail-with-ruby-s-net-smtp
8
8
 
9
- require "openssl"
10
- require "net/smtp"
9
+ begin
10
+ require "openssl"
11
+ require "net/smtp"
11
12
 
12
- Net::SMTP.class_eval do
13
- private
14
- def do_start(helodomain, user, secret, authtype)
15
- raise IOError, 'SMTP session already started' if @started
13
+ Net::SMTP.class_eval do
14
+ private
15
+ def do_start(helodomain, user, secret, authtype)
16
+ raise IOError, 'SMTP session already started' if @started
16
17
 
17
- if user or secret
18
- if 3 == self.method(:check_auth_args).arity
19
- check_auth_args(user, secret, authtype)
20
- else
21
- check_auth_args(user, secret)
18
+ if user or secret
19
+ if 3 == self.method(:check_auth_args).arity
20
+ check_auth_args(user, secret, authtype)
21
+ else
22
+ check_auth_args(user, secret)
23
+ end
22
24
  end
23
- end
24
25
 
25
- sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
26
- @socket = Net::InternetMessageIO.new(sock)
27
- @socket.read_timeout = 60 #@read_timeout
28
- @socket.debug_output = STDERR #@debug_output
26
+ sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
27
+ @socket = Net::InternetMessageIO.new(sock)
28
+ @socket.read_timeout = 60 #@read_timeout
29
+ @socket.debug_output = STDERR #@debug_output
29
30
 
30
- check_response(critical { recv_response() })
31
- do_helo(helodomain)
31
+ check_response(critical { recv_response() })
32
+ do_helo(helodomain)
32
33
 
33
- raise 'openssl library not installed' unless defined?(OpenSSL)
34
- starttls
35
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
36
- ssl.sync_close = true
37
- ssl.connect
38
- @socket = Net::InternetMessageIO.new(ssl)
39
- @socket.read_timeout = 60 #@read_timeout
40
- @socket.debug_output = STDERR #@debug_output
41
- do_helo(helodomain)
34
+ raise 'openssl library not installed' unless defined?(OpenSSL)
35
+ starttls
36
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
37
+ ssl.sync_close = true
38
+ ssl.connect
39
+ @socket = Net::InternetMessageIO.new(ssl)
40
+ @socket.read_timeout = 60 #@read_timeout
41
+ @socket.debug_output = STDERR #@debug_output
42
+ do_helo(helodomain)
42
43
 
43
- authenticate user, secret, authtype if user
44
- @started = true
45
- ensure
46
- unless @started
47
- # authentication failed, cancel connection.
48
- @socket.close if not @started and @socket and not @socket.closed?
49
- @socket = nil
44
+ authenticate user, secret, authtype if user
45
+ @started = true
46
+ ensure
47
+ unless @started
48
+ # authentication failed, cancel connection.
49
+ @socket.close if not @started and @socket and not @socket.closed?
50
+ @socket = nil
51
+ end
50
52
  end
51
- end
52
53
 
53
- def do_helo(helodomain)
54
- begin
55
- if @esmtp
56
- ehlo helodomain
57
- else
58
- helo helodomain
59
- end
60
- rescue Net::ProtocolError
61
- if @esmtp
62
- @esmtp = false
63
- @error_occured = false
64
- retry
54
+ def do_helo(helodomain)
55
+ begin
56
+ if @esmtp
57
+ ehlo helodomain
58
+ else
59
+ helo helodomain
60
+ end
61
+ rescue Net::ProtocolError
62
+ if @esmtp
63
+ @esmtp = false
64
+ @error_occured = false
65
+ retry
66
+ end
67
+ raise
65
68
  end
66
- raise
67
69
  end
68
- end
69
70
 
70
- def starttls
71
- getok('STARTTLS')
71
+ def starttls
72
+ getok('STARTTLS')
73
+ end
72
74
  end
75
+
76
+ # We cannot do TLS if we do not have 'openssl'
77
+ rescue LoadError
73
78
  end
74
79
 
75
80
  # EOF
@@ -19,10 +19,11 @@ namespace :doc do
19
19
  end
20
20
  rd.rdoc_files.push(*files)
21
21
 
22
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
23
-
22
+ name = PROJ.name
24
23
  rf_name = PROJ.rubyforge.name
25
- title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
24
+
25
+ title = "#{name}-#{PROJ.version} Documentation"
26
+ title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != name
26
27
 
27
28
  rd.options << "-t #{title}"
28
29
  rd.options.concat(rdoc.opts)
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  require 'ostruct'
7
7
  require 'find'
8
8
 
9
- class OpenStruct; undef :gem; end
9
+ class OpenStruct; undef :gem if defined? :gem; end
10
10
 
11
11
  # TODO: make my own openstruct type object that includes descriptions
12
12
  # TODO: use the descriptions to output help on the available bones options
@@ -124,9 +124,7 @@ import(*rakefiles)
124
124
  %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
125
125
 
126
126
  # Setup some constants
127
- WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
128
-
129
- DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
127
+ DEV_NULL = File.exist?('/dev/null') ? '/dev/null' : 'NUL:'
130
128
 
131
129
  def quiet( &block )
132
130
  io = [STDOUT.dup, STDERR.dup]
@@ -139,23 +137,17 @@ ensure
139
137
  $stdout, $stderr = STDOUT, STDERR
140
138
  end
141
139
 
142
- DIFF = if WIN32 then 'diff.exe'
143
- else
144
- if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
145
- else 'diff' end
146
- end unless defined? DIFF
140
+ DIFF = if system("gdiff '#{__FILE__}' '#{__FILE__}' > #{DEV_NULL} 2>&1") then 'gdiff'
141
+ else 'diff' end unless defined? DIFF
147
142
 
148
- SUDO = if WIN32 then ''
149
- else
150
- if quiet {system 'which sudo'} then 'sudo'
151
- else '' end
152
- end
143
+ SUDO = if system("which sudo > #{DEV_NULL} 2>&1") then 'sudo'
144
+ else '' end unless defined? SUDO
153
145
 
154
- RCOV = WIN32 ? 'rcov.bat' : 'rcov'
155
- RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
156
- GEM = WIN32 ? 'gem.bat' : 'gem'
146
+ RCOV = "#{RUBY} -S rcov"
147
+ RDOC = "#{RUBY} -S rdoc"
148
+ GEM = "#{RUBY} -S gem"
157
149
 
158
- %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
150
+ %w(rcov spec/rake/spectask rubyforge bones facets/ansicode zentest).each do |lib|
159
151
  begin
160
152
  require lib
161
153
  Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
@@ -0,0 +1,36 @@
1
+ if HAVE_ZENTEST
2
+
3
+ # --------------------------------------------------------------------------
4
+ if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
5
+ require 'autotest'
6
+
7
+ namespace :test do
8
+ task :autotest do
9
+ Autotest.run
10
+ end
11
+ end
12
+
13
+ desc "Run the autotest loop"
14
+ task :autotest => 'test:autotest'
15
+
16
+ end # if test
17
+
18
+ # --------------------------------------------------------------------------
19
+ if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
20
+ require 'autotest/rspec'
21
+
22
+ namespace :spec do
23
+ task :autotest do
24
+ load '.autotest' if test(?f, '.autotest')
25
+ Autotest::Rspec.run
26
+ end
27
+ end
28
+
29
+ desc "Run the autotest loop"
30
+ task :autotest => 'spec:autotest'
31
+
32
+ end # if rspec
33
+
34
+ end # if HAVE_ZENTEST
35
+
36
+ # EOF
data/lib/bones.rb CHANGED
@@ -1,11 +1,17 @@
1
1
 
2
+ require 'rbconfig'
3
+
2
4
  module Bones
3
5
 
4
6
  # :stopdoc:
5
- VERSION = '2.4.0'
7
+ VERSION = '2.5.0'
6
8
  PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
7
- WIN32 = %r/win32/ =~ RUBY_PLATFORM
8
- DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
9
+ HOME = File.expand_path(ENV['HOME'] || ENV['USERPROFILE'])
10
+ DEV_NULL = File.exist?('/dev/null') ? '/dev/null' : 'NUL:'
11
+
12
+ # Ruby Interpreter location - taken from Rake source code
13
+ RUBY = File.join(Config::CONFIG['bindir'],
14
+ Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
9
15
  # :startdoc:
10
16
 
11
17
  # Returns the path for Mr Bones. If any arguments are given,
@@ -48,7 +54,7 @@ module Bones
48
54
  load bones_setup
49
55
 
50
56
  rakefiles = Dir.glob(File.join(Dir.pwd, %w[tasks *.rake])).sort
51
- import(*rakefiles)
57
+ import(*rakefiles) unless rakefiles.empty?
52
58
  end
53
59
 
54
60
  # TODO: fix file lists for Test::Unit and RSpec
@@ -36,21 +36,18 @@ describe Bones::App::FileManager do
36
36
  end
37
37
 
38
38
  it "should return a list of files to copy" do
39
- @fm.source = Bones.path 'data'
39
+ @fm.source = Bones.path %w[spec data data]
40
40
 
41
41
  ary = @fm._files_to_copy
42
- ary.length.should == 9
42
+ ary.length.should == 6
43
43
 
44
44
  ary.should == %w[
45
45
  .bnsignore
46
- History.txt.bns
46
+ History
47
+ NAME/NAME.rb.bns
47
48
  README.txt.bns
48
49
  Rakefile.bns
49
- bin/NAME.bns
50
50
  lib/NAME.rb.bns
51
- spec/NAME_spec.rb.bns
52
- spec/spec_helper.rb.bns
53
- test/test_NAME.rb
54
51
  ]
55
52
  end
56
53
 
@@ -0,0 +1,16 @@
1
+ # The list of files that should be ignored by Mr Bones.
2
+ # Lines that start with '#' are comments.
3
+ #
4
+ # A .gitignore file can be used instead by setting it as the ignore
5
+ # file in your Rakefile:
6
+ #
7
+ # PROJ.ignore_file = '.gitignore'
8
+ #
9
+ # For a project with a C extension, the following would be a good set of
10
+ # exclude patterns (uncomment them if you want to use them):
11
+ # *.[oa]
12
+ # *~
13
+ announcement.txt
14
+ coverage
15
+ doc
16
+ pkg
@@ -0,0 +1 @@
1
+ This file has no extension
data/tasks/rdoc.rake CHANGED
@@ -19,10 +19,11 @@ namespace :doc do
19
19
  end
20
20
  rd.rdoc_files.push(*files)
21
21
 
22
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
23
-
22
+ name = PROJ.name
24
23
  rf_name = PROJ.rubyforge.name
25
- title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
24
+
25
+ title = "#{name}-#{PROJ.version} Documentation"
26
+ title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != name
26
27
 
27
28
  rd.options << "-t #{title}"
28
29
  rd.options.concat(rdoc.opts)
data/tasks/setup.rb CHANGED
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  require 'ostruct'
7
7
  require 'find'
8
8
 
9
- class OpenStruct; undef :gem; end
9
+ class OpenStruct; undef :gem if defined? :gem; end
10
10
 
11
11
  # TODO: make my own openstruct type object that includes descriptions
12
12
  # TODO: use the descriptions to output help on the available bones options
@@ -124,9 +124,7 @@ import(*rakefiles)
124
124
  %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
125
125
 
126
126
  # Setup some constants
127
- WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
128
-
129
- DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
127
+ DEV_NULL = File.exist?('/dev/null') ? '/dev/null' : 'NUL:'
130
128
 
131
129
  def quiet( &block )
132
130
  io = [STDOUT.dup, STDERR.dup]
@@ -139,23 +137,17 @@ ensure
139
137
  $stdout, $stderr = STDOUT, STDERR
140
138
  end
141
139
 
142
- DIFF = if WIN32 then 'diff.exe'
143
- else
144
- if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
145
- else 'diff' end
146
- end unless defined? DIFF
140
+ DIFF = if system("gdiff '#{__FILE__}' '#{__FILE__}' > #{DEV_NULL} 2>&1") then 'gdiff'
141
+ else 'diff' end unless defined? DIFF
147
142
 
148
- SUDO = if WIN32 then ''
149
- else
150
- if quiet {system 'which sudo'} then 'sudo'
151
- else '' end
152
- end
143
+ SUDO = if system("which sudo > #{DEV_NULL} 2>&1") then 'sudo'
144
+ else '' end unless defined? SUDO
153
145
 
154
- RCOV = WIN32 ? 'rcov.bat' : 'rcov'
155
- RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
156
- GEM = WIN32 ? 'gem.bat' : 'gem'
146
+ RCOV = "#{RUBY} -S rcov"
147
+ RDOC = "#{RUBY} -S rdoc"
148
+ GEM = "#{RUBY} -S gem"
157
149
 
158
- %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
150
+ %w(rcov spec/rake/spectask rubyforge bones facets/ansicode zentest).each do |lib|
159
151
  begin
160
152
  require lib
161
153
  Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
@@ -0,0 +1,36 @@
1
+ if HAVE_ZENTEST
2
+
3
+ # --------------------------------------------------------------------------
4
+ if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
5
+ require 'autotest'
6
+
7
+ namespace :test do
8
+ task :autotest do
9
+ Autotest.run
10
+ end
11
+ end
12
+
13
+ desc "Run the autotest loop"
14
+ task :autotest => 'test:autotest'
15
+
16
+ end # if test
17
+
18
+ # --------------------------------------------------------------------------
19
+ if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
20
+ require 'autotest/rspec'
21
+
22
+ namespace :spec do
23
+ task :autotest do
24
+ load '.autotest' if test(?f, '.autotest')
25
+ Autotest::Rspec.run
26
+ end
27
+ end
28
+
29
+ desc "Run the autotest loop"
30
+ task :autotest => 'spec:autotest'
31
+
32
+ end # if rspec
33
+
34
+ end # if HAVE_ZENTEST
35
+
36
+ # EOF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bones
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-01 00:00:00 -07:00
12
+ date: 2009-04-05 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.3
23
+ version: 0.8.4
24
24
  version:
25
25
  description: Mr Bones is a handy tool that builds a skeleton for your new Ruby projects. The skeleton contains some starter code and a collection of rake tasks to ease the management and deployment of your source code. Mr Bones is not viral -- all the code your project needs is included in the skeleton (no gem dependency required).
26
26
  email: tim.pease@gmail.com
@@ -43,8 +43,10 @@ extra_rdoc_files:
43
43
  - lib/bones/tasks/spec.rake
44
44
  - lib/bones/tasks/svn.rake
45
45
  - lib/bones/tasks/test.rake
46
+ - lib/bones/tasks/zentest.rake
46
47
  - spec/data/foo/README.txt
47
48
  files:
49
+ - .autotest
48
50
  - History.txt
49
51
  - README.rdoc
50
52
  - Rakefile
@@ -82,9 +84,12 @@ files:
82
84
  - lib/bones/tasks/spec.rake
83
85
  - lib/bones/tasks/svn.rake
84
86
  - lib/bones/tasks/test.rake
87
+ - lib/bones/tasks/zentest.rake
85
88
  - spec/bones/app/file_manager_spec.rb
86
89
  - spec/bones/app_spec.rb
87
90
  - spec/bones_spec.rb
91
+ - spec/data/data/.bnsignore
92
+ - spec/data/data/History
88
93
  - spec/data/data/NAME/NAME.rb.bns
89
94
  - spec/data/data/README.txt.bns
90
95
  - spec/data/data/Rakefile.bns
@@ -104,6 +109,7 @@ files:
104
109
  - tasks/spec.rake
105
110
  - tasks/svn.rake
106
111
  - tasks/test.rake
112
+ - tasks/zentest.rake
107
113
  has_rdoc: true
108
114
  homepage: http://codeforpeople.rubyforge.org/bones
109
115
  post_install_message: |