pulsar 0.0.5 → 0.0.6

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.
data/README.md CHANGED
@@ -1,49 +1,19 @@
1
1
  # Pulsar
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/nebulab/pulsar.png?branch=master)](http://travis-ci.org/nebulab/pulsar)
4
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/nebulab/pulsar)
4
+ [![Code Climate](https://codeclimate.com/github/nebulab/pulsar.png)](https://codeclimate.com/github/nebulab/pulsar)
5
5
 
6
- NebuLab's central capistrano deploy resource.
6
+ Pulsar is a little tool that helps with deploys. Its main purpose is building capfiles for [Capistrano](https://rubygems.org/gems/capistrano)
7
+ to run. It makes it easy to manage a large number of apps via a separate configuration repository.
7
8
 
9
+ ## Installation & Usage
8
10
 
9
- A quick example. To run any cap command for an application specified in a configuration repo you can run:
10
-
11
- ```
12
- pulsar -c=<configuration-repo-git-url> <application> <stage> <capistrano_args>
13
- ```
14
-
15
- A couple of concrete examples:
16
-
17
- ```
18
- pulsar -c git@github.com:nebulab/deploy-configuration.git nebulab production --tasks
19
-
20
- pulsar -c git@github.com:nebulab/deploy-configuration.git nebulab staging # Deploy on staging
21
-
22
- pulsar -c git@github.com:nebulab/deploy-configuration.git farmavillage production deploy:check
23
- ```
24
-
25
- ## Installation
26
-
27
- Add this line to your application's Gemfile:
28
-
29
- gem 'pulsar'
30
-
31
- And then execute:
32
-
33
- $ bundle
34
-
35
- Or install it yourself as:
36
-
37
- $ gem install pulsar
38
-
39
- ## Usage
40
-
41
- TODO: Write usage instructions here
11
+ Refer to the [GitHub Page](http://pulsar.nebulab.it).
42
12
 
43
13
  ## Contributing
44
14
 
45
15
  1. Fork it
46
16
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
- 3. Commit your changes (`git commit -am 'Add some feature'`)
17
+ 3. Commit your changes with tests (`git commit -am 'Add some feature'`)
48
18
  4. Push to the branch (`git push origin my-new-feature`)
49
19
  5. Create new Pull Request
@@ -2,4 +2,5 @@ module Pulsar
2
2
  autoload :MainCommand, "pulsar/commands/main"
3
3
  autoload :CapCommand, "pulsar/commands/cap"
4
4
  autoload :ListCommand, "pulsar/commands/list"
5
+ autoload :InitCommand, "pulsar/commands/init"
5
6
  end
@@ -0,0 +1,21 @@
1
+ module Pulsar
2
+ class InitCommand < MainCommand
3
+ parameter "CONFIGURATION_PATH", "where to generate your configuration repository"
4
+
5
+ def execute
6
+ Bundler.with_clean_env do
7
+ destination_path = File.expand_path(configuration_path)
8
+
9
+ pulsar_cmd_path = File.expand_path(File.dirname(__FILE__))
10
+ init_repo_path = "#{pulsar_cmd_path}/../generators/init_repo"
11
+
12
+ init_repo_path += "/*" if File.directory?(destination_path)
13
+
14
+ run_cmd("cp -r #{init_repo_path} #{destination_path}", :verbose => verbose?)
15
+
16
+ puts "Your starter configuration repo is in #{destination_path.yellow}."
17
+ puts "Remember to run #{ "bundle install".red } to add the needed Gemfile.lock."
18
+ end
19
+ end
20
+ end
21
+ end
@@ -17,5 +17,6 @@ module Pulsar
17
17
  #
18
18
  subcommand "cap", "build a capfile from configuration repo and execute the cap command on it", CapCommand
19
19
  subcommand "list", "list all available apps and environments which you can deploy", ListCommand
20
+ subcommand "init", "generate a new configuration repo with some basic recipes to use with pulsar", InitCommand
20
21
  end
21
22
  end
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'pulsar'
4
+ gem 'capistrano'
5
+
6
+ gem 'colored'
7
+ gem 'spinning_cursor'
@@ -0,0 +1,4 @@
1
+ Pulsar Configuration
2
+ ====================
3
+
4
+ Pulsar deploy configurations
@@ -0,0 +1,41 @@
1
+ #
2
+ # Require everything and extend with additional modules
3
+ #
4
+ Bundler.require
5
+
6
+ extend Pulsar::Helpers::Capistrano
7
+
8
+ #
9
+ # Load deploy capistrano recipe
10
+ #
11
+ load 'deploy'
12
+
13
+ #
14
+ # Configure libraries/recipes from Gemfile
15
+ #
16
+ require 'bundler/capistrano'
17
+
18
+ #
19
+ # Load default recipes
20
+ #
21
+ load_recipes do
22
+ generic :cleanup, :rake
23
+ end
24
+
25
+ #
26
+ # Put here shared configuration that should be a default
27
+ # for all your apps
28
+ #
29
+
30
+ # set :scm, :git
31
+ # set :repository, defer { "git@github.com:your_gh_user/#{application}.git" }
32
+ # set :branch, "master"
33
+ # set :port, 22
34
+ # set :ssh_options, { :forward_agent => true }
35
+ # set :default_run_options, { :pty => true }
36
+ # set :deploy_to, defer { "/var/www/#{application}" }
37
+ # set :deploy_via, :remote_cache
38
+ # set :user, "www-data"
39
+ # set :use_sudo, false
40
+ # set :rake, "bundle exec rake"
41
+ # set :rails_env, defer { "#{stage}" }
@@ -0,0 +1,9 @@
1
+ set :application, "your_app"
2
+
3
+ load_recipes do
4
+ #
5
+ # Recipes you wish to include as defaults for both stages
6
+ # for example:
7
+ #
8
+ # rails :assets
9
+ end
@@ -0,0 +1,12 @@
1
+ server "your_app.com", :db, :web, :app, :primary => true
2
+
3
+ set :stage, "production"
4
+
5
+ load_recipes do
6
+ #
7
+ # Recipes you wish to include for production stage only
8
+ # for example:
9
+ #
10
+ # rails :fix_permissions, :symlink_db
11
+ # server :unicorn
12
+ end
@@ -0,0 +1,14 @@
1
+ #
2
+ # Use this directory to include any file you whish to
3
+ # include whenever you run this app.
4
+ #
5
+ # You don't need to run the include_recipe method.
6
+ #
7
+ # The filename can be whatever you want it to be.
8
+ #
9
+ # These recipes are considered custom and always appended
10
+ # to the Capfile of this application.
11
+ #
12
+ # production/ and staging/ directories will have recipes
13
+ # which are automatically included only in such stages.
14
+ #
@@ -0,0 +1,12 @@
1
+ server "staging.your_app.com", :db, :web, :app, :primary => true
2
+
3
+ set :stage, "staging"
4
+
5
+ load_recipes do
6
+ #
7
+ # Recipes you wish to include for staging stage only
8
+ # for example:
9
+ #
10
+ # server :passenger
11
+ # notify :campfire
12
+ end
@@ -0,0 +1,50 @@
1
+ if logger.level == Capistrano::Logger::IMPORTANT
2
+ arrow = "→".yellow.bold
3
+ ok = "✓".green
4
+
5
+ before "deploy:update_code" do
6
+ SpinningCursor.start do
7
+ banner "#{arrow} Updating Code"
8
+ message "#{arrow} Updating Code #{ok}"
9
+ end
10
+ end
11
+
12
+ before "bundle:install" do
13
+ SpinningCursor.start do
14
+ banner "#{arrow} Installing Gems"
15
+ message "#{arrow} Installing Gems #{ok}"
16
+ end
17
+ end
18
+
19
+ before "deploy:assets:symlink" do
20
+ SpinningCursor.start do
21
+ banner "#{arrow} Symlinking Assets"
22
+ message "#{arrow} Symlinking Assets #{ok}"
23
+ end
24
+ end
25
+
26
+ before "deploy:assets:precompile" do
27
+ SpinningCursor.start do
28
+ banner "#{arrow} Compiling Assets"
29
+ message "#{arrow} Compiling Assets #{ok}"
30
+ end
31
+ end
32
+
33
+ before "deploy:create_symlink" do
34
+ SpinningCursor.start do
35
+ banner "#{arrow} Symlinking Application"
36
+ message "#{arrow} Symlinking Application #{ok}"
37
+ end
38
+ end
39
+
40
+ before "deploy:restart" do
41
+ SpinningCursor.start do
42
+ banner "#{arrow} Restarting Webserver"
43
+ message "#{arrow} Restarting Webserver #{ok}"
44
+ end
45
+ end
46
+
47
+ after "deploy" do
48
+ SpinningCursor.stop
49
+ end
50
+ end
@@ -0,0 +1,6 @@
1
+ namespace :rake do
2
+ desc "Invoke your awesome rake tasks!"
3
+ task :invoke, :roles => :web do
4
+ run("cd #{deploy_to}/current && RAILS_ENV=#{rails_env} bundle exec rake #{ENV['ARGS']}")
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Pulsar
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Pulsar::InitCommand do
4
+ let(:pulsar) { Pulsar::InitCommand.new("init") }
5
+
6
+ it "copies over the configuration repo" do
7
+ expect { pulsar.run(["#{tmp_path}/new-conf-repo"]) }.to change{ Dir.glob("#{tmp_path}/new-conf-repo").length }.by(1)
8
+ end
9
+ end
@@ -23,11 +23,12 @@ describe Pulsar::MainCommand do
23
23
  end
24
24
 
25
25
  context "subcommands" do
26
- it "should be cap and list" do
26
+ it "should be cap and list and init" do
27
27
  help = pulsar.help
28
28
  help.should =~ /Subcommands:/
29
29
  help.should =~ /cap/
30
30
  help.should =~ /list/
31
+ help.should =~ /init/
31
32
  end
32
33
  end
33
34
  end
data/spec/spec_helper.rb CHANGED
@@ -15,7 +15,7 @@ RSpec.configure do |config|
15
15
  config.include Helpers
16
16
  config.include OutputCapture
17
17
 
18
- config.after(:suite) do
19
- FileUtils.rm_r(Dir.glob("#{File.dirname(__FILE__)}/support/tmp/*"))
18
+ config.around(:each) do
19
+ FileUtils.rm_rf(Dir.glob("#{File.dirname(__FILE__)}/support/tmp/*"))
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulsar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-06 00:00:00.000000000 Z
13
+ date: 2013-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: clamp
@@ -128,14 +128,28 @@ files:
128
128
  - lib/pulsar.rb
129
129
  - lib/pulsar/commands/all.rb
130
130
  - lib/pulsar/commands/cap.rb
131
+ - lib/pulsar/commands/init.rb
131
132
  - lib/pulsar/commands/list.rb
132
133
  - lib/pulsar/commands/main.rb
134
+ - lib/pulsar/generators/init_repo/Gemfile
135
+ - lib/pulsar/generators/init_repo/README.md
136
+ - lib/pulsar/generators/init_repo/apps/base.rb
137
+ - lib/pulsar/generators/init_repo/apps/your_app/defaults.rb
138
+ - lib/pulsar/generators/init_repo/apps/your_app/production.rb
139
+ - lib/pulsar/generators/init_repo/apps/your_app/recipes/custom_recipe.rb
140
+ - lib/pulsar/generators/init_repo/apps/your_app/recipes/production/.gitkeep
141
+ - lib/pulsar/generators/init_repo/apps/your_app/recipes/staging/.gitkeep
142
+ - lib/pulsar/generators/init_repo/apps/your_app/staging.rb
143
+ - lib/pulsar/generators/init_repo/recipes/generic/cleanup.rb
144
+ - lib/pulsar/generators/init_repo/recipes/generic/rake.rb
145
+ - lib/pulsar/generators/init_repo/recipes/rails/.gitkeep
133
146
  - lib/pulsar/helpers/capistrano.rb
134
147
  - lib/pulsar/helpers/clamp.rb
135
148
  - lib/pulsar/tasks/.gitkeep
136
149
  - lib/pulsar/version.rb
137
150
  - pulsar.gemspec
138
151
  - spec/pulsar/commands/cap_spec.rb
152
+ - spec/pulsar/commands/init_spec.rb
139
153
  - spec/pulsar/commands/list_spec.rb
140
154
  - spec/pulsar/commands/main_spec.rb
141
155
  - spec/pulsar/helpers/clamp_spec.rb
@@ -164,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
178
  version: '0'
165
179
  segments:
166
180
  - 0
167
- hash: 3869526505221080668
181
+ hash: -1640336626814053383
168
182
  required_rubygems_version: !ruby/object:Gem::Requirement
169
183
  none: false
170
184
  requirements:
@@ -173,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
187
  version: '0'
174
188
  segments:
175
189
  - 0
176
- hash: 3869526505221080668
190
+ hash: -1640336626814053383
177
191
  requirements: []
178
192
  rubyforge_project:
179
193
  rubygems_version: 1.8.24
@@ -184,6 +198,7 @@ summary: A simple gem that parses capistrano configuration froma another (privat
184
198
  capistrano configurations in each app.
185
199
  test_files:
186
200
  - spec/pulsar/commands/cap_spec.rb
201
+ - spec/pulsar/commands/init_spec.rb
187
202
  - spec/pulsar/commands/list_spec.rb
188
203
  - spec/pulsar/commands/main_spec.rb
189
204
  - spec/pulsar/helpers/clamp_spec.rb