bard-rake 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -0
- data/VERSION +1 -1
- data/bard-rake.gemspec +4 -1
- data/lib/bard/rake.rb +3 -61
- data/lib/bard/rake/bootstrap.rb +36 -0
- data/lib/bard/rake/bundler.rb +16 -0
- data/lib/bard/rake/db.rb +24 -0
- metadata +5 -2
data/Rakefile
CHANGED
@@ -20,6 +20,12 @@ rescue LoadError
|
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
21
|
end
|
22
22
|
|
23
|
+
task :release do
|
24
|
+
system "git push"
|
25
|
+
system "git push github"
|
26
|
+
Rake::Task["gemcutter:release"].invoke
|
27
|
+
end
|
28
|
+
|
23
29
|
require 'spec/rake/spectask'
|
24
30
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
31
|
spec.libs << 'lib' << 'spec'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bard-rake.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bard-rake}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Micah Geisel"]
|
@@ -27,6 +27,9 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"bard-rake.gemspec",
|
29
29
|
"lib/bard/rake.rb",
|
30
|
+
"lib/bard/rake/bootstrap.rb",
|
31
|
+
"lib/bard/rake/bundler.rb",
|
32
|
+
"lib/bard/rake/db.rb",
|
30
33
|
"spec/bard-rake_spec.rb",
|
31
34
|
"spec/spec.opts",
|
32
35
|
"spec/spec_helper.rb"
|
data/lib/bard/rake.rb
CHANGED
@@ -1,61 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
end
|
5
|
-
|
6
|
-
namespace :db do
|
7
|
-
desc "Dump the current database to db/data.sql"
|
8
|
-
task :dump => :"backup:db" do
|
9
|
-
config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
|
10
|
-
db_file = Dir.glob("../#{config['database'].gsub(/_/, '-')}-*.sql").first
|
11
|
-
FileUtils.move db_file, "db/data.sql"
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Load the db/data.sql data into the current database."
|
15
|
-
task :load => :environment do
|
16
|
-
config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
|
17
|
-
Rake::Task["db:drop"].invoke
|
18
|
-
Rake::Task["db:create"].invoke
|
19
|
-
mysql = `which mysql`.strip
|
20
|
-
options = " -u#{config['username']}"
|
21
|
-
options += " -p#{config['password']}" if config['password']
|
22
|
-
options += " -h #{config['host']}" if config['host']
|
23
|
-
|
24
|
-
raise RuntimeError, "I only work with mysql." unless config['adapter'] == 'mysql'
|
25
|
-
raise RuntimeError, "Cannot find mysql." if mysql.blank?
|
26
|
-
|
27
|
-
sh "#{mysql} #{options} '#{config["database"]}' < db/data.sql"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "Bootstrap project"
|
32
|
-
task :bootstrap => %w(bootstrap:files gems:install db:create db:migrate restart)
|
33
|
-
|
34
|
-
namespace :bootstrap do
|
35
|
-
desc "Bootstrap project to run tests"
|
36
|
-
task :test => :bootstrap do
|
37
|
-
system "rake gems:install db:create db:schema:load RAILS_ENV=test"
|
38
|
-
system "rake gems:install RAILS_ENV=cucumber"
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "Bootstrap project to run in production"
|
42
|
-
task :production => :bootstrap do
|
43
|
-
if File.exist?("public/stylesheets/sass") or File.exist?("app/sass")
|
44
|
-
Sass::Plugin.options[:always_update] = true;
|
45
|
-
Sass::Plugin.update_stylesheets
|
46
|
-
end
|
47
|
-
Rake::Task["asset:packager:build_all"].invoke if File.exist?("vendor/plugins/asset_packager")
|
48
|
-
end
|
49
|
-
|
50
|
-
task :files do
|
51
|
-
system "git submodule sync"
|
52
|
-
system "git submodule init"
|
53
|
-
system "git submodule update --merge"
|
54
|
-
system "git submodule foreach 'git checkout `git name-rev --name-only HEAD`'"
|
55
|
-
system "cp config/database.sample.yml config/database.yml" unless File.exist?('config/database.yml')
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
Rake::Task[:default].clear
|
60
|
-
desc "Bootstrap the current project and run the tests."
|
61
|
-
task :default => ["bootstrap:test", :spec, :cucumber]
|
1
|
+
require 'bard/rake/bundler'
|
2
|
+
require 'bard/rake/db'
|
3
|
+
require 'bard/rake/bootstrap'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
task :restart do
|
2
|
+
system "touch tmp/restart.txt"
|
3
|
+
system "touch tmp/debug.txt" if ENV["DEBUG"] == 'true'
|
4
|
+
end
|
5
|
+
|
6
|
+
desc "Bootstrap project"
|
7
|
+
task :bootstrap => %w(bootstrap:files gems:install db:create db:migrate restart)
|
8
|
+
|
9
|
+
namespace :bootstrap do
|
10
|
+
desc "Bootstrap project to run tests"
|
11
|
+
task :test => :bootstrap do
|
12
|
+
system "rake gems:install db:create db:schema:load RAILS_ENV=test"
|
13
|
+
system "rake gems:install RAILS_ENV=cucumber"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Bootstrap project to run in production"
|
17
|
+
task :production => :bootstrap do
|
18
|
+
if File.exist?("public/stylesheets/sass") or File.exist?("app/sass")
|
19
|
+
Sass::Plugin.options[:always_update] = true;
|
20
|
+
Sass::Plugin.update_stylesheets
|
21
|
+
end
|
22
|
+
Rake::Task["asset:packager:build_all"].invoke if File.exist?("vendor/plugins/asset_packager")
|
23
|
+
end
|
24
|
+
|
25
|
+
task :files do
|
26
|
+
system "git submodule sync"
|
27
|
+
system "git submodule init"
|
28
|
+
system "git submodule update --merge"
|
29
|
+
system "git submodule foreach 'git checkout `git name-rev --name-only HEAD`'"
|
30
|
+
system "cp config/database.sample.yml config/database.yml" unless File.exist?('config/database.yml')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Rake::Task[:default].clear
|
35
|
+
desc "Bootstrap the current project and run the tests."
|
36
|
+
task :default => ["bootstrap:test", :spec, :cucumber]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# replace rails 2.3's gems tasks with bundler-aware versions
|
2
|
+
if File.exist? "Gemfile"
|
3
|
+
Rake::Task[:gems].clear
|
4
|
+
desc "Asks bundler for the status of the gem dependencies."
|
5
|
+
task :gems do
|
6
|
+
system "bundle show"
|
7
|
+
end
|
8
|
+
|
9
|
+
Rake::Task[:"gems:install"].clear
|
10
|
+
namespace :gems do
|
11
|
+
desc "Invoke bundle install if the dependencies aren't satisfied."
|
12
|
+
task :install do
|
13
|
+
system "bundle install" unless system "bundle check"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/bard/rake/db.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :db do
|
2
|
+
desc "Dump the current database to db/data.sql"
|
3
|
+
task :dump => :"backup:db" do
|
4
|
+
config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
|
5
|
+
db_file = Dir.glob("../#{config['database'].gsub(/_/, '-')}-*.sql").first
|
6
|
+
FileUtils.move db_file, "db/data.sql"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Load the db/data.sql data into the current database."
|
10
|
+
task :load => :environment do
|
11
|
+
config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
|
12
|
+
Rake::Task["db:drop"].invoke
|
13
|
+
Rake::Task["db:create"].invoke
|
14
|
+
mysql = `which mysql`.strip
|
15
|
+
options = " -u#{config['username']}"
|
16
|
+
options += " -p#{config['password']}" if config['password']
|
17
|
+
options += " -h #{config['host']}" if config['host']
|
18
|
+
|
19
|
+
raise RuntimeError, "I only work with mysql." unless config['adapter'] == 'mysql'
|
20
|
+
raise RuntimeError, "Cannot find mysql." if mysql.blank?
|
21
|
+
|
22
|
+
sh "#{mysql} #{options} '#{config["database"]}' < db/data.sql"
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Micah Geisel
|
@@ -52,6 +52,9 @@ files:
|
|
52
52
|
- VERSION
|
53
53
|
- bard-rake.gemspec
|
54
54
|
- lib/bard/rake.rb
|
55
|
+
- lib/bard/rake/bootstrap.rb
|
56
|
+
- lib/bard/rake/bundler.rb
|
57
|
+
- lib/bard/rake/db.rb
|
55
58
|
- spec/bard-rake_spec.rb
|
56
59
|
- spec/spec.opts
|
57
60
|
- spec/spec_helper.rb
|