Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplify CLI workflow (fixes #45)

  • Loading branch information...
commit cc4d6b3b30dd153e8a3eb7f43a97250e22f4d40b 1 parent a594f0c
Felipe Kaufmann authored
12 README.md
View
@@ -8,7 +8,7 @@ Not everyone can or wants to deploy on heroku. But now you can have the same awe
## Quickstart
-`blazing init`, edit the configuration, run `blazing setup:local` and `blazing setup:remote <target>` and you're set. Deploy with `git push <target> <branch>` or setup git to always push your current branch.
+`blazing init`, edit the configuration, run `blazing setup [target]` and you're set. Deploy with `git push <target> <branch>` or setup git to always push your current branch.
## Overview & Background
@@ -49,17 +49,13 @@ See the generated configuration file or [the template file](https://github.com/e
### Setup
-`blazing setup:local` will setup your local repository for deployment with blazing/git push. Basically, it will add a remote for each target you defined in the configuration file.
-
-`blazing setup:remote <target>` will setup the project on the server side. It will:
+`blazing setup` will:
+* setup your local repository for deployment with blazing/git push. Basically, it will add a remote for each target you defined in the configuration file.
* clone the repository to the specified location
* setup the repository to allow a currently checked out branch to be pushed to it
-* run ``blazing update``
-
-`blazing update <target>`
-Whenever you change something in your blazing config file you can run the update command so your git post-receive hook gets updated.
+Whenever you change something in your blazing config file you can run the `update` command so your git post-receive hook and your git remotess get updated.
### Deploying
8 lib/blazing/runner.rb
View
@@ -31,7 +31,7 @@ def init_command
end
end
- def setup_local_command
+ def setup_git_remotes
repository = Grit::Repo.new(Dir.pwd)
@config.targets.each do |target|
info("Adding new remote #{target.name} pointing to #{target.location}")
@@ -39,12 +39,14 @@ def setup_local_command
end
end
- def setup_remote_command
+ def setup_command
@target.setup
+ update_command
end
def update_command
- @target.update
+ setup_git_remotes
+ @target.apply_hook
end
def recipes_run_command
3  lib/blazing/target.rb
View
@@ -14,10 +14,9 @@ def initialize(name, location, config, options = {})
def setup
@shell.run "ssh #{user}@#{host} '#{clone_repository} && #{setup_repository}'"
- self.update
end
- def update
+ def apply_hook
hook = ERB.new(File.read("#{Blazing::TEMPLATE_ROOT}/hook.erb")).result(binding)
File.open(Blazing::TMP_HOOK, "wb") do |f|
27 spec/blazing/integration/setup_local_spec.rb
View
@@ -1,27 +0,0 @@
-require 'spec_helper'
-require 'blazing/config'
-require 'blazing/runner'
-require 'grit'
-
-describe 'blazing setup:local' do
-
- before :each do
- setup_sandbox
- @production_url = 'user@host:/some/where'
- @staging_url = 'user@host:/some/where/else'
-
- @config = Blazing::Config.new
- @config.target :production, @production_url
- @config.target :staging, @staging_url, :default => true
- capture(:stdout) { Blazing::Runner.new(@config).exec('setup:local') }
- end
-
- after :each do
- teardown_sandbox
- end
-
- it 'adds a git remote for each target' do
- Grit::Repo.new(Dir.pwd).config['remote.production.url'].should == @production_url
- end
-
-end
6 spec/blazing/integration/setup_remote_spec.rb
View
@@ -3,7 +3,7 @@
require 'blazing/runner'
require 'grit'
-describe 'blazing setup:remote' do
+describe 'blazing setup' do
before :each do
setup_sandbox
@@ -25,8 +25,8 @@
@target = @config.default_target
@target.instance_variable_set('@shell', @shell)
@shell.should_receive(:run).with("ssh user@host 'git clone /some/where/else && cd /some/where/else && git config receive.denyCurrentBranch ignore'")
- @target.should_receive(:update)
- capture(:stdout) { @runner.exec('setup:remote') }
+ @target.should_receive(:apply_hook)
+ capture(:stdout) { @runner.exec('setup') }
end
end
5 spec/blazing/integration/update_spec.rb
View
@@ -39,4 +39,9 @@
capture(:stdout) { @runner.exec('update') }
end
+ it 'adds a git remote for each target' do
+ capture(:stdout) { @runner.exec('update') }
+ Grit::Repo.new(Dir.pwd).config['remote.production.url'].should == @production_url
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.