scatter_deploy 0.1.2 → 0.1.3
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/lib/scatter/cli.rb +1 -15
- data/lib/scatter.rb +1 -1
- metadata +3 -4
- data/lib/scatter/config.rb +0 -53
data/lib/scatter/cli.rb
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
require 'thor'
|
|
2
|
-
require 'scatter/config'
|
|
3
2
|
|
|
4
3
|
module Scatter
|
|
5
4
|
class CLI < Thor
|
|
6
5
|
|
|
7
|
-
desc "config SUBCOMMAND ...ARGS", "Set Scatter config."
|
|
8
|
-
subcommand 'config', Scatter::Config
|
|
9
|
-
|
|
10
6
|
class_option :directory,
|
|
11
7
|
:aliases => "-d",
|
|
12
8
|
:type => :string,
|
|
13
|
-
:default =>
|
|
9
|
+
:default => "#{Dir.home}/.deploys",
|
|
14
10
|
:desc => "Specify a deploys directory."
|
|
15
11
|
|
|
16
12
|
class_option :project,
|
|
@@ -45,16 +41,6 @@ module Scatter
|
|
|
45
41
|
say Scatter::VERSION
|
|
46
42
|
end
|
|
47
43
|
|
|
48
|
-
def method_missing(*args)
|
|
49
|
-
puts args
|
|
50
|
-
config = Config.new.read
|
|
51
|
-
alias_name = args.join ' '
|
|
52
|
-
super unless config['aliases'] and config['aliases'][alias_name]
|
|
53
|
-
|
|
54
|
-
# Execute the aliased command
|
|
55
|
-
system "scatter #{config['aliases'][alias_name]}"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
44
|
protected
|
|
59
45
|
def git?
|
|
60
46
|
`git rev-parse --is-inside-work-tree 2>/dev/null`.match "^true"
|
data/lib/scatter.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scatter_deploy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-03-
|
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -55,7 +55,6 @@ files:
|
|
|
55
55
|
- MIT-LICENSE
|
|
56
56
|
- bin/scatter
|
|
57
57
|
- lib/scatter/cli.rb
|
|
58
|
-
- lib/scatter/config.rb
|
|
59
58
|
- lib/scatter.rb
|
|
60
59
|
homepage: http://evansolomon.me/
|
|
61
60
|
licenses:
|
|
@@ -72,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
72
71
|
version: '0'
|
|
73
72
|
segments:
|
|
74
73
|
- 0
|
|
75
|
-
hash:
|
|
74
|
+
hash: 1486605952724511090
|
|
76
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
76
|
none: false
|
|
78
77
|
requirements:
|
data/lib/scatter/config.rb
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'thor'
|
|
2
|
-
require 'json'
|
|
3
|
-
|
|
4
|
-
module Scatter
|
|
5
|
-
class Config < Thor
|
|
6
|
-
CONFIG_FILE = "#{Dir.home}/.scatterconfig"
|
|
7
|
-
|
|
8
|
-
desc "alias FROM TO", "Alias a scatter command."
|
|
9
|
-
def alias(from, to)
|
|
10
|
-
say "Aliasing `scatter #{from}` to `scatter #{to}`"
|
|
11
|
-
|
|
12
|
-
settings = read
|
|
13
|
-
settings["aliases"] ||= {}
|
|
14
|
-
settings["aliases"][from] = to
|
|
15
|
-
save settings
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc "deploys PATH", "Set a default deploys directory."
|
|
19
|
-
def deploys(path)
|
|
20
|
-
path = File.expand_path path
|
|
21
|
-
say "Setting default deploys directory to #{path}"
|
|
22
|
-
settings = read
|
|
23
|
-
settings['directory'] = path
|
|
24
|
-
save settings
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
no_tasks do
|
|
28
|
-
def read
|
|
29
|
-
setup
|
|
30
|
-
return {} unless @settings.length > 0
|
|
31
|
-
|
|
32
|
-
begin
|
|
33
|
-
JSON.load @settings
|
|
34
|
-
rescue
|
|
35
|
-
{}
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
protected
|
|
41
|
-
def setup
|
|
42
|
-
File.open CONFIG_FILE, "w+" unless File.exists? CONFIG_FILE
|
|
43
|
-
@settings = IO.read CONFIG_FILE
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def save(settings)
|
|
47
|
-
setup
|
|
48
|
-
File.open(CONFIG_FILE, "w+") do |f|
|
|
49
|
-
f.write JSON.pretty_generate(settings)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|