scatter_deploy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +19 -0
- data/README.md +3 -0
- data/bin/scatter +9 -0
- data/lib/scatter/cli.rb +91 -0
- data/lib/scatter.rb +5 -0
- data/scatter_deploy.gemspec +23 -0
- metadata +85 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013 Daryl Koopersmith, Evan Solomon
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
data/bin/scatter
ADDED
data/lib/scatter/cli.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Scatter
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
class_option :directory,
|
7
|
+
:aliases => "-d",
|
8
|
+
:type => :string,
|
9
|
+
:default => "#{Dir.home}/.deploys",
|
10
|
+
:desc => "Specify a deploys directory."
|
11
|
+
|
12
|
+
class_option :project,
|
13
|
+
:aliases => "-p",
|
14
|
+
:type => :string,
|
15
|
+
:desc => "Specify a project, defaults to current Git root's basename."
|
16
|
+
|
17
|
+
class_option :shared,
|
18
|
+
:aliases => "-s",
|
19
|
+
:type => :string,
|
20
|
+
:desc => "Use a deploy script in the __shared directory. The project name will automatically be passed as an argument"
|
21
|
+
|
22
|
+
desc "deploy", "Run a deploy routine. This is the default task."
|
23
|
+
def deploy
|
24
|
+
run
|
25
|
+
end
|
26
|
+
default_task :deploy
|
27
|
+
|
28
|
+
desc "cap COMMAND", "Run arbitrary Capistrano commands."
|
29
|
+
def cap(*cmd)
|
30
|
+
execute "cap", cmd
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "execute COMMAND", "Run arbitrary commands."
|
34
|
+
def execute(*cmd)
|
35
|
+
run cmd.join ' '
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "version", "Show version."
|
39
|
+
map %w(-v --version) => :version
|
40
|
+
def version
|
41
|
+
say Scatter::VERSION
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
def git?
|
46
|
+
`git rev-parse --is-inside-work-tree 2>/dev/null`.match "^true"
|
47
|
+
end
|
48
|
+
|
49
|
+
def project_name
|
50
|
+
return options.project if options.project
|
51
|
+
File.basename `git rev-parse --show-toplevel`.chomp if git?
|
52
|
+
end
|
53
|
+
|
54
|
+
def project_deploy_dir
|
55
|
+
return "#{options.directory}/__shared" if options.shared
|
56
|
+
"#{options.directory}/#{project_name}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def capfile?
|
60
|
+
File.exists? "#{project_deploy_dir}/Capfile"
|
61
|
+
end
|
62
|
+
|
63
|
+
def executable?
|
64
|
+
deploy = "#{project_deploy_dir}/deploy"
|
65
|
+
File.exists? deploy and File.executable? deploy
|
66
|
+
end
|
67
|
+
|
68
|
+
def generate_command
|
69
|
+
return "./#{options.shared} #{project_name}" if options.shared
|
70
|
+
return "./deploy" if executable?
|
71
|
+
return "cap deploy" if capfile?
|
72
|
+
end
|
73
|
+
|
74
|
+
def run(command=nil)
|
75
|
+
unless project_deploy_dir
|
76
|
+
say "No deploy directory found"
|
77
|
+
return
|
78
|
+
end
|
79
|
+
|
80
|
+
command = generate_command unless command
|
81
|
+
|
82
|
+
unless command
|
83
|
+
say "No deploy command found"
|
84
|
+
return
|
85
|
+
end
|
86
|
+
|
87
|
+
system "cd #{project_deploy_dir} && #{command}"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
data/lib/scatter.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
require 'scatter'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
8
|
+
spec.add_dependency 'thor', '~> 0.17.0'
|
9
|
+
spec.authors = ['Evan Solomon']
|
10
|
+
spec.email = 'evan@evanalyze.com'
|
11
|
+
spec.description = "A deploy helper."
|
12
|
+
spec.executables = %w(scatter)
|
13
|
+
spec.files = %w(README.md scatter_deploy.gemspec MIT-LICENSE)
|
14
|
+
spec.files += Dir.glob("bin/**/*")
|
15
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
16
|
+
spec.homepage = 'http://evansolomon.me/'
|
17
|
+
spec.licenses = ['MIT']
|
18
|
+
spec.name = 'scatter_deploy'
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
21
|
+
spec.summary = "Scatter separates deploy scripts from project code, but keeps the convenience of running deploys from project directories."
|
22
|
+
spec.version = Scatter::VERSION
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scatter_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Evan Solomon
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: thor
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.17.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.17.0
|
46
|
+
description: A deploy helper.
|
47
|
+
email: evan@evanalyze.com
|
48
|
+
executables:
|
49
|
+
- scatter
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- README.md
|
54
|
+
- scatter_deploy.gemspec
|
55
|
+
- MIT-LICENSE
|
56
|
+
- bin/scatter
|
57
|
+
- lib/scatter/cli.rb
|
58
|
+
- lib/scatter.rb
|
59
|
+
homepage: http://evansolomon.me/
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.3.6
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.8.25
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Scatter separates deploy scripts from project code, but keeps the convenience
|
84
|
+
of running deploys from project directories.
|
85
|
+
test_files: []
|