buildar 1.4.0.8 → 1.4.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST.txt +1 -0
- data/README.md +204 -0
- data/VERSION +1 -1
- metadata +2 -1
data/MANIFEST.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
Buildar
|
2
|
+
=======
|
3
|
+
Buildar provides a set of rake tasks to help automate releasing your gem:
|
4
|
+
* Versioning
|
5
|
+
* Building / Packaging
|
6
|
+
* Publishing
|
7
|
+
|
8
|
+
With a set of options to integrate with your current project.
|
9
|
+
|
10
|
+
Rake tasks
|
11
|
+
----------
|
12
|
+
Core
|
13
|
+
* `release` - `message` `build` `tag` `publish`
|
14
|
+
* `build` - `test` `bump_build` build a .gem file inside pkg/
|
15
|
+
* `test` - runs your tests using rake/testtask
|
16
|
+
* `message` - capture a message from ENV['message'] or prompt STDIN
|
17
|
+
* `install` - `build` uninstall, install built .gem
|
18
|
+
* `version` - show the current project version
|
19
|
+
* `buildar` - config check
|
20
|
+
|
21
|
+
With rubygems.org integration
|
22
|
+
* `publish` - `verify publish credentials` gem push
|
23
|
+
|
24
|
+
With git integration
|
25
|
+
* `tag` - `test` git tag according to current version, pushed to origin
|
26
|
+
|
27
|
+
With version file integration
|
28
|
+
* `bump_build` - increment the 4th version number (1.2.3.4 -> 1.2.3.5)
|
29
|
+
* `bump_patch` - increment the 3rd version number (1.2.3.4 -> 1.2.4.0)
|
30
|
+
* `bump_minor` - increment the 2nd version number (1.2.3.4 -> 1.3.0.0)
|
31
|
+
* `bump_major` - increment the 1st version number (1.2.3.4 -> 2.0.0.0)
|
32
|
+
* `release_patch` - `bump_patch` `release`
|
33
|
+
* `release_minor` - `bump_minor` `release`
|
34
|
+
* `release_major` - `bump_major` `release`
|
35
|
+
|
36
|
+
Tasks which depend on optional functionality will not fail if the option is disabled. They are effectively skipped.
|
37
|
+
|
38
|
+
[Just show me the file](https://github.com/rickhull/buildar/blob/master/lib/buildar/tasks.rb)
|
39
|
+
|
40
|
+
Install
|
41
|
+
-------
|
42
|
+
```shell
|
43
|
+
$ gem install buildar # sudo as necessary
|
44
|
+
```
|
45
|
+
|
46
|
+
Usage
|
47
|
+
-----
|
48
|
+
Edit your Rakefile. Add to the top:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'buildar/tasks'
|
52
|
+
|
53
|
+
Buildar.conf(__FILE__) do |b|
|
54
|
+
b.name = 'Example' # optional, inferred from directory
|
55
|
+
# ...
|
56
|
+
end
|
57
|
+
|
58
|
+
# make sure you have a task named :test, even if it's empty
|
59
|
+
task :test do
|
60
|
+
# ...
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
That is basically the minimal Rakefile needed for Buildar to operate, assuming you have a valid gemspec file named `Example.gemspec`.
|
65
|
+
|
66
|
+
Without a gemspec file
|
67
|
+
----------------------
|
68
|
+
```ruby
|
69
|
+
Buildar.conf(__FILE__) do |b|
|
70
|
+
b.name = 'Example'
|
71
|
+
b.use_gemspec_file = false
|
72
|
+
b.use_version_file = false
|
73
|
+
b.use_git = false
|
74
|
+
b.publish[:rubygems] = false
|
75
|
+
|
76
|
+
b.gemspec.summary = 'Example of foo lorem ipsum'
|
77
|
+
b.gemspec.author = 'Buildar'
|
78
|
+
b.gemspec.license = 'MIT'
|
79
|
+
b.gemspec.description = 'Foo bar baz quux'
|
80
|
+
b.gemspec.files = ['Rakefile']
|
81
|
+
b.gemspec.version = 2.0
|
82
|
+
end
|
83
|
+
```
|
84
|
+
From [examples/no_gemspec_file.rb](https://github.com/rickhull/buildar/blob/master/examples/no_gemspec_file.rb)
|
85
|
+
|
86
|
+
Someone told me this breaks [Bundler](https://github.com/bundler/bundler), so maybe just use a gemspec file, k?
|
87
|
+
|
88
|
+
Dogfood
|
89
|
+
-------
|
90
|
+
Here is Buildar's [rakefile.rb](https://github.com/rickhull/buildar/blob/master/rakefile.rb):
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
require 'buildar/tasks'
|
94
|
+
require 'rake/testtask'
|
95
|
+
|
96
|
+
Buildar.conf(__FILE__) do |b|
|
97
|
+
b.name = 'buildar'
|
98
|
+
b.use_version_file = true
|
99
|
+
b.version_filename = 'VERSION'
|
100
|
+
b.use_git = true
|
101
|
+
b.publish[:rubygems] = true
|
102
|
+
end
|
103
|
+
|
104
|
+
Rake::TestTask.new :test do |t|
|
105
|
+
t.pattern = 'test/*.rb'
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
You can use it as a starting point.
|
110
|
+
|
111
|
+
Use a VERSION file
|
112
|
+
------------------
|
113
|
+
* Buildar can manage your version numbers with `b.use_version_file = true`
|
114
|
+
* The version only matters in the context of a release. For internal development, git SHAs vastly outclass version numbers.
|
115
|
+
* "The right version number" for the next release is a function of the current release version and the magnitude (or breakiness) of the change
|
116
|
+
* http://semver.org/
|
117
|
+
* Automate everything
|
118
|
+
|
119
|
+
Enable and configure a version file:
|
120
|
+
```ruby
|
121
|
+
b.use_version_file = true
|
122
|
+
b.version_filename = 'VERSION'
|
123
|
+
```
|
124
|
+
|
125
|
+
The VERSION file should look something like
|
126
|
+
```
|
127
|
+
1.2.3.4
|
128
|
+
```
|
129
|
+
|
130
|
+
Buildar will be able to `bump_major` `bump_minor` `bump_patch` and `bump_build`. This helps with a repeatable, identifiable builds: `build` depends on `bump_build` etc.
|
131
|
+
|
132
|
+
Every build bumps the build number. Since the build operates off of your potentially dirty working copy, and not some commit SHA, there is no guarantee that things haven't changed between builds, even if "nothing is supposed to have changed". Typically you'll want to let Buildar manage the build number, and you manage the major, minor, and patch numbers with:
|
133
|
+
* `release_major` - `bump_major`
|
134
|
+
* `release_minor` - `bump_minor`
|
135
|
+
* `release_patch` - `bump_patch`
|
136
|
+
|
137
|
+
To make your app or lib aware of its version via this file, simply:
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
# e.g. lib/foo.rb
|
141
|
+
#################
|
142
|
+
module Foo
|
143
|
+
# use a method, not a constant like VERSION
|
144
|
+
# if you use a constant, then you're doing an extra file read at requiretime
|
145
|
+
# and that hurts production. This method should not be called in production.
|
146
|
+
# It's here more for deployment and sysadmin purposes. Memoize as needed.
|
147
|
+
#
|
148
|
+
def self.version
|
149
|
+
file = File.expand_path('../../VERSION', __FILE__)
|
150
|
+
File.read(file).chomp
|
151
|
+
end
|
152
|
+
end
|
153
|
+
```
|
154
|
+
|
155
|
+
If you stick with the default `b.use_version_file = false` then you need to make sure to keep your gemspec's version attribute updated.
|
156
|
+
|
157
|
+
Gemspec file tricks
|
158
|
+
-------------------
|
159
|
+
I like to let Buildar manage my [VERSION](https://github.com/rickhull/buildar/blob/master/VERSION) file, and I also like to maintain my [MANIFEST.txt](https://github.com/rickhull/buildar/blob/master/MANIFEST.txt) -- the canonical list of files belonging to the project -- outside of [buildar.gemspec](https://github.com/rickhull/buildar/blob/master/buildar.gemspec).
|
160
|
+
|
161
|
+
With
|
162
|
+
```ruby
|
163
|
+
Buildar.conf(__FILE__) do |b|
|
164
|
+
b.use_gemspec_file = true
|
165
|
+
b.use_version_file = true
|
166
|
+
```
|
167
|
+
|
168
|
+
You'll need to keep your gemspec file in synch with the version_file. Here's [how Buildar does it](https://github.com/rickhull/buildar/blob/master/buildar.gemspec):
|
169
|
+
```ruby
|
170
|
+
# Gem::Specification.new do |s|
|
171
|
+
# ...
|
172
|
+
# dynamic setup
|
173
|
+
this_dir = File.expand_path('..', __FILE__)
|
174
|
+
version_file = File.join(this_dir, 'VERSION')
|
175
|
+
manifest_file = File.join(this_dir, 'MANIFEST.txt')
|
176
|
+
|
177
|
+
# dynamic assignments
|
178
|
+
s.version = File.read(version_file).chomp
|
179
|
+
s.files = File.readlines(manifest_file).map { |f| f.chomp }
|
180
|
+
```
|
181
|
+
|
182
|
+
Note, this also shows how to maintain a MANIFEST.txt file outside of your gemspec file.
|
183
|
+
|
184
|
+
Integrate with git
|
185
|
+
------------------
|
186
|
+
Enable git integration with `b.use_git = true`. This empowers `tag` and `bump`:
|
187
|
+
* `tag` is a `release` dependency. It depends on `test` git tag -a $tagname -m $message
|
188
|
+
* `bump` and friends will commit VERSION changes
|
189
|
+
|
190
|
+
Publish to rubygems.org
|
191
|
+
-----------------------
|
192
|
+
Enable `publish` to rubygems.org with `b.publish[:rubygems] = true`.
|
193
|
+
|
194
|
+
Testing it out
|
195
|
+
--------------
|
196
|
+
```shell
|
197
|
+
rake buildar # print Buildar's config / smoketest
|
198
|
+
rake version # print the Buildar's understanding of the version
|
199
|
+
rake build # build a .gem file in pkg/
|
200
|
+
rake install # build, uninstall, install
|
201
|
+
rake release # build the .gem and push it rubygems.org
|
202
|
+
```
|
203
|
+
|
204
|
+
`release` depends on `publish` which depends on `verify_publish_credentials` which will fail if you don't have `~/.gem/credentials`. In that case, sign up for an account at http://rubygems.org/ and follow the instructions to get your credentials file setup.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.0.
|
1
|
+
1.4.0.10
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0.
|
4
|
+
version: 1.4.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- buildar.gemspec
|
38
38
|
- MANIFEST.txt
|
39
39
|
- VERSION
|
40
|
+
- README.md
|
40
41
|
- rakefile.rb
|
41
42
|
- lib/buildar.rb
|
42
43
|
- lib/buildar/tasks.rb
|