rake-confirm 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.pattern = 'spec/**/*_spec.rb'
7
+ end
8
+
9
+ task :default => [:spec]
@@ -5,7 +5,7 @@ task :confirm do
5
5
  abort if ask.downcase != Rails.root.basename.to_s
6
6
  end
7
7
 
8
- %w(db:drop db:migrate db:schema:load db:seed db:setup).each do |name|
8
+ %w(db:drop db:fixtures:load db:rollback db:migrate db:schema:load db:seed db:setup).each do |name|
9
9
  Rake::Task[name].enhance([:confirm])
10
10
  end
11
11
 
@@ -1,5 +1,5 @@
1
1
  module Rake
2
2
  module Confirm
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -14,4 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "rake-confirm"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Rake::Confirm::VERSION
17
+
18
+ gem.add_dependency 'rake', ['>= 0']
19
+ gem.add_development_dependency 'rspec', ['>= 0']
17
20
  end
@@ -0,0 +1,46 @@
1
+ require 'rake'
2
+
3
+ describe "Rake::Confirm" do
4
+ describe "confirm" do
5
+ # TODO: not DRY, but I don't know how to share variables with rspec DSL in/out context
6
+ @confirmed_tasks = %w(db:drop db:fixtures:load db:rollback db:migrate db:schema:load db:seed db:setup)
7
+ let(:confirmed_tasks){ %w(db:drop db:fixtures:load db:rollback db:migrate db:schema:load db:seed db:setup) }
8
+
9
+ @not_confirmed_tasks = %w(db:create db:migrate:status db:schema:dump db:structure:dump db:version)
10
+ let(:not_confirmed_tasks){ %w(db:create db:migrate:status db:schema:dump db:structure:dump db:version) }
11
+
12
+ before(:each) do
13
+ # stub for rake/confirm.rb
14
+ module Rails
15
+ class Railtie
16
+ ::Rails::Railtie.stub!(:rake_tasks)
17
+ end
18
+ end
19
+
20
+ # # inject dummy tasks
21
+ confirmed_tasks.each do |t|
22
+ Rake::Task.define_task(t)
23
+ end
24
+
25
+ not_confirmed_tasks.each do |t|
26
+ Rake::Task.define_task(t)
27
+ end
28
+
29
+ # delayed loading because 'task' is evaluated before stubbing
30
+ require 'rake-confirm'
31
+ load File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'rake', 'confirm', 'tasks', 'confirm.rake'))
32
+ end
33
+
34
+ @confirmed_tasks.each do |t|
35
+ it "should make #{t} with confirmation" do
36
+ Rake::Task[t].prerequisites.should include(:confirm)
37
+ end
38
+ end
39
+
40
+ @not_confirmed_tasks.each do |t|
41
+ it "should not make #{t} with confirmation" do
42
+ Rake::Task[t].prerequisites.should_not include(:confirm)
43
+ end
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,23 +1,60 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rake-confirm
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - SHIBATA Hiroshi
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-05-10 00:00:00.000000000 Z
13
- dependencies: []
17
+
18
+ date: 2012-05-11 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ requirement: *id001
32
+ name: rake
33
+ type: :runtime
34
+ - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ requirement: *id002
46
+ name: rspec
47
+ type: :development
14
48
  description: Confirmation for destructive Rails task.
15
- email:
49
+ email:
16
50
  - shibata.hiroshi@gmail.com
17
51
  executables: []
52
+
18
53
  extensions: []
54
+
19
55
  extra_rdoc_files: []
20
- files:
56
+
57
+ files:
21
58
  - .gitignore
22
59
  - Gemfile
23
60
  - LICENSE
@@ -28,28 +65,39 @@ files:
28
65
  - lib/rake/confirm/tasks/confirm.rake
29
66
  - lib/rake/confirm/version.rb
30
67
  - rake-confirm.gemspec
68
+ - spec/rake_confirm_spec.rb
31
69
  homepage: https://github.com/hsbt/rake-confirm
32
70
  licenses: []
71
+
33
72
  post_install_message:
34
73
  rdoc_options: []
35
- require_paths:
74
+
75
+ require_paths:
36
76
  - lib
37
- required_ruby_version: !ruby/object:Gem::Requirement
77
+ required_ruby_version: !ruby/object:Gem::Requirement
38
78
  none: false
39
- requirements:
40
- - - ! '>='
41
- - !ruby/object:Gem::Version
42
- version: '0'
43
- required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
87
  none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: '0'
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
49
95
  requirements: []
96
+
50
97
  rubyforge_project:
51
- rubygems_version: 1.8.24
98
+ rubygems_version: 1.8.15
52
99
  signing_key:
53
100
  specification_version: 3
54
101
  summary: Confirmation for destructive Rails task.
55
- test_files: []
102
+ test_files:
103
+ - spec/rake_confirm_spec.rb