pulsar 0.3.5 → 1.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +150 -0
- data/.ruby-version +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +4 -265
- data/bin/pulsar +1 -1
- data/circle.yml +22 -0
- data/lib/pulsar.rb +28 -7
- data/lib/pulsar/cli.rb +79 -0
- data/lib/pulsar/constants.rb +5 -0
- data/lib/pulsar/generators/initial_repo/Gemfile +3 -0
- data/lib/pulsar/generators/{init_repo → initial_repo}/README.md +1 -1
- data/lib/pulsar/generators/initial_repo/apps/Capfile +8 -0
- data/lib/pulsar/generators/initial_repo/apps/deploy.rb +35 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/Capfile +18 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/deploy.rb +4 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/production.rb +3 -0
- data/lib/pulsar/generators/initial_repo/apps/your_app/staging.rb +3 -0
- data/lib/pulsar/generators/initial_repo/recipes/generic/rake.rake +12 -0
- data/lib/pulsar/generators/{init_repo/apps/your_app/recipes/production → initial_repo/recipes/rails}/.gitkeep +0 -0
- data/lib/pulsar/interactors/add_applications.rb +48 -0
- data/lib/pulsar/interactors/cleanup.rb +9 -0
- data/lib/pulsar/interactors/clone_repository.rb +50 -0
- data/lib/pulsar/interactors/copy_environment_file.rb +30 -0
- data/lib/pulsar/interactors/copy_initial_repository.rb +22 -0
- data/lib/pulsar/interactors/create_capfile.rb +32 -0
- data/lib/pulsar/interactors/create_deploy_file.rb +32 -0
- data/lib/pulsar/interactors/create_run_dirs.rb +21 -0
- data/lib/pulsar/interactors/identify_repository_location.rb +23 -0
- data/lib/pulsar/interactors/identify_repository_type.rb +34 -0
- data/lib/pulsar/interactors/run_bundle_install.rb +28 -0
- data/lib/pulsar/interactors/run_capistrano.rb +30 -0
- data/lib/pulsar/organizers/deploy.rb +16 -0
- data/lib/pulsar/organizers/install.rb +7 -0
- data/lib/pulsar/organizers/list.rb +12 -0
- data/lib/pulsar/version.rb +1 -1
- data/pulsar.gemspec +13 -11
- data/spec/features/deploy_spec.rb +162 -0
- data/spec/features/install_spec.rb +66 -0
- data/spec/features/list_spec.rb +140 -0
- data/spec/spec_helper.rb +26 -14
- data/{lib/pulsar/generators/init_repo/apps/your_app/recipes/staging → spec/support/dummies}/.gitkeep +0 -0
- data/spec/support/dummies/conf/dir/Gemfile +3 -0
- data/spec/support/dummies/conf/dir/apps/Capfile +9 -0
- data/spec/support/dummies/conf/dir/apps/blog/Capfile +1 -0
- data/spec/support/dummies/conf/dir/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/blog/staging.rb +4 -0
- data/spec/support/dummies/conf/dir/apps/deploy.rb +1 -0
- data/{lib/pulsar/generators/init_repo/recipes/rails/.gitkeep → spec/support/dummies/conf/dir/apps/ecommerce/staging.rb} +0 -0
- data/spec/support/dummies/conf/dir/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/dotenv +1 -0
- data/spec/support/dummies/conf/empty/apps/.gitkeep +0 -0
- data/spec/support/dummies/conf/empty/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/wrong_bundle/Gemfile +3 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/Capfile +9 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/Capfile +1 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/wrong_bundle/apps/deploy.rb +1 -0
- data/spec/support/dummies/conf/wrong_bundle/recipes/.gitkeep +0 -0
- data/spec/support/dummies/conf/wrong_cap/Gemfile +3 -0
- data/spec/support/dummies/conf/wrong_cap/apps/Capfile +0 -0
- data/spec/support/dummies/conf/wrong_cap/apps/blog/deploy.rb +4 -0
- data/spec/support/dummies/conf/wrong_cap/apps/blog/production.rb +4 -0
- data/spec/support/dummies/conf/wrong_cap/apps/deploy.rb +1 -0
- data/spec/support/dummies/conf/wrong_cap/recipes/.gitkeep +0 -0
- data/spec/units/cli/deploy_spec.rb +116 -0
- data/spec/units/cli/install_spec.rb +44 -0
- data/spec/units/cli/list_spec.rb +107 -0
- data/spec/units/constants_spec.rb +21 -0
- data/spec/units/interactors/add_applications_spec.rb +46 -0
- data/spec/units/interactors/cleanup_spec.rb +21 -0
- data/spec/units/interactors/clone_initial_repository_spec.rb +41 -0
- data/spec/units/interactors/clone_repository_spec.rb +122 -0
- data/spec/units/interactors/copy_environment_file_spec.rb +80 -0
- data/spec/units/interactors/create_capfile_spec.rb +77 -0
- data/spec/units/interactors/create_deploy_file_spec.rb +70 -0
- data/spec/units/interactors/create_run_dirs_spec.rb +47 -0
- data/spec/units/interactors/identify_repository_location_spec.rb +49 -0
- data/spec/units/interactors/identify_repository_type_spec.rb +85 -0
- data/spec/units/interactors/run_bundle_install_spec.rb +60 -0
- data/spec/units/interactors/run_capistrano_spec.rb +92 -0
- data/spec/units/organizers/deploy_spec.rb +28 -0
- data/spec/units/organizers/install_spec.rb +13 -0
- data/spec/units/organizers/list_spec.rb +24 -0
- metadata +179 -106
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -17
- data/bin/pulsar-utils +0 -5
- data/lib/pulsar/commands/all.rb +0 -6
- data/lib/pulsar/commands/init.rb +0 -23
- data/lib/pulsar/commands/list.rb +0 -19
- data/lib/pulsar/commands/main.rb +0 -64
- data/lib/pulsar/commands/utils.rb +0 -14
- data/lib/pulsar/generators/init_repo/Gemfile +0 -7
- data/lib/pulsar/generators/init_repo/apps/base.rb +0 -41
- data/lib/pulsar/generators/init_repo/apps/your_app/defaults.rb +0 -9
- data/lib/pulsar/generators/init_repo/apps/your_app/production.rb +0 -12
- data/lib/pulsar/generators/init_repo/apps/your_app/recipes/custom_recipe.rb +0 -14
- data/lib/pulsar/generators/init_repo/apps/your_app/staging.rb +0 -12
- data/lib/pulsar/generators/init_repo/recipes/generic/cleanup.rb +0 -50
- data/lib/pulsar/generators/init_repo/recipes/generic/utils.rb +0 -9
- data/lib/pulsar/helpers/all.rb +0 -8
- data/lib/pulsar/helpers/capistrano.rb +0 -47
- data/lib/pulsar/helpers/clamp.rb +0 -223
- data/lib/pulsar/helpers/path.rb +0 -71
- data/lib/pulsar/helpers/shell.rb +0 -31
- data/lib/pulsar/options/all.rb +0 -6
- data/lib/pulsar/options/conf_repo.rb +0 -41
- data/lib/pulsar/options/shared.rb +0 -15
- data/spec/pulsar/commands/init_spec.rb +0 -10
- data/spec/pulsar/commands/list_spec.rb +0 -127
- data/spec/pulsar/commands/main_spec.rb +0 -360
- data/spec/pulsar/commands/utils_spec.rb +0 -33
- data/spec/pulsar/helpers/capistrano_spec.rb +0 -70
- data/spec/pulsar/helpers/clamp_spec.rb +0 -105
- data/spec/pulsar/helpers/shell_spec.rb +0 -11
- data/spec/support/dummies/dummy_app/config.ru +0 -3
- data/spec/support/dummies/dummy_conf/Gemfile +0 -4
- data/spec/support/dummies/dummy_conf/apps/base.rb +0 -46
- data/spec/support/dummies/dummy_conf/apps/dummy_app/custom_stage.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/dummy_app/defaults.rb +0 -7
- data/spec/support/dummies/dummy_conf/apps/dummy_app/production.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/production/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/staging/custom_recipe.rb +0 -1
- data/spec/support/dummies/dummy_conf/apps/dummy_app/staging.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/custom_stage.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/defaults.rb +0 -7
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/production.rb +0 -5
- data/spec/support/dummies/dummy_conf/apps/other_dummy_app/staging.rb +0 -5
- data/spec/support/dummies/dummy_conf/recipes/generic/recipe.rb +0 -3
- data/spec/support/modules/helpers.rb +0 -85
- data/spec/support/modules/output_capture.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 921914916a66521e123a39711c7b62f7336cb901
|
|
4
|
+
data.tar.gz: 15e6595fcaa432a63321128e515cfd2141af9ec3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7c0a941f8cce88aadf721b9d5dda5a98169be84853447dfd061046c3a6475fc667eb519019eb324b65922e93814d7b85ac01ca69994c8af82dba23e8d1bfe0b
|
|
7
|
+
data.tar.gz: e508f7f5149735f13802e5506c33ae592a3ffb08a11eb2254b3fea1d6b2d08560b05a056ebeadab78f1689db59514754e1f9224e06de6078d5ef00c1db9910e1
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,155 @@
|
|
|
1
|
+
Style/FrozenStringLiteralComment:
|
|
2
|
+
Enabled: false
|
|
3
|
+
|
|
4
|
+
Metrics/ModuleLength:
|
|
5
|
+
Exclude:
|
|
6
|
+
- "spec/**/*.rb"
|
|
7
|
+
|
|
8
|
+
Metrics/BlockLength:
|
|
9
|
+
Exclude:
|
|
10
|
+
- "spec/**/*.rb"
|
|
11
|
+
|
|
12
|
+
# Relaxed.Ruby.Style
|
|
13
|
+
|
|
14
|
+
Style/Alias:
|
|
15
|
+
Enabled: false
|
|
16
|
+
StyleGuide: http://relaxed.ruby.style/#stylealias
|
|
17
|
+
|
|
18
|
+
Style/BeginBlock:
|
|
19
|
+
Enabled: false
|
|
20
|
+
StyleGuide: http://relaxed.ruby.style/#stylebeginblock
|
|
21
|
+
|
|
22
|
+
Style/BlockDelimiters:
|
|
23
|
+
Enabled: false
|
|
24
|
+
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
|
|
25
|
+
|
|
1
26
|
Style/Documentation:
|
|
2
27
|
Enabled: false
|
|
28
|
+
StyleGuide: http://relaxed.ruby.style/#styledocumentation
|
|
29
|
+
|
|
30
|
+
Style/DotPosition:
|
|
31
|
+
Enabled: false
|
|
32
|
+
StyleGuide: http://relaxed.ruby.style/#styledotposition
|
|
33
|
+
|
|
34
|
+
Style/DoubleNegation:
|
|
35
|
+
Enabled: false
|
|
36
|
+
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
|
|
37
|
+
|
|
38
|
+
Style/EndBlock:
|
|
39
|
+
Enabled: false
|
|
40
|
+
StyleGuide: http://relaxed.ruby.style/#styleendblock
|
|
41
|
+
|
|
42
|
+
Style/FormatString:
|
|
43
|
+
Enabled: false
|
|
44
|
+
StyleGuide: http://relaxed.ruby.style/#styleformatstring
|
|
45
|
+
|
|
46
|
+
Style/IfUnlessModifier:
|
|
47
|
+
Enabled: false
|
|
48
|
+
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
|
|
49
|
+
|
|
50
|
+
Style/Lambda:
|
|
51
|
+
Enabled: false
|
|
52
|
+
StyleGuide: http://relaxed.ruby.style/#stylelambda
|
|
53
|
+
|
|
54
|
+
Style/ModuleFunction:
|
|
55
|
+
Enabled: false
|
|
56
|
+
StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
|
|
57
|
+
|
|
58
|
+
Style/MultilineBlockChain:
|
|
59
|
+
Enabled: false
|
|
60
|
+
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
|
|
61
|
+
|
|
62
|
+
Style/NegatedIf:
|
|
63
|
+
Enabled: false
|
|
64
|
+
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
|
|
65
|
+
|
|
66
|
+
Style/NegatedWhile:
|
|
67
|
+
Enabled: false
|
|
68
|
+
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
|
|
69
|
+
|
|
70
|
+
Style/ParallelAssignment:
|
|
71
|
+
Enabled: false
|
|
72
|
+
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
|
|
73
|
+
|
|
74
|
+
Style/PercentLiteralDelimiters:
|
|
75
|
+
Enabled: false
|
|
76
|
+
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
|
|
77
|
+
|
|
78
|
+
Style/PerlBackrefs:
|
|
79
|
+
Enabled: false
|
|
80
|
+
StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
|
|
81
|
+
|
|
82
|
+
Style/Semicolon:
|
|
83
|
+
Enabled: false
|
|
84
|
+
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
|
|
85
|
+
|
|
86
|
+
Style/SignalException:
|
|
87
|
+
Enabled: false
|
|
88
|
+
StyleGuide: http://relaxed.ruby.style/#stylesignalexception
|
|
89
|
+
|
|
90
|
+
Style/SingleLineBlockParams:
|
|
91
|
+
Enabled: false
|
|
92
|
+
StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
|
|
93
|
+
|
|
94
|
+
Style/SingleLineMethods:
|
|
95
|
+
Enabled: false
|
|
96
|
+
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
|
|
97
|
+
|
|
98
|
+
Style/SpaceBeforeBlockBraces:
|
|
99
|
+
Enabled: false
|
|
100
|
+
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
|
|
101
|
+
|
|
102
|
+
Style/SpaceInsideParens:
|
|
103
|
+
Enabled: false
|
|
104
|
+
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
|
|
3
105
|
|
|
4
106
|
Style/SpecialGlobalVars:
|
|
5
107
|
Enabled: false
|
|
108
|
+
StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
|
|
109
|
+
|
|
110
|
+
Style/StringLiterals:
|
|
111
|
+
Enabled: false
|
|
112
|
+
StyleGuide: http://relaxed.ruby.style/#stylestringliterals
|
|
113
|
+
|
|
114
|
+
Style/TrailingCommaInLiteral:
|
|
115
|
+
Enabled: false
|
|
116
|
+
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
|
|
117
|
+
|
|
118
|
+
Style/WhileUntilModifier:
|
|
119
|
+
Enabled: false
|
|
120
|
+
StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
|
|
121
|
+
|
|
122
|
+
Lint/AmbiguousRegexpLiteral:
|
|
123
|
+
Enabled: false
|
|
124
|
+
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
|
|
125
|
+
|
|
126
|
+
Lint/AssignmentInCondition:
|
|
127
|
+
Enabled: false
|
|
128
|
+
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
|
|
129
|
+
|
|
130
|
+
Metrics/AbcSize:
|
|
131
|
+
Enabled: false
|
|
132
|
+
|
|
133
|
+
Metrics/BlockNesting:
|
|
134
|
+
Enabled: false
|
|
135
|
+
|
|
136
|
+
Metrics/ClassLength:
|
|
137
|
+
Enabled: false
|
|
138
|
+
|
|
139
|
+
Metrics/ModuleLength:
|
|
140
|
+
Enabled: false
|
|
141
|
+
|
|
142
|
+
Metrics/CyclomaticComplexity:
|
|
143
|
+
Enabled: false
|
|
144
|
+
|
|
145
|
+
Metrics/LineLength:
|
|
146
|
+
Enabled: false
|
|
147
|
+
|
|
148
|
+
Metrics/MethodLength:
|
|
149
|
+
Enabled: false
|
|
150
|
+
|
|
151
|
+
Metrics/ParameterLists:
|
|
152
|
+
Enabled: false
|
|
153
|
+
|
|
154
|
+
Metrics/PerceivedComplexity:
|
|
155
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.4.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Pulsar
|
|
1
|
+
# Pulsar
|
|
2
2
|
|
|
3
3
|
The easy [Capistrano](https://rubygems.org/gems/capistrano) deploy and configuration manager.
|
|
4
4
|
|
|
@@ -11,272 +11,11 @@ have all your application dependencies installed). This lets you integrate Pulsa
|
|
|
11
11
|
Some of the benefits of using Pulsar:
|
|
12
12
|
* No capistrano configurations in the application code
|
|
13
13
|
* No need to have the application locally to deploy
|
|
14
|
-
* Multistage support by default
|
|
15
14
|
* Every recipe can be shared between all applications
|
|
16
15
|
* Can easily be integrated with other tools
|
|
17
16
|
* Write the least possible code to deploy
|
|
18
17
|
|
|
19
|
-
##
|
|
18
|
+
## Capistrano support
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
$ gem install pulsar
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This will install two commands: `pulsar` and `pulsar-utils`. The first command is required to run capistrano,
|
|
28
|
-
the other is for everything else.
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
You'll need to create your own configuration repo:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
$ pulsar-utils init ~/Desktop/pulsar-conf
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
This will create a basic start point for building your configuration repository. As soon as you're done configuring
|
|
39
|
-
you should consider storing this folder as an actual git repository.
|
|
40
|
-
|
|
41
|
-
Here it is possible to see how this configuration repository will look like: [Pulsar Conf Demo](http://github.com/nebulab/pulsar-conf-demo)
|
|
42
|
-
|
|
43
|
-
**NOTE**: Pulsar only supports git and *nix systems.
|
|
44
|
-
|
|
45
|
-
## Configuration
|
|
46
|
-
|
|
47
|
-
This is an example repository configuration layout:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
pulsar-conf/
|
|
51
|
-
|── Gemfile
|
|
52
|
-
├── Gemfile.lock
|
|
53
|
-
├── apps
|
|
54
|
-
│ ├── base.rb
|
|
55
|
-
│ └── my_application
|
|
56
|
-
│ ├── defaults.rb
|
|
57
|
-
│ ├── production.rb
|
|
58
|
-
│ ├── recipes
|
|
59
|
-
│ │ └── custom_recipe.rb
|
|
60
|
-
│ └── staging.rb
|
|
61
|
-
└── recipes
|
|
62
|
-
├── generic
|
|
63
|
-
│ ├── cleanup.rb
|
|
64
|
-
│ ├── maintenance_mode.rb
|
|
65
|
-
│ ├── notify.rb
|
|
66
|
-
│ └── utils.rb
|
|
67
|
-
├── rails
|
|
68
|
-
│ ├── passenger.rb
|
|
69
|
-
│ ├── repair_permissions.rb
|
|
70
|
-
│ ├── symlink_configs.rb
|
|
71
|
-
│ ├── unicorn.rb
|
|
72
|
-
│ └── whenever.rb
|
|
73
|
-
└── spree_1
|
|
74
|
-
└── symlink_assets.rb
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Pulsar uses these files to build capistrano configurations on the fly, depending on how you invoke the `pulsar` command.
|
|
78
|
-
Since Pulsar it's basically a capistrano wrapper, the content of these files is plain old capistrano syntax.
|
|
79
|
-
|
|
80
|
-
### _apps_ directory
|
|
81
|
-
|
|
82
|
-
This directory contains your application configurations. You'll have one directory per application.
|
|
83
|
-
|
|
84
|
-
* `base.rb` has configurations that are shared by all applications
|
|
85
|
-
* `my_application/defaults.rb` includes configuration shared by every stage of the application
|
|
86
|
-
* `my_application/staging.rb` and `my_application/production.rb` files include stage configurations
|
|
87
|
-
* `my_application/recipes/` are recipes that are always included for that application (no need to use `load_recipes`)
|
|
88
|
-
|
|
89
|
-
### _recipes_ directory
|
|
90
|
-
|
|
91
|
-
This directory contains your recipes. You can create any number of directories to organize your recipes.
|
|
92
|
-
To load a recipe from your configurations you can use the `load_recipes` helper:
|
|
93
|
-
|
|
94
|
-
```ruby
|
|
95
|
-
#
|
|
96
|
-
# Somewhere inside apps/
|
|
97
|
-
#
|
|
98
|
-
load_recipes do
|
|
99
|
-
rails :repair_permissions, :unicorn
|
|
100
|
-
generic :cleanup, :utils
|
|
101
|
-
end
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
This will use capistrano's `load` method to include recipes from `rails/` and `generic/`.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
Another way to include your recipes is by using the `Gemfile`. Many gems already include custom recipes for capistrano so
|
|
109
|
-
you just need to require those. An example with [Whenever](https://github.com/javan/whenever):
|
|
110
|
-
|
|
111
|
-
```ruby
|
|
112
|
-
#
|
|
113
|
-
# Inside Gemfile
|
|
114
|
-
#
|
|
115
|
-
gem 'whenever'
|
|
116
|
-
|
|
117
|
-
#
|
|
118
|
-
# Inside recipes/rails/whenever.rb
|
|
119
|
-
#
|
|
120
|
-
require 'whenever/capistrano'
|
|
121
|
-
|
|
122
|
-
set :whenever_command, "bundle exec whenever"
|
|
123
|
-
|
|
124
|
-
#
|
|
125
|
-
# Somewhere inside apps/
|
|
126
|
-
#
|
|
127
|
-
load_recipes do
|
|
128
|
-
rails :whenever
|
|
129
|
-
end
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
You can specify some recipes to be loaded only when you run Pulsar from inside a Rack application directory.
|
|
135
|
-
This is useful with recipes that require something inside that directory (like retrieving the database/assets
|
|
136
|
-
from a staging environment).
|
|
137
|
-
|
|
138
|
-
You can do that like this:
|
|
139
|
-
|
|
140
|
-
```ruby
|
|
141
|
-
#
|
|
142
|
-
# Somewhere inside apps/
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
#
|
|
146
|
-
# These recipes will be available only if you're running
|
|
147
|
-
# Pulsar inside a Rack application (like Rails) directory
|
|
148
|
-
#
|
|
149
|
-
load_recipes(app_only: true) do
|
|
150
|
-
rails :assets_pull, :database_pull
|
|
151
|
-
end
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Loading the repository
|
|
155
|
-
|
|
156
|
-
Once the repository is ready, you'll need to tell Pulsar where it is. The repository location can be specified either
|
|
157
|
-
as a full git path or a github repository path (`gh-user/pulsar-conf`).
|
|
158
|
-
|
|
159
|
-
Since Pulsar requires the repository for everything, there are multiple ways to store this information so that
|
|
160
|
-
you don't have to type it everytime. You can also use local repository, which is useful while developing your
|
|
161
|
-
deployment.
|
|
162
|
-
|
|
163
|
-
You have three possibilities:
|
|
164
|
-
|
|
165
|
-
* `-c` command line option
|
|
166
|
-
* `PULSAR_CONF_REPO` environment variable
|
|
167
|
-
* `~/.pulsar/config` configuration file
|
|
168
|
-
|
|
169
|
-
The fastest way is probably the `.pulsar/config` file inside your home directory:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
#
|
|
173
|
-
# Inside ~/.pulsar/config
|
|
174
|
-
#
|
|
175
|
-
PULSAR_CONF_REPO="gh-user/pulsar-conf"
|
|
176
|
-
|
|
177
|
-
#
|
|
178
|
-
# You can use local repository for development so you don't need to push changes every time
|
|
179
|
-
#
|
|
180
|
-
# PULSAR_CONF_REPO="/full/path/to/repository"
|
|
181
|
-
|
|
182
|
-
#
|
|
183
|
-
# Also supported
|
|
184
|
-
#
|
|
185
|
-
# PULSAR_CONF_REPO="git://github.com/gh-user/pulsar-conf.git"
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Pulsar will read this file and set the environment variables properly.
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
If you don't want to add another file to your home directory you can export the variables yourself:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
#
|
|
196
|
-
# Inside ~/.bash_profile or ~/.zshrc
|
|
197
|
-
#
|
|
198
|
-
export PULSAR_CONF_REPO="gh-user/pulsar-conf"
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Usage
|
|
202
|
-
|
|
203
|
-
After the repository is ready, running Pulsar is straightforward. To deploy `my_application` to `production`:
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
$ pulsar my_application production
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
As a rule of thumb, anything that's added at the end of the command is passed to capistrano. Some examples:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
$ pulsar my_application production --tasks
|
|
213
|
-
|
|
214
|
-
$ pulsar my_application staging deploy:migrations
|
|
215
|
-
|
|
216
|
-
$ pulsar my_application staging shell
|
|
217
|
-
|
|
218
|
-
#
|
|
219
|
-
# Deploy multiple apps by using commas
|
|
220
|
-
#
|
|
221
|
-
$ pulsar my_app1,my_app2,my_app3 production
|
|
222
|
-
|
|
223
|
-
#
|
|
224
|
-
# Deploy multiple apps by using pattern matching
|
|
225
|
-
# (uses Dir.glob)
|
|
226
|
-
#
|
|
227
|
-
$ pulsar my_app* production
|
|
228
|
-
# or
|
|
229
|
-
$ pulsar *worker staging
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Running inside a Rack application (e.g. Ruby on Rails application)
|
|
234
|
-
|
|
235
|
-
In case you frequently work from a Rack application and would like a workflow similar to that of capistrano, Pulsar
|
|
236
|
-
supports running from inside a Rack application directory. If you use this a lot, you should consider installing
|
|
237
|
-
Pulsar via the application `Gemfile`.
|
|
238
|
-
|
|
239
|
-
When deploying from inside a Rack application you can omit the application name:
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
$ cd /path/to/my_application
|
|
243
|
-
|
|
244
|
-
$ pulsar production
|
|
245
|
-
|
|
246
|
-
$ pulsar staging deploy:migrations
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
If you need a particular configuration for an application you can store a `.pulsar` file inside the application
|
|
252
|
-
directory:
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
#
|
|
256
|
-
# Inside /path/to/my_application/.pulsar
|
|
257
|
-
#
|
|
258
|
-
PULSAR_CONF_REPO="gh-user/pulsar-conf"
|
|
259
|
-
|
|
260
|
-
#
|
|
261
|
-
# If the application directory name is different than what
|
|
262
|
-
# you configured inside the Pulsar configuration repository
|
|
263
|
-
#
|
|
264
|
-
# PULSAR_APP_NAME="my-application"
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
## Integrations
|
|
268
|
-
|
|
269
|
-
Pulsar is easy to integrate, you just need access to the configurations repository and the ability to
|
|
270
|
-
run a command.
|
|
271
|
-
|
|
272
|
-
### Hubot
|
|
273
|
-
|
|
274
|
-
https://gist.github.com/mtylty/5324075
|
|
275
|
-
|
|
276
|
-
## Contributing
|
|
277
|
-
|
|
278
|
-
1. Fork it
|
|
279
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
280
|
-
3. Commit your changes with tests (`git commit -am 'Add some feature'`)
|
|
281
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
282
|
-
5. Create new Pull Request
|
|
20
|
+
This version of Pulsar, version `1.0.0` only supports Capistrano v3. If you're looking for Capistrano v2 support you can
|
|
21
|
+
use Pulsar version `0.3.5` but, take care, that version is not maintained anymore.
|