dao 5.5.0 → 8.0.0
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.
- checksums.yaml +6 -14
- data/README.md +258 -0
- data/Rakefile +4 -5
- data/coerce-0.0.8/README +28 -0
- data/coerce-0.0.8/Rakefile +392 -0
- data/coerce-0.0.8/coerce.gemspec +31 -0
- data/coerce-0.0.8/lib/coerce.rb +210 -0
- data/dao.gemspec +38 -25
- data/lib/dao.rb +18 -81
- data/lib/dao/_lib.rb +42 -0
- data/lib/dao/active_record.rb +8 -8
- data/lib/dao/api/call.rb +19 -4
- data/lib/dao/api/dsl.rb +1 -1
- data/lib/dao/coerce.rb +211 -0
- data/lib/dao/conducer.rb +10 -14
- data/lib/dao/conducer/controller_support.rb +5 -0
- data/lib/dao/conducer/view_support.rb +0 -2
- data/lib/dao/db.rb +0 -1
- data/lib/dao/errors.rb +17 -11
- data/lib/dao/errors2html.rb +128 -0
- data/lib/dao/form.rb +13 -16
- data/lib/dao/messages.rb +0 -4
- data/lib/dao/path.rb +1 -1
- data/lib/dao/route.rb +2 -2
- data/lib/dao/status.rb +3 -4
- data/lib/dao/support.rb +26 -19
- data/lib/dao/upload.rb +0 -1
- data/lib/dao/validations/common.rb +6 -6
- data/lib/dao/validations/validator.rb +3 -3
- data/lib/dao/wrap.rb +259 -0
- data/tasks/default.rake +207 -0
- data/tasks/this.rb +207 -0
- data/test/active_model_conducer_lint_test.rb +3 -11
- data/test/api_test.rb +24 -35
- data/test/conducer_test.rb +37 -47
- data/test/errors_test.rb +29 -13
- data/test/form_test.rb +24 -34
- data/test/rake_rerun_reporter.rb +74 -0
- data/test/support_test.rb +9 -14
- data/test/test_helper.rb +220 -0
- data/test/{helper.rb → util.rb} +0 -0
- data/test/validations_test.rb +14 -28
- data/wrap-1.5.2/README +57 -0
- data/wrap-1.5.2/Rakefile +394 -0
- data/wrap-1.5.2/lib/wrap.rb +295 -0
- data/{test → wrap-1.5.2/test}/testing.rb +0 -1
- data/wrap-1.5.2/test/wrap_test.rb +397 -0
- data/wrap-1.5.2/wrap.gemspec +38 -0
- metadata +47 -103
- data/Gemfile +0 -16
- data/Gemfile.lock +0 -118
- data/README +0 -256
data/lib/dao/upload.rb
CHANGED
@@ -364,9 +364,9 @@ module Dao
|
|
364
364
|
options = Map.options_for!(args)
|
365
365
|
list = args + Array(options.delete(:keys)) + Array(options.delete(:or))
|
366
366
|
|
367
|
-
list.each do |
|
367
|
+
list.each do |_args|
|
368
368
|
candidates = list.dup
|
369
|
-
candidates.delete(
|
369
|
+
candidates.delete(_args)
|
370
370
|
|
371
371
|
message = options[:message] || "(or #{ candidates.map{|candidate| Array(candidate).join('.')}.join(', ') } ) is blank or missing"
|
372
372
|
allow_nil = options[:allow_nil]
|
@@ -424,7 +424,7 @@ module Dao
|
|
424
424
|
|
425
425
|
m
|
426
426
|
end
|
427
|
-
validates(*
|
427
|
+
validates(*_args, &block)
|
428
428
|
end
|
429
429
|
end
|
430
430
|
|
@@ -432,9 +432,9 @@ module Dao
|
|
432
432
|
options = Map.options_for!(args)
|
433
433
|
list = args + Array(options.delete(:keys)) + Array(options.delete(:or))
|
434
434
|
|
435
|
-
list.each do |
|
435
|
+
list.each do |_args|
|
436
436
|
candidates = list.dup
|
437
|
-
candidates.delete(
|
437
|
+
candidates.delete(_args)
|
438
438
|
|
439
439
|
message = options[:message] || "(and #{ candidates.map{|candidate| Array(candidate).join('.')}.join(', ') } ) is blank or missing"
|
440
440
|
allow_nil = options[:allow_nil]
|
@@ -492,7 +492,7 @@ module Dao
|
|
492
492
|
|
493
493
|
m
|
494
494
|
end
|
495
|
-
validates(*
|
495
|
+
validates(*_args, &block)
|
496
496
|
end
|
497
497
|
end
|
498
498
|
|
@@ -101,7 +101,7 @@ module Dao
|
|
101
101
|
block = args.pop if args.last.respond_to?(:call)
|
102
102
|
block ||= NotBlank
|
103
103
|
callback = Callback.new(options, &block)
|
104
|
-
|
104
|
+
Map.options_for!(args)
|
105
105
|
key = key_for(args)
|
106
106
|
validations = stack.validations.last || self.validations
|
107
107
|
validations[key] ||= Callback::Chain.new
|
@@ -112,7 +112,7 @@ module Dao
|
|
112
112
|
|
113
113
|
def validates_each(*args, &block)
|
114
114
|
options = Map.options_for!(args)
|
115
|
-
|
115
|
+
key_for(args)
|
116
116
|
|
117
117
|
args.push(options)
|
118
118
|
|
@@ -299,7 +299,7 @@ module Dao
|
|
299
299
|
if forcing_validity?
|
300
300
|
true
|
301
301
|
else
|
302
|
-
|
302
|
+
Map.options_for!(args)
|
303
303
|
run_validations
|
304
304
|
errors.empty? and status.ok?
|
305
305
|
end
|
data/lib/dao/wrap.rb
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
module Dao
|
2
|
+
module Wrap
|
3
|
+
def Wrap.included(other)
|
4
|
+
super
|
5
|
+
ensure
|
6
|
+
other.send(:instance_eval, &ClassMethods)
|
7
|
+
other.send(:class_eval, &InstanceMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
def Wrap.code_for(method)
|
11
|
+
name = method.name.to_s
|
12
|
+
arity = method.arity
|
13
|
+
|
14
|
+
case
|
15
|
+
when arity == 0
|
16
|
+
signature = <<-__.strip
|
17
|
+
def #{ name }(&block)
|
18
|
+
args = []
|
19
|
+
__
|
20
|
+
|
21
|
+
when arity < 0
|
22
|
+
argv = Array.new(arity.abs - 1){|i| "arg#{ i }"}
|
23
|
+
argv.push('*args')
|
24
|
+
argv = argv.join(', ')
|
25
|
+
|
26
|
+
signature = <<-__.strip
|
27
|
+
def #{ name }(#{ argv }, &block)
|
28
|
+
args = [#{ argv }]
|
29
|
+
__
|
30
|
+
|
31
|
+
when arity > 0
|
32
|
+
argv = Array.new(arity){|i| "arg#{ i }"}
|
33
|
+
argv = argv.join(', ')
|
34
|
+
|
35
|
+
signature = <<-__.strip
|
36
|
+
def #{ name }(#{ argv }, &block)
|
37
|
+
args = [#{ argv }]
|
38
|
+
__
|
39
|
+
end
|
40
|
+
|
41
|
+
code =
|
42
|
+
<<-__
|
43
|
+
#{ signature.strip }
|
44
|
+
|
45
|
+
if running_callbacks?(#{ name.inspect })
|
46
|
+
return wrapped_#{ name }(*args, &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
running_callbacks(#{ name.inspect }) do
|
50
|
+
catch(:halt) do
|
51
|
+
return false if run_callbacks(:before, #{ name.inspect }, args)==false
|
52
|
+
|
53
|
+
begin
|
54
|
+
result = wrapped_#{ name }(*args, &block)
|
55
|
+
ensure
|
56
|
+
run_callbacks(:after, #{ name.inspect }, [result]) unless $!
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
__
|
62
|
+
|
63
|
+
return code
|
64
|
+
end
|
65
|
+
|
66
|
+
ClassMethods = proc do
|
67
|
+
def method_added(name)
|
68
|
+
return super if wrapping?
|
69
|
+
begin
|
70
|
+
super
|
71
|
+
ensure
|
72
|
+
wrap!(name) if wrapped?(name)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def include(other)
|
77
|
+
super
|
78
|
+
ensure
|
79
|
+
other.instance_methods.each do |name|
|
80
|
+
if wrapped?(name)
|
81
|
+
begin
|
82
|
+
remove_method(name)
|
83
|
+
rescue NameError
|
84
|
+
nil
|
85
|
+
end
|
86
|
+
wrap!(name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def wrap(name, *args, &block)
|
92
|
+
wrapped!(name)
|
93
|
+
|
94
|
+
wrap!(name) if
|
95
|
+
begin
|
96
|
+
instance_method(name)
|
97
|
+
true
|
98
|
+
rescue NameError
|
99
|
+
false
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def wrapped!(name)
|
104
|
+
name = name.to_s
|
105
|
+
wrapped.push(name) unless wrapped.include?(name)
|
106
|
+
name
|
107
|
+
end
|
108
|
+
|
109
|
+
def wrapped
|
110
|
+
@wrapped ||= []
|
111
|
+
end
|
112
|
+
|
113
|
+
def wrapped?(name)
|
114
|
+
ancestors.any?{|ancestor| ancestor.respond_to?(:wrapped) and ancestor.wrapped.include?(name.to_s)}
|
115
|
+
end
|
116
|
+
|
117
|
+
def wrap!(name)
|
118
|
+
name = name.to_s
|
119
|
+
method = instance_method(name)
|
120
|
+
|
121
|
+
wrapping! name do
|
122
|
+
name = name.to_s
|
123
|
+
wrapped_name = "wrapped_#{ name }"
|
124
|
+
|
125
|
+
begin
|
126
|
+
remove_method(wrapped_name)
|
127
|
+
rescue NameError
|
128
|
+
nil
|
129
|
+
end
|
130
|
+
|
131
|
+
alias_method(wrapped_name, name)
|
132
|
+
|
133
|
+
module_eval(Wrap.code_for(method))
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def wrapping!(name, &block)
|
138
|
+
name = name.to_s
|
139
|
+
@wrapping ||= []
|
140
|
+
|
141
|
+
return if @wrapping.last == name
|
142
|
+
|
143
|
+
@wrapping.push(name)
|
144
|
+
|
145
|
+
begin
|
146
|
+
block.call
|
147
|
+
ensure
|
148
|
+
@wrapping.pop
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def wrapping?(*name)
|
153
|
+
@wrapping ||= []
|
154
|
+
|
155
|
+
if name.empty?
|
156
|
+
!@wrapping.empty?
|
157
|
+
else
|
158
|
+
@wrapping.last == name.last.to_s
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def callbacks
|
163
|
+
@callbacks ||= Map.new
|
164
|
+
end
|
165
|
+
|
166
|
+
def initialize_callbacks!(name)
|
167
|
+
callbacks[name] ||= Map[ :before, [], :after, [] ]
|
168
|
+
callbacks[name]
|
169
|
+
end
|
170
|
+
|
171
|
+
def before(name, *args, &block)
|
172
|
+
wrap(name) unless wrapped?(name)
|
173
|
+
name = wrap_expand_aliases(name)
|
174
|
+
cb = initialize_callbacks!(name)
|
175
|
+
cb.before.push(args.shift || block)
|
176
|
+
end
|
177
|
+
|
178
|
+
def after(name, *args, &block)
|
179
|
+
wrap(name) unless wrapped?(name)
|
180
|
+
name = wrap_expand_aliases(name)
|
181
|
+
cb = initialize_callbacks!(name)
|
182
|
+
cb.after.push(args.shift || block)
|
183
|
+
end
|
184
|
+
|
185
|
+
def wrap_aliases
|
186
|
+
@@wrap_aliases ||= Hash.new
|
187
|
+
end
|
188
|
+
|
189
|
+
def wrap_alias(dst, src)
|
190
|
+
wrap_aliases[dst.to_s] = src.to_s
|
191
|
+
end
|
192
|
+
|
193
|
+
def wrap_expand_aliases(name)
|
194
|
+
name = name.to_s
|
195
|
+
loop do
|
196
|
+
break unless wrap_aliases.has_key?(name)
|
197
|
+
name = wrap_aliases[name]
|
198
|
+
end
|
199
|
+
name
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
InstanceMethods = proc do
|
204
|
+
def running_callbacks(name, &block)
|
205
|
+
name = name.to_s
|
206
|
+
@running_callbacks ||= []
|
207
|
+
return block.call() if @running_callbacks.last == name
|
208
|
+
|
209
|
+
@running_callbacks.push(name)
|
210
|
+
|
211
|
+
begin
|
212
|
+
block.call()
|
213
|
+
ensure
|
214
|
+
@running_callbacks.pop
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def running_callbacks?(*name)
|
219
|
+
@running_callbacks ||= []
|
220
|
+
|
221
|
+
if name.empty?
|
222
|
+
@running_callbacks.last
|
223
|
+
else
|
224
|
+
@running_callbacks.last == name.last.to_s
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def run_callbacks(which, name, argv)
|
229
|
+
which = which.to_s.to_sym
|
230
|
+
name = name.to_s
|
231
|
+
list = []
|
232
|
+
|
233
|
+
self.class.ancestors.each do |ancestor|
|
234
|
+
next unless ancestor.respond_to?(:callbacks)
|
235
|
+
|
236
|
+
if ancestor.callbacks.is_a?(Map) and ancestor.callbacks[name].is_a?(Map)
|
237
|
+
callbacks = ancestor.callbacks[name][which]
|
238
|
+
accumulate = (which == :before ? :unshift : :push)
|
239
|
+
list.send(accumulate, *callbacks) if callbacks.is_a?(Array)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
list.each do |callback|
|
244
|
+
block = callback.respond_to?(:call) ? callback : proc{ send(callback.to_s.to_sym) }
|
245
|
+
args = argv.slice(0 .. (block.arity > 0 ? block.arity : -1))
|
246
|
+
result = instance_exec(*args, &block)
|
247
|
+
return false if result == false
|
248
|
+
end
|
249
|
+
|
250
|
+
true
|
251
|
+
end
|
252
|
+
|
253
|
+
def halt!(*args)
|
254
|
+
value = args.size == 0 ? false : args.shift
|
255
|
+
throw(:halt, value)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
data/tasks/default.rake
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
# vim: syntax=ruby
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'digest'
|
4
|
+
#------------------------------------------------------------------------------
|
5
|
+
# If you want to Develop on this project just run 'rake develop' and you'll
|
6
|
+
# have all you need to get going. If you want to use bundler for development,
|
7
|
+
# then run 'rake develop:using_bundler'
|
8
|
+
#------------------------------------------------------------------------------
|
9
|
+
namespace :develop do
|
10
|
+
|
11
|
+
# Install all the development and runtime dependencies of this gem using the
|
12
|
+
# gemspec.
|
13
|
+
task :default => 'Gemfile' do
|
14
|
+
require 'rubygems/dependency_installer'
|
15
|
+
installer = ::Gem::DependencyInstaller.new
|
16
|
+
puts "Installing bundler..."
|
17
|
+
installer.install 'bundler'
|
18
|
+
sh 'bundle install'
|
19
|
+
puts "\n\nNow run 'rake test'"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create a Gemfile that just references the gemspec
|
23
|
+
file 'Gemfile' => :gemspec do
|
24
|
+
File.open( "Gemfile", "w+" ) do |f|
|
25
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
26
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
27
|
+
f.puts 'source "https://rubygems.org/"'
|
28
|
+
f.puts 'gemspec'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
desc "Boostrap development"
|
33
|
+
task :develop => "develop:default"
|
34
|
+
|
35
|
+
#------------------------------------------------------------------------------
|
36
|
+
# Minitest - standard TestTask
|
37
|
+
#------------------------------------------------------------------------------
|
38
|
+
begin
|
39
|
+
require 'rake/testtask'
|
40
|
+
Rake::TestTask.new( :test ) do |t|
|
41
|
+
t.libs = %w[ lib spec test ]
|
42
|
+
t.pattern = "{test,spec}/**/{test_*,*_spec,*_test}.rb"
|
43
|
+
end
|
44
|
+
|
45
|
+
task :test_requirements
|
46
|
+
task :test => :test_requirements
|
47
|
+
task :default => :test
|
48
|
+
rescue LoadError
|
49
|
+
This.task_warning( 'test' )
|
50
|
+
end
|
51
|
+
|
52
|
+
#------------------------------------------------------------------------------
|
53
|
+
# Manifest - We want an explicit list of thos files that are to be packaged in
|
54
|
+
# the gem. Most of this is from Hoe.
|
55
|
+
#------------------------------------------------------------------------------
|
56
|
+
namespace 'manifest' do
|
57
|
+
desc "Check the manifest"
|
58
|
+
task :check => :clean do
|
59
|
+
files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
|
60
|
+
files = files.select{ |f| File.file?( f ) }
|
61
|
+
|
62
|
+
tmp = "Manifest.tmp"
|
63
|
+
File.open( tmp, 'w' ) do |f|
|
64
|
+
f.puts files.join("\n")
|
65
|
+
end
|
66
|
+
|
67
|
+
begin
|
68
|
+
sh "diff -du Manifest.txt #{tmp}"
|
69
|
+
ensure
|
70
|
+
rm tmp
|
71
|
+
end
|
72
|
+
puts "Manifest looks good"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Generate the manifest"
|
76
|
+
task :generate => :clean do
|
77
|
+
files = %x[ git ls-files ].split("\n").sort
|
78
|
+
files.reject! { |f| f =~ This.exclude_from_manifest }
|
79
|
+
File.open( "Manifest.txt", "w" ) do |f|
|
80
|
+
f.puts files.join("\n")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
#------------------------------------------------------------------------------
|
86
|
+
# Fixme - look for fixmes and report them
|
87
|
+
#------------------------------------------------------------------------------
|
88
|
+
namespace :fixme do
|
89
|
+
task :default => 'manifest:check' do
|
90
|
+
This.manifest.each do |file|
|
91
|
+
next if file == __FILE__
|
92
|
+
next unless file =~ %r/(txt|rb|md|rdoc|css|html|xml|css)\Z/
|
93
|
+
puts "FIXME: Rename #{file}" if file =~ /fixme/i
|
94
|
+
IO.readlines( file ).each_with_index do |line, idx|
|
95
|
+
prefix = "FIXME: #{file}:#{idx+1}".ljust(42)
|
96
|
+
puts "#{prefix} => #{line.strip}" if line =~ /fixme/i
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def fixme_project_root
|
102
|
+
This.project_path( '../fixme' )
|
103
|
+
end
|
104
|
+
|
105
|
+
def fixme_project_path( subtree )
|
106
|
+
fixme_project_root.join( subtree )
|
107
|
+
end
|
108
|
+
|
109
|
+
def local_fixme_files
|
110
|
+
This.manifest.select { |p| p =~ %r|^tasks/| }
|
111
|
+
end
|
112
|
+
|
113
|
+
def outdated_fixme_files
|
114
|
+
local_fixme_files.select do |local|
|
115
|
+
upstream = fixme_project_path( local )
|
116
|
+
upstream.exist? &&
|
117
|
+
( Digest::SHA256.file( local ) != Digest::SHA256.file( upstream ) )
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def fixme_up_to_date?
|
122
|
+
outdated_fixme_files.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
desc "See if the fixme tools are outdated"
|
126
|
+
task :outdated => :release_check do
|
127
|
+
if fixme_up_to_date? then
|
128
|
+
puts "Fixme files are up to date."
|
129
|
+
else
|
130
|
+
outdated_fixme_files.each do |f|
|
131
|
+
puts "#{f} is outdated"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "Update outdated fixme files"
|
137
|
+
task :update => :release_check do
|
138
|
+
if fixme_up_to_date? then
|
139
|
+
puts "Fixme files are already up to date."
|
140
|
+
else
|
141
|
+
puts "Updating fixme files:"
|
142
|
+
outdated_fixme_files.each do |local|
|
143
|
+
upstream = fixme_project_path( local )
|
144
|
+
puts " * #{local}"
|
145
|
+
FileUtils.cp( upstream, local )
|
146
|
+
end
|
147
|
+
puts "Use your git commands as appropriate."
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
desc "Look for fixmes and report them"
|
152
|
+
task :fixme => "fixme:default"
|
153
|
+
|
154
|
+
#------------------------------------------------------------------------------
|
155
|
+
# Gem Specification
|
156
|
+
#------------------------------------------------------------------------------
|
157
|
+
# Really this is only here to support those who use bundler
|
158
|
+
desc "Build the #{This.name}.gemspec file"
|
159
|
+
task :gemspec do
|
160
|
+
File.open( This.gemspec_file, "wb+" ) do |f|
|
161
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
162
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
163
|
+
f.write This.platform_gemspec.to_ruby
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# .rbc files from ruby 2.0
|
168
|
+
CLOBBER << FileList["**/*.rbc"]
|
169
|
+
|
170
|
+
# The standard gem packaging task, everyone has it.
|
171
|
+
require 'rubygems/package_task'
|
172
|
+
::Gem::PackageTask.new( This.platform_gemspec ) do
|
173
|
+
# nothing
|
174
|
+
end
|
175
|
+
|
176
|
+
#------------------------------------------------------------------------------
|
177
|
+
# Release - the steps we go through to do a final release, this is pulled from
|
178
|
+
# a compbination of mojombo's rakegem, hoe and hoe-git
|
179
|
+
#
|
180
|
+
# 1) make sure we are on the master branch
|
181
|
+
# 2) make sure there are no uncommitted items
|
182
|
+
# 3) check the manifest and make sure all looks good
|
183
|
+
# 4) build the gem
|
184
|
+
# 5) do an empty commit to have the commit message of the version
|
185
|
+
# 6) tag that commit as the version
|
186
|
+
# 7) push master
|
187
|
+
# 8) push the tag
|
188
|
+
# 7) pus the gem
|
189
|
+
#------------------------------------------------------------------------------
|
190
|
+
task :release_check do
|
191
|
+
unless `git branch` =~ /^\* master$/
|
192
|
+
abort "You must be on the master branch to release!"
|
193
|
+
end
|
194
|
+
unless `git status` =~ /^nothing to commit/m
|
195
|
+
abort "Nope, sorry, you have unfinished business"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_name} to rubygems.org"
|
200
|
+
task :release => [ :release_check, 'manifest:check', :gem ] do
|
201
|
+
sh "git commit --allow-empty -a -m 'Release #{This.version}'"
|
202
|
+
sh "git tag -a -m 'v#{This.version}' v#{This.version}"
|
203
|
+
sh "git push origin master"
|
204
|
+
sh "git push origin v#{This.version}"
|
205
|
+
sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
|
206
|
+
end
|
207
|
+
|