libertine 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.rvmrc +2 -0
- data/Isolate +5 -0
- data/README.markdown +30 -0
- data/Rakefile +10 -0
- data/lib/libertine.rb +15 -0
- data/lib/libertine/error.rb +3 -0
- data/lib/libertine/project.rb +181 -0
- metadata +13 -6
data/.gitignore
ADDED
data/.rvmrc
ADDED
data/Isolate
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Libertine
|
2
|
+
|
3
|
+
Because there aren't enough ways to manage a RubyGem with a
|
4
|
+
Rakefile. Libertine assumes Ruby 1.8.7+, Git, GitHub, and a Unixish
|
5
|
+
operating system. Don't use this yet.
|
6
|
+
|
7
|
+
## License
|
8
|
+
|
9
|
+
Copyright 2010 John Barnette (code@jbarnette.com). Portions from Hoe,
|
10
|
+
Copyright Ryan Davis, Seattle.rb. Portions from Rakegem, Copyright Tom
|
11
|
+
Preston-Werner.
|
12
|
+
|
13
|
+
[The MIT License] Permission is hereby granted, free of charge, to any
|
14
|
+
person obtaining a copy of this software and associated documentation
|
15
|
+
files (the 'Software'), to deal in the Software without restriction,
|
16
|
+
including without limitation the rights to use, copy, modify, merge,
|
17
|
+
publish, distribute, sublicense, and/or sell copies of the Software,
|
18
|
+
and to permit persons to whom the Software is furnished to do so,
|
19
|
+
subject to the following conditions:
|
20
|
+
|
21
|
+
The above copyright notice and this permission notice shall be
|
22
|
+
included in all copies or substantial portions of the Software.
|
23
|
+
|
24
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
25
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
26
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
27
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
28
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
29
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
30
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Libertine eats its own dogfood, always using the current version of
|
2
|
+
# itself to drive this Rakefile.
|
3
|
+
|
4
|
+
$:.unshift "./lib"
|
5
|
+
|
6
|
+
begin require "libertine"; rescue LoadError; abort "Install libertine." end
|
7
|
+
|
8
|
+
Libertine do
|
9
|
+
by "John Barnette", "code@jbarnette.com"
|
10
|
+
end
|
data/lib/libertine.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "libertine/project"
|
2
|
+
|
3
|
+
require "isolate"
|
4
|
+
require "isolate/rake"
|
5
|
+
|
6
|
+
Isolate.now! :system => false
|
7
|
+
|
8
|
+
module Libertine
|
9
|
+
VERSION = "0.0.1"
|
10
|
+
end
|
11
|
+
|
12
|
+
def Libertine name = nil, &block
|
13
|
+
name ||= File.basename Dir["lib/*.rb"].first, ".rb"
|
14
|
+
Libertine::Project.new name, &block
|
15
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require "libertine/error"
|
2
|
+
require "rubygems/builder"
|
3
|
+
require "rubygems/specification"
|
4
|
+
require "rubygems/version"
|
5
|
+
|
6
|
+
Gem.configuration.verbose = false
|
7
|
+
|
8
|
+
module Libertine
|
9
|
+
class Project
|
10
|
+
attr_reader :dir
|
11
|
+
attr_reader :name
|
12
|
+
|
13
|
+
def initialize name, dir = nil, &block
|
14
|
+
@authors = []
|
15
|
+
@dir = dir || "."
|
16
|
+
@emails = []
|
17
|
+
@homepage = "http://github.com/#{ENV['USER']}/#{name}"
|
18
|
+
@includes = []
|
19
|
+
@name = name
|
20
|
+
@ruby = ">= 1.8.7"
|
21
|
+
|
22
|
+
if readme = glob("README*").first
|
23
|
+
grafs = File.read(readme).delete("\r").split(/\n\n+/).reject do |t|
|
24
|
+
/\A\s/ =~ t || /^[#-=]/ =~ t
|
25
|
+
end
|
26
|
+
|
27
|
+
@description = grafs.first.gsub /\n\s*/, " "
|
28
|
+
@summary = @description.split(".\s").first + "."
|
29
|
+
end
|
30
|
+
|
31
|
+
instance_eval(&block) if block_given?
|
32
|
+
tasks!
|
33
|
+
end
|
34
|
+
|
35
|
+
def by name, email
|
36
|
+
@authors << name
|
37
|
+
@emails << email
|
38
|
+
end
|
39
|
+
|
40
|
+
def description desc = nil
|
41
|
+
desc ? @description = desc : @description
|
42
|
+
end
|
43
|
+
|
44
|
+
def files
|
45
|
+
`git ls-files`.split.concat @includes
|
46
|
+
end
|
47
|
+
|
48
|
+
def gemfile
|
49
|
+
"tmp/#{spec.file_name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def homepage url = nil
|
53
|
+
url ? @homepage = url : @homepage
|
54
|
+
end
|
55
|
+
|
56
|
+
def glob *globs
|
57
|
+
Dir.chdir dir do
|
58
|
+
Dir[*globs].select { |f| files.include? f }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def include *files
|
63
|
+
@includes.concat files
|
64
|
+
end
|
65
|
+
|
66
|
+
def inspect
|
67
|
+
"#<Libertine::Project:#{object_id} dir: #{dir} " +
|
68
|
+
"name: #{name} version: #{version}>"
|
69
|
+
end
|
70
|
+
|
71
|
+
def ruby req = nil
|
72
|
+
req ? @ruby = req : @ruby
|
73
|
+
end
|
74
|
+
|
75
|
+
def rubygems req = nil
|
76
|
+
req ? @rubygems = req : @rubygems
|
77
|
+
end
|
78
|
+
|
79
|
+
def spec &block
|
80
|
+
@specformer = block if block_given?
|
81
|
+
|
82
|
+
Gem::Specification.new do |s|
|
83
|
+
s.authors = @authors
|
84
|
+
s.description = description
|
85
|
+
s.email = @emails
|
86
|
+
s.executables = glob("bin/*").map { |f| File.basename f }
|
87
|
+
s.files = files
|
88
|
+
s.homepage = homepage
|
89
|
+
s.name = name
|
90
|
+
s.required_ruby_version = ruby
|
91
|
+
s.rubyforge_project = name
|
92
|
+
s.summary = summary
|
93
|
+
s.version = version
|
94
|
+
|
95
|
+
if rubygems
|
96
|
+
s.required_rubygems_version = rubygems
|
97
|
+
end
|
98
|
+
|
99
|
+
Isolate.sandbox.entries.each do |entry|
|
100
|
+
if entry.environments.empty?
|
101
|
+
s.add_runtime_dependency entry.name, *entry.requirement
|
102
|
+
elsif entry.environments.include? "development"
|
103
|
+
s.add_development_dependency entry.name, *entry.requirement
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
unless s.dependencies.any? { |d| d.name == "libertine" }
|
108
|
+
s.add_development_dependency "libertine", ">= #{VERSION}"
|
109
|
+
end
|
110
|
+
|
111
|
+
@specformer[s] if @specformer
|
112
|
+
|
113
|
+
begin
|
114
|
+
s.validate
|
115
|
+
rescue Gem::InvalidSpecificationException => e
|
116
|
+
raise Libertine::Error, "Bad gemspec: #{e.message}."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def summary summ = nil
|
122
|
+
summ ? @summary = summ : @summary
|
123
|
+
end
|
124
|
+
|
125
|
+
def released?
|
126
|
+
versions.include? version
|
127
|
+
end
|
128
|
+
|
129
|
+
def tasks!
|
130
|
+
file(gemfile => files) do |t|
|
131
|
+
Gem::Builder.new(spec).build
|
132
|
+
mv spec.file_name, t.name
|
133
|
+
end
|
134
|
+
|
135
|
+
desc "Build #{gemfile}."
|
136
|
+
task "gem" => gemfile
|
137
|
+
|
138
|
+
desc "Show the current gemspec."
|
139
|
+
task("gem:spec") { puts spec.to_ruby }
|
140
|
+
|
141
|
+
desc "Release v#{version}." unless released?
|
142
|
+
task "release" => "gem" do
|
143
|
+
if released?
|
144
|
+
raise Libertine::Error, "v#{version} is already released!"
|
145
|
+
end
|
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}.'"
|
153
|
+
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
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def version
|
163
|
+
return @version if defined? @version
|
164
|
+
regexp = /VERSION += +([\"\'])([\d][\w\.]+)\1/
|
165
|
+
|
166
|
+
files.select { |f| %r%lib/.*\.rb\Z% =~ f }.each do |file|
|
167
|
+
break if @version = File.read(file)[regexp, 2]
|
168
|
+
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
|
+
end
|
180
|
+
end
|
181
|
+
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
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Barnette
|
@@ -57,8 +57,8 @@ dependencies:
|
|
57
57
|
segments:
|
58
58
|
- 0
|
59
59
|
- 0
|
60
|
-
-
|
61
|
-
version: 0.0.
|
60
|
+
- 1
|
61
|
+
version: 0.0.1
|
62
62
|
type: :development
|
63
63
|
version_requirements: *id003
|
64
64
|
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.
|
@@ -70,8 +70,15 @@ extensions: []
|
|
70
70
|
|
71
71
|
extra_rdoc_files: []
|
72
72
|
|
73
|
-
files:
|
74
|
-
|
73
|
+
files:
|
74
|
+
- .gitignore
|
75
|
+
- .rvmrc
|
76
|
+
- Isolate
|
77
|
+
- README.markdown
|
78
|
+
- Rakefile
|
79
|
+
- lib/libertine.rb
|
80
|
+
- lib/libertine/error.rb
|
81
|
+
- lib/libertine/project.rb
|
75
82
|
has_rdoc: true
|
76
83
|
homepage: http://github.com/jbarnette/libertine
|
77
84
|
licenses: []
|