shuttle-deploy 0.2.0.beta7 → 0.2.0.beta9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/shuttle/cli.rb CHANGED
@@ -5,6 +5,10 @@ module Shuttle
5
5
  attr_reader :options, :command
6
6
  attr_reader :path
7
7
 
8
+ def self.run
9
+ Shuttle::CLI.new.run
10
+ end
11
+
8
12
  def initialize(path=nil)
9
13
  @path = File.expand_path(path || Dir.pwd)
10
14
  @options = default_options
@@ -13,13 +17,22 @@ module Shuttle
13
17
  def run
14
18
  parse_options
15
19
  parse_command
16
- find_config
17
20
 
18
- begin
19
- runner = Shuttle::Runner.new(@options)
20
- runner.execute(@command.dup)
21
- rescue Shuttle::ConfigError => err
22
- terminate(err.message)
21
+ if @command == 'generate'
22
+ begin
23
+ generator = Shuttle::Generator.new.run
24
+ rescue Exception => err
25
+ terminate(err.message)
26
+ end
27
+ else
28
+ find_config
29
+
30
+ begin
31
+ runner = Shuttle::Runner.new(@options)
32
+ runner.execute(@command.dup)
33
+ rescue Shuttle::ConfigError => err
34
+ terminate(err.message)
35
+ end
23
36
  end
24
37
  end
25
38
 
@@ -98,11 +111,12 @@ module Shuttle
98
111
 
99
112
  def lookup_files
100
113
  [
114
+ options[:path],
101
115
  "#{@path}/shuttle.yml",
102
116
  "#{@path}/config/deploy.yml",
103
117
  "#{@path}/config/deploy/#{options[:target]}.yml",
104
118
  "#{ENV['HOME']}/.shuttle/#{File.basename(Dir.pwd)}.yml"
105
- ]
119
+ ].compact
106
120
  end
107
121
  end
108
122
  end
@@ -0,0 +1,57 @@
1
+ module Shuttle
2
+ class Generator
3
+ include TerminalHelpers
4
+
5
+ STRATEGIES = %w(static wordpress rails)
6
+
7
+ attr_reader :strategy
8
+ attr_reader :name, :git, :path
9
+
10
+ def initialize(strategy='static')
11
+ unless STRATEGIES.include?(strategy)
12
+ raise ArgumentError, "Invalid strategy: #{strategy}"
13
+ end
14
+
15
+ @strategy = strategy
16
+ @path = File.join(Dir.pwd, 'shuttle.yml')
17
+ end
18
+
19
+ def run
20
+ @name = ask('Application name', :required => true)
21
+ @git = ask('Git repository', :required => true)
22
+
23
+ hash = send("generate_#{strategy}")
24
+
25
+ File.open(path, 'w') do |f|
26
+ f.write(YAML.dump(hash))
27
+ end
28
+
29
+ display "New shuttle config has been generated at ./shuttle.yml"
30
+ end
31
+
32
+ private
33
+
34
+ def generate_static
35
+ {
36
+ 'app' => {
37
+ 'name' => name,
38
+ 'git' => git
39
+ },
40
+ 'target' => {
41
+ 'host' => "mysite.com",
42
+ 'user' => "deployer",
43
+ 'password' => "password",
44
+ 'deploy_to' => "/home/deployer/#{name}"
45
+ }
46
+ }
47
+ end
48
+
49
+ def generate_wordpress
50
+ # TODO
51
+ end
52
+
53
+ def generate_rails
54
+ # TODO
55
+ end
56
+ end
57
+ end
@@ -155,6 +155,9 @@ module Shuttle
155
155
  end
156
156
 
157
157
  ssh.close
158
+ rescue SocketError => err
159
+ STDERR.puts "Socket error: #{err.message}"
160
+ exit 1
158
161
  rescue Net::SSH::AuthenticationFailed
159
162
  STDERR.puts "SSH Authentication failed"
160
163
  exit 1
@@ -1,3 +1,3 @@
1
1
  module Shuttle
2
- VERSION = '0.2.0.beta7'
2
+ VERSION = '0.2.0.beta9'
3
3
  end
data/lib/shuttle.rb CHANGED
@@ -22,6 +22,7 @@ module Shuttle
22
22
  autoload :PathHelpers, 'shuttle/path_helpers'
23
23
  autoload :Strategy, 'shuttle/strategy'
24
24
  autoload :Hook, 'shuttle/hook'
25
+ autoload :Generator, 'shuttle/generator'
25
26
 
26
27
  autoload :Static, 'shuttle/deployment/static'
27
28
  autoload :Php, 'shuttle/deployment/php'
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shuttle-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta7
4
+ version: 0.2.0.beta9
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Dan Sosedoff
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: simplecov
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: net-ssh
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: net-ssh-session
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ~>
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ~>
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: terminal_helpers
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ~>
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ~>
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: chronic_duration
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ~>
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ~>
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: hashr
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ~>
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ~>
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: safe_yaml
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ~>
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :runtime
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ~>
137
156
  - !ruby/object:Gem::Version
@@ -139,6 +158,7 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: toml
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
163
  - - ~>
144
164
  - !ruby/object:Gem::Version
@@ -146,6 +166,7 @@ dependencies:
146
166
  type: :runtime
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
171
  - - ~>
151
172
  - !ruby/object:Gem::Version
@@ -183,6 +204,7 @@ files:
183
204
  - lib/shuttle/deployment/wordpress/plugins.rb
184
205
  - lib/shuttle/deployment/wordpress/vip.rb
185
206
  - lib/shuttle/errors.rb
207
+ - lib/shuttle/generator.rb
186
208
  - lib/shuttle/helpers.rb
187
209
  - lib/shuttle/hook.rb
188
210
  - lib/shuttle/path_helpers.rb
@@ -204,26 +226,30 @@ files:
204
226
  - spec/target_spec.rb
205
227
  homepage: https://github.com/sosedoff/shuttle
206
228
  licenses: []
207
- metadata: {}
208
229
  post_install_message:
209
230
  rdoc_options: []
210
231
  require_paths:
211
232
  - lib
212
233
  required_ruby_version: !ruby/object:Gem::Requirement
234
+ none: false
213
235
  requirements:
214
236
  - - ! '>='
215
237
  - !ruby/object:Gem::Version
216
238
  version: '0'
239
+ segments:
240
+ - 0
241
+ hash: -900810902781667857
217
242
  required_rubygems_version: !ruby/object:Gem::Requirement
243
+ none: false
218
244
  requirements:
219
245
  - - ! '>'
220
246
  - !ruby/object:Gem::Version
221
247
  version: 1.3.1
222
248
  requirements: []
223
249
  rubyforge_project:
224
- rubygems_version: 2.0.3
250
+ rubygems_version: 1.8.25
225
251
  signing_key:
226
- specification_version: 4
252
+ specification_version: 3
227
253
  summary: Minimalistic deployment tool
228
254
  test_files:
229
255
  - spec/cli_spec.rb
@@ -234,4 +260,3 @@ test_files:
234
260
  - spec/path_helpers_spec.rb
235
261
  - spec/spec_helper.rb
236
262
  - spec/target_spec.rb
237
- has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDE3YjNiNmUwMmZjM2VmOTg4YTg3YjNjNGVhMmQ0NDBhOTE5NDZkNQ==
5
- data.tar.gz: !binary |-
6
- NjZlYWY5YzI1ZjY4YjUxYTMyNWQ0M2JhNjViZmNlMjUwOTcxNDVhMQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NzU5OWVmMTE4Y2JiYjI4ODkxODJkN2E0OTJmZmFiMTBmOTUyYWJlYmIzNDg5
10
- Nzg5YjljODk4OGQ1NzVkMjNjZmI4YTA1YmIzOTZkNzJmMzc4N2MzYzFkYTJj
11
- NzkzZjY4ZDE2NjAzYThhZGVhZDNjNWFlZTJiZTEyOTMyZjc0Mzg=
12
- data.tar.gz: !binary |-
13
- OGU0ZDg2Y2YxZmExNmQzMmYxMzNhNmM1ZjkzZTRmMWI3ZDZiMmM2YjEzN2Fj
14
- MDU4N2UxYzFjYjI0ZTgzNjVjMDU2ZWNkMDU2OTJhYWY5NzQ4ODVmMmE4ODE1
15
- OTAzODU4YTA2MWQ3Mzk1YzdhOTFmMTc1ZDA0MjQ4MzNmY2E3ZjI=