rails_reset 0.0.1
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 +18 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +5 -0
- data/lib/rails_reset.rb +13 -0
- data/lib/rails_reset/version.rb +3 -0
- data/lib/tasks/rails.rake +27 -0
- data/railsreset.gemspec +25 -0
- data/spec/rails_reset_spec.rb +43 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support.rb +16 -0
- metadata +125 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Johan van Zonneveld
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# RailsReset [](http://travis-ci.org/42rockers/rails_reset)
|
2
|
+
|
3
|
+
Reset your development and test environment with one simple rake task.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'rails_reset', :group => [:development, :test]
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Instead of doing:
|
18
|
+
|
19
|
+
$ rake db:migrate:reset db:seed db:test:prepare sunspot:reindex
|
20
|
+
|
21
|
+
You can do:
|
22
|
+
|
23
|
+
$ rake rails:reset
|
24
|
+
|
25
|
+
Note: It will only reindex solr if you use sunspot
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/rails_reset.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
namespace :rails do
|
2
|
+
|
3
|
+
desc "Reset your development and test environment."
|
4
|
+
|
5
|
+
task :reset => :environment do
|
6
|
+
|
7
|
+
## Reset database, perform seeds and prepare test database
|
8
|
+
|
9
|
+
['db:migrate:reset', 'db:seed', 'db:test:prepare'].each do |cmd|
|
10
|
+
|
11
|
+
p "Invoking: rake #{cmd}"
|
12
|
+
|
13
|
+
Rake::Task[cmd].invoke
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
## Reindex solr index if Sunspot is defined
|
18
|
+
|
19
|
+
if defined?(Sunspot)
|
20
|
+
p "Invoking: sunspot:reindex"
|
21
|
+
|
22
|
+
Rake::Task['sunspot:reindex'].invoke
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/railsreset.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails_reset/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rails_reset"
|
8
|
+
gem.version = RailsReset::VERSION
|
9
|
+
gem.authors = ["Johan van Zonneveld"]
|
10
|
+
gem.email = ["johan@vzonneveld.nl"]
|
11
|
+
gem.description = %q{Simple rake task to reset your app for development/testing}
|
12
|
+
gem.summary = %q{Reset your development and test environment with one simple rake task}
|
13
|
+
gem.homepage = "https://github.com/42rockers/rails_reset"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency "bundler", ">= 1.0.0"
|
21
|
+
gem.add_development_dependency "rspec", ">= 2.3"
|
22
|
+
gem.add_dependency "rake"
|
23
|
+
|
24
|
+
gem.add_dependency 'rails', '>= 3.0'
|
25
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "rails:reset" do
|
4
|
+
include_context "rake"
|
5
|
+
|
6
|
+
DEFAULT_TASKS = ['db:migrate:reset', 'db:seed', 'db:test:prepare']
|
7
|
+
|
8
|
+
before do
|
9
|
+
DEFAULT_TASKS.each do |cmd|
|
10
|
+
Rake::Task.define_task(cmd)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
its(:prerequisites) { should include("environment") }
|
15
|
+
|
16
|
+
DEFAULT_TASKS.each do |cmd|
|
17
|
+
|
18
|
+
it "should invoke: #{cmd}" do
|
19
|
+
|
20
|
+
Rake::Task[cmd].should_receive(:invoke)
|
21
|
+
subject.invoke
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with sunspot defined' do
|
28
|
+
|
29
|
+
before do
|
30
|
+
Sunspot = mock 'Sunspot'
|
31
|
+
Rake::Task.define_task('sunspot:reindex')
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should invoke: sunspot:reindex" do
|
35
|
+
|
36
|
+
Rake::Task['sunspot:reindex'].should_receive(:invoke)
|
37
|
+
subject.invoke
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/support.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# spec/support/shared_contexts/rake.rb
|
2
|
+
require "rake"
|
3
|
+
|
4
|
+
shared_context "rake" do
|
5
|
+
let(:rake) { Rake::Application.new }
|
6
|
+
let(:task_name) { self.class.top_level_description }
|
7
|
+
let(:task_path) { "lib/tasks/#{task_name.split(":").first}" }
|
8
|
+
subject { rake[task_name] }
|
9
|
+
|
10
|
+
before do
|
11
|
+
Rake.application = rake
|
12
|
+
load "#{task_path}.rake"
|
13
|
+
|
14
|
+
Rake::Task.define_task(:environment)
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_reset
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Johan van Zonneveld
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rails
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.0'
|
78
|
+
description: Simple rake task to reset your app for development/testing
|
79
|
+
email:
|
80
|
+
- johan@vzonneveld.nl
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- .gitignore
|
86
|
+
- .travis.yml
|
87
|
+
- Gemfile
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- lib/rails_reset.rb
|
92
|
+
- lib/rails_reset/version.rb
|
93
|
+
- lib/tasks/rails.rake
|
94
|
+
- railsreset.gemspec
|
95
|
+
- spec/rails_reset_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
- spec/support.rb
|
98
|
+
homepage: https://github.com/42rockers/rails_reset
|
99
|
+
licenses: []
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.8.24
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: Reset your development and test environment with one simple rake task
|
122
|
+
test_files:
|
123
|
+
- spec/rails_reset_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/support.rb
|