burke 0.3.5 → 0.3.6

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.
@@ -0,0 +1,12 @@
1
+ === Version 0.3.6 / 2010-11-17
2
+
3
+ * Fixed Ruby 1.9 issues
4
+ * Stripped whitespace from burke:tasks disabled reasons
5
+ * Handled case where tag for previous version does not exist
6
+ * Fixed typo
7
+ * changed to 'gem' method for verifying task dependencies
8
+ * Made release task more informative
9
+ * Made the relationship between release task operations and questions more logical
10
+ * Added automatic history file building to release task
11
+ * restructured specs, fixed up rcov integration
12
+
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH << File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
1
+ $:.unshift File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
2
2
  require 'burke'
3
3
 
4
4
  Burke.setup do
@@ -11,6 +11,6 @@ Burke.setup do
11
11
  clean %w[.yardoc]
12
12
  clobber %w[pkg doc html coverage]
13
13
 
14
- rspec.rcov.failure_threshold = 70
14
+ rspec.rcov.failure_threshold = 65
15
15
  end
16
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -113,12 +113,12 @@ module Burke
113
113
  field(:rakefile_file) { find_file('rakefile').freeze }
114
114
  field(:version_file) { find_file('version{.*,}').freeze }
115
115
 
116
- field(:version) { File.read(version_file).strip.freeze if version_file }
116
+ field(:version) { File.read(version_file).strip if version_file }
117
117
 
118
118
  field :files do
119
- fs = Dir['{lib,spec,bin}/**/*']
119
+ fs = Dir['{lib,spec,bin,test}/**/*']
120
120
  fs << docs.readme_file
121
- fs << docs.license_file
121
+ fs.concat docs.extra_files
122
122
  fs << version_file
123
123
  fs << rakefile_file
124
124
  fs.compact.freeze
@@ -176,7 +176,7 @@ module Burke
176
176
  td.execute(settings)
177
177
  enabled << [name, nil]
178
178
  rescue Exception => ex
179
- disabled << [name, ex.message]
179
+ disabled << [name, ex.message.strip]
180
180
  end
181
181
  else
182
182
  disabled << [name, "disabled by project developer(s)"]
@@ -190,9 +190,8 @@ module Burke
190
190
  puts ' Enabled '
191
191
  puts ' ---------'
192
192
  width = enabled.map {|a| a[0].length}.sort.last
193
- enabled.sort_by {|a| a[0]}.each do |name, reason|
193
+ enabled.sort_by {|a| a[0]}.each do |name, _|
194
194
  line = "+ #{name.ljust(width)}"
195
- line << " (#{reason})" if reason
196
195
  puts line
197
196
  end
198
197
  puts
@@ -143,7 +143,7 @@ module Burke
143
143
  end
144
144
  when '='
145
145
  if field_exists? key
146
- self[key] = *args
146
+ self[key] = args[0]
147
147
  else
148
148
  super
149
149
  end
@@ -160,7 +160,7 @@ module Burke
160
160
  end
161
161
  v
162
162
  else
163
- self[key] = *args
163
+ self[key] = args[0]
164
164
  end
165
165
  else
166
166
  super
@@ -14,7 +14,7 @@ module Burke
14
14
  end
15
15
 
16
16
  field 'extra_files' do
17
- [license_file].compact.freeze
17
+ [license_file, history_file].compact.freeze
18
18
  end
19
19
 
20
20
  field 'readme_file' do
@@ -25,6 +25,10 @@ module Burke
25
25
  find_file('{licen{c,s}e,copying}{.*,}').freeze
26
26
  end
27
27
 
28
+ field 'history_file' do
29
+ find_file('{history,changelog}{.*,}').freeze
30
+ end
31
+
28
32
  field 'markup' do
29
33
  case File.extname(readme_file).downcase
30
34
  when '.rdoc'
@@ -1,13 +1,12 @@
1
1
  module Burke
2
2
  define_task 'release' do |s|
3
- begin
4
- require 'git'
5
- rescue LoadError
6
- raise "'git' gem is not available"
7
- end
3
+ gem 'git'
4
+ require 'git'
5
+
8
6
  if s.key? 'version'
9
7
  raise "version is managed in an unknown way"
10
8
  end
9
+
11
10
  desc 'Release a new version of this project'
12
11
  task 'release' do |t|
13
12
  g = Git.open '.'
@@ -49,20 +48,75 @@ module Burke
49
48
  new_version = Gem::Version.new(segments.join('.'))
50
49
  end
51
50
 
52
- print "The VERSION file will be changed from containing '#{old_version}' "
53
- print "to '#{new_version}'. The changes will be commited to the Git "
54
- print "repository and tagged with 'v#{new_version}'."
51
+ case settings.docs.markup
52
+ when 'rdoc'
53
+ settings.docs.history_file ||= "History.rdoc"
54
+ when 'markdown'
55
+ settings.docs.history_file ||= "History.md"
56
+ when 'textile'
57
+ settings.docs.history_file ||= "History.textile"
58
+ else
59
+ settings.docs.history_file ||= "History.txt"
60
+ end
61
+
62
+ puts "Would you like the history file '#{settings.docs.history_file}' to be updated? [Y]es, [N]o"
63
+ update_changelog = nil
64
+ until %w[y n yes no].include? update_changelog
65
+ print "> "
66
+ update_changelog = $stdin.gets.strip.downcase
67
+ puts
68
+ end
69
+ update_changelog = %w[yes y].include? update_changelog
70
+
71
+ puts "The VERSION file will be changed from containing '#{old_version}' "
72
+ puts "to '#{new_version}'. The changes will be commited to the Git "
73
+ puts "repository and tagged with 'v#{new_version}'."
74
+ if update_changelog
75
+ puts "A new entry will be made in the history file '#{settings.docs.history_file}'."
76
+ end
55
77
  puts
56
78
 
57
79
  continue = nil
58
- until ['y', 'n', 'yes', 'no'].include? continue
80
+ until %w[y n yes no].include? continue
59
81
  puts "Continue? [Y]es, [N]o"
60
82
  print "> "
61
83
  continue = $stdin.gets.strip.downcase
62
84
  puts
63
85
  end
86
+ continue = %w[yes y].include? continue
64
87
 
65
- if %w[yes y].include? continue
88
+ if continue
89
+ if update_changelog
90
+ log_entries = nil
91
+ begin
92
+ log_entries = g.log.between("v#{old_version}", '.').to_a
93
+ rescue
94
+ log_entries = g.log.to_a
95
+ end
96
+ messages = log_entries.map {|c| c.message}.uniq
97
+ str = ""
98
+ time = Time.now
99
+ date_str = "%.4d-%.2d-%.2d" % [time.year, time.month, time.day]
100
+ heading = "Version #{new_version} / #{date_str}"
101
+ case settings.docs.markup
102
+ when 'rdoc'
103
+ str << "=== #{heading}\n\n"
104
+ when 'markdown'
105
+ str << "### #{heading}\n\n"
106
+ when 'textile'
107
+ str << "h3. #{heading}\n\n"
108
+ else
109
+ str << "#{heading}\n\n"
110
+ end
111
+ str << messages.map {|m| "* " + m}.join("\n")
112
+
113
+ old_log = File.read(settings.docs.history_file) rescue ""
114
+ new_log = [str, old_log].join("\n\n")
115
+ open(settings.docs.history_file, 'w') do |f|
116
+ f.write new_log
117
+ end
118
+ end
119
+
66
120
  open 'VERSION', 'w' do |f|
67
121
  f.puts new_version.to_s
68
122
  end
@@ -2,11 +2,8 @@ module Burke
2
2
  Settings.field(:rspec) { self.rspec = RSpecSettings.new }
3
3
 
4
4
  define_task 'spec' do |s|
5
- begin
6
- require 'rspec/core/rake_task'
7
- rescue LoadError
8
- raise "'rspec' gem is not available"
9
- end
5
+ gem 'rspec-core', '~> 2'
6
+ require 'rspec/core/rake_task'
10
7
 
11
8
  RSpec::Core::RakeTask.new 'spec' do |t|
12
9
  build_spec_task t, s.rspec
@@ -14,35 +11,33 @@ module Burke
14
11
  end
15
12
 
16
13
  define_task 'spec:rcov' do |s|
17
- begin
18
- require 'rspec/core/rake_task'
19
- rescue LoadError
20
- raise "'rspec' gem is not available"
21
- end
14
+ gem 'rcov'
15
+ gem 'rspec-core', '~> 2'
16
+ require 'rspec/core/rake_task'
22
17
 
23
18
  desc "Run RSpec code examples and generate full RCov report"
24
19
  RSpec::Core::RakeTask.new('spec:rcov') do |t|
20
+ require 'shellwords'
25
21
  t.rcov = true
26
22
  t.rcov_opts = [
27
- '-Ilib',
23
+ "-I#{%w[lib spec].map {|e| File.expand_path(e).shellescape }.join ':'}",
28
24
  '--exclude', "'spec/,#{s.rakefile_file}'",
29
25
  ]
30
26
  end
31
27
  end
32
28
 
33
29
  define_task 'spec:rcov:verify' do |s|
34
- begin
35
- require 'rspec/core/rake_task'
36
- rescue LoadError
37
- raise "'rspec' gem is not available"
38
- end
30
+ gem 'rcov'
31
+ gem 'rspec-core', '~> 2'
32
+ require 'rspec/core/rake_task'
39
33
 
40
34
  desc "Run RSpec code examples and verify RCov percentage"
41
35
  RSpec::Core::RakeTask.new('spec:rcov:verify') do |t|
36
+ require 'shellwords'
42
37
  t.rcov = true
43
38
  t.rcov_opts = [
44
39
  '--failure-threshold', s.rspec.rcov.failure_threshold,
45
- '-Ilib',
40
+ "-I#{%w[lib spec].map {|e| File.expand_path(e).shellescape }.join ':'}",
46
41
  '--exclude', "'spec/,#{s.rakefile_file}'",
47
42
  '--no-html'
48
43
  ]
@@ -1,10 +1,7 @@
1
1
  module Burke
2
2
  define_task 'yard' do |s|
3
- begin
4
- require 'yard'
5
- rescue LoadError
6
- raise "'yard' gem is not available"
7
- end
3
+ gem 'yard'
4
+ require 'yard'
8
5
 
9
6
  opts = []
10
7
  d = s.docs
@@ -0,0 +1,32 @@
1
+ module Helpers
2
+ module Projects
3
+ def project_dir(name)
4
+ File.join(File.dirname(__FILE__), 'projects', name)
5
+ end
6
+
7
+ def mock_burke_project(name, &block)
8
+ Dir.chdir project_dir(name) do
9
+ # Stow away current Burke settings and mock out the `settings` method
10
+ Burke.module_eval do
11
+ class << self
12
+ alias :old_settings :settings
13
+ def settings
14
+ @_settings ||= Burke::Settings.new
15
+ end
16
+ end
17
+ end
18
+
19
+ load 'Rakefile'
20
+ block.call
21
+
22
+ # Restore Burke to how it was
23
+ Burke.module_eval do
24
+ class << self
25
+ alias :settings :old_settings
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'burke'
3
+
4
+ Burke.setup do
5
+ name 'conventional'
6
+ summary 'A conventional project'
7
+ end
8
+
@@ -1,4 +1,3 @@
1
- ($LOAD_PATH << File.dirname(File.expand_path(__FILE__))).uniq!
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Burke::Holder do
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'helpers/projects'
3
+
4
+ describe "conventional project" do
5
+ include Helpers::Projects
6
+
7
+ around do |example|
8
+ mock_burke_project('conventional', &example)
9
+ end
10
+
11
+ let(:settings) { Burke.settings }
12
+ subject { settings }
13
+
14
+ its(:name) { should eql 'conventional' }
15
+
16
+ its(:version_file) { should eql 'VERSION' }
17
+ its(:rakefile_file) { should eql 'Rakefile' }
18
+ its(:version) { should eql '1.2.3' }
19
+
20
+ describe 'docs' do
21
+ subject { settings.docs }
22
+ its(:readme_file) { should eql 'README.md' }
23
+ its(:license_file) { should eql 'COPYING' }
24
+ its(:markup) { should eql 'markdown' }
25
+ end
26
+
27
+ describe 'test' do
28
+ subject { settings.test }
29
+ its(:files) { should eql ['test/foo_test.rb'] }
30
+ end
31
+ end
32
+
33
+
@@ -1,24 +1,4 @@
1
- $LOAD_PATH << File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
1
+ $:.unshift File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
2
2
  require 'burke'
3
3
  require 'rspec/core'
4
4
 
5
- def mock_burke_setup
6
- Burke.module_eval do
7
- class << self
8
- alias :old_settings :settings
9
-
10
- def settings
11
- @settings ||= Burke::Settings.new
12
- end
13
- end
14
- end
15
- end
16
-
17
- def unmock_burke_setup
18
- Burke.module_eval do
19
- class << self
20
- alias :settings :old_settings
21
- end
22
- end
23
- end
24
-
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burke
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 5
9
- version: 0.3.5
9
+ - 6
10
+ version: 0.3.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - Aiden Nibali
@@ -14,31 +15,33 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-24 00:00:00 +11:00
18
+ date: 2010-11-17 00:00:00 +11:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ name: rake
21
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
22
25
  requirements:
23
26
  - - "="
24
27
  - !ruby/object:Gem::Version
28
+ hash: 49
25
29
  segments:
26
30
  - 0
27
31
  - 8
28
32
  - 7
29
33
  version: 0.8.7
30
- requirement: *id001
31
34
  prerelease: false
35
+ requirement: *id001
32
36
  type: :development
33
- name: rake
34
37
  description:
35
38
  email: dismal.denizen@gmail.com
36
39
  executables: []
37
40
 
38
41
  extensions: []
39
42
 
40
- extra_rdoc_files: []
41
-
43
+ extra_rdoc_files:
44
+ - History.rdoc
42
45
  files:
43
46
  - lib/burke/tasks/rdoc.rb
44
47
  - lib/burke/tasks/yard.rb
@@ -51,14 +54,17 @@ files:
51
54
  - lib/burke/holder.rb
52
55
  - lib/burke.rb
53
56
  - spec/holder_spec.rb
57
+ - spec/projects/conventional_project_spec.rb
58
+ - spec/helpers/projects.rb
59
+ - spec/helpers/projects/conventional/lib/main.rb
60
+ - spec/helpers/projects/conventional/test/foo_test.rb
61
+ - spec/helpers/projects/conventional/Rakefile
62
+ - spec/helpers/projects/conventional/README.md
63
+ - spec/helpers/projects/conventional/COPYING
64
+ - spec/helpers/projects/conventional/VERSION
54
65
  - spec/spec_helper.rb
55
- - spec/simple_project/lib/main.rb
56
- - spec/simple_project/Rakefile
57
- - spec/simple_project/README.md
58
- - spec/simple_project/COPYING
59
- - spec/simple_project/VERSION
60
- - spec/burke_spec.rb
61
66
  - README.rdoc
67
+ - History.rdoc
62
68
  - VERSION
63
69
  - Rakefile
64
70
  has_rdoc: true
@@ -68,29 +74,33 @@ licenses: []
68
74
  post_install_message:
69
75
  rdoc_options:
70
76
  - --title
71
- - burke 0.3.5
77
+ - burke 0.3.6
72
78
  - --main
73
79
  - README.rdoc
74
80
  require_paths:
75
81
  - lib
76
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
77
84
  requirements:
78
85
  - - ">="
79
86
  - !ruby/object:Gem::Version
87
+ hash: 3
80
88
  segments:
81
89
  - 0
82
90
  version: "0"
83
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
84
93
  requirements:
85
94
  - - ">="
86
95
  - !ruby/object:Gem::Version
96
+ hash: 3
87
97
  segments:
88
98
  - 0
89
99
  version: "0"
90
100
  requirements: []
91
101
 
92
102
  rubyforge_project:
93
- rubygems_version: 1.3.6
103
+ rubygems_version: 1.3.7
94
104
  signing_key:
95
105
  specification_version: 3
96
106
  summary: Helper for creating nice, clean Rake files
@@ -1,39 +0,0 @@
1
- ($LOAD_PATH << File.dirname(File.expand_path(__FILE__))).uniq!
2
- require 'spec_helper'
3
-
4
- DIR = File.dirname(File.expand_path(__FILE__))
5
-
6
- describe Burke do
7
- describe 'settings' do
8
- context 'for example of a simple project' do
9
- before do
10
- @old_pwd = Dir.pwd
11
- Dir.chdir File.join(DIR, 'simple_project')
12
- mock_burke_setup
13
- load 'Rakefile'
14
- @settings = Burke.settings
15
- end
16
-
17
- subject { @settings }
18
-
19
- its(:name) { should eql 'simple_project' }
20
-
21
- its(:version_file) { should eql 'VERSION' }
22
- its(:rakefile_file) { should eql 'Rakefile' }
23
- its(:version) { should eql '1.2.3' }
24
-
25
- describe 'docs' do
26
- subject { @settings.docs }
27
- its(:readme_file) { should eql 'README.md' }
28
- its(:license_file) { should eql 'COPYING' }
29
- its(:markup) { should eql 'markdown' }
30
- end
31
-
32
- after do
33
- unmock_burke_setup
34
- Dir.chdir @old_pwd
35
- end
36
- end
37
- end
38
- end
39
-
@@ -1,8 +0,0 @@
1
- require 'rubygems'
2
- require 'burke'
3
-
4
- Burke.setup do
5
- name 'simple_project'
6
- summary 'A simple project which follows conventions'
7
- end
8
-