bard 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bard.gemspec +2 -2
- data/features/step_definitions/submodule_steps.rb +2 -3
- data/features/support/env.rb +12 -3
- data/lib/bard.rb +8 -26
- data/lib/bard/capistrano.rb +5 -12
- data/lib/bard/check.rb +16 -6
- data/lib/bard/rake.rb +32 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.10
|
data/bard.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bard}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.10"
|
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", "Nick Hogle"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-28}
|
13
13
|
s.default_executable = %q{bard}
|
14
14
|
s.description = %q{This immaculate work of engineering genius allows mere mortals to collaborate with beings of transcendent intelligence like Micah, Michael, and Nick.}
|
15
15
|
s.email = %q{info@botandrose.com}
|
@@ -23,10 +23,9 @@ end
|
|
23
23
|
|
24
24
|
Given /^a commit with a new submodule$/ do
|
25
25
|
type "git submodule add #{ROOT}/tmp/submodule_a.git submodule"
|
26
|
-
type "git submodule init"
|
27
|
-
type "git submodule update --merge"
|
26
|
+
type "git submodule update --init"
|
28
27
|
Dir.chdir "submodule" do
|
29
|
-
type "git checkout
|
28
|
+
type "git checkout master"
|
30
29
|
end
|
31
30
|
type "git add ."
|
32
31
|
type "git commit -m 'added submodule'"
|
data/features/support/env.rb
CHANGED
@@ -13,10 +13,19 @@ ENV["GIT_INDEX_FILE"] = nil
|
|
13
13
|
ROOT = File.expand_path(File.dirname(__FILE__) + '/../..')
|
14
14
|
|
15
15
|
# setup fixtures
|
16
|
-
|
17
|
-
FileUtils.
|
16
|
+
if File.exist?("/dev/shm")
|
17
|
+
FileUtils.rm_rf "tmp"
|
18
|
+
tmp_dir = "/dev/shm/bard_testing_tmp"
|
19
|
+
FileUtils.rm_rf tmp_dir
|
20
|
+
FileUtils.mkdir tmp_dir
|
21
|
+
`ln -s #{tmp_dir} tmp`
|
22
|
+
else
|
23
|
+
FileUtils.rm_rf "tmp"
|
24
|
+
FileUtils.mkdir "tmp"
|
25
|
+
end
|
26
|
+
|
18
27
|
Dir.chdir 'tmp' do
|
19
|
-
`git clone --mirror --recursive
|
28
|
+
`git clone --mirror --recursive #{ROOT}/fixtures/repo origin.git`
|
20
29
|
|
21
30
|
`git clone --bare --recursive origin.git submodule_a.git`
|
22
31
|
`git clone --bare --recursive origin.git submodule_b.git`
|
data/lib/bard.rb
CHANGED
@@ -20,26 +20,27 @@ class Bard < Thor
|
|
20
20
|
|
21
21
|
VERSION = File.read(File.expand_path(File.dirname(__FILE__) + "../../VERSION")).chomp
|
22
22
|
|
23
|
-
method_options %w( verbose -v ) => :boolean
|
24
|
-
|
25
23
|
desc "create [PROJECT_NAME]", "create new project"
|
26
24
|
def create(project_name)
|
25
|
+
auto_update!
|
27
26
|
check_dependencies
|
28
27
|
template_path = File.expand_path(File.dirname(__FILE__) + "/bard/template.rb")
|
29
28
|
command = "rails --template=#{template_path} #{project_name}"
|
30
29
|
exec command
|
31
30
|
end
|
32
31
|
|
32
|
+
method_options %w( verbose -v ) => :boolean
|
33
33
|
desc "check [PROJECT_PATH]", "check current project and environment for missing dependencies and common problems"
|
34
34
|
def check(project_path = nil)
|
35
35
|
project_path = "." if project_path.nil? and File.directory? ".git" and File.exist? "config/environment.rb"
|
36
|
+
auto_update!
|
36
37
|
check_dependencies
|
37
38
|
check_project project_path if project_path
|
38
39
|
end
|
39
40
|
|
40
41
|
desc "data", "copy production database down to your local machine"
|
41
42
|
def data
|
42
|
-
|
43
|
+
ensure_sanity!
|
43
44
|
exec "cap data:pull"
|
44
45
|
end
|
45
46
|
|
@@ -50,8 +51,7 @@ class Bard < Thor
|
|
50
51
|
warn NonFastForwardError unless fast_forward_merge?
|
51
52
|
|
52
53
|
run_crucial "git pull --rebase origin integration"
|
53
|
-
|
54
|
-
prepare_environment changed_files(@common_ancestor, "origin/integration")
|
54
|
+
run_crucial "rake bootstrap:test"
|
55
55
|
end
|
56
56
|
|
57
57
|
desc "push", "push local changes out to the remote"
|
@@ -100,37 +100,19 @@ class Bard < Thor
|
|
100
100
|
|
101
101
|
desc "stage", "!!! INTERNAL USE ONLY !!! reset HEAD to integration, update submodules, run migrations, install gems, restart server"
|
102
102
|
def stage
|
103
|
-
|
103
|
+
ensure_sanity!
|
104
104
|
|
105
|
-
ENV['RAILS_ENV'] = "staging"
|
106
105
|
run_crucial "git fetch"
|
107
106
|
run_crucial "git reset --hard origin/integration"
|
108
|
-
|
107
|
+
run_crucial "rake bootstrap RAILS_ENV=staging"
|
109
108
|
end
|
110
109
|
|
111
110
|
private
|
112
111
|
def ensure_sanity!
|
112
|
+
auto_update!
|
113
113
|
check_dependencies
|
114
114
|
raise NotInProjectRootError unless File.directory? ".git"
|
115
115
|
raise NotOnIntegrationError unless current_branch == "integration"
|
116
116
|
raise WorkingTreeDirtyError unless `git status`.include? "working directory clean"
|
117
117
|
end
|
118
|
-
|
119
|
-
def prepare_environment(changed_files = nil)
|
120
|
-
if changed_files.nil? or changed_files.any? { |f| f =~ %r(^config/environment.+) }
|
121
|
-
run_crucial "rake gems:install"
|
122
|
-
end
|
123
|
-
|
124
|
-
if changed_files.nil? or changed_files.any? { |f| f =~ %r(^db/migrate/.+) }
|
125
|
-
run_crucial "rake db:migrate"
|
126
|
-
run_crucial "rake db:migrate RAILS_ENV=test" unless ENV['RAILS_ENV'] == 'staging'
|
127
|
-
end
|
128
|
-
|
129
|
-
run_crucial "git submodule sync"
|
130
|
-
run_crucial "git submodule init"
|
131
|
-
run_crucial "git submodule update --merge"
|
132
|
-
run_crucial "git submodule foreach 'git checkout `git name-rev --name-only HEAD`'"
|
133
|
-
|
134
|
-
system "touch tmp/restart.txt"
|
135
|
-
end
|
136
118
|
end
|
data/lib/bard/capistrano.rb
CHANGED
@@ -26,17 +26,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
26
26
|
# system "rm db/data.sql"
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
run "cd #{application} && rake gems:install" if File.exist?("Rakefile")
|
35
|
-
run "cd #{application} && script/runner 'Sass::Plugin.options[:always_update] = true; Sass::Plugin.update_stylesheets'" if File.exist?("public/stylesheets/sass") or File.exist?("app/sass")
|
36
|
-
run "cd #{application} && rake asset:packager:build_all" if File.exist?("vendor/plugins/asset_packager")
|
37
|
-
run "cd #{application} && git submodule init && git submodule update" if File.exist?(".gitmodules")
|
38
|
-
run "cd #{application} && rake db:migrate && rake restart" if File.exist?("Rakefile")
|
39
|
-
puts "Deploy Succeeded"
|
40
|
-
end
|
29
|
+
desc "push app from staging to production"
|
30
|
+
task :deploy, :roles => :production do
|
31
|
+
system "git push github" if `git remote` =~ /\bgithub\b/
|
32
|
+
run "cd #{application} && git pull origin/master && rake bootstrap:production"
|
33
|
+
puts "Deploy Succeeded"
|
41
34
|
end
|
42
35
|
end
|
data/lib/bard/check.rb
CHANGED
@@ -1,27 +1,37 @@
|
|
1
1
|
class Bard < Thor
|
2
2
|
private
|
3
|
+
def auto_update!
|
4
|
+
original_command = [ENV["_"], @_invocations[Bard], ARGV].flatten.join(" ")
|
5
|
+
required = `curl -s http://gemcutter.org/api/v1/gems/bard.json`.match(/"version":"([0-9.]+)"/)[1]
|
6
|
+
if Versionomy.parse(Bard::VERSION) < Versionomy.parse(required)
|
7
|
+
original_command = [ENV["_"], @_invocations[Bard], ARGV].flatten.join(" ")
|
8
|
+
puts "bard gem is out of date... updating to new version"
|
9
|
+
exec "gem install bard && #{original_command}"
|
10
|
+
end
|
11
|
+
if options.verbose?
|
12
|
+
puts green("#{"bard".ljust(9)} (#{Bard::VERSION})")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
3
16
|
def check_dependencies
|
4
17
|
required = {
|
5
|
-
'bard' => `curl -s http://gemcutter.org/api/v1/gems/bard.json`.match(/"version":"([0-9.]+)"/)[1],
|
6
18
|
'git' => '1.6.4',
|
7
19
|
'rubygems' => '1.3.4',
|
8
|
-
'ruby' => '1.8.
|
20
|
+
'ruby' => '1.8.7'
|
9
21
|
}
|
10
22
|
actual = {
|
11
|
-
'bard' => Bard::VERSION,
|
12
23
|
'git' => `git --version`[/[0-9.]+/],
|
13
24
|
'rubygems' => Gem::VERSION,
|
14
25
|
'ruby' => RUBY_VERSION
|
15
26
|
}
|
16
27
|
help = {
|
17
|
-
'bard' => 'please type `gem install bard` to update',
|
18
28
|
'git' => 'please visit http://git-scm.com/download and install the appropriate package for your architecture',
|
19
29
|
'rubygems' => 'please type `gem update --system` to update',
|
20
|
-
'ruby' => '
|
30
|
+
'ruby' => 'ruby 1.8.7 is required for all projects now. talk to micah for upgrade help'
|
21
31
|
}
|
22
32
|
|
23
33
|
errors = []
|
24
|
-
%w(
|
34
|
+
%w(git rubygems ruby).each do |pkg|
|
25
35
|
if Versionomy.parse(actual[pkg]) < Versionomy.parse(required[pkg])
|
26
36
|
errors << red("#{pkg.ljust(9)} (#{actual[pkg]}) ... NEED (#{required[pkg]})\n #{help[pkg]}")
|
27
37
|
elsif options.verbose?
|
data/lib/bard/rake.rb
CHANGED
@@ -1,10 +1,36 @@
|
|
1
|
-
task :
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
6
32
|
end
|
7
33
|
|
8
34
|
Rake::Task[:default].clear
|
9
35
|
desc "Bootstrap the current project and run the tests."
|
10
|
-
task :default => [:
|
36
|
+
task :default => ["bootstrap:test", :spec, :cucumber]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-28 00:00:00 -08:00
|
14
14
|
default_executable: bard
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|