clearcap 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8caae8b5972dc7848968b700eed29b8c022f9835
4
+ data.tar.gz: ec6a41ba46a481799365a7ac2e78391db87036c2
5
+ SHA512:
6
+ metadata.gz: dda290e2101e2782ba4bdcd38d13110ac0d8f899eb774a62c39f65662121bf50705f34ea785dc579a94661cf0796f6bab78866aae244c542e00955c3e57f2027
7
+ data.tar.gz: 4099c482bd7cd42868a15631a0095b77514c3352cc7311e9fc3e7f21d183f650ea5322ce6fdbd668f20d8288e7ec6871cbbafe523baa80fd38371267bc58788d
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in clearcap.gemspec
4
+ gemspec
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2013 Jamon Holmgren
2
+
3
+ This is a proprietary gem and may only be used by ClearSight Studio and web applications developed by ClearSight Studio.
@@ -0,0 +1,53 @@
1
+ # Clearcap
2
+
3
+ Contains ClearSight Studio's common Capistrano settings.
4
+
5
+ ## Installation
6
+
7
+ Add these lines to your application's Gemfile:
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'capistrano', require: false
12
+ gem 'clearcap', git: "git@bitbucket.org:clearsightstudio/clearcap.git", require: false
13
+ end
14
+ ```
15
+
16
+
17
+ ### Webfaction
18
+
19
+ **NOTE: This is a WIP. It's for Webfaction specifically.**
20
+
21
+ 1. Set up SSH [http://optic.clearsightstudio.com/post/192-setting-up-ssh-on-webfaction](http://optic.clearsightstudio.com/post/192-setting-up-ssh-on-webfaction)
22
+ 1. Set up a deployment key in Bitbucket with the server's id_rsa.pub (create one using `ssh-keygen -t rsa` unless exists?)
23
+ 1. Copy the database.yml to the server's `shared/config/database.yml` (you should be gitignoring the database.yml)
24
+ 1. `gem install capistrano`
25
+ 1. `capify .`
26
+ 1. Gemfile should have the lines above (in Installation)
27
+ 1. Edit `deploy.rb` to look like below in the deploy.rb section.
28
+ 1. bundle up, then run `cap deploy` and enjoy your output.~
29
+
30
+ #### deploy.rb
31
+
32
+ ```ruby
33
+ require "bundler/capistrano"
34
+
35
+ set :application, "myappname"
36
+ set :repository, "git@bitbucket.org:clearsightstudio/myreponame.git"
37
+ set :deploy_to, "/home/myusername/webapps/myappname"
38
+
39
+ role :web, "someserver.webfactional.com" # Your HTTP server, Apache/etc
40
+ role :app, "someserver.webfactional.com" # This may be the same as your `Web` server
41
+ role :db, "someserver.webfactional.com", :primary => true # This is where Rails migrations will run
42
+
43
+ set :user, "myusername"
44
+
45
+ require 'clearcap/deploy/webfaction'
46
+
47
+ # Add any overrides for the Clearcap defaults here.
48
+ # set :scm, :something_else
49
+ ```
50
+
51
+ ## Contributing
52
+
53
+ 1. Don't.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'clearcap/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "clearcap"
8
+ spec.version = Clearcap::VERSION
9
+ spec.authors = ["Jamon Holmgren", "Ryan Linton"]
10
+ spec.email = ["jamon@clearsightstudio.com", "ryanl@clearsightstudio.com"]
11
+ spec.description = %q{Contains ClearSight Studio's common Capistrano settings.}
12
+ spec.summary = %q{ClearSight Studio common Capistrano settings}
13
+ spec.homepage = "https://bitbucket.org/clearsightstudio/clearcap"
14
+ spec.license = "Proprietary"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "capistrano"
22
+ spec.add_dependency "colored"
23
+ spec.add_dependency "growl"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ end
@@ -0,0 +1,4 @@
1
+ require "clearcap/version"
2
+
3
+ module Clearcap
4
+ end
@@ -0,0 +1,67 @@
1
+ require "clearcap/deploy/common"
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
4
+
5
+ configuration.load do
6
+
7
+ require "rvm/capistrano"
8
+
9
+ default_run_options[:pty] = true
10
+
11
+ set :bundle_without, [:development]
12
+ set :keep_releases, 2
13
+ set :rake, "bundle exec rake"
14
+ set :rvm_type, :user
15
+
16
+ namespace :newrelic do
17
+ desc <<-EOD
18
+ symlink to the shared/newrelic.yml
19
+ EOD
20
+ task :symlink, :except => { :no_release => true } do
21
+ # run "ln -s #{shared_path}/config/newrelic.yml #{release_path}/config/newrelic.yml"
22
+ end
23
+
24
+ after "deploy:finalize_update", "newrelic:symlink"
25
+ end
26
+
27
+ namespace :uploads do
28
+ desc <<-EOD
29
+ Creates the upload folders unless they exist
30
+ and sets the proper upload permissions.
31
+ EOD
32
+ task :setup, :except => { :no_release => true } do
33
+ dirs = upload_dirs.map { |d| File.join(shared_path, d) }.join(' ')
34
+ run "#{try_sudo} mkdir -p #{dirs} && #{try_sudo} chmod g+w #{dirs}"
35
+ end
36
+
37
+ desc <<-EOD
38
+ [internal] Creates the symlink to uploads shared folders
39
+ for the most recently deployed version
40
+ EOD
41
+ task :symlink, :except => { :no_release => true } do
42
+ run "rm -rf #{release_path}/public/uploads"
43
+ run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
44
+ end
45
+
46
+ desc <<-EOD
47
+ [internal] Computes uploads directory paths
48
+ and registers them in Capistrano environment.
49
+ EOD
50
+ task :register_dirs do
51
+ set :upload_dirs, %w(public/uploads)
52
+ set :shared_children, fetch(:shared_children) + fetch(:upload_dirs)
53
+ end
54
+
55
+ after "deploy:finalize_update", "uploads:symlink"
56
+ on :start , "uploads:register_dirs"
57
+ end
58
+
59
+ # Using Passenger mod_rails
60
+ namespace :deploy do
61
+ task :restart do
62
+ raise StandardError.new("Your deploy.rb needs a restart string.") unless restart_string
63
+ run restart_string
64
+ end
65
+ end
66
+
67
+ end
@@ -0,0 +1,157 @@
1
+ #!/bin/env ruby
2
+ # encoding: utf-8
3
+ require 'optparse'
4
+
5
+ options = {}
6
+
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: Look it up on BitBucket."
9
+
10
+ options[:verbose] = false
11
+ opts.on( '-v', '--verbose' ) do
12
+ options[:verbose] = true
13
+ end
14
+ end.parse!
15
+
16
+
17
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
18
+
19
+ configuration.load do
20
+
21
+ set :use_sudo, false
22
+ set :scm, :git
23
+ default_run_options[:pty] = true
24
+
25
+ after "deploy:finalize_update", "deploy:migrate"
26
+ after "deploy:restart", "deploy:cleanup"
27
+
28
+ namespace :notifications do
29
+ desc <<-EOD
30
+ [internal] Shows a success message when done deploying.
31
+ EOD
32
+ task :success do
33
+ require "growl"
34
+ if Growl.installed?
35
+ Growl.notify "#{application} deployed successfully to #{rails_env}.", title: 'Capistrano', sticky: true
36
+ end
37
+ end
38
+ end
39
+
40
+ if options[:verbose] == true
41
+ logger.level = Capistrano::Logger::DEBUG
42
+ else
43
+
44
+ require "colored"
45
+ logger.level = Capistrano::Logger::IMPORTANT
46
+
47
+ STDOUT.sync
48
+
49
+ before "deploy:update_code" do
50
+ @begin = Time.now
51
+ puts "Deploying".cyan;
52
+ end
53
+
54
+ before "bundle:install" do
55
+ print "Bundling"
56
+
57
+ @start_time = Time.now.to_i
58
+
59
+ Thread.new do
60
+ while @bundled != true
61
+ print "."
62
+ sleep 1.5
63
+ end
64
+ end
65
+ end
66
+
67
+ after "bundle:install" do
68
+ @bundled = true
69
+ print "✔".green
70
+ puts " -- [#{Time.now.to_i - @start_time} secs]"
71
+ end
72
+
73
+ before "deploy:migrate" do
74
+ print "Migrating"
75
+
76
+ @start_time = Time.now.to_i
77
+
78
+ Thread.new do
79
+ while @migrated != true
80
+ print "."
81
+ sleep 1.5
82
+ end
83
+ end
84
+ end
85
+
86
+ after "deploy:migrate" do
87
+ @migrated = true
88
+ print "✔".green
89
+ puts " -- [#{Time.now.to_i - @start_time} secs]"
90
+ end
91
+
92
+ before "deploy:assets:clean" do
93
+ print "Cleaning"
94
+
95
+ @start_time = Time.now.to_i
96
+
97
+ Thread.new do
98
+ while @cleaned != true
99
+ print "."
100
+ sleep 1.5
101
+ end
102
+ end
103
+ end
104
+
105
+ after "deploy:assets:clean" do
106
+ @cleaned = true
107
+ print "✔".green
108
+ puts " -- [#{Time.now.to_i - @start_time} secs]"
109
+ end
110
+
111
+ before "deploy:assets:precompile" do
112
+ print "Compiling"
113
+
114
+ @start_time = Time.now.to_i
115
+
116
+ Thread.new do
117
+ while @compiled != true
118
+ print "."
119
+ sleep 1.5
120
+ end
121
+ end
122
+ end
123
+
124
+ after "deploy:assets:precompile" do
125
+ @compiled = true
126
+ print "✔".green
127
+ puts " -- [#{Time.now.to_i - @start_time} secs]"
128
+ end
129
+
130
+ after "deploy:update_code" do puts "Deploy Complete......✔".green end
131
+
132
+ before "deploy:restart" do
133
+ print "Restarting"
134
+
135
+ @start_time = Time.now.to_i
136
+
137
+ Thread.new do
138
+ while @restarted != true
139
+ print "."
140
+ sleep 1.5
141
+ end
142
+ end
143
+ end
144
+
145
+ after "deploy:restart" do
146
+ @restarted = true
147
+ print "✔".green
148
+ puts " -- [#{Time.now.to_i - @start_time} secs]"
149
+
150
+ puts "\nDeploy Time: #{Time.now.to_i - @begin.to_i} seconds"
151
+ end
152
+
153
+ after "deploy:restart", "notifications:success" # Show a growl
154
+
155
+ end
156
+
157
+ end
@@ -0,0 +1,27 @@
1
+ require "clearcap/deploy/common"
2
+
3
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
4
+
5
+ configuration.load do
6
+
7
+ set :deploy_to, "/home/#{user}/webapps/#{application}"
8
+
9
+ role :web, "#{webfaction}.webfaction.com" # Your HTTP server, Apache/etc
10
+ role :app, "#{webfaction}.webfaction.com" # This may be the same as your `Web` server
11
+ role :db, "#{webfaction}.webfaction.com", :primary => true # This is where Rails migrations will run
12
+
13
+
14
+ namespace :deploy do
15
+ desc "Restart nginx"
16
+ task :restart do
17
+ run "#{deploy_to}/bin/restart"
18
+ end
19
+ end
20
+
21
+ set :default_environment, {
22
+ 'PATH' => "#{deploy_to}/bin:$PATH",
23
+ 'GEM_HOME' => "#{deploy_to}/gems",
24
+ 'GEM_PATH' => "#{deploy_to}/gems"
25
+ }
26
+
27
+ end
@@ -0,0 +1,3 @@
1
+ module Clearcap
2
+ VERSION = "1.1.0"
3
+ end
@@ -0,0 +1,14 @@
1
+ def replace_line(filepath, pattern, replace)
2
+ File.open filepath, 'w' do |f|
3
+ text = File.read(filepath)
4
+ replace = text.gsub(pattern, replace)
5
+ File.open(filepath, "w") {|file| file.puts replace}
6
+ end
7
+ end
8
+
9
+ desc "Sets up ClearCap and Capistrano"
10
+ task :setup do
11
+ file 'Gemfile' do
12
+
13
+ end
14
+ end
File without changes
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clearcap
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jamon Holmgren
8
+ - Ryan Linton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: colored
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: growl
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '1.3'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Contains ClearSight Studio's common Capistrano settings.
85
+ email:
86
+ - jamon@clearsightstudio.com
87
+ - ryanl@clearsightstudio.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - .gitignore
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - clearcap.gemspec
98
+ - lib/clearcap.rb
99
+ - lib/clearcap/deploy/avlux.rb
100
+ - lib/clearcap/deploy/common.rb
101
+ - lib/clearcap/deploy/webfaction.rb
102
+ - lib/clearcap/version.rb
103
+ - lib/tasks/install.rake
104
+ - template/deploy.rb
105
+ homepage: https://bitbucket.org/clearsightstudio/clearcap
106
+ licenses:
107
+ - Proprietary
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.0.0
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: ClearSight Studio common Capistrano settings
129
+ test_files: []