technicalpickles-jeweler 0.3.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -12,20 +12,16 @@ Trouble is when developing your Rubygems on GitHub, you generally do one of the
12
12
  * ... why use utilities made for the days before GitHub existed?
13
13
  * ... why have extra stuff you aren't going to use?
14
14
 
15
- Jeweler was created with a few intentions:
16
-
17
- * The only configuration should be providing a Gem::Specification to Jeweler
18
- * Version bumping should only be one command away
19
- * Authoritative version information should stored in one place
20
- * Jeweler should only concern itself with versioning and gems
21
- * Your Rakefile should be usable when Jeweler isn't installed (you just wouldn't be able to version bump or generate a gemspec)
22
- * Jeweler should use Jeweler. Oh the meta!
23
-
24
- ## Use Jeweler in a new project
15
+ Jeweler was created with a few goals in mind:
25
16
 
26
- We'll use Jeweler as an example for creating a new project.
17
+ * Only use a Gem::Specification as configuration
18
+ * Be one command away from version bumping and releasing
19
+ * Store version information in one place
20
+ * Only concern itself with git, gems, and versioning
21
+ * Not be a requirement for using your Rakefile (you just wouldn't be able to use its tasks)
22
+ * Use Jeweler internally. Oh the meta!
27
23
 
28
- ### Install it
24
+ ## Installation
29
25
 
30
26
  Run the following if you haven't already:
31
27
 
@@ -35,68 +31,118 @@ Install the gem:
35
31
 
36
32
  sudo gem install technicalpickles-jeweler
37
33
 
38
- ### Create a directory and git repo
39
-
40
- $ mkdir jeweler
41
- $ cd jeweler
42
- $ git init
34
+ ## Configuration for an existing project
43
35
 
44
- ### Create a Rakefile:
36
+ Armed with the gem, we can begin diving into an example. [the-perfect-gem](http://github.com/technicalpickles/the-perfect-gem/tree) was setup as a Jeweler showcase, and a simple example:
45
37
 
46
- require 'rake'
47
-
48
38
  begin
49
- require 'rubygems'
50
39
  require 'jeweler'
51
- Jeweler.gemspec = Gem::Specification.new do |s|
52
- s.name = "jeweler"
53
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
40
+ Jeweler::Tasks.new do |s|
41
+ s.name = "the-perfect-gem"
42
+ s.summary = "TODO"
54
43
  s.email = "josh@technicalpickles.com"
55
- s.homepage = "http://github.com/technicalpickles/jeweler"
56
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
57
- s.authors = ["Josh Nichols", "Dan Croak"]
58
- s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
44
+ s.homepage = "http://github.com/technicalpickles/the-perfect-gem"
45
+ s.description = "TODO"
46
+ s.authors = ["Josh Nichols"]
59
47
  end
60
48
  rescue LoadError
61
49
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
62
50
  end
51
+
52
+ Here's a rundown of what's happening:
53
+
54
+ * Wrap everything in a begin block, and rescue from LoadError
55
+ * This lets us degrade gracefully if jeweler isn't installed
56
+ * Make a new `Jeweler::Tasks`
57
+ * It gets yielded a new `Gem::Specification`
58
+ * This is where all the configuration happens
59
+ * Things you definitely need to specify:
60
+ * `name`
61
+ * Things you probably want to specify:
62
+ * `summary`
63
+ * `email`
64
+ * `homepage`
65
+ * `description`
66
+ * `authors`
67
+ * Things you can specify, but have defaults
68
+ * `files`, defaults to `FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]`
69
+ * Things you shouldn't specify:
70
+ * `version`, because Jeweler takes care of this for you
71
+ * Other things of interest
72
+ * `executables`, if you have any scripts
73
+ * `add_dependency`, if you have any dependencies
74
+ * Keep in mind that this is a `Gem::Specification`, so you can do whatever you would need to do to get your gem in shape
75
+
76
+ ## Bootstrap a new project
77
+
78
+ Before proceeding, take a minute to setup your git environment, specifically your name and email address:
79
+
80
+ $ git config --global user.email johndoe@example.com
81
+ $ git config --global user.name 'John Doe'
82
+
83
+ Jeweler provides a generator of sorts, `jeweler`. It takes two arguments: your GitHub username and a repository name.
63
84
 
64
- Note, we don't include 'date', or 'version'. Jeweler handles filing these in when it needs them.
85
+ $ jeweler technicalpickles the-perfect-gem
86
+
87
+ Basically, this does:
88
+
89
+ * Creates the the-perfect-gem directory
90
+ * Seeds it with some basic files:
91
+ * `.gitignore`, with the usual suspects predefined
92
+ * `Rakefile`, setup with tasks for jeweler, test, rdoc, and rcov
93
+ * `README`, with your project name
94
+ * `LICENSE`, MIT, with your name prefilled
95
+ * `test/test_helper`, setup with shoulda, mocha, and a re-opened `Test::Unit::TestCase`
96
+ * `test/the_perfect_gem.rb`, placeholder failing test
97
+ * `lib/the_perfect_gem.rb`, placeholder library file
98
+ * Makes it a git repo
99
+ * Sets up `git@github.com:technicalpickles/jeweler.git` as the `origin` git remote
100
+ * Makes an initial commit, but does not push
101
+
102
+ At this point, you probably should create a repository by wandering to [http://github.com/repositories/new](http://github.com/repositories/new). Be sure to use the same project name you told Jeweler.
65
103
 
66
- If you don't specify `s.files`, it will use `s.files = FileList["[A-Z]*.*", "{generators,lib,test,spec}/**/*"]`.
104
+ With the repository firmly created, just push it:
67
105
 
68
- ### Create a version file
106
+ $ git push origin master
107
+
108
+ You also probably should [enable RubyGem creation for you repository](http://github.com/blog/51-github-s-rubygem-server): Go to your project's edit page and check the 'RubyGem' box.
69
109
 
70
- Create an initial `VERSION.yml`. It will by default to 0.0.0, but you can specify MAJOR, MINOR, and PATCH to tweak it:
110
+ ## Overview of Jeweler workflow
71
111
 
72
- $ rake version:write MAJOR=1 MINOR=5 PATCH=2
73
- (in /Users/nichoj/Projects/jeweler)
74
- Wrote to VERSION.yml: 1.5.2
112
+ Here's the general idea:
75
113
 
76
- ### Generate the gemspec
114
+ * Hack, commit, hack, commit, etc, etc
115
+ * Version bump
116
+ * Release
117
+ * Have a delicious scotch
118
+
119
+ The hacking and the scotch are up to you, but Jeweler provides rake tasks for the rest.
77
120
 
78
- $ rake gemspec
79
-
80
- This also validates that the gemspec should work on GitHub.
121
+ ### Versioning
81
122
 
82
- ### Commit it already
123
+ Versioning information is stored in `VERSION.yml`. It's a plain ol' YAML file which contains three things:
83
124
 
84
- $ git add .
85
- $ git commit -a -m "First commit, yo."
86
-
87
- ### Make a github repository
125
+ * major
126
+ * minor
127
+ * patch
128
+
129
+ Consider, for a second, `1.5.3`.
130
+
131
+ * major = 1
132
+ * minor = 5
133
+ * patch = 3
88
134
 
89
- Wander to http://github.com/repositories/new and follow the instructions to get it pushed.
135
+ #### Your first time
90
136
 
91
- ### Enable RubyGem building on the repository
137
+ When you first start using Jeweler, there won't be a `VERSION.yml`, so it'll assume 0.0.0.
92
138
 
93
- Go to your project's edit page and check the 'RubyGem' box.
139
+ If you need some arbitrary version, you can do one of the following:
94
140
 
95
- ### Implement something awesome
141
+ * `rake version:write MAJOR=6 MINOR=0 PATCH=3`
142
+ * Write `VERSION.yml` by hand (lame)
96
143
 
97
- I'll let you figure that out on your own.
98
144
 
99
- ### Bump the version
145
+ #### After that
100
146
 
101
147
  You have a few rake tasks for doing the version bump:
102
148
 
@@ -108,59 +154,30 @@ If you need to do an arbitrary bump, use the same task you used to create `VERSI
108
154
 
109
155
  $ rake version:write MAJOR=6 MINOR=0 PATCH=3
110
156
 
111
- After that, commit and push it:
157
+ The process of version bumping does a commit to your repo, so make sure your repo is in a clean state (ie nothing uncommitted).
112
158
 
113
- $ git commit -a -m "Version bump, yo."
114
- $ git push origin master
159
+ ### Release it
115
160
 
116
- ### Play the waiting game
161
+ It's pretty straight forward:
117
162
 
118
- Wander over to [Has My Gem Built Yet](http://hasmygembuiltyet.org/) to play the waiting game.
163
+ $ rake release
164
+
165
+ This takes care of:
119
166
 
120
- ## Extra stuff you might want to for your RubyGem project
167
+ * Generating a `.gemspec` for you project, with the version you just bumped to
168
+ * Commit and push the updated `.gemspec`
169
+ * Create a tag
170
+ * Push the tag
121
171
 
122
- As was mentioned, Jeweler tries to only do versioning and gem stuff. Most projects have a few other needs:
172
+ ### Play the waiting game
123
173
 
124
- * Testing
125
- * RDoc
126
- * Default task
174
+ How do you know when your gem is built? [Has My Gem Built Yet](http://hasmygembuiltyet.org/) was specifically designed to answer that question.
127
175
 
128
- Jeweler doesn't provide these. But it's easy enough to use Rake's built in tasks:
176
+ If it happens to be down, you can also check out the GitHub Gem repo's [list](http://gems.github.com/list). Just search for youname-yourrepo.s
129
177
 
130
- require 'rake'
131
- require 'rake/testtask'
132
- require 'rake/rdoctask'
178
+ ### Putting it all together
133
179
 
134
- begin
135
- require 'rubygems'
136
- require 'jeweler'
137
- Jeweler.gemspec = Gem::Specification.new do |s|
138
- s.name = "jeweler"
139
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
140
- s.email = "josh@technicalpickles.com"
141
- s.homepage = "http://github.com/technicalpickles/jeweler"
142
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
143
- s.authors = ["Josh Nichols", "Dan Croak"]
144
- s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
145
- end
146
- rescue LoadError
147
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
148
- end
149
-
150
- Rake::TestTask.new do |t|
151
- t.libs << 'lib'
152
- t.pattern = 'test/**/*_test.rb'
153
- t.verbose = false
154
- end
155
-
156
- desc 'Generate documentation for the safety_valve plugin.'
157
- Rake::RDocTask.new(:rdoc) do |rdoc|
158
- rdoc.rdoc_dir = 'rdoc'
159
- rdoc.title = 'Jeweler'
160
- rdoc.options << '--line-numbers' << '--inline-source'
161
- rdoc.rdoc_files.include('README.*')
162
- rdoc.rdoc_files.include('lib/**/*.rb')
163
- end
164
-
165
- desc "Run the test suite"
166
- task :default => :test
180
+ <hack, hack, hack, commit>
181
+ $ rake version:bump:patch release
182
+
183
+ Now browse to http://gems.github.com/yourname/yourproject, and wait for it to be built.
data/Rakefile CHANGED
@@ -15,7 +15,6 @@ begin
15
15
  gemspec.homepage = "http://github.com/technicalpickles/jeweler"
16
16
  gemspec.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
17
17
  gemspec.authors = ["Josh Nichols"]
18
- gemspec.bindir = 'bin'
19
18
  gemspec.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*", 'lib/jeweler/templates/.gitignore']
20
19
  gemspec.add_dependency 'schacon-git'
21
20
  end
@@ -40,7 +39,7 @@ end
40
39
 
41
40
  Rcov::RcovTask.new do |t|
42
41
  t.libs << "test"
43
- t.test_files = FileList['test/*_test.rb']
42
+ t.test_files = FileList['test/**/*_test.rb']
44
43
  t.verbose = true
45
44
  end
46
45
 
data/TODO CHANGED
@@ -1,5 +1,7 @@
1
- * Generator for making new Jeweler projects
2
- * Rails generator for making a plugin that's Jeweler enabled
3
- * Git tagging/branching
4
- * Make sure everything is pushed/committed before bumping (controlled by a Jeweler.strict perhaps)
5
- * Have version:bump:xxx do a commit with an appropriate message
1
+ * Generators
2
+ * Rails generator for making a plugin that's Jeweler enabled
3
+ * Support rspec?
4
+ * Releasing
5
+ * Create tag based on version
6
+ * Push tags
7
+ * Open hasmygembuiltyet.org
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- patch: 4
2
+ patch: 1
3
3
  major: 0
4
- minor: 3
4
+ minor: 4
data/lib/jeweler.rb CHANGED
@@ -2,7 +2,6 @@ require 'date'
2
2
 
3
3
  require 'jeweler/bumping'
4
4
  require 'jeweler/versioning'
5
- require 'jeweler/singleton'
6
5
  require 'jeweler/gemspec'
7
6
  require 'jeweler/errors'
8
7
  require 'jeweler/generator'
@@ -12,7 +11,6 @@ require 'jeweler/tasks'
12
11
 
13
12
  # A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest.
14
13
  class Jeweler
15
- include Jeweler::Singleton
16
14
  include Jeweler::Bumping
17
15
  include Jeweler::Versioning
18
16
  include Jeweler::Gemspec
@@ -41,11 +41,21 @@ class Jeweler
41
41
  }
42
42
  YAML.dump(version_hash, f)
43
43
  end
44
+
44
45
  refresh_version
45
46
 
46
47
  @gemspec.version = version
47
-
48
+
48
49
  puts "Wrote to #{version_yaml_path}: #{version}"
50
+
51
+ commit_version
52
+ end
53
+
54
+ def commit_version
55
+ if @repo
56
+ @repo.add('VERSION.yml')
57
+ @repo.commit("Version bump to #{version}", 'VERSION.yml')
58
+ end
49
59
  end
50
60
  end
51
- end
61
+ end
@@ -12,15 +12,17 @@ class Jeweler
12
12
  @repo.commit("Regenerated gemspec for version #{version}")
13
13
  @repo.push
14
14
 
15
- # require 'ruby-debug'
16
- # breakpoint
17
- #
18
- # @repo.tag("v#{version}")
15
+ @repo.add_tag(release_tag)
16
+ @repo.push('origin', release_tag)
17
+ end
18
+
19
+ def release_tag
20
+ @release_tag ||= "v#{version}"
19
21
  end
20
22
 
21
23
  protected
22
24
  def any_pending_changes?
23
- !@repo.status.added.empty? || !@repo.status.deleted.empty? || !@repo.status.changed.empty? || !@repo.status.untracked.empty?
25
+ @repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty? && @repo.status.untracked.empty?
24
26
  end
25
27
  end
26
28
  end
data/lib/jeweler/tasks.rb CHANGED
@@ -3,8 +3,10 @@ require 'rake/tasklib'
3
3
 
4
4
  class Jeweler
5
5
  class Tasks < ::Rake::TaskLib
6
- def initialize(&block)
7
- @gemspec = Gem::Specification.new(&block)
6
+ def initialize(gemspec = nil, &block)
7
+ @gemspec = Gem::Specification.new()
8
+ block.call(@gemspec) if block
9
+
8
10
  @jeweler = Jeweler.new(@gemspec)
9
11
 
10
12
  define_tasks
@@ -83,4 +85,4 @@ class Jeweler
83
85
 
84
86
  end
85
87
  end
86
- end
88
+ end
@@ -33,7 +33,7 @@ end
33
33
 
34
34
  Rcov::RcovTask.new do |t|
35
35
  t.libs << "test"
36
- t.test_files = FileList['test/*_test.rb']
36
+ t.test_files = FileList['test/**/*_test.rb']
37
37
  t.verbose = true
38
38
  end
39
39
 
data/test/jeweler_test.rb CHANGED
@@ -150,4 +150,4 @@ class JewelerTest < Test::Unit::TestCase
150
150
  end
151
151
  end
152
152
 
153
- end
153
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.1
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: 2008-10-26 00:00:00 -07:00
12
+ date: 2008-11-03 00:00:00 -08:00
13
13
  default_executable: jeweler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,7 +41,6 @@ files:
41
41
  - lib/jeweler/gemspec.rb
42
42
  - lib/jeweler/generator.rb
43
43
  - lib/jeweler/release.rb
44
- - lib/jeweler/singleton.rb
45
44
  - lib/jeweler/tasks.rb
46
45
  - lib/jeweler/templates
47
46
  - lib/jeweler/templates/LICENSE
@@ -1,22 +0,0 @@
1
- class Jeweler
2
- module Singleton
3
- def self.included(base)
4
- base.extend(ClassMethods)
5
- end
6
-
7
- module ClassMethods
8
- # Gives Jeweler a gem to craft. This is really just a convience method for making the Rake usage nicer.
9
- # In reality, this creates a new Jeweler, and assigns that to the singleton instance.
10
- def craft(gemspec)
11
- @@instance = new(gemspec)
12
- end
13
- alias_method :gemspec=, :craft
14
-
15
- # Gets the current Jeweler. Typically only the Jeweler Rake tasks would use this.
16
- def instance
17
- @@instance
18
- end
19
- end
20
- end
21
-
22
- end