libertine 0.0.1 → 0.0.2
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.
- data/.gitignore +2 -1
- data/Rakefile +2 -2
- data/lib/libertine.rb +1 -1
- data/lib/libertine/project.rb +41 -49
- data/lib/libertine/scm.rb +50 -0
- data/lib/libertine/scm/git.rb +38 -0
- metadata +6 -18
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/lib/libertine.rb
CHANGED
data/lib/libertine/project.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "libertine/error"
|
2
|
+
require "libertine/scm/git"
|
2
3
|
require "rubygems/builder"
|
3
4
|
require "rubygems/specification"
|
4
|
-
require "rubygems/version"
|
5
5
|
|
6
6
|
Gem.configuration.verbose = false
|
7
7
|
|
@@ -9,15 +9,18 @@ module Libertine
|
|
9
9
|
class Project
|
10
10
|
attr_reader :dir
|
11
11
|
attr_reader :name
|
12
|
+
attr_reader :scm
|
12
13
|
|
13
14
|
def initialize name, dir = nil, &block
|
14
15
|
@authors = []
|
15
16
|
@dir = dir || "."
|
16
17
|
@emails = []
|
18
|
+
@excludes = []
|
17
19
|
@homepage = "http://github.com/#{ENV['USER']}/#{name}"
|
18
|
-
@includes =
|
20
|
+
@includes = %w(.manifest)
|
19
21
|
@name = name
|
20
22
|
@ruby = ">= 1.8.7"
|
23
|
+
@scm = Libertine::SCM::Git.new @dir
|
21
24
|
|
22
25
|
if readme = glob("README*").first
|
23
26
|
grafs = File.read(readme).delete("\r").split(/\n\n+/).reject do |t|
|
@@ -41,26 +44,41 @@ module Libertine
|
|
41
44
|
desc ? @description = desc : @description
|
42
45
|
end
|
43
46
|
|
47
|
+
def exclude *globs
|
48
|
+
@excludes.concat globs
|
49
|
+
end
|
50
|
+
|
44
51
|
def files
|
45
|
-
|
52
|
+
Dir.chdir dir do
|
53
|
+
scm.files.tap do |ls|
|
54
|
+
includes = @includes.map { |i| Dir[i] }.flatten
|
55
|
+
excludes = @excludes.map { |x| Dir[x] }.flatten
|
56
|
+
|
57
|
+
ls.concat includes
|
58
|
+
ls.reject! { |f| excludes.include? f }
|
59
|
+
|
60
|
+
ls.uniq!
|
61
|
+
ls.sort!
|
62
|
+
end
|
63
|
+
end
|
46
64
|
end
|
47
65
|
|
48
66
|
def gemfile
|
49
67
|
"tmp/#{spec.file_name}"
|
50
68
|
end
|
51
69
|
|
52
|
-
def homepage url = nil
|
53
|
-
url ? @homepage = url : @homepage
|
54
|
-
end
|
55
|
-
|
56
70
|
def glob *globs
|
57
71
|
Dir.chdir dir do
|
58
72
|
Dir[*globs].select { |f| files.include? f }
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
62
|
-
def
|
63
|
-
@
|
76
|
+
def homepage url = nil
|
77
|
+
url ? @homepage = url : @homepage
|
78
|
+
end
|
79
|
+
|
80
|
+
def include *globs
|
81
|
+
@includes.concat globs
|
64
82
|
end
|
65
83
|
|
66
84
|
def inspect
|
@@ -90,7 +108,7 @@ module Libertine
|
|
90
108
|
s.required_ruby_version = ruby
|
91
109
|
s.rubyforge_project = name
|
92
110
|
s.summary = summary
|
93
|
-
s.version = version
|
111
|
+
s.version = scm.version
|
94
112
|
|
95
113
|
if rubygems
|
96
114
|
s.required_rubygems_version = rubygems
|
@@ -104,7 +122,8 @@ module Libertine
|
|
104
122
|
end
|
105
123
|
end
|
106
124
|
|
107
|
-
unless
|
125
|
+
unless name == "libertine" ||
|
126
|
+
s.dependencies.any? { |d| d.name == "libertine" }
|
108
127
|
s.add_development_dependency "libertine", ">= #{VERSION}"
|
109
128
|
end
|
110
129
|
|
@@ -122,10 +141,6 @@ module Libertine
|
|
122
141
|
summ ? @summary = summ : @summary
|
123
142
|
end
|
124
143
|
|
125
|
-
def released?
|
126
|
-
versions.include? version
|
127
|
-
end
|
128
|
-
|
129
144
|
def tasks!
|
130
145
|
file(gemfile => files) do |t|
|
131
146
|
Gem::Builder.new(spec).build
|
@@ -138,44 +153,21 @@ module Libertine
|
|
138
153
|
desc "Show the current gemspec."
|
139
154
|
task("gem:spec") { puts spec.to_ruby }
|
140
155
|
|
141
|
-
desc "
|
142
|
-
task "
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
unless /^\* master$/ =~ `git branch`
|
148
|
-
raise Libertine::Error, "Only release from the master branch!"
|
149
|
-
end
|
150
|
-
|
151
|
-
unless `git status -s`.empty?
|
152
|
-
sh "git commit --allow-empty -am 'Release v#{version}.'"
|
156
|
+
desc "Show the file manifest."
|
157
|
+
task "manifest" do
|
158
|
+
files.join("\n").tap do |manifest|
|
159
|
+
File.open(".manifest", "wb") { |f| f.write manifest }
|
160
|
+
puts manifest
|
153
161
|
end
|
154
|
-
|
155
|
-
sh "git tag v#{version}"
|
156
|
-
sh "git push origin master"
|
157
|
-
sh "git push origin v#{version}"
|
158
|
-
sh "gem push #{gemfile}"
|
159
162
|
end
|
160
|
-
end
|
161
163
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
164
|
+
if scm.releaseable?
|
165
|
+
desc "Release v#{scm.version}." unless scm.released?
|
166
|
+
task "release" => "gem" do
|
167
|
+
scm.release
|
168
|
+
sh "gem push #{gemfile}"
|
169
|
+
end
|
168
170
|
end
|
169
|
-
|
170
|
-
@version or raise Libertine::Error,
|
171
|
-
"Can't find VERSION in lib/*.rb. Add it."
|
172
|
-
end
|
173
|
-
|
174
|
-
def versions
|
175
|
-
`git tag -l 'v*'`.split("\n").
|
176
|
-
select { |t| /^v\d/ =~ t }.
|
177
|
-
map { |t| t[1..-1] }.
|
178
|
-
sort_by { |v| Gem::Version.new v }
|
179
171
|
end
|
180
172
|
end
|
181
173
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "libertine/error"
|
2
|
+
require "rubygems/version"
|
3
|
+
|
4
|
+
module Libertine
|
5
|
+
class SCM < Struct.new(:dir)
|
6
|
+
def files # FIX: includes & excludes here instead?
|
7
|
+
implement :files, []
|
8
|
+
end
|
9
|
+
|
10
|
+
def implement method, default = nil
|
11
|
+
$stderr.puts "#{self.class.name}##{method} isn't implemented!"
|
12
|
+
default
|
13
|
+
end
|
14
|
+
|
15
|
+
def release
|
16
|
+
if released? version
|
17
|
+
raise Libertine::Error, "v#{version} is already released!"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def released? version = nil
|
22
|
+
versions.include? version || self.version
|
23
|
+
end
|
24
|
+
|
25
|
+
def releaseable?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def tags
|
30
|
+
implement :tags, []
|
31
|
+
end
|
32
|
+
|
33
|
+
def version
|
34
|
+
return @version if defined? @version
|
35
|
+
regexp = /VERSION += +([\"\'])([\d][\w\.]+)\1/
|
36
|
+
|
37
|
+
files.select { |f| %r%lib/.*\.rb\Z% =~ f }.each do |file|
|
38
|
+
break if @version = File.read(file)[regexp, 2]
|
39
|
+
end
|
40
|
+
|
41
|
+
@version or raise Libertine::Error,
|
42
|
+
"Can't find VERSION in lib/*.rb. Add it."
|
43
|
+
end
|
44
|
+
|
45
|
+
def versions
|
46
|
+
tags.select { |t| /\Av#{Gem::Version::VERSION_PATTERN}\Z/ =~ t }.
|
47
|
+
map { |t| t[1..-1] }.sort_by { |v| Gem::Version.new v }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "libertine/error"
|
2
|
+
require "libertine/scm"
|
3
|
+
|
4
|
+
module Libertine
|
5
|
+
class SCM
|
6
|
+
class Git < Libertine::SCM
|
7
|
+
def files
|
8
|
+
Dir.chdir(dir) { `git ls-files`.split }
|
9
|
+
end
|
10
|
+
|
11
|
+
def release
|
12
|
+
super
|
13
|
+
|
14
|
+
Dir.chdir dir do
|
15
|
+
unless /^\* master$/ =~ `git branch`
|
16
|
+
raise Libertine::Error, "Only release from the master branch!"
|
17
|
+
end
|
18
|
+
|
19
|
+
unless `git status -s`.empty?
|
20
|
+
sh "git commit --allow-empty -am 'Release v#{version}.'"
|
21
|
+
end
|
22
|
+
|
23
|
+
sh "git tag v#{version}"
|
24
|
+
sh "git push origin master"
|
25
|
+
sh "git push origin v#{version}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def releaseable?
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
33
|
+
def tags
|
34
|
+
Dir.chdir(dir) { `git tag -l 'v*'`.split }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Barnette
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-20 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -46,21 +46,6 @@ dependencies:
|
|
46
46
|
version: 1.7.2
|
47
47
|
type: :development
|
48
48
|
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: libertine
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
- 0
|
60
|
-
- 1
|
61
|
-
version: 0.0.1
|
62
|
-
type: :development
|
63
|
-
version_requirements: *id003
|
64
49
|
description: Because there aren't enough ways to manage a RubyGem with a Rakefile. Libertine assumes Ruby 1.8.7+, Git, GitHub, and a Unixish operating system. Don't use this yet.
|
65
50
|
email:
|
66
51
|
- code@jbarnette.com
|
@@ -72,6 +57,7 @@ extra_rdoc_files: []
|
|
72
57
|
|
73
58
|
files:
|
74
59
|
- .gitignore
|
60
|
+
- .manifest
|
75
61
|
- .rvmrc
|
76
62
|
- Isolate
|
77
63
|
- README.markdown
|
@@ -79,6 +65,8 @@ files:
|
|
79
65
|
- lib/libertine.rb
|
80
66
|
- lib/libertine/error.rb
|
81
67
|
- lib/libertine/project.rb
|
68
|
+
- lib/libertine/scm.rb
|
69
|
+
- lib/libertine/scm/git.rb
|
82
70
|
has_rdoc: true
|
83
71
|
homepage: http://github.com/jbarnette/libertine
|
84
72
|
licenses: []
|