setup_recipes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in setup_recipes.gemspec
4
+ gemspec
data/README ADDED
File without changes
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require 'capistrano'
2
+
3
+ Dir.glob(File.join(File.dirname(__FILE__), '/setup_recipes/*.rb')).sort.each { |f| require f }
4
+
5
+ module SetupRecipes
6
+ VERSION = "0.0.1"
7
+ end
@@ -0,0 +1,14 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do |c|
2
+ namespace :setup do
3
+ desc "git init and do first commit"
4
+ task :git do
5
+ run_locally "git init"
6
+ run_locally "git remote add origin #{repository}"
7
+
8
+ run_locally "git add ."
9
+ run_locally "git commit -a -m 'initial commit'"
10
+
11
+ run_locally "git push origin master:refs/heads/master"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do |c|
2
+ namespace :setup do
3
+ desc "init gitosis project"
4
+ task :gitosis do
5
+ gitosis_dir = c[:gitosis_dir] || '~/projects/gitosis-admin'
6
+ gitosis_user = c[:gitosis_user]
7
+
8
+ # TODO support many app hosts
9
+ host = c.roles[:app].servers.first
10
+
11
+ run_locally "ssh #{user}@#{host} 'ssh-keygen -t dsa'"
12
+ run_locally "ssh #{user}@#{host} 'cat /home/#{user}/.ssh/id_dsa.pub' > #{gitosis_dir}/keydir/deploy_#{application}.pub"
13
+
14
+ run_locally "cd #{gitosis_dir} && git add keydir/deploy_#{application}.pub"
15
+ run_locally "cd #{gitosis_dir} && echo '[group #{application}]' >> gitosis.conf"
16
+ run_locally "cd #{gitosis_dir} && echo 'writable = #{application}' >> gitosis.conf"
17
+ run_locally "cd #{gitosis_dir} && echo 'members = #{gitosis_user} deploy_#{application}' >> gitosis.conf"
18
+ run_locally "cd #{gitosis_dir} && git commit -a -m 'added #{application}' && git push"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do |c|
2
+ namespace :setup do
3
+ desc "setup auth key"
4
+ task :key do
5
+ c.roles.values.map(&:servers).flatten.uniq.each do |host|
6
+ run_locally "cat ~/.ssh/id_dsa.pub | ssh -i #{c[:pem_key]} #{user}@#{host} 'cat >> /home/#{user}/.ssh/authorized_keys2'"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "setup_recipes"
6
+ s.version = "0.0.1"
7
+ s.authors = ["Stas Ladonenko"]
8
+ s.email = ["stas.ladonenko@gmail.com"]
9
+ s.homepage = "https://github.com/stasl/setup_recipes"
10
+ s.summary = %q{Capistrano task for initial project/server setup}
11
+ s.description = %q{A bunch of useful recipes to speed up initial server setup}
12
+
13
+ s.rubyforge_project = "setup_recipes"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency(%q<capistrano>, [">= 2.9"])
21
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: setup_recipes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Stas Ladonenko
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &70165295638480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2.9'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70165295638480
25
+ description: A bunch of useful recipes to speed up initial server setup
26
+ email:
27
+ - stas.ladonenko@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README
35
+ - Rakefile
36
+ - lib/setup_recipes.rb
37
+ - lib/setup_recipes/git.rb
38
+ - lib/setup_recipes/gitosis.rb
39
+ - lib/setup_recipes/key.rb
40
+ - setup_recipes.gemspec
41
+ homepage: https://github.com/stasl/setup_recipes
42
+ licenses: []
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project: setup_recipes
61
+ rubygems_version: 1.8.10
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Capistrano task for initial project/server setup
65
+ test_files: []