blazing 0.0.16 → 0.1.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +2 -0
  2. data/.rvmrc +1 -1
  3. data/Gemfile +0 -10
  4. data/Gemfile.lock +53 -44
  5. data/Guardfile +8 -0
  6. data/README.md +23 -99
  7. data/Rakefile +21 -4
  8. data/bin/blazing +23 -5
  9. data/blazing.gemspec +19 -8
  10. data/features/help_banner.feature +13 -0
  11. data/features/step_definitions/blazing_steps.rb +1 -0
  12. data/features/support/env.rb +9 -0
  13. data/lib/blazing.rb +4 -13
  14. data/lib/blazing/config.rb +38 -73
  15. data/lib/blazing/dsl_setter.rb +20 -0
  16. data/lib/blazing/recipe.rb +5 -78
  17. data/lib/blazing/runner.rb +44 -2
  18. data/lib/blazing/shell.rb +7 -0
  19. data/lib/blazing/target.rb +44 -134
  20. data/lib/blazing/templates/config.erb +21 -0
  21. data/lib/blazing/templates/hook.erb +43 -0
  22. data/lib/blazing/version.rb +1 -1
  23. data/spec/blazing/config_spec.rb +104 -48
  24. data/spec/blazing/integration/init_spec.rb +8 -37
  25. data/spec/blazing/integration/setup_local_spec.rb +27 -0
  26. data/spec/blazing/integration/setup_remote_spec.rb +32 -0
  27. data/spec/blazing/integration/update_spec.rb +38 -0
  28. data/spec/blazing/recipe_spec.rb +5 -66
  29. data/spec/blazing/runner_spec.rb +41 -6
  30. data/spec/blazing/target_spec.rb +26 -99
  31. data/spec/spec_helper.rb +18 -12
  32. data/spec/support/{config.rb → empty_config.rb} +0 -0
  33. metadata +170 -97
  34. data/TODO +0 -3
  35. data/lib/blazing/base.rb +0 -41
  36. data/lib/blazing/bootstrap.rb +0 -27
  37. data/lib/blazing/cli/base.rb +0 -64
  38. data/lib/blazing/cli/create.rb +0 -32
  39. data/lib/blazing/cli/hook.rb +0 -22
  40. data/lib/blazing/cli/templates/blazing.tt +0 -7
  41. data/lib/blazing/cli/templates/post-hook.tt +0 -25
  42. data/lib/blazing/core_ext/object.rb +0 -8
  43. data/lib/blazing/logger.rb +0 -31
  44. data/lib/blazing/recipes/bundler_recipe.rb +0 -20
  45. data/lib/blazing/recipes/rvm_recipe.rb +0 -11
  46. data/spec/blazing/binary_spec.rb +0 -11
  47. data/spec/blazing/cli/base_spec.rb +0 -94
  48. data/spec/blazing/cli/create_spec.rb +0 -27
  49. data/spec/blazing/cli/hook_spec.rb +0 -16
  50. data/spec/blazing/logger_spec.rb +0 -50
  51. data/spec/blazing/recipes/bundler_recipe_spec.rb +0 -32
  52. data/spec/blazing/recipes/passenger_recipe_spec.rb +0 -6
  53. data/spec/blazing/recipes/rvm_recipe_spec.rb +0 -11
  54. data/spec/blazing/remote_spec.rb +0 -136
data/.gitignore CHANGED
@@ -7,3 +7,5 @@ tags
7
7
  .idea
8
8
  coverage
9
9
  *.rbc
10
+ results.html
11
+ SCRATCHPAD
data/.rvmrc CHANGED
@@ -4,7 +4,7 @@
4
4
  # development environment upon cd'ing into the directory
5
5
 
6
6
  # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
- environment_id="ruby-1.9.2-p180@blazing"
7
+ environment_id="ruby-1.9.2@blazing-rework"
8
8
 
9
9
  #
10
10
  # First we attempt to load the desired environment directly from the environment
data/Gemfile CHANGED
@@ -2,13 +2,3 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in blazing.gemspec
4
4
  gemspec
5
-
6
- gem 'rake', '0.8.7'
7
- gem 'rspec'
8
- gem 'ruby-debug19', :platforms => :ruby_19
9
- gem 'ruby-debug', :platforms => :ruby_18
10
- gem 'guard' , '0.4.0.rc'
11
- gem 'guard-rspec'
12
- gem 'growl'
13
- gem 'simplecov', '>= 0.4.0', :require => false, :group => :test, :platforms => :ruby_19
14
- gem 'rb-fsevent'
@@ -1,73 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blazing (0.0.16)
5
- activesupport (>= 3.0.5)
4
+ blazing (0.1.0.alpha1)
5
+ activesupport
6
6
  grit
7
7
  i18n
8
- thor (>= 0.14.6)
8
+ methadone
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- activesupport (3.0.9)
14
- archive-tar-minitar (0.5.2)
15
- columnize (0.3.2)
16
- diff-lcs (1.1.2)
13
+ activesupport (3.1.1)
14
+ multi_json (~> 1.0)
15
+ aruba (0.4.6)
16
+ bcat (>= 0.6.1)
17
+ childprocess (>= 0.2.0)
18
+ cucumber (>= 1.0.2)
19
+ rdiscount (>= 1.6.8)
20
+ rspec (>= 2.6.0)
21
+ bcat (0.6.2)
22
+ rack (~> 1.0)
23
+ builder (3.0.0)
24
+ childprocess (0.2.2)
25
+ ffi (~> 1.0.6)
26
+ cucumber (1.1.0)
27
+ builder (>= 2.1.2)
28
+ diff-lcs (>= 1.1.2)
29
+ gherkin (~> 2.5.0)
30
+ json (>= 1.4.6)
31
+ term-ansicolor (>= 1.0.6)
32
+ diff-lcs (1.1.3)
33
+ ffi (1.0.9)
34
+ gherkin (2.5.2)
35
+ json (>= 1.4.6)
17
36
  grit (2.4.1)
18
37
  diff-lcs (~> 1.1)
19
38
  mime-types (~> 1.15)
20
39
  growl (1.0.3)
21
- guard (0.4.0.rc)
40
+ guard (0.8.4)
22
41
  thor (~> 0.14.6)
23
- guard-rspec (0.3.0)
24
- guard (>= 0.2.2)
42
+ guard-cucumber (0.7.3)
43
+ cucumber (>= 0.10)
44
+ guard (>= 0.8.3)
45
+ guard-rspec (0.5.0)
46
+ guard (>= 0.8.4)
25
47
  i18n (0.6.0)
26
- linecache (0.43)
27
- linecache19 (0.5.12)
28
- ruby_core_source (>= 0.1.4)
48
+ json (1.6.1)
49
+ methadone (0.3.0)
29
50
  mime-types (1.16)
30
- rake (0.8.7)
51
+ multi_json (1.0.3)
52
+ rack (1.3.4)
53
+ rake (0.9.2)
31
54
  rb-fsevent (0.4.0)
32
- rspec (2.5.0)
33
- rspec-core (~> 2.5.0)
34
- rspec-expectations (~> 2.5.0)
35
- rspec-mocks (~> 2.5.0)
36
- rspec-core (2.5.1)
37
- rspec-expectations (2.5.0)
55
+ rdiscount (1.6.8)
56
+ rdoc (3.10)
57
+ json (~> 1.4)
58
+ rspec (2.6.0)
59
+ rspec-core (~> 2.6.0)
60
+ rspec-expectations (~> 2.6.0)
61
+ rspec-mocks (~> 2.6.0)
62
+ rspec-core (2.6.4)
63
+ rspec-expectations (2.6.0)
38
64
  diff-lcs (~> 1.1.2)
39
- rspec-mocks (2.5.0)
40
- ruby-debug (0.10.4)
41
- columnize (>= 0.1)
42
- ruby-debug-base (~> 0.10.4.0)
43
- ruby-debug-base (0.10.4)
44
- linecache (>= 0.3)
45
- ruby-debug-base19 (0.11.25)
46
- columnize (>= 0.3.1)
47
- linecache19 (>= 0.5.11)
48
- ruby_core_source (>= 0.1.4)
49
- ruby-debug19 (0.11.6)
50
- columnize (>= 0.3.1)
51
- linecache19 (>= 0.5.11)
52
- ruby-debug-base19 (>= 0.11.19)
53
- ruby_core_source (0.1.5)
54
- archive-tar-minitar (>= 0.5.2)
55
- simplecov (0.4.2)
56
- simplecov-html (~> 0.4.4)
57
- simplecov-html (0.4.4)
65
+ rspec-mocks (2.6.0)
66
+ term-ansicolor (1.0.7)
58
67
  thor (0.14.6)
59
68
 
60
69
  PLATFORMS
61
70
  ruby
62
71
 
63
72
  DEPENDENCIES
73
+ aruba
64
74
  blazing!
65
75
  growl
66
- guard (= 0.4.0.rc)
76
+ guard
77
+ guard-cucumber
67
78
  guard-rspec
68
- rake (= 0.8.7)
79
+ rake (~> 0.9.2)
69
80
  rb-fsevent
81
+ rdoc
70
82
  rspec
71
- ruby-debug
72
- ruby-debug19
73
- simplecov (>= 0.4.0)
data/Guardfile CHANGED
@@ -6,4 +6,12 @@ guard 'rspec', :version => 2, :cli => "--colour --fail-fast --format nested" do
6
6
  watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
7
7
  watch(%r{^lib/blazing/(.+)\.rb}) { |m| "spec/blazing/#{m[1]}_spec.rb" }
8
8
  watch('spec/spec_helper.rb') { "spec" }
9
+ watch(%r{^lib/blazing/templates/(.+)}) { "spec" }
10
+ watch('lib/blazing/runner.rb') { "spec/blazing/integration/*" }
11
+ end
12
+
13
+ guard 'cucumber' do
14
+ watch(%r{^features/.+\.feature$})
15
+ watch(%r{^features/support/.+$}) { 'features' }
16
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
9
17
  end
data/README.md CHANGED
@@ -1,122 +1,46 @@
1
- Blazing -- Fast and painless git push deploys
2
- =============================================
1
+ [![Build Status](http://travis-ci.org/effkay/blazing.png)](http://travis-ci.org/effkay/blazing)
3
2
 
4
- [![Build Status](http://travis-ci.org/effkay/blazing.png)](http://travis-ci.org/effkay/blazing) (but still in alpha!)
3
+ # Blazing fast git push deploys
5
4
 
6
- ## What
5
+ ## Overview
7
6
 
8
- Blazing aims to be a fast and hassle free way to deploy web
9
- applications. It may work for other frameworks, but it is mainly
10
- designed to deploy Ruby on Rails and Rack based applications, as well as
11
- static sites.
7
+ ## Installation
12
8
 
13
- Some design goals:
9
+ ## Usage
14
10
 
15
- * A deploy is just a git push to another remote. All that must be done afterwards is triggered by pre and post receveie git hooks.
16
- * initial setup done by ruby script, so unexerpienced users do not
17
- have to fiddle with the git config files
18
- * clean API for writing your own recipes, no messy rake file jungles
19
- * DRY, clean and minimal configuration file
20
- * blazing fast!
11
+ ## Development & Contribution
21
12
 
22
- ## Why
13
+ ### Improving Blazing itself
23
14
 
24
- I initially started working on an extension to capistrano which would
25
- cover most of my needs and the needs we had at [Screen
26
- Concept](http://www.screenconcept.ch). After a short while I noticed
27
- that bolting more functionality on top of capistrano was just going to
28
- be messy (and a PTA to maintain). We were alerady using tons of own recipes and customizations,
29
- capistrano multistage, capistrano-ext, etc.
15
+ ### Blazing Recipes
30
16
 
31
- I had a look at what others were doing and after a round of trying
32
- around and not getting what I wanted, I started this.
17
+ ## Contribution
33
18
 
34
- ### Inspiration & Alternatives
19
+ ## TODO
35
20
 
36
- I looked at [Inploy](https://github.com/dcrec1/inploy) and [Vlad](https://github.com/seattlerb/vlad) after having used [Capistrano](https://github.com/capistrano/capistrano) for several
37
- years. Then got inspired by defunkt's
38
- [blog post](https://github.com/blog/470-deployment-script-spring-cleaning) about deployment script spring cleaning. Other's doing a similar thing with git push deployments are Mislav's [git-deploy](https://github.com/mislav/git-deploy) and [pushand](https://github.com/remi/pushand.git) by remi.
21
+ ###0.1 alpha:
39
22
 
40
- ## Installation & Setup
23
+ * implement hook
41
24
 
42
- Run `blazing init` in your project's root, this will create the necessary files to use and configure blazing.
25
+ * implement recipes
43
26
 
44
- ## Configuration & Blazing DSL
27
+ * checkout branch specified when deploying (i.e git push production
28
+ some_feature_branch should checkout some_feature_branch on prod target)
45
29
 
46
- The blazing config file features a DSL similar to capistrano or other
47
- such systems.
30
+ * handle target as argument in runner
48
31
 
49
- Examples:
32
+ * finish readme
50
33
 
51
- ```ruby
52
- repository 'git@github.com:someones/repository.git'
34
+ ### Later
53
35
 
54
- use [:bundler, :whenever]
55
- use :rvm, :rvm_string => 'ree@production'
36
+ * recipes with options
37
+ * read origin and set it as repository automatically
38
+ * allow to set deployed branch in config
39
+ * handle local deployment
56
40
 
57
- target :stagigng, :deploy_to => 'user@hostname:/path/to/target', :default => true
58
- target :production, :deploy_to => 'user@somehostname:/path/to/target'
59
- ...
60
- ```
61
-
62
- ## Deploying
63
-
64
- ```bash
65
- blazing deploy <target_name>
66
- ```
67
-
68
- Or, if everyting is already set up on the remote etc. you can acutally
69
- just do a git push to your target name.
70
-
71
- ## Development
72
-
73
- Report Issues/Questions/Feature requests on [GitHub
74
- Issues](http://github.com/effkay/blazing/issues)
75
-
76
- ### Extending / Fixing Blazing itself
77
-
78
- Pull requests are very welcome as long as they are well tested. Please
79
- create a topic branch for every separate change you intend to make.
80
-
81
- ### Developing Blazing Extensions
82
-
83
- **(Still work in progress and not a stable API yet)**
84
-
85
- Example:
86
-
87
- ```ruby
88
- class SomeFunkyRecipe < Blazing::Recipe
89
-
90
- def self.run
91
- # do something
92
- end
93
-
94
- end
95
- ```
96
41
 
97
42
  ## Authors
98
43
 
99
- [Felipe Kaufmann](http://github.com/effkay)
100
-
101
44
  ## License
102
45
 
103
- Copyright (c) 2011 Felipe Kaufmann
104
-
105
- Permission is hereby granted, free of charge, to any person obtaining
106
- a copy of this software and associated documentation files (the
107
- "Software"), to deal in the Software without restriction, including
108
- without limitation the rights to use, copy, modify, merge, publish,
109
- distribute, sublicense, and/or sell copies of the Software, and to
110
- permit persons to whom the Software is furnished to do so, subject to
111
- the following conditions:
112
-
113
- The above copyright notice and this permission notice shall be
114
- included in all copies or substantial portions of the Software.
115
-
116
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
117
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
118
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
119
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
120
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
121
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
122
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
+ See the `MIT-LICENSE` file
data/Rakefile CHANGED
@@ -1,9 +1,14 @@
1
1
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
- Bundler.setup
4
-
2
+ require 'rake/clean'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+ require 'rdoc/task'
5
6
  require 'rspec/core/rake_task'
6
7
 
8
+ include Rake::DSL
9
+
10
+ Bundler::GemHelper.install_tasks
11
+
7
12
  desc "Run specs"
8
13
  RSpec::Core::RakeTask.new do |t|
9
14
  # t.rspec_opts = %w(--colour --fail-fast --format nested)
@@ -11,4 +16,16 @@ RSpec::Core::RakeTask.new do |t|
11
16
  t.ruby_opts = %w(-w)
12
17
  end
13
18
 
14
- task :default => :spec
19
+ CUKE_RESULTS = 'results.html'
20
+ CLEAN << CUKE_RESULTS
21
+ Cucumber::Rake::Task.new(:features) do |t|
22
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
23
+ t.fork = false
24
+ end
25
+
26
+ Rake::RDocTask.new do |rd|
27
+ rd.main = "README.rdoc"
28
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
29
+ end
30
+
31
+ task :default => [:spec,:features]
@@ -1,11 +1,29 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby -w
2
2
 
3
3
  require 'bundler'
4
4
  Bundler.setup
5
5
 
6
- require 'thor'
7
- require 'thor/group'
6
+ require 'optparse'
7
+ require 'methadone'
8
8
  require 'blazing'
9
- require 'blazing/cli/base'
9
+ require 'blazing/config'
10
+ require 'blazing/runner'
10
11
 
11
- Blazing::CLI::Base.start
12
+ include Methadone::Main
13
+
14
+ main do |command, target|
15
+ if command == 'init'
16
+ config = nil
17
+ else
18
+ config = Blazing::Config.parse(options[:file])
19
+ end
20
+
21
+ runner = Blazing::Runner.new(config, target)
22
+ runner.exec(command)
23
+ end
24
+
25
+ arg :command
26
+ arg :target, :optional
27
+ on("-f configuration", "--file configuration", "config file location (defaults to config/blazing.rb)")
28
+
29
+ go!
@@ -5,24 +5,35 @@ require "blazing/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "blazing"
7
7
  s.version = Blazing::VERSION
8
- s.platform = Gem::Platform::RUBY
9
8
  s.authors = ["Felipe Kaufmann"]
10
9
  s.email = ["felipekaufmann@gmail.com"]
11
10
  s.homepage = "https://github.com/effkay/blazing"
12
11
  s.summary = %q{blazing fast deployment}
13
12
  s.description = %q{git push deployent utility, ready to be extended by your own recipes}
13
+
14
+ s.rubyforge_project = "blazing"
15
+
14
16
  s.files = `git ls-files`.split("\n")
15
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- # s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.executables = ["blazing"]
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
19
  s.require_paths = ["lib"]
19
20
 
20
- # TODO: better to use ~ ?
21
- s.add_dependency "thor", ">= 0.14.6"
22
- s.add_dependency "grit"
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_development_dependency('rdoc')
25
+ s.add_development_dependency('aruba')
26
+ s.add_development_dependency('rake','~> 0.9.2')
27
+ s.add_development_dependency('rspec')
28
+ s.add_development_dependency('guard')
29
+ s.add_development_dependency('guard-rspec')
30
+ s.add_development_dependency('guard-cucumber')
31
+ s.add_development_dependency('growl')
32
+ s.add_development_dependency('rb-fsevent')
33
+ s.add_dependency('methadone')
34
+ s.add_dependency('grit')
23
35
 
24
36
  # TODO: Get rid of those, just used for guessing recipe names etc in lib/recipes.rb
25
- s.add_dependency "activesupport", ">= 3.0.5"
37
+ s.add_dependency "activesupport"
26
38
  s.add_dependency "i18n"
27
-
28
39
  end
@@ -0,0 +1,13 @@
1
+ Feature: Help Banner
2
+ In order to know what this gem does
3
+ I want to see the help banner
4
+
5
+ Scenario: Run blazing --help
6
+ When I get help for "blazing"
7
+ Then the exit status should be 0
8
+ And the banner should be present
9
+
10
+ Scenario:
11
+ When I run `blazing`
12
+ Then the exit status should not be 0
13
+ And the output should contain "'command' is required"
@@ -0,0 +1 @@
1
+ # Put your step defintions here