bones 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +11 -0
  2. data/Manifest.txt +20 -25
  3. data/README.txt +114 -83
  4. data/Rakefile +7 -6
  5. data/data/Rakefile.erb +7 -1
  6. data/data/bin/NAME.erb +1 -1
  7. data/data/lib/NAME.rb.erb +4 -11
  8. data/data/spec/NAME_spec.rb.erb +0 -1
  9. data/data/spec/spec_helper.rb.erb +0 -1
  10. data/lib/bones.rb +21 -8
  11. data/lib/bones/annotation_extractor.rb +1 -2
  12. data/lib/bones/debug.rb +0 -1
  13. data/lib/bones/main.rb +183 -109
  14. data/lib/bones/smtp_tls.rb +0 -1
  15. data/{data → lib/bones}/tasks/ann.rake +0 -1
  16. data/{data → lib/bones}/tasks/bones.rake +0 -1
  17. data/lib/bones/tasks/gem.rake +192 -0
  18. data/{data → lib/bones}/tasks/git.rake +0 -1
  19. data/{data → lib/bones}/tasks/manifest.rake +3 -4
  20. data/{data → lib/bones}/tasks/notes.rake +0 -1
  21. data/{data → lib/bones}/tasks/post_load.rake +2 -2
  22. data/{data → lib/bones}/tasks/rdoc.rake +0 -1
  23. data/{data → lib/bones}/tasks/rubyforge.rake +2 -4
  24. data/{data → lib/bones}/tasks/setup.rb +14 -3
  25. data/{data → lib/bones}/tasks/spec.rake +1 -2
  26. data/{data → lib/bones}/tasks/svn.rake +0 -1
  27. data/{data → lib/bones}/tasks/test.rake +3 -1
  28. data/spec/bones/main_spec.rb +157 -0
  29. data/spec/bones_spec.rb +18 -0
  30. data/spec/data/data/README.txt +0 -0
  31. data/spec/data/data/Rakefile +0 -0
  32. data/spec/data/foo/README.txt +0 -0
  33. data/spec/data/foo/Rakefile +0 -0
  34. data/spec/spec_helper.rb +22 -0
  35. data/tasks/ann.rake +0 -1
  36. data/tasks/bones.rake +0 -1
  37. data/tasks/gem.rake +98 -32
  38. data/tasks/git.rake +0 -1
  39. data/tasks/manifest.rake +3 -4
  40. data/tasks/notes.rake +0 -1
  41. data/tasks/post_load.rake +2 -2
  42. data/tasks/rdoc.rake +0 -1
  43. data/tasks/rubyforge.rake +2 -4
  44. data/tasks/setup.rb +14 -3
  45. data/tasks/spec.rake +1 -2
  46. data/tasks/svn.rake +47 -0
  47. data/tasks/test.rake +3 -1
  48. metadata +40 -17
  49. data/data/tasks/gem.rake +0 -126
@@ -0,0 +1,18 @@
1
+
2
+ require File.expand_path(
3
+ File.join(File.dirname(__FILE__), 'spec_helper'))
4
+
5
+ describe Bones do
6
+
7
+ before :all do
8
+ @root_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9
+ end
10
+
11
+ it "finds things releative to 'root'" do
12
+ Bones.path(%w[lib bones debug]).
13
+ should == File.join(@root_dir, %w[lib bones debug])
14
+ end
15
+
16
+ end # describe Bones
17
+
18
+ # EOF
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ # Equivalent to a header guard in C/C++
2
+ # Used to prevent the spec helper from being loaded more than once
3
+ unless defined? BONES_SPEC_HELPER
4
+ BONES_SPEC_HELPER = true
5
+
6
+ require File.expand_path(
7
+ File.join(File.dirname(__FILE__), %w[.. lib bones]))
8
+
9
+ Spec::Runner.configure do |config|
10
+ # == Mock Framework
11
+ #
12
+ # RSpec uses it's own mocking framework by default. If you prefer to
13
+ # use mocha, flexmock or RR, uncomment the appropriate line:
14
+ #
15
+ # config.mock_with :mocha
16
+ # config.mock_with :flexmock
17
+ # config.mock_with :rr
18
+ end
19
+
20
+ end # unless defined?
21
+
22
+ # EOF
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  begin
4
3
  require 'bones/smtp_tls'
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  if HAVE_BONES
4
3
 
@@ -1,6 +1,92 @@
1
- # $Id$
2
1
 
3
- require 'rake/gempackagetask'
2
+ require 'find'
3
+ require 'rake/packagetask'
4
+ require 'rubygems/user_interaction'
5
+ require 'rubygems/builder'
6
+
7
+ module Bones
8
+ class GemPackageTask < Rake::PackageTask
9
+ # Ruby GEM spec containing the metadata for this package. The
10
+ # name, version and package_files are automatically determined
11
+ # from the GEM spec and don't need to be explicitly provided.
12
+ #
13
+ attr_accessor :gem_spec
14
+
15
+ # Tasks from the Bones gem directory
16
+ attr_reader :bones_files
17
+
18
+ # Create a GEM Package task library. Automatically define the gem
19
+ # if a block is given. If no block is supplied, then +define+
20
+ # needs to be called to define the task.
21
+ #
22
+ def initialize(gem_spec)
23
+ init(gem_spec)
24
+ yield self if block_given?
25
+ define if block_given?
26
+ end
27
+
28
+ # Initialization tasks without the "yield self" or define
29
+ # operations.
30
+ #
31
+ def init(gem)
32
+ super(gem.name, gem.version)
33
+ @gem_spec = gem
34
+ @package_files += gem_spec.files if gem_spec.files
35
+ @bones_files = []
36
+
37
+ local_setup = File.join(Dir.pwd, %w[tasks setup.rb])
38
+ if !test(?e, local_setup)
39
+ Dir.glob(::Bones.path(%w[lib bones tasks *])).each {|fn| bones_files << fn}
40
+ gem_spec.files = (gem_spec.files +
41
+ bones_files.map {|fn| File.join('tasks', File.basename(fn))}).sort
42
+ end
43
+ end
44
+
45
+ # Create the Rake tasks and actions specified by this
46
+ # GemPackageTask. (+define+ is automatically called if a block is
47
+ # given to +new+).
48
+ #
49
+ def define
50
+ super
51
+ task :prereqs
52
+ task :package => ['gem:prereqs', "#{package_dir_path}/#{gem_file}"]
53
+ file "#{package_dir_path}/#{gem_file}" => [package_dir_path] + package_files + bones_files do
54
+ when_writing("Creating GEM") {
55
+ chdir(package_dir_path) do
56
+ Gem::Builder.new(gem_spec).build
57
+ verbose(true) {
58
+ mv gem_file, "../#{gem_file}"
59
+ }
60
+ end
61
+ }
62
+ end
63
+
64
+ file package_dir_path => bones_files do
65
+ mkdir_p package_dir rescue nil
66
+ bones_files.each do |fn|
67
+ base_fn = File.join('tasks', File.basename(fn))
68
+ f = File.join(package_dir_path, base_fn)
69
+ fdir = File.dirname(f)
70
+ mkdir_p(fdir) if !File.exist?(fdir)
71
+ if File.directory?(fn)
72
+ mkdir_p(f)
73
+ else
74
+ raise "file name conflict for '#{base_fn}' (conflicts with '#{fn}')" if test(?e, f)
75
+ safe_ln(fn, f)
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ def gem_file
82
+ if @gem_spec.platform == Gem::Platform::RUBY
83
+ "#{package_name}.gem"
84
+ else
85
+ "#{package_name}-#{@gem_spec.platform}.gem"
86
+ end
87
+ end
88
+ end # class GemPackageTask
89
+ end # module Bones
4
90
 
5
91
  namespace :gem do
6
92
 
@@ -19,6 +105,10 @@ namespace :gem do
19
105
  s.add_dependency(*dep)
20
106
  end
21
107
 
108
+ PROJ.gem.development_dependencies.each do |dep|
109
+ s.add_development_dependency(*dep)
110
+ end
111
+
22
112
  s.files = PROJ.gem.files
23
113
  s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
24
114
  s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
@@ -57,37 +147,14 @@ namespace :gem do
57
147
  end
58
148
  end # Gem::Specification.new
59
149
 
60
- # A prerequisites task that all other tasks depend upon
61
- task :prereqs
62
-
63
- desc 'Show information about the gem'
64
- task :debug => 'gem:prereqs' do
65
- puts PROJ.gem._spec.to_ruby
66
- end
67
-
68
- pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
150
+ Bones::GemPackageTask.new(PROJ.gem._spec) do |pkg|
69
151
  pkg.need_tar = PROJ.gem.need_tar
70
152
  pkg.need_zip = PROJ.gem.need_zip
71
- pkg.package_files += PROJ.gem._spec.files
72
153
  end
73
- Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
74
-
75
- gem_file = if PROJ.gem._spec.platform == Gem::Platform::RUBY
76
- "#{pkg.package_name}.gem"
77
- else
78
- "#{pkg.package_name}-#{PROJ.gem._spec.platform}.gem"
79
- end
80
154
 
81
- desc "Build the gem file #{gem_file}"
82
- task :package => ['gem:prereqs', "#{pkg.package_dir}/#{gem_file}"]
83
-
84
- file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.gem._spec.files do
85
- when_writing("Creating GEM") {
86
- Gem::Builder.new(PROJ.gem._spec).build
87
- verbose(true) {
88
- mv gem_file, "#{pkg.package_dir}/#{gem_file}"
89
- }
90
- }
155
+ desc 'Show information about the gem'
156
+ task :debug => 'gem:prereqs' do
157
+ puts PROJ.gem._spec.to_ruby
91
158
  end
92
159
 
93
160
  desc 'Install the gem'
@@ -113,14 +180,13 @@ namespace :gem do
113
180
  task :cleanup do
114
181
  sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
115
182
  end
116
-
117
183
  end # namespace :gem
118
184
 
185
+
119
186
  desc 'Alias to gem:package'
120
187
  task :gem => 'gem:package'
121
188
 
122
189
  task :clobber => 'gem:clobber_package'
123
-
124
- remove_desc_for_task %w(gem:clobber_package)
190
+ remove_desc_for_task 'gem:clobber_package'
125
191
 
126
192
  # EOF
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  if HAVE_GIT
4
3
 
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  require 'find'
4
3
 
@@ -15,9 +14,9 @@ namespace :manifest do
15
14
  lines.map! do |line|
16
15
  case line
17
16
  when %r/^(-{3}|\+{3})/; nil
18
- when %r/^@/; Console::ANSICode.blue line
19
- when %r/^\+/; Console::ANSICode.green line
20
- when %r/^\-/; Console::ANSICode.red line
17
+ when %r/^@/; ANSICode.blue line
18
+ when %r/^\+/; ANSICode.green line
19
+ when %r/^\-/; ANSICode.red line
21
20
  else line end
22
21
  end
23
22
  end
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  if HAVE_BONES
4
3
 
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  # This file does not define any rake tasks. It is used to load some project
4
3
  # settings if they are not defined by the user.
@@ -10,7 +9,8 @@ PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
10
9
 
11
10
  flatten_arrays = lambda do |this,os|
12
11
  os.instance_variable_get(:@table).each do |key,val|
13
- next if key == :dependencies
12
+ next if key == :dependencies \
13
+ or key == :development_dependencies
14
14
  case val
15
15
  when Array; val.flatten!
16
16
  when OpenStruct; this.call(this,val)
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  require 'rake/rdoctask'
4
3
 
@@ -6,7 +6,7 @@ require 'rake/contrib/sshpublisher'
6
6
 
7
7
  namespace :gem do
8
8
  desc 'Package and upload to RubyForge'
9
- task :release => [:clobber, 'gem:package'] do |t|
9
+ task :release => [:clobber, 'gem'] do |t|
10
10
  v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
11
11
  abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
12
12
  pkg = "pkg/#{PROJ.gem._spec.full_name}"
@@ -26,9 +26,7 @@ namespace :gem do
26
26
  c['release_changes'] = PROJ.changes if PROJ.changes
27
27
  c['preformatted'] = true
28
28
 
29
- files = [(PROJ.gem.need_tar ? "#{pkg}.tgz" : nil),
30
- (PROJ.gem.need_zip ? "#{pkg}.zip" : nil),
31
- "#{pkg}.gem"].compact
29
+ files = Dir.glob("#{pkg}*.*")
32
30
 
33
31
  puts "Releasing #{PROJ.name} v. #{PROJ.version}"
34
32
  rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  require 'rubygems'
4
3
  require 'rake'
@@ -8,6 +7,9 @@ require 'ostruct'
8
7
 
9
8
  class OpenStruct; undef :gem; end
10
9
 
10
+ # TODO: make my own openstruct type object that includes descriptions
11
+ # TODO: use the descriptions to output help on the available bones options
12
+
11
13
  PROJ = OpenStruct.new(
12
14
  # Project Defaults
13
15
  :name => nil,
@@ -48,6 +50,7 @@ PROJ = OpenStruct.new(
48
50
  # Gem Packaging
49
51
  :gem => OpenStruct.new(
50
52
  :dependencies => [],
53
+ :development_dependencies => [],
51
54
  :executables => nil,
52
55
  :extensions => FileList['ext/**/extconf.rb'],
53
56
  :files => nil,
@@ -110,8 +113,10 @@ PROJ = OpenStruct.new(
110
113
  )
111
114
 
112
115
  # Load the other rake files in the tasks folder
113
- rakefiles = Dir.glob('tasks/*.rake').sort
114
- rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
116
+ tasks_dir = File.expand_path(File.dirname(__FILE__))
117
+ post_load_fn = File.join(tasks_dir, 'post_load.rake')
118
+ rakefiles = Dir.glob(File.join(tasks_dir, '*.rake')).sort
119
+ rakefiles.unshift(rakefiles.delete(post_load_fn)).compact!
115
120
  import(*rakefiles)
116
121
 
117
122
  # Setup the project libraries
@@ -162,6 +167,12 @@ HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and
162
167
  HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and
163
168
  system("git --version 2>&1 > #{DEV_NULL}"))
164
169
 
170
+ # Add bones as a development dependency
171
+ #
172
+ if HAVE_BONES
173
+ PROJ.gem.development_dependencies << ['bones', ">= #{Bones::VERSION}"]
174
+ end
175
+
165
176
  # Reads a file at +path+ and spits out an array of the +paragraphs+
166
177
  # specified.
167
178
  #
@@ -1,6 +1,5 @@
1
- # $Id$
2
1
 
3
- if HAVE_SPEC_RAKE_SPECTASK
2
+ if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
4
3
  require 'spec/rake/verify_rcov'
5
4
 
6
5
  namespace :spec do
@@ -0,0 +1,47 @@
1
+
2
+ if HAVE_SVN
3
+
4
+ unless PROJ.svn.root
5
+ info = %x/svn info ./
6
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
7
+ PROJ.svn.root = (m.nil? ? '' : m[1])
8
+ end
9
+ PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
10
+
11
+ namespace :svn do
12
+
13
+ # A prerequisites task that all other tasks depend upon
14
+ task :prereqs
15
+
16
+ desc 'Show tags from the SVN repository'
17
+ task :show_tags => 'svn:prereqs' do |t|
18
+ tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
19
+ tags.gsub!(%r/\/$/, '')
20
+ tags = tags.split("\n").sort {|a,b| b <=> a}
21
+ puts tags
22
+ end
23
+
24
+ desc 'Create a new tag in the SVN repository'
25
+ task :create_tag => 'svn:prereqs' do |t|
26
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
27
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
28
+
29
+ svn = PROJ.svn
30
+ trunk = File.join(svn.root, svn.trunk)
31
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
32
+ tag = File.join(svn.root, svn.tags, tag)
33
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
34
+
35
+ puts "Creating SVN tag '#{tag}'"
36
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
37
+ abort "Tag creation failed"
38
+ end
39
+ end
40
+
41
+ end # namespace :svn
42
+
43
+ task 'gem:release' => 'svn:create_tag'
44
+
45
+ end # if PROJ.svn.path
46
+
47
+ # EOF
@@ -1,5 +1,5 @@
1
- # $Id$
2
1
 
2
+ if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
3
3
  require 'rake/testtask'
4
4
 
5
5
  namespace :test do
@@ -35,4 +35,6 @@ task :test => 'test:run'
35
35
 
36
36
  task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
37
 
38
+ end
39
+
38
40
  # 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.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,17 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-02 00:00:00 -06:00
12
+ date: 2008-10-15 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 0.8.1
23
+ version: 0.8.2
23
24
  version:
24
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).
25
26
  email: tim.pease@gmail.com
@@ -31,6 +32,20 @@ extra_rdoc_files:
31
32
  - History.txt
32
33
  - README.txt
33
34
  - bin/bones
35
+ - lib/bones/tasks/ann.rake
36
+ - lib/bones/tasks/bones.rake
37
+ - lib/bones/tasks/gem.rake
38
+ - lib/bones/tasks/git.rake
39
+ - lib/bones/tasks/manifest.rake
40
+ - lib/bones/tasks/notes.rake
41
+ - lib/bones/tasks/post_load.rake
42
+ - lib/bones/tasks/rdoc.rake
43
+ - lib/bones/tasks/rubyforge.rake
44
+ - lib/bones/tasks/spec.rake
45
+ - lib/bones/tasks/svn.rake
46
+ - lib/bones/tasks/test.rake
47
+ - spec/data/data/README.txt
48
+ - spec/data/foo/README.txt
34
49
  files:
35
50
  - History.txt
36
51
  - Manifest.txt
@@ -45,25 +60,32 @@ files:
45
60
  - data/lib/NAME.rb.erb
46
61
  - data/spec/NAME_spec.rb.erb
47
62
  - data/spec/spec_helper.rb.erb
48
- - data/tasks/ann.rake
49
- - data/tasks/bones.rake
50
- - data/tasks/gem.rake
51
- - data/tasks/git.rake
52
- - data/tasks/manifest.rake
53
- - data/tasks/notes.rake
54
- - data/tasks/post_load.rake
55
- - data/tasks/rdoc.rake
56
- - data/tasks/rubyforge.rake
57
- - data/tasks/setup.rb
58
- - data/tasks/spec.rake
59
- - data/tasks/svn.rake
60
- - data/tasks/test.rake
61
63
  - data/test/test_NAME.rb
62
64
  - lib/bones.rb
63
65
  - lib/bones/annotation_extractor.rb
64
66
  - lib/bones/debug.rb
65
67
  - lib/bones/main.rb
66
68
  - lib/bones/smtp_tls.rb
69
+ - lib/bones/tasks/ann.rake
70
+ - lib/bones/tasks/bones.rake
71
+ - lib/bones/tasks/gem.rake
72
+ - lib/bones/tasks/git.rake
73
+ - lib/bones/tasks/manifest.rake
74
+ - lib/bones/tasks/notes.rake
75
+ - lib/bones/tasks/post_load.rake
76
+ - lib/bones/tasks/rdoc.rake
77
+ - lib/bones/tasks/rubyforge.rake
78
+ - lib/bones/tasks/setup.rb
79
+ - lib/bones/tasks/spec.rake
80
+ - lib/bones/tasks/svn.rake
81
+ - lib/bones/tasks/test.rake
82
+ - spec/bones/main_spec.rb
83
+ - spec/bones_spec.rb
84
+ - spec/data/data/README.txt
85
+ - spec/data/data/Rakefile
86
+ - spec/data/foo/README.txt
87
+ - spec/data/foo/Rakefile
88
+ - spec/spec_helper.rb
67
89
  - tasks/ann.rake
68
90
  - tasks/bones.rake
69
91
  - tasks/gem.rake
@@ -75,6 +97,7 @@ files:
75
97
  - tasks/rubyforge.rake
76
98
  - tasks/setup.rb
77
99
  - tasks/spec.rake
100
+ - tasks/svn.rake
78
101
  - tasks/test.rake
79
102
  has_rdoc: true
80
103
  homepage: http://codeforpeople.rubyforge.org/bones
@@ -103,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
126
  requirements: []
104
127
 
105
128
  rubyforge_project: codeforpeople
106
- rubygems_version: 1.1.1
129
+ rubygems_version: 1.2.0
107
130
  signing_key:
108
131
  specification_version: 2
109
132
  summary: Mr Bones is a handy tool that builds a skeleton for your new Ruby projects