skynet-deploy 1.0.2 → 1.1.0

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/.rvmrc CHANGED
@@ -4,7 +4,7 @@
4
4
  # development environment upon cd'ing into the directory
5
5
 
6
6
  # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
- environment_id="ruby-1.9.2-p290@skynet"
7
+ environment_id="ruby-1.9.3-p327@skynet"
8
8
 
9
9
  #
10
10
  # First we attempt to load the desired environment directly from the environment
data/lib/skynet/cli.rb CHANGED
@@ -83,14 +83,26 @@ module Skynet
83
83
  end
84
84
  end
85
85
 
86
- desc "config [PROJECT_NAME]", "Generate config.yml, stubbed out for PROJECT_NAME"
87
- def config(name="PROJECT_NAME")
88
- @project_name = name
89
- template('config.yml', 'config.yml')
86
+ desc "install", "Generate config.yml"
87
+ method_option :wizard, type: :boolean, default: false, aliases: '-w', desc: 'Run configuration wizard'
88
+ def install
89
+ copy_file 'config.yml'
90
+ run_wizard if options[:wizard]
91
+ end
92
+
93
+ desc 'config', 'Run a wizard to append a new project to existing config.yml'
94
+ method_option :file, type: :string, default: './config.yml', aliases: '-f', desc: 'Configuration file'
95
+ def config
96
+ copy_file 'config.yml', options[:file] unless File.exists? options[:file]
97
+ run_wizard options[:file]
90
98
  end
91
99
 
92
100
  private
93
101
 
102
+ def run_wizard(file = './config.yml')
103
+ append_file file, Wizard.new.run
104
+ end
105
+
94
106
  def load_configuration(file)
95
107
  YAML.load_file(file).with_indifferent_access
96
108
  end
@@ -15,16 +15,12 @@
15
15
  # master: /var/www/project_name_production
16
16
  # develop: /var/www/project_name_staging
17
17
  #
18
- # Example for private repository deployment:
19
- # project_name:
20
- # url: https://github.com/owner/project_name
21
- # type: jekyll
22
- # key: /home/username/.ssh/id_rsa
23
- # branch: master
24
- # destination: /var/www/project_name
18
+ # Example for private repository deployment:
19
+ # project_name:
20
+ # url: https://github.com/owner/project_name
21
+ # type: jekyll
22
+ # key: /home/username/.ssh/id_rsa
23
+ # branch: master
24
+ # destination: /var/www/project_name
25
+
25
26
 
26
- <%= @project_name %>:
27
- url: https://github.com/ORGANIZATION_OR_USER/<%= @project_name %>
28
- branch: master
29
- type:
30
- destination:
@@ -1,3 +1,3 @@
1
1
  module Skynet
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,61 @@
1
+ require 'skynet/builder/base'
2
+
3
+ module Skynet
4
+ class Wizard < Thor::Shell::Basic
5
+
6
+ def run
7
+ [
8
+ "#{ask('Project name:').downcase}:",
9
+ " url: #{repository_url}",
10
+ " type: #{build_type}",
11
+ private_key,
12
+ branches,
13
+ "\n"
14
+ ].compact.join "\n"
15
+ end
16
+
17
+ private
18
+
19
+ def repository_url
20
+ if ask('Is the repository on github? (y/n)').downcase == 'y'
21
+ @github = true
22
+ owner = ask 'Repository owner:'
23
+ project = ask 'Github project name:'
24
+ "https://github.com/#{owner}/#{project}"
25
+ else
26
+ @github = false
27
+ ask 'Repository URL:'
28
+ end
29
+ end
30
+
31
+ def build_type
32
+ say 'Choose a build type:'
33
+ Builder::ALLOWED_BUILDERS.each_index do |index|
34
+ say "#{index + 1}: #{Builder::ALLOWED_BUILDERS[index]}"
35
+ end
36
+ builder = ask 'Choice:'
37
+ Builder::ALLOWED_BUILDERS[builder.to_i - 1]
38
+ end
39
+
40
+ def private_key
41
+ needs_key = ask('Is this a private repository? (y/n)').downcase
42
+ if needs_key == 'y'
43
+ [" key: #{ask 'Full path to ssh key:'}"].tap do |pk|
44
+ pk << " repository: #{ask 'SSH repository address:'}" unless @github
45
+ end.join "\n"
46
+ else
47
+ nil
48
+ end
49
+ end
50
+
51
+ def branches
52
+ branches = [' branches:']
53
+ while (branch = ask('Branch to deploy (blank to finish):')).present?
54
+ dest = ask 'Full path to build destination:'
55
+ branches << " #{branch}: #{dest}"
56
+ end
57
+ branches.join "\n"
58
+ end
59
+
60
+ end
61
+ end
data/lib/skynet.rb CHANGED
@@ -6,6 +6,7 @@ module Skynet
6
6
  autoload :Builder, 'skynet/builder'
7
7
  autoload :App, 'skynet/app'
8
8
  autoload :CLI, 'skynet/cli'
9
+ autoload :Wizard, 'skynet/wizard'
9
10
 
10
11
  def self.logger
11
12
  @logger ||= Logger.new(STDOUT)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skynet-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
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: 2012-12-07 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -196,6 +196,7 @@ files:
196
196
  - lib/skynet/cli.rb
197
197
  - lib/skynet/templates/config.yml
198
198
  - lib/skynet/version.rb
199
+ - lib/skynet/wizard.rb
199
200
  - skynet.gemspec
200
201
  - spec/skynet/builder/base_spec.rb
201
202
  - spec/skynet/builder/jekyll_spec.rb
@@ -214,6 +215,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
215
  - - ! '>='
215
216
  - !ruby/object:Gem::Version
216
217
  version: '0'
218
+ segments:
219
+ - 0
220
+ hash: -4491089130922770134
217
221
  required_rubygems_version: !ruby/object:Gem::Requirement
218
222
  none: false
219
223
  requirements:
@@ -222,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
226
  version: 1.3.6
223
227
  requirements: []
224
228
  rubyforge_project:
225
- rubygems_version: 1.8.21
229
+ rubygems_version: 1.8.23
226
230
  signing_key:
227
231
  specification_version: 3
228
232
  summary: Sinatra app that listens for GitHub post-receive callbacks and deploys your