jeweler 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ # jeweler 1.2.0 2009-08-06
2
+ * Generator now adds development dependencies appropriate to your testing framework
3
+ * Added check_dependencies tasks for verifying gem dependencies are installed
4
+ * Fixed typo in generated yard task
5
+ * Fixed generator from having a lot of extra newlines
6
+
1
7
  # jeweler 1.1.0 2009-08-05
2
8
 
3
9
  * Support for generating a project that uses yard instead of rdoc
data/Rakefile CHANGED
@@ -96,31 +96,6 @@ else
96
96
  task :default => :test
97
97
  end
98
98
 
99
- namespace :development_dependencies do
100
- task :check do
101
- missing_dependencies = Rake.application.jeweler.gemspec.development_dependencies.select do |dependency|
102
- begin
103
- Gem.activate dependency.name, dependency.version_requirements.to_s
104
- false
105
- rescue LoadError => e
106
- true
107
- end
108
- end
109
-
110
- #require 'ruby-debug'; breakpoint
111
-
112
- if missing_dependencies.empty?
113
- puts "Development dependencies seem to be installed."
114
- else
115
- puts "Missing some dependencies. Install them with the following commands:"
116
- missing_dependencies.each do |dependency|
117
- puts %Q{\tgem install #{dependency.name} --version "#{dependency.version_requirements}"}
118
- end
119
- abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
120
- end
121
-
122
- end
123
- end
124
99
 
125
- task :test => 'development_dependencies:check'
126
- task :features => 'development_dependencies:check'
100
+ task :test => :check_dependencies
101
+ task :features => :check_dependencies
@@ -1,4 +1,4 @@
1
1
  ---
2
- :major: 1
3
2
  :patch: 0
4
- :minor: 1
3
+ :major: 1
4
+ :minor: 2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jeweler}
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Nichols"]
12
- s.date = %q{2009-08-05}
12
+ s.date = %q{2009-08-06}
13
13
  s.default_executable = %q{jeweler}
14
14
  s.description = %q{Simple and opinionated helper for creating Rubygem projects on GitHub}
15
15
  s.email = %q{josh@technicalpickles.com}
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
51
51
  "lib/jeweler.rb",
52
52
  "lib/jeweler/commands.rb",
53
53
  "lib/jeweler/commands/build_gem.rb",
54
+ "lib/jeweler/commands/check_dependencies.rb",
54
55
  "lib/jeweler/commands/install_gem.rb",
55
56
  "lib/jeweler/commands/release.rb",
56
57
  "lib/jeweler/commands/release_to_rubyforge.rb",
@@ -70,9 +71,11 @@ Gem::Specification.new do |s|
70
71
  "lib/jeweler/generator/micronaut_mixin.rb",
71
72
  "lib/jeweler/generator/minitest_mixin.rb",
72
73
  "lib/jeweler/generator/options.rb",
74
+ "lib/jeweler/generator/rdoc_mixin.rb",
73
75
  "lib/jeweler/generator/rspec_mixin.rb",
74
76
  "lib/jeweler/generator/shoulda_mixin.rb",
75
77
  "lib/jeweler/generator/testunit_mixin.rb",
78
+ "lib/jeweler/generator/yard_mixin.rb",
76
79
  "lib/jeweler/rubyforge_tasks.rb",
77
80
  "lib/jeweler/specification.rb",
78
81
  "lib/jeweler/tasks.rb",
@@ -129,6 +129,12 @@ class Jeweler
129
129
  Jeweler::Commands::SetupRubyforge.build_for(self).run
130
130
  end
131
131
 
132
+ def check_dependencies(type = nil)
133
+ command = Jeweler::Commands::CheckDependencies.build_for(self)
134
+ command.type = type
135
+
136
+ command.run
137
+ end
132
138
 
133
139
  def in_git_repo?
134
140
  File.exists?(File.join(self.base_dir, '.git'))
@@ -1,5 +1,6 @@
1
1
  require 'jeweler/commands/build_gem'
2
2
  require 'jeweler/commands/install_gem'
3
+ require 'jeweler/commands/check_dependencies'
3
4
  require 'jeweler/commands/release'
4
5
  require 'jeweler/commands/release_to_rubyforge'
5
6
  require 'jeweler/commands/setup_rubyforge'
@@ -0,0 +1,52 @@
1
+ class Jeweler
2
+ module Commands
3
+ class CheckDependencies
4
+ class MissingDependenciesError < RuntimeError
5
+ attr_accessor :dependencies, :type
6
+ end
7
+
8
+ attr_accessor :gemspec, :type
9
+
10
+ def run
11
+ missing_dependencies = dependencies.select do |dependency|
12
+ begin
13
+ Gem.activate dependency.name, dependency.version_requirements.to_s
14
+ false
15
+ rescue LoadError => e
16
+ true
17
+ end
18
+ end
19
+
20
+ if missing_dependencies.empty?
21
+ puts "#{type || 'All'} dependencies seem to be installed."
22
+ else
23
+ puts "Missing some dependencies. Install them with the following commands:"
24
+ missing_dependencies.each do |dependency|
25
+ puts %Q{\tgem install #{dependency.name} --version "#{dependency.version_requirements}"}
26
+ end
27
+
28
+ abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
29
+ end
30
+
31
+ end
32
+
33
+ def dependencies
34
+ case type
35
+ when :runtime, :development
36
+ gemspec.send("#{type}_dependencies")
37
+ else
38
+ gemspec.dependencies
39
+ end
40
+
41
+ end
42
+
43
+ def self.build_for(jeweler)
44
+ command = new
45
+
46
+ command.gemspec = jeweler.gemspec
47
+
48
+ command
49
+ end
50
+ end
51
+ end
52
+ end
@@ -11,6 +11,9 @@ require 'jeweler/generator/rspec_mixin'
11
11
  require 'jeweler/generator/shoulda_mixin'
12
12
  require 'jeweler/generator/testunit_mixin'
13
13
 
14
+ require 'jeweler/generator/rdoc_mixin'
15
+ require 'jeweler/generator/yard_mixin'
16
+
14
17
  class Jeweler
15
18
  class NoGitUserName < StandardError
16
19
  end
@@ -29,12 +32,12 @@ class Jeweler
29
32
 
30
33
  class Generator
31
34
  attr_accessor :target_dir, :user_name, :user_email, :summary,
32
- :project_name, :github_username, :github_token,
35
+ :description, :project_name, :github_username, :github_token,
33
36
  :repo, :should_create_repo,
34
37
  :testing_framework, :documentation_framework,
35
38
  :should_use_cucumber, :should_setup_rubyforge,
36
39
  :should_use_reek, :should_use_roodi,
37
- :description
40
+ :development_dependencies
38
41
 
39
42
  DEFAULT_TESTING_FRAMEWORK = :shoulda
40
43
  DEFAULT_DOCUMENTATION_FRAMEWORK = :rdoc
@@ -44,6 +47,8 @@ class Jeweler
44
47
  raise NoGitHubRepoNameGiven
45
48
  end
46
49
 
50
+ self.development_dependencies = []
51
+
47
52
  self.project_name = project_name
48
53
 
49
54
  self.testing_framework = (options[:testing_framework] || DEFAULT_TESTING_FRAMEWORK).to_sym
@@ -56,6 +61,14 @@ class Jeweler
56
61
  raise ArgumentError, "Unsupported testing framework (#{testing_framework})"
57
62
  end
58
63
 
64
+ begin
65
+ generator_mixin_name = "#{self.documentation_framework.to_s.capitalize}Mixin"
66
+ generator_mixin = self.class.const_get(generator_mixin_name)
67
+ extend generator_mixin
68
+ rescue NameError => e
69
+ raise ArgumentError, "Unsupported documentation framework (#{documentation_framework})"
70
+ end
71
+
59
72
 
60
73
  self.target_dir = options[:directory] || self.project_name
61
74
 
@@ -67,6 +80,8 @@ class Jeweler
67
80
  self.should_use_roodi = options[:use_roodi]
68
81
  self.should_setup_rubyforge = options[:rubyforge]
69
82
 
83
+ development_dependencies << "cucumber" if should_use_cucumber
84
+
70
85
  use_user_git_config
71
86
 
72
87
  end
@@ -131,14 +146,6 @@ class Jeweler
131
146
  File.join(features_dir, 'step_definitions')
132
147
  end
133
148
 
134
- def doc_task
135
- case documentation_framework
136
- when :yard then "yardoc"
137
- else
138
- documentation_framework.to_s
139
- end
140
- end
141
-
142
149
  protected
143
150
 
144
151
  # This is in a separate method so we can stub it out during testing
@@ -214,7 +221,7 @@ class Jeweler
214
221
  template_contents = File.read(File.join(template_dir, source))
215
222
  template = ERB.new(template_contents, nil, '<>')
216
223
 
217
- template_result = template.result(binding)
224
+ template_result = template.result(binding).gsub(/\n\n\n+/, "\n\n")
218
225
 
219
226
  File.open(final_destination, 'w') {|file| file.write(template_result)}
220
227
 
@@ -2,6 +2,10 @@ class Jeweler
2
2
  class Generator
3
3
  module BaconMixin
4
4
 
5
+ def self.extended(generator)
6
+ generator.development_dependencies << "bacon"
7
+ end
8
+
5
9
  def default_task
6
10
  'spec'
7
11
  end
@@ -1,6 +1,9 @@
1
1
  class Jeweler
2
2
  class Generator
3
3
  module MicronautMixin
4
+ def self.extended(generator)
5
+ generator.development_dependencies << "spicycode-micronaut"
6
+ end
4
7
 
5
8
  def default_task
6
9
  'examples'
@@ -1,6 +1,9 @@
1
1
  class Jeweler
2
2
  class Generator
3
3
  module MinitestMixin
4
+ def self.extended(generator)
5
+ generator.development_dependencies << "minitest"
6
+ end
4
7
 
5
8
  def default_task
6
9
  'test'
@@ -0,0 +1,9 @@
1
+ class Jeweler
2
+ class Generator
3
+ module RdocMixin
4
+ def doc_task
5
+ 'rdoc'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,6 +1,9 @@
1
1
  class Jeweler
2
2
  class Generator
3
3
  module RspecMixin
4
+ def self.extended(generator)
5
+ generator.development_dependencies << "rspec"
6
+ end
4
7
 
5
8
  def default_task
6
9
  'spec'
@@ -1,6 +1,9 @@
1
1
  class Jeweler
2
2
  class Generator
3
3
  module ShouldaMixin
4
+ def self.extended(generator)
5
+ generator.development_dependencies << "thoughtbot-shoulda"
6
+ end
4
7
 
5
8
  def default_task
6
9
  'test'
@@ -0,0 +1,14 @@
1
+ class Jeweler
2
+ class Generator
3
+ module YardMixin
4
+ def self.extended(generator)
5
+ generator.development_dependencies << "yard"
6
+ end
7
+
8
+ def doc_task
9
+ 'yardoc'
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -111,6 +111,24 @@ class Jeweler
111
111
  task :release do
112
112
  jeweler.release
113
113
  end
114
+
115
+ desc "Check that runtime and development dependencies are installed"
116
+ task :check_dependencies do
117
+ jeweler.check_dependencies
118
+ end
119
+
120
+ namespace :check_dependencies do
121
+ desc "Check that runtime dependencies are installed"
122
+ task :runtime do
123
+ jeweler.check_dependencies(:runtime)
124
+ end
125
+
126
+ desc"Check that development dependencies are installed"
127
+ task :development do
128
+ jeweler.check_dependencies(:development)
129
+ end
130
+
131
+ end
114
132
 
115
133
  end
116
134
  end
@@ -12,10 +12,12 @@ begin
12
12
  gem.authors = ["<%= user_name %>"]
13
13
  <% if should_setup_rubyforge %>
14
14
  gem.rubyforge_project = "<%= project_name %>"
15
+ <% end %>
16
+ <% development_dependencies.each do |dependency| %>
17
+ gem.add_development_dependency "<%= dependency %>"
15
18
  <% end %>
16
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
20
  end
18
-
19
21
  <% if should_setup_rubyforge %>
20
22
  Jeweler::RubyforgeTasks.new do |rubyforge|
21
23
  rubyforge.doc_task = "<%= doc_task %>"
@@ -75,10 +77,14 @@ rescue LoadError
75
77
  end
76
78
  <% end %>
77
79
 
80
+ task :<%= test_task %> => :check_dependencies
81
+
78
82
  <% if should_use_cucumber %>
79
83
  begin
80
84
  require 'cucumber/rake/task'
81
85
  Cucumber::Rake::Task.new(:features)
86
+
87
+ task :features => :check_dependencies
82
88
  rescue LoadError
83
89
  task :features do
84
90
  abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
@@ -138,7 +144,7 @@ begin
138
144
  YARD::Rake::YardocTask.new
139
145
  rescue LoadError
140
146
  task :yardoc do
141
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
147
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
142
148
  end
143
149
  end
144
150
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-05 00:00:00 -04:00
12
+ date: 2009-08-06 00:00:00 -04:00
13
13
  default_executable: jeweler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,7 @@ files:
124
124
  - lib/jeweler.rb
125
125
  - lib/jeweler/commands.rb
126
126
  - lib/jeweler/commands/build_gem.rb
127
+ - lib/jeweler/commands/check_dependencies.rb
127
128
  - lib/jeweler/commands/install_gem.rb
128
129
  - lib/jeweler/commands/release.rb
129
130
  - lib/jeweler/commands/release_to_rubyforge.rb
@@ -143,9 +144,11 @@ files:
143
144
  - lib/jeweler/generator/micronaut_mixin.rb
144
145
  - lib/jeweler/generator/minitest_mixin.rb
145
146
  - lib/jeweler/generator/options.rb
147
+ - lib/jeweler/generator/rdoc_mixin.rb
146
148
  - lib/jeweler/generator/rspec_mixin.rb
147
149
  - lib/jeweler/generator/shoulda_mixin.rb
148
150
  - lib/jeweler/generator/testunit_mixin.rb
151
+ - lib/jeweler/generator/yard_mixin.rb
149
152
  - lib/jeweler/rubyforge_tasks.rb
150
153
  - lib/jeweler/specification.rb
151
154
  - lib/jeweler/tasks.rb