sunzi 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,7 +11,7 @@ Sunzi assumes that modern Linux distributions have (mostly) sane defaults and gr
11
11
 
12
12
  Its design goals are:
13
13
 
14
- * **It's just shell script.** No clunky Ruby DSL involved. Sunzi recipes are written in a plain shell script. Most of the information about server configuration on the web is written in shell commands. Just copy-paste them, rather than translate it into an arbitrary DSL. Also, Bash is the greatest common denominator on minimum Linux installs.
14
+ * **It's just shell script.** No clunky Ruby DSL involved. Most of the information about server configuration on the web is written in shell commands. Just copy-paste them, rather than translate it into an arbitrary DSL. Also, Bash is the greatest common denominator on minimum Linux installs.
15
15
  * **Focus on diff from default.** No big-bang overwriting. Append or replace the smallest possible piece of data in a config file. Loads of custom configurations make it difficult to understand what you are really doing.
16
16
  * **Always use the root user.** Think twice before blindly assuming you need a regular user - it doesn't add any security benefit for server provisioning, it just adds extra verbosity for nothing. However, it doesn't mean that you shouldn't create regular users with Sunzi - feel free to write your own recipes.
17
17
  * **Minimum dependencies.** No configuration server required. You don't even need a Ruby runtime on the remote server.
@@ -22,44 +22,44 @@ Quickstart
22
22
  Install:
23
23
 
24
24
  ```bash
25
- gem install sunzi
25
+ $ gem install sunzi
26
26
  ```
27
27
 
28
28
  Go to your project directory, then:
29
29
 
30
30
  ```bash
31
- sunzi create
31
+ $ sunzi create
32
32
  ```
33
33
 
34
- It generates a `sunzi` folder along with subdirectories and templates. Inside `sunzi`, there's `sunzi.yml`, which defines dynamic attributes to be used from recipes. Also there's the `remote` folder, which will be transferred to the remote server, that contains recipes and dynamic variables compiled from `sunzi.yml`.
34
+ It generates a `sunzi` folder along with subdirectories and templates. Inside `sunzi`, there's `sunzi.yml`, which defines your own dynamic attributes to be used from scripts. Also there's the `remote` folder, which will be transferred to the remote server, that contains recipes and dynamic variables compiled from `sunzi.yml`.
35
35
 
36
36
  Go into the `sunzi` directory, then run `sunzi deploy`:
37
37
 
38
38
  ```bash
39
- cd sunzi
40
- sunzi deploy example.com
39
+ $ cd sunzi
40
+ $ sunzi deploy example.com
41
41
  ```
42
42
 
43
43
  Now, what it actually does is:
44
44
 
45
- 1. Compile sunzi.yml to generate attributes and retrieve remote recipes
45
+ 1. Compile `sunzi.yml` to generate attributes and retrieve remote recipes
46
46
  1. SSH to `example.com` and login as `root`
47
47
  1. Transfer the content of the `remote` directory to the remote server and extract in `$HOME/sunzi`
48
48
  1. Run `install.sh` on the remote server
49
49
 
50
50
  As you can see, all you need to do is edit `install.sh` and add some shell commands. That's it.
51
51
 
52
- A Sunzi project with no recipes is totally fine, so that you can start small, go big later.
52
+ A Sunzi project with no recipes is totally fine, so that you can start small, go big as you get along.
53
53
 
54
54
  Commands
55
55
  --------
56
56
 
57
57
  ```bash
58
- sunzi # Show command help
59
- sunzi create # Create a new Sunzi project
60
- sunzi deploy # Deploy Sunzi project
61
- sunzi setup # Setup a new VM on the Cloud services
62
- sunzi teardown # Teardown an existing VM on the Cloud services
58
+ $ sunzi # Show command help
59
+ $ sunzi create # Create a new Sunzi project
60
+ $ sunzi deploy [user@host:port] # Deploy Sunzi project
61
+ $ sunzi setup [linode|ec2] # Setup a new VM on the Cloud services
62
+ $ sunzi teardown [linode|ec2] [name] # Teardown an existing VM on the Cloud services
63
63
  ```
64
64
 
65
65
  Directory structure
@@ -170,5 +170,5 @@ and now run `vagrant up`, it will change the root password to `vagrant`.
170
170
  Also keep in mind that you need to specify the port number 2222.
171
171
 
172
172
  ```bash
173
- sunzi deploy localhost:2222
173
+ $ sunzi deploy localhost:2222
174
174
  ```
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << "test"
7
+ t.test_files = FileList['test/test*.rb']
8
+ t.verbose = true
9
+ end
data/bin/sunzi CHANGED
@@ -4,5 +4,5 @@
4
4
  Signal.trap(:INT) { abort "\nAborting." }
5
5
 
6
6
  # Load the main lib and invoke CLI.
7
- require File.expand_path('../../lib/sunzi',__FILE__)
8
- Sunzi::Cli.start
7
+ require 'sunzi'
8
+ Sunzi::Cli.start
data/lib/sunzi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sunzi
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/sunzi.rb CHANGED
@@ -1,19 +1,17 @@
1
- LIB_PATH = File.join(File.dirname(__FILE__), 'sunzi')
2
-
3
1
  require 'thor'
4
2
  require 'rainbow'
5
3
  require 'yaml'
6
4
 
7
5
  module Sunzi
8
- autoload :Cli, File.join(LIB_PATH, 'cli')
9
- autoload :Dependency, File.join(LIB_PATH, 'dependency')
10
- autoload :Logger, File.join(LIB_PATH, 'logger')
11
- autoload :Utility, File.join(LIB_PATH, 'utility')
12
- autoload :Version, File.join(LIB_PATH, 'version')
6
+ autoload :Cli, 'sunzi/cli'
7
+ autoload :Dependency, 'sunzi/dependency'
8
+ autoload :Logger, 'sunzi/logger'
9
+ autoload :Utility, 'sunzi/utility'
10
+ autoload :Version, 'sunzi/version'
13
11
 
14
12
  module Cloud
15
- autoload :Base, File.join(LIB_PATH, 'cloud', 'base')
16
- autoload :Linode, File.join(LIB_PATH, 'cloud', 'linode')
17
- autoload :EC2, File.join(LIB_PATH, 'cloud', 'ec2')
13
+ autoload :Base, 'sunzi/cloud/base'
14
+ autoload :Linode, 'sunzi/cloud/linode'
15
+ autoload :EC2, 'sunzi/cloud/ec2'
18
16
  end
19
17
  end
@@ -13,7 +13,7 @@ else
13
13
  else
14
14
  echo "The public key file is not found! Try the following command:"
15
15
  echo "cp ~/.ssh/$1 remote"
16
- echo "If the file name found in ~/.ssh is different from \"$1\", edit attributes.yml as appropriate."
16
+ echo "If the file name found in ~/.ssh is different from \"$1\", edit sunzi.yml as appropriate."
17
17
  exit 1
18
18
  fi
19
19
  fi
data/sunzi.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  # s.add_development_dependency "rspec"
22
22
  s.add_runtime_dependency "thor"
23
23
  s.add_runtime_dependency "rainbow"
24
+ s.add_development_dependency "rake"
24
25
  end
data/test/test_cli.rb CHANGED
@@ -1,5 +1,5 @@
1
+ require 'sunzi'
1
2
  require 'test/unit'
2
- require '../lib/sunzi'
3
3
 
4
4
  class TestCli < Test::Unit::TestCase
5
5
  def setup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunzi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-28 00:00:00.000000000 Z
12
+ date: 2012-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &2164966260 !ruby/object:Gem::Requirement
16
+ requirement: &2152827160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164966260
24
+ version_requirements: *2152827160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rainbow
27
- requirement: &2164965000 !ruby/object:Gem::Requirement
27
+ requirement: &2152825860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,18 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164965000
35
+ version_requirements: *2152825860
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &2152824980 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2152824980
36
47
  description: Server provisioning utility for minimalists
37
48
  email:
38
49
  - kenn.ejima@gmail.com