capistrano-generals 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c68ee2a15f115648399481fd7698d389e983d70e
4
+ data.tar.gz: a2a3d4ae62f947ddbc3b52a18ab05b5b55ab8582
5
+ SHA512:
6
+ metadata.gz: 4d614b6144a875004c3f79de1c54c1f8dc6fde5aa27e5b78c5adbf307d86da3f63fec87def74aa627056132fe3a096550b7101cda4372de97e152c0fe6b87b01
7
+ data.tar.gz: 40db883ff86977e42a6f60085de0a47b80fcab6a9a37408a2974e78f8420567c3c5e7cf0e110496bb94f26eea0f379b13139403810197c3a79718b49d9728e06
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-generals.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Stef Schenkelaars
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Capistrano::Generals
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano-generals'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-generals
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/capistrano-generals/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/generals/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-generals"
8
+ spec.version = Capistrano::Generals::VERSION
9
+ spec.authors = ["Stef Schenkelaars"]
10
+ spec.email = ["stef.schenkelaars@gmail.com"]
11
+ spec.summary = "Some general capistrano tasks which are commonly used"
12
+ spec.description = "Some general capistrano tasks which are commonly used"
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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", ">= 3.1"
22
+ spec.add_dependency "sshkit", ">= 1.2.0"
23
+
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,11 @@
1
+ module Capistrano
2
+ module Generals
3
+ module Helpers
4
+
5
+ def red text
6
+ "\033[31m#{text}\033[0m"
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Generals
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ # Load all the rake files
2
+ Dir[File.dirname(__FILE__) + '/tasks/**/*.rake'].each {|file| load file }
@@ -0,0 +1,56 @@
1
+ namespace :deploy do
2
+ namespace :symlink do
3
+
4
+ desc 'Upload the linked files from local system'
5
+ task :upload_linked_files do
6
+ fetch(:linked_files).each do |filename|
7
+
8
+ # Initialize variable outsize run_locally block to make sure it can be
9
+ # passed into the remote block
10
+ local_cksum = nil
11
+
12
+ run_locally do
13
+ # Check if file exists, else abort
14
+ unless File.exist? filename
15
+ abort red "Cannot find file #{filename} on local machine"
16
+ end
17
+
18
+ # Get local file info
19
+ local_cksum = capture :cksum, filename
20
+ end
21
+ local_sum, local_size, local_path = local_cksum.split
22
+
23
+ on roles :app do
24
+ # Create directory
25
+ dir_path = File.join shared_path, File.dirname(filename)
26
+ execute :mkdir, '-p', dir_path
27
+
28
+ # Check if file already exists on remote
29
+ remote_file_path = File.join shared_path, filename
30
+ if test("[ -f #{remote_file_path} ]")
31
+ # File already exists
32
+ # Get remote file info
33
+ remote_cksum = capture :cksum, remote_file_path
34
+ remote_sum, remote_size, remote_path = remote_cksum.split
35
+
36
+ # Check if the file has changed
37
+ if local_sum == remote_sum
38
+ info "#{filename} Already up to date."
39
+ else
40
+ upload! local_path, remote_file_path
41
+ info "Replaced #{filename} -> #{remote_file_path}"
42
+ end
43
+
44
+ else
45
+ # File does not exists
46
+ upload! local_path, remote_file_path
47
+ info "Uploaded #{filename} -> #{remote_file_path}"
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,24 @@
1
+ namespace :git do
2
+
3
+ desc 'Push selected branch to git repo'
4
+ task :push do
5
+ # Check for any local changes that haven't been committed
6
+ # Use 'cap git:push IGNORE_DEPLOY_RB=1' to ignore changes to this file (for testing)
7
+ status = %x(git status --porcelain).chomp
8
+ if status != ""
9
+ if status !~ %r{^[M ][M ] config/deploy.rb$}
10
+ abort "Local git repository has uncommitted changes"
11
+ elsif !ENV["IGNORE_DEPLOY_RB"]
12
+ # This is used for testing changes to this script without committing them first
13
+ abort "Local git repository has uncommitted changes (set IGNORE_DEPLOY_RB=1 to ignore changes to deploy.rb)"
14
+ end
15
+ end
16
+
17
+ # Push selected branch to github
18
+ branch = fetch(:branch)
19
+ unless system "git push #{repo_url} #{branch} #{'-f' if ENV['FORCE']}"
20
+ abort red("Failed to push changes to #{fetch(:repo_url)} (set FORCE=true to force push to github)")
21
+ end
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-generals
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stef Schenkelaars
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sshkit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Some general capistrano tasks which are commonly used
56
+ email:
57
+ - stef.schenkelaars@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - capistrano-generals.gemspec
68
+ - lib/capistrano/generals.rb
69
+ - lib/capistrano/generals/helpers.rb
70
+ - lib/capistrano/generals/version.rb
71
+ - lib/capistrano/tasks/deploy/symlink.rake
72
+ - lib/capistrano/tasks/git.rake
73
+ homepage: ''
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Some general capistrano tasks which are commonly used
97
+ test_files: []