blazing 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +183 -0
  4. data/.travis.yml +8 -4
  5. data/CHANGELOG.md +7 -1
  6. data/Gemfile +1 -1
  7. data/Guardfile +6 -7
  8. data/README.md +30 -152
  9. data/Rakefile +5 -6
  10. data/bin/blazing +1 -2
  11. data/blazing.gemspec +17 -26
  12. data/lib/blazing.rb +2 -14
  13. data/lib/blazing/cli.rb +32 -39
  14. data/lib/blazing/commands.rb +18 -26
  15. data/lib/blazing/config.rb +21 -51
  16. data/lib/blazing/dsl.rb +37 -0
  17. data/lib/blazing/hook.rb +15 -11
  18. data/lib/blazing/logger.rb +13 -17
  19. data/lib/blazing/repository.rb +5 -1
  20. data/lib/blazing/shell.rb +5 -5
  21. data/lib/blazing/target.rb +3 -3
  22. data/lib/blazing/templates/config.erb +10 -45
  23. data/lib/blazing/templates/hook/base.erb +0 -3
  24. data/lib/blazing/templates/hook/bundler.erb +4 -3
  25. data/lib/blazing/templates/hook/env-scripts.erb +3 -3
  26. data/lib/blazing/templates/hook/rake.erb +0 -1
  27. data/lib/blazing/templates/hook/rvm.erb +3 -31
  28. data/lib/blazing/templates/hook/setup.erb +1 -1
  29. data/lib/blazing/version.rb +3 -0
  30. data/spec/blazing/cli_spec.rb +1 -11
  31. data/spec/blazing/commands_spec.rb +35 -65
  32. data/spec/blazing/config_spec.rb +22 -102
  33. data/spec/blazing/dsl_spec.rb +60 -0
  34. data/spec/blazing/hook_spec.rb +31 -82
  35. data/spec/blazing/integration/deployment_spec.rb +20 -22
  36. data/spec/blazing/integration/init_spec.rb +2 -4
  37. data/spec/blazing/integration/setup_spec.rb +30 -30
  38. data/spec/blazing/integration/update_spec.rb +35 -35
  39. data/spec/blazing/logger_spec.rb +0 -4
  40. data/spec/blazing/repository_spec.rb +8 -10
  41. data/spec/blazing/shell_spec.rb +2 -4
  42. data/spec/blazing/target_spec.rb +12 -13
  43. data/spec/spec_helper.rb +8 -12
  44. data/spec/support/dummy_config.rb +6 -0
  45. metadata +18 -35
  46. data/lib/blazing/dsl_setter.rb +0 -20
  47. data/lib/blazing/recipe.rb +0 -45
  48. data/lib/blazing/templates/hook/recipes.erb +0 -5
  49. data/spec/blazing/dsl_setter_spec.rb +0 -29
  50. data/spec/blazing/integration/list_spec.rb +0 -20
  51. data/spec/blazing/integration/recipes_spec.rb +0 -29
  52. data/spec/blazing/recipe_spec.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c9f536163166c533719cbc5d5b33e0777b7f4ca
4
- data.tar.gz: 8c99b501e25c992b62457a17d419ad865f76e78e
3
+ metadata.gz: 9b55d420459708516165067c0187dcb4fff95527
4
+ data.tar.gz: 7e30457ee430a4957b2684bebdb82c31c479d0c7
5
5
  SHA512:
6
- metadata.gz: 9aaddee359cca03e1487630cf394bd0160eb3a2780bd29e86c2184895a95ccf1af52603af413295124168d57e1e79c1347b8ab2fd4b05a8883cf3544ee33f037
7
- data.tar.gz: 72c957dd7c57dd3dde9a7561861ef242d2d4cf4c8d045819f5d70bb9cba1532551038f423c5ba663797803715b7def29d80541879d4a7e03e8f1246745f10fb4
6
+ metadata.gz: 2fe75b672e295745f80090ec501b97551d807590f41cc252f03fa3e7b1a187f1cf21e244796e73c235cc91d9104bd56260c81c2ec1a7781a042cb1d2ad90d706
7
+ data.tar.gz: ab0130d6723a2b4b54474fc83d4369c6b5777e74bed8e8c3a669bb012d96771e30d3a8c6f692d56c64d29f02f8618faccb9b63925b0bd27a78250a52331cc3c4
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ coverage
9
9
  *.rbc
10
10
  results.html
11
11
  Gemfile.lock
12
+ TODOS
@@ -0,0 +1,183 @@
1
+ # This is the default configuration file. Enabling and disabling is configured
2
+ # in separate files. This file adds all other parameters apart from Enabled.
3
+
4
+ # Common configuration.
5
+ AllCops:
6
+ # Include gemspec and Rakefile
7
+ Include:
8
+ - '**/*.gemspec'
9
+ Exclude:
10
+ - Rakefile
11
+ - spec/spec_helper.rb
12
+
13
+ # Indent private/protected/public as deep as method definitions
14
+ AccessModifierIndentation:
15
+ # supported styles are "indent" and "outdent"
16
+ EnforcedStyle: indent
17
+
18
+ # Align the elements of a hash literal if they span more than one line.
19
+ AlignHash:
20
+ # Alignment of entries using hash rocket as separator. Valid values are:
21
+ #
22
+ # key - left alignment of keys
23
+ # 'a' => 2
24
+ # 'bb' => 3
25
+ # separator - alignment of hash rockets, keys are right aligned
26
+ # 'a' => 2
27
+ # 'bb' => 3
28
+ # table - left alignment of keys, hash rockets, and values
29
+ # 'a' => 2
30
+ # 'bb' => 3
31
+ EnforcedHashRocketStyle: key
32
+ # Alignment of entries using colon as separator. Valid values are:
33
+ #
34
+ # key - left alignment of keys
35
+ # a: 0
36
+ # bb: 1
37
+ # separator - alignment of colons, keys are right aligned
38
+ # a: 0
39
+ # bb: 1
40
+ # table - left alignment of keys and values
41
+ # a: 0
42
+ # bb: 1
43
+ EnforcedColonStyle: key
44
+
45
+ DeprecatedHashMethods:
46
+ # key? instead of has_key?
47
+ # value? instead of has_value?
48
+ Enabled: false
49
+
50
+ PredicateName:
51
+ Enabled: false
52
+
53
+ Delegate:
54
+ Enabled: false
55
+
56
+ Metrics/AbcSize:
57
+ Enabled: false
58
+
59
+ # don't prefer 'fail' over raise
60
+ SignalException:
61
+ Description: 'Checks for proper usage of fail and raise.'
62
+ Enabled: false
63
+
64
+ BlockNesting:
65
+ Max: 3
66
+
67
+ BracesAroundHashParameters:
68
+ # Valid values are: braces, no_braces
69
+ EnforcedStyle: no_braces
70
+
71
+ ClassLength:
72
+ CountComments: false # count full line comments?
73
+ Max: 100
74
+
75
+ # Align with the style guide.
76
+ CollectionMethods:
77
+ PreferredMethods:
78
+ collect: 'map'
79
+ collect!: 'map!'
80
+ inject: 'reduce'
81
+ find_all: 'select'
82
+
83
+ # Checks formatting of special comments
84
+ CommentAnnotation:
85
+ Keywords:
86
+ - TODO
87
+ - FIXME
88
+ - OPTIMIZE
89
+ - HACK
90
+ - REVIEW
91
+ - NOTE
92
+ - NOTICE
93
+
94
+ # Avoid complex methods.
95
+ CyclomaticComplexity:
96
+ Max: 9
97
+
98
+ PerceivedComplexity:
99
+ Max: 9
100
+
101
+ # Multi-line method chaining should be done with leading dots.
102
+ # DotPosition:
103
+ # Style: 'leading'
104
+
105
+ # Use empty lines between defs.
106
+ EmptyLineBetweenDefs:
107
+ # If true, this parameter means that single line method definitions don't
108
+ # need an empty line between them.
109
+ AllowAdjacentOneLineDefs: false
110
+
111
+ HashSyntax:
112
+ # Valid values are: ruby19, hash_rockets
113
+ EnforcedStyle: ruby19
114
+
115
+ LambdaCall:
116
+ # Valid values are: call, braces
117
+ EnforcedStyle: call
118
+
119
+ ClassAndModuleChildren:
120
+ Enabled: true
121
+
122
+ LineLength:
123
+ Max: 180
124
+
125
+ # MethodLength:
126
+ # CountComments: false # count full line comments?
127
+ # Max: 20
128
+
129
+ # MethodName:
130
+ # # Valid values are: snake_case, camelCase
131
+ # EnforcedStyle: snake_case
132
+
133
+ NumericLiterals:
134
+ MinDigits: 5
135
+
136
+ # Output:
137
+ # Ignore:
138
+ # - '^.*\.rake$'
139
+ # - '^.*/script/.*$'
140
+ # - '^.*/tasks/.*$'
141
+ # - 'Rakefile$'
142
+
143
+ ParameterLists:
144
+ Max: 4
145
+ CountKeywordArgs: true
146
+
147
+ Alias:
148
+ Enabled: false
149
+
150
+ # top level documentation
151
+ Documentation:
152
+ Enabled: false
153
+
154
+ ModuleFunction:
155
+ Enabled: false
156
+
157
+ # TrivialAccessors doesn't require exact name matches and doesn't allow
158
+ # predicated methods by default.
159
+ TrivialAccessors:
160
+ ExactNameMatch: false
161
+ AllowPredicates: false
162
+ Whitelist:
163
+ - to_ary
164
+ - to_a
165
+ - to_c
166
+ - to_enum
167
+ - to_h
168
+ - to_hash
169
+ - to_i
170
+ - to_int
171
+ - to_io
172
+ - to_open
173
+ - to_path
174
+ - to_proc
175
+ - to_r
176
+ - to_regexp
177
+ - to_str
178
+ - to_s
179
+ - to_sym
180
+
181
+ VariableName:
182
+ # Valid values are: snake_case, camelCase
183
+ EnforcedStyle: snake_case
@@ -1,5 +1,9 @@
1
+ ---
2
+ language: ruby
1
3
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
- - 1.9.3
5
- - ree
4
+ - 2.0.0
5
+ - 2.1.6
6
+ - 2.2.2
7
+ script:
8
+ - bundle exec rake
9
+ - bundle exec rubocop
@@ -1,6 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- ## master
3
+ ## 0.5.0 - August 3, 2015
4
+
5
+ * removed support for deprecated ruby versions (< 2.0)
6
+ * integrate rubocop and made him happy :)
7
+ * Remove recipe support
8
+ * Support rbenv by default, rework env script handling
9
+ * some bugfixes
4
10
 
5
11
  ## 0.4.2 - June 28, 2015
6
12
 
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
data/Guardfile CHANGED
@@ -1,17 +1,16 @@
1
- guard :rspec, :version => 2, :cli => "--colour --fail-fast --format nested" do
2
-
1
+ guard :rspec, version: 2, cli: '--colour --fail-fast' do
3
2
  # Generated: by guard-rspec
4
3
  watch(%r{^spec/.+_spec\.rb})
5
4
  watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
- watch('spec/spec_helper.rb') { "spec" }
5
+ watch('spec/spec_helper.rb') { 'spec' }
7
6
 
8
7
  # Not Generated
9
8
  watch('spec/spec_helper.rb') { %w(spec/spec_helper spec) }
10
9
  watch(%r{^spec/.+_spec\.rb})
11
10
  watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
12
11
  watch(%r{^lib/blazing/(.+)\.rb}) { |m| "spec/blazing/#{m[1]}_spec.rb" }
13
- watch('spec/spec_helper.rb') { "spec" }
14
- watch(%r{^lib/blazing/templates/(.+)}) { "spec" }
15
- watch('lib/blazing/cli.rb') { "spec/blazing/integration/*" }
16
- watch('lib/blazing/commands.rb') { "spec/blazing/integration/*" }
12
+ watch('spec/spec_helper.rb') { 'spec' }
13
+ watch(%r{^lib/blazing/templates/(.+)}) { 'spec' }
14
+ watch('lib/blazing/cli.rb') { 'spec/blazing/integration/*' }
15
+ watch('lib/blazing/commands.rb') { 'spec/blazing/integration/*' }
17
16
  end
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  [![Build Status](https://secure.travis-ci.org/effkay/blazing.png?branch=master)](http://travis-ci.org/effkay/blazing)
2
+ [![Code Climate](https://codeclimate.com/github/effkay/blazing.png)](https://codeclimate.com/github/effkay/blazing)
3
+ [![Gem Version](https://badge.fury.io/rb/blazing.png)](http://badge.fury.io/rb/blazing)
2
4
 
3
5
  Blazing fast and painless git push deploys
4
6
  ==========================================
5
7
 
6
8
  *Oh no, yet another deployer!*
7
9
 
8
- Not everyone can or wants to deploy on heroku. But now you can have the same (well, almost the same, since we're not gonna patch SSH) awesomely smooth git push deploys on whatever server you have SSH access to. Blazing helps you to create and distribute your post-receive hooks, which are executed on the remote server after you successfully pushed to it. It also helps you to easily set up remote repositories for deploying to, is extendable by recipes and is configured by a nice DSL.
10
+ Not everyone can or wants to deploy on heroku. But now you can have the same (well, almost the same, since we're not gonna patch SSH) awesomely smooth git push deploys on whatever server you have SSH access to. Blazing helps you to create and distribute your post-receive hooks, which are executed on the remote server after you successfully pushed to it. It also helps you to easily set up remote repositories for deploying to, is extendable by simple rake tasks and is configured by a nice DSL.
9
11
 
10
12
  Quickstart
11
13
  ----------
@@ -17,181 +19,56 @@ Features
17
19
 
18
20
  Out of the box, blazing can do the following:
19
21
 
22
+ * **uses ruby, but works for deploying pretty much anything else just as well**
20
23
  * set up a repository you can push to for deployment
21
24
  * set up a git post-receive hook, configurable by a simple DSL
22
25
  * works with rvm/rbenv/chruby(and probably others)
23
- * uses bundler for dependency management
24
- * allows you to run custom rake tasks after deployment
25
- * is extendable by blazing recipes
26
-
27
- Overview & Background
28
- ---------------------
29
-
30
- Blazing is a deployment tool written in Ruby. It provides helpers to setup your project with a git post-receive hook, which is triggered every time you push to your production repository.
31
-
32
- I initially started working on an extension to capistrano which would cover most of my needs and the nees of my team. After a short while I noticed that bolting more functionality on top of capistrano was just going to be messy (and a PTA to maintain). We were alerady using tons of own recipes and customizations, capistrano multistage, capistrano-ext, etc.
33
-
34
- I had a look at what others were doing and after a round of trying around and not getting what I wanted, I started this.
35
-
36
- #### Design Goals
37
-
38
- When I started working on blazing, I had some design goals in mind which I think should stay relevant for this project:
39
-
40
- - it must be well tested
41
- - it must stay robust, simple and with small code base with as few moving parts as possible. Minimum code in the main project, extensions live outside.
42
- - no messy rake scripts: Define the desired behavior trough a DSL, and extensions add to this DSL in a clean and modular way
43
- - Deployments should be fast
44
-
45
- #### Inspiration & Alternatives
46
-
47
- 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
48
- years. Then got inspired by defunkt's
49
- [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) (which was a great inspiration and resource) and [pushand](https://github.com/remi/pushand.git) by remi. If you don't like blazing, you might give them a try.
26
+ * allows you to run custom rake tasks during deployment
27
+ * Makes it easy to ssh to target directory on server with env variables
28
+ set
50
29
 
51
30
  Usage
52
31
  -----
53
32
 
54
- #### Installation
55
-
56
- Your machine should be setup with ruby, rubygems, bundler and git. Install blazing by adding it to your `Gemfile` or run `gem install blazing`. The basic assumption from now on will be that you are working on a project with bundler and a Gemfile. Support for other ways to handle dependencies might be added in the future but **at the moment bundler is required**.
57
-
58
- #### blazing Commands
59
-
60
- ##### `blazing init`
61
-
62
- Generate a blazing config file
63
-
64
- ##### `blazing setup <target>`
65
-
66
- Setup target repository for deployment and add git remote localy. Use 'all' as target name to update all configured targets at once.
67
-
68
- ##### `blazing update <target>`
69
-
70
- Update post-receive hook according to current config. Run it after changing the blazing config. Use 'all' as target name to update all configured targets at once.
71
-
72
- ##### `blazing list`
73
-
74
- List available recipes
75
-
76
- ##### `blazing recipes`
77
-
78
- Run the configured recipes (used on deployment target, can be used to test recipes localy)
79
-
80
- The `setup` and `update` commands also take 'all' as an option. This will perform the action on all your defined targets.
33
+ ### Installation
81
34
 
82
- #### Configuration (blazing DSL)
35
+ Make sure you have bundler available on your local machine as well as on
36
+ the server you are deploying to.
83
37
 
84
- ```ruby
85
- # Sample target definition:
86
- #
87
- # target <target_name>, <target_location>, [options]
88
- #
89
- # The options provided in the target definition will override any
90
- # options provided in the recipe call.
91
- #
92
- # Options recognized by blazing core:
93
- # rails_env: used when calling the rake task after deployment
38
+ ### blazing Commands
94
39
 
95
- target :staging, 'user@server:/var/www/someproject.com',
96
- :recipe_specific_option => 'foo', :rails_env => 'production'
97
-
98
-
99
- # Sample rvm setup:
100
- #
101
- # rvm <rvm-string>
102
- #
103
- # Setting the rvm string will make sure that the correct rvm ruby and
104
- # gemset is used before the post-receive hook does anything at all.
105
- # Use :rvmrc as rvm string if you want blazing to use the rvm
106
- # environment specified in your project's .rvmrc file.
107
-
108
- rvm 'ruby-1.9.3@some-gemset'
109
-
110
-
111
- # Sample config for custom rvm location:
112
- #
113
- # rvm_scripts <path_to_rvm_scripts>
114
- #
115
- # If you have installed rvm to a custom location, use this method to
116
- # specify where the rvm scripts are located.
117
-
118
- rvm_scripts '/opt/rvm/scripts/rvm'
119
-
120
-
121
- # Sample rbenv/chruby/other setup:
122
- #
123
- # env_scripts <path_to_version_manager_script>
124
- #
125
- # If you need to source a file for your non-rvm version manager to
126
- # you can do that with env_scripts. You should also remove the
127
- # rvm/rvm_scripts options above.
128
-
129
- env_scripts '/etc/profile.d/rbenv.sh'
130
-
131
- # Sample recipe setup:
132
- #
133
- # recipe <recipe_name>, [options]
134
- #
135
- # The given recipe will be called with the provided options. Refer to each
136
- # recipe's documentation for available options. Options provided here
137
- # may be overridden by target specific options.
138
- # Recipes will be executed in the order they are defined!yy
139
-
140
- recipe :precompile_assets, :recipe_specific_option => 'bar'
40
+ ```
41
+ Commands:
42
+ blazing goto [TARGET] # Open ssh session on target. Use -c to specify a command to be run
43
+ blazing help [COMMAND] # Describe available commands or one specific command
44
+ blazing init # Generate a sample blazing config file
45
+ blazing setup [TARGET] # Setup local and remote repository/repositories for deployment
46
+ blazing update [TARGET] # Re-Generate and upload hook based on current configuration
47
+ blazing version # Show the blazing version
48
+ ```
141
49
 
50
+ **Always remember to update your hooks after updating blazing**
142
51
 
143
- # Sample rake file config:
144
- #
145
- # rake <task>, [environment variables]
146
- #
147
- # The provided rake task will be run after all recipes have run.
148
- # Note: you can only call a single rake task. If you need to run several
149
- # tasks just create one task that wrapps all the others.
52
+ ### Configuration (blazing DSL)
150
53
 
151
- rake :post_deploy, 'RAILS_ENV=production'
152
- ```
54
+ Run blazing init in your project to generate a config file or look at
55
+ [the sample config
56
+ template](https://github.com/effkay/blazing/blob/master/lib/blazing/templates/config.erb)
153
57
 
154
- #### Deploying
58
+ ### Deploying
155
59
 
156
60
  Just push to your remote… so if you set up a target named `production`, use `git push production master` to deploy your master branch there.
157
61
 
158
62
  Recipes
159
63
  -------
160
64
 
161
- Blazing only offers a small set of core features. However, it is extendable by recipes.
162
-
163
- #### Available Recipes
164
-
165
- * [blazing-passenger](https://github.com/effkay/blazing-passenger)
166
- * [blazing-rails](https://github.com/effkay/blazing-rails)
167
-
168
- #### Creating a blazing Recipe
169
-
170
- Creating a blazing recipe is very easy. There are some ground rules:
171
-
172
- * recipes should live in gems called `blazing-<somename>`
173
- * blazing converts the symbol given in the config to the class name and calls run on it. So if you have `recipe :passenger_restart` blazing will try to run `Blazing::Recipe::PassengerRestart.run` with the options provided.
174
- * Recipes should live in the `Blazing::Recipe` namespace and inherit from `Blazing::Recipe` as well
175
- * Recipes are run in the order they are specified in the config, so there is no way to handle inter-recipe dependencies yet.
176
- * Make sure your recipe classes are loaded when the recipe gem itself is
177
- loaded
178
- * A minimal recipe implementation might look like this:
179
-
180
- ```ruby
181
- class Blazing::Recipe::Example < Blazing::Recipe
182
- def run(target_options = {})
183
- super target_options
184
- # do some stuff
185
- # access options with @options[:key]
186
- end
187
- end
188
- ```
189
- Please have a look at [blazing-passenger](https://github.com/effkay/blazing-passenger) to get an idea of how to implement your recipe.
65
+ Recipes have been removed from blazing.
190
66
 
191
67
  Authors
192
68
  -------
193
69
 
194
- Felipe Kaufmann ([@effkay][])
70
+ * Felipe Kaufmann ([@effkay][])
71
+ * Alexander Adam ([@alexanderadam][])
195
72
 
196
73
  License
197
74
  -------
@@ -199,3 +76,4 @@ License
199
76
  See the [MIT-LICENSE file](https://github.com/effkay/blazing/blob/master/MIT-LICENCE)
200
77
 
201
78
  [@effkay]: https://github.com/effkay
79
+ [@alexanderadam]: https://github.com/alexanderadam