teleport 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  ## Welcome to Teleport
2
2
 
3
- This is a fork of https://github.com/gurgeous/teleport, which is the canonical and maintained version of this gem.
4
-
5
3
  Teleport is a lightweight way to set up Ubuntu machines. The name derives from the mechanism that teleport uses to setup the target machine - it copies itself onto the target machine via ssh and then runs itself there. In effect, it "teleports" to the target. This design makes it possible for teleport to bootstrap itself onto a fresh machine. There's no need to install ruby or anything else by hand.
6
4
 
7
5
  Teleport strives to be **idempotent** - you can run it repeatedly without changing the result. In other words, as you build up your teleport config file you can generally run it over and over again without fear of breaking the target machine.
@@ -1,9 +1,11 @@
1
1
  module Teleport
2
2
  # This class parses Telfile, and includes DSL and the models.
3
3
  class Config
4
+ include Constants
5
+
4
6
  RUBIES = ["1.9.3", "1.9.2", "REE", "1.8.7"]
5
7
 
6
- attr_accessor :user, :ruby, :ssh_options, :roles, :servers, :apt, :packages, :recipes, :callbacks, :dsl
8
+ attr_accessor :user, :ruby, :ssh_options, :roles, :servers, :apt, :packages, :recipes, :callbacks, :dsl, :ssh_key
7
9
 
8
10
  def initialize(file = "Telfile")
9
11
  @roles = []
@@ -152,6 +154,10 @@ module Teleport
152
154
  @config.recipes += list.flatten
153
155
  end
154
156
 
157
+ def ssh_key(v)
158
+ @config.ssh_key = v
159
+ end
160
+
155
161
  %w(install user packages gemfiles files recipes).each do |op|
156
162
  %w(before after).each do |before_after|
157
163
  callback = "#{before_after}_#{op}".to_sym
@@ -10,10 +10,13 @@ module Teleport
10
10
  run_verbose!
11
11
  _read_config
12
12
 
13
- # setup @config constants
14
- Config::DSL.const_set("HOST", @host)
15
- Config::DSL.const_set("USER", @config.user)
16
- Config::DSL.const_set("ROLE", @role && @role.name)
13
+ # setup @config constants. Put them in mirror so they're
14
+ # accessible to both the DSL and Mirror itself. That way you can
15
+ # access these if you call install_file directly.
16
+ Mirror.const_set("HOST", @host)
17
+ Mirror.const_set("USER", @config.user)
18
+ Mirror.const_set("ROLE", @role && @role.name)
19
+ Mirror.const_set("SERVER", @server)
17
20
 
18
21
  # add mixins
19
22
  @config.dsl.extend(Mirror)
@@ -170,7 +173,7 @@ EOF
170
173
  if File.exists?(PUBKEY)
171
174
  authorized_keys = "/home/#{user}/.ssh/authorized_keys"
172
175
  if !File.exists?(authorized_keys)
173
- puts "adding #{PUBKEY} to authorized_keys..."
176
+ puts "adding #{File.basename(@config.ssh_key || PUBKEY)} to authorized_keys..."
174
177
  mkdir_if_necessary(File.dirname(authorized_keys), user, 0700)
175
178
  cp(PUBKEY, authorized_keys, user, 0600)
176
179
  end
@@ -220,7 +223,6 @@ EOF
220
223
  Dir.chdir(DATA) do
221
224
  files.each do |i|
222
225
  gemfile = "#{i}/Gemfile"
223
- lock = "#{gemfile}.lock"
224
226
  if File.exists?(gemfile)
225
227
  banner "Gemfiles - #{gemfile}..."
226
228
  run "bundle install --gemfile #{gemfile}"
data/lib/teleport/main.rb CHANGED
@@ -86,9 +86,14 @@ module Teleport
86
86
  f.puts("CONFIG_RUBYGEMS='#{RUBYGEMS}'")
87
87
  end
88
88
  # keys
89
- ssh_key = "#{ENV["HOME"]}/.ssh/#{PUBKEY}"
89
+ if ssh_key = @config.ssh_key
90
+ if !File.exists?(ssh_key)
91
+ fatal("I can't find the specified ssh key: #{ssh_key}")
92
+ end
93
+ end
94
+ ssh_key ||= "#{ENV["HOME"]}/.ssh/#{PUBKEY}"
90
95
  if File.exists?(ssh_key)
91
- run("cp", [ssh_key, DIR])
96
+ run("cp", [ssh_key, "#{DIR}/#{PUBKEY}"])
92
97
  end
93
98
 
94
99
  Dir.chdir(File.dirname(DIR)) do
data/lib/teleport/run.sh CHANGED
@@ -36,12 +36,12 @@ function install_ruby() {
36
36
  readline=libreadline-gplv2-dev
37
37
  fi
38
38
  apt-get install -y wget $readline
39
-
39
+
40
40
  banner "installing Ruby $CONFIG_RUBY..."
41
41
  case $CONFIG_RUBY in
42
42
  1.8.7 ) install_ruby_187 ;;
43
43
  1.9.2 ) install_ruby_192 ;;
44
- 1.9.3 ) install_ruby_193 ;;
44
+ 1.9.3 ) install_ruby_193 ;;
45
45
  REE ) install_ruby_ree ;;
46
46
  * ) fatal "unknown ruby ($CONFIG_RUBY)" ;;
47
47
  esac
@@ -49,7 +49,7 @@ function install_ruby() {
49
49
 
50
50
  function install_ruby_187() {
51
51
  apt-get -y install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev
52
-
52
+
53
53
  wget http://production.cf.rubygems.org/rubygems/rubygems-$CONFIG_RUBYGEMS.tgz
54
54
  tar xfpz rubygems-$CONFIG_RUBYGEMS.tgz
55
55
  (cd rubygems-$CONFIG_RUBYGEMS ; ruby setup.rb)
@@ -75,13 +75,13 @@ function install_ruby_192() {
75
75
  local patch=p290
76
76
 
77
77
  install_ruby_19_requirements
78
-
78
+
79
79
  wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-$patch.tar.gz
80
80
  tar xvzf ruby-1.9.2-$patch.tar.gz
81
-
81
+
82
82
  cd ruby-1.9.2-$patch
83
83
  ./configure --prefix=/usr/local \
84
- --program-suffix=1.9.2 \
84
+ --program-suffix=192 \
85
85
  --with-ruby-version=1.9.2 \
86
86
  --disable-install-doc
87
87
  make
@@ -93,42 +93,41 @@ function install_ruby_192() {
93
93
  --provides="ruby"
94
94
  cd ..
95
95
 
96
- update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby1.9.2 500 \
97
- --slave /usr/local/bin/ri ri /usr/local/bin/ri1.9.2 \
98
- --slave /usr/local/bin/irb irb /usr/local/bin/irb1.9.2 \
99
- --slave /usr/local/bin/gem gem /usr/local/bin/gem1.9.2 \
100
- --slave /usr/local/bin/erb erb /usr/local/bin/erb1.9.2 \
101
- --slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc1.9.2
96
+ update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby192 500 \
97
+ --slave /usr/local/bin/ri ri /usr/local/bin/ri192 \
98
+ --slave /usr/local/bin/irb irb /usr/local/bin/irb192 \
99
+ --slave /usr/local/bin/gem gem /usr/local/bin/gem192 \
100
+ --slave /usr/local/bin/erb erb /usr/local/bin/erb192 \
101
+ --slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc192
102
102
  }
103
103
 
104
104
  function install_ruby_193() {
105
- local patch=p0
105
+ local patch=p125
106
106
 
107
107
  install_ruby_19_requirements
108
108
 
109
109
  wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-$patch.tar.gz
110
110
  tar xvzf ruby-1.9.3-$patch.tar.gz
111
-
111
+
112
112
  cd ruby-1.9.3-$patch
113
113
  ./configure --prefix=/usr/local \
114
- --program-suffix=1.9.3 \
114
+ --program-suffix=193 \
115
115
  --with-ruby-version=1.9.3 \
116
116
  --disable-install-doc
117
117
  make
118
118
  checkinstall -D -y \
119
- --fstrans=no \
120
119
  --nodoc \
121
120
  --pkgname="ruby1.9.3" \
122
121
  --pkgversion="1.9.3-$patch" \
123
122
  --provides="ruby"
124
123
  cd ..
125
124
 
126
- update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby1.9.3 500 \
127
- --slave /usr/local/bin/ri ri /usr/local/bin/ri1.9.3 \
128
- --slave /usr/local/bin/irb irb /usr/local/bin/irb1.9.3 \
129
- --slave /usr/local/bin/gem gem /usr/local/bin/gem1.9.3 \
130
- --slave /usr/local/bin/erb erb /usr/local/bin/erb1.9.3 \
131
- --slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc1.9.3
125
+ update-alternatives --install /usr/local/bin/ruby ruby /usr/local/bin/ruby193 500 \
126
+ --slave /usr/local/bin/ri ri /usr/local/bin/ri193 \
127
+ --slave /usr/local/bin/irb irb /usr/local/bin/irb193 \
128
+ --slave /usr/local/bin/gem gem /usr/local/bin/gem193 \
129
+ --slave /usr/local/bin/erb erb /usr/local/bin/erb193 \
130
+ --slave /usr/local/bin/rdoc rdoc /usr/local/bin/rdoc193
132
131
  }
133
132
 
134
133
  function install_ruby_ree() {
@@ -1,4 +1,4 @@
1
1
  module Teleport
2
2
  # Gem version
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
@@ -21,6 +21,8 @@ describe Teleport::Config do
21
21
  user "somebody"
22
22
  ruby "1.8.7"
23
23
 
24
+ ssh_key "keys/my-key.pub"
25
+
24
26
  role :master, :packages => %w(nginx), :recipes => %w(master.rb)
25
27
  role :slave, :packages => %w(memcached)
26
28
  server "one", :role => :master, :packages => %w(strace)
@@ -42,6 +44,7 @@ EOF
42
44
  let(:config) do
43
45
  Teleport::Config.new
44
46
  end
47
+
45
48
  it "has the master role" do
46
49
  config.role(:master).name.should == :master
47
50
  config.role(:master).packages.should == %w(nginx)
@@ -71,5 +74,8 @@ EOF
71
74
  config.apt.first.line.should == "blah blah blah"
72
75
  config.apt.first.options[:key].should == "123"
73
76
  end
77
+ it "has a ssh key path" do
78
+ config.ssh_key.should == "keys/my-key.pub"
79
+ end
74
80
  end
75
81
  end
metadata CHANGED
@@ -1,111 +1,104 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: teleport
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 4
10
- segments_generated: true
11
- version: 1.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.5
5
+ prerelease:
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Adam Doppelt
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2011-12-13 00:00:00 -08:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- segments_generated: true
32
- version: "0"
12
+ date: 2012-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: amazon-ec2
34
- prerelease: false
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
35
22
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- segments_generated: true
47
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
48
31
  name: awesome_print
49
- prerelease: false
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
50
38
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
54
41
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- segments_generated: true
62
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
63
47
  name: rake
64
- prerelease: false
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
65
54
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
69
57
  none: false
70
- requirements:
71
- - - ~>
72
- - !ruby/object:Gem::Version
73
- hash: 21
74
- segments:
75
- - 3
76
- - 9
77
- segments_generated: true
78
- version: "3.9"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
79
63
  name: rdoc
80
- prerelease: false
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.9'
81
70
  type: :development
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- requirement: &id005 !ruby/object:Gem::Requirement
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
85
73
  none: false
86
- requirements:
74
+ requirements:
87
75
  - - ~>
88
- - !ruby/object:Gem::Version
89
- hash: 15
90
- segments:
91
- - 2
92
- - 6
93
- segments_generated: true
94
- version: "2.6"
76
+ - !ruby/object:Gem::Version
77
+ version: '3.9'
78
+ - !ruby/object:Gem::Dependency
95
79
  name: rspec
96
- prerelease: false
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '2.6'
97
86
  type: :development
98
- version_requirements: *id005
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2.6'
99
94
  description: Easy Ubuntu server setup via teleportation.
100
- email:
95
+ email:
101
96
  - amd@gurge.com
102
- executables:
97
+ executables:
103
98
  - teleport
104
99
  extensions: []
105
-
106
100
  extra_rdoc_files: []
107
-
108
- files:
101
+ files:
109
102
  - .gitignore
110
103
  - Gemfile
111
104
  - LICENSE
@@ -129,41 +122,34 @@ files:
129
122
  - spec/support/telfile.rb
130
123
  - spec/unit/teleport/config_spec.rb
131
124
  - teleport.gemspec
132
- has_rdoc: true
133
125
  homepage: http://github.com/gurgeous/teleport
134
126
  licenses: []
135
-
136
127
  post_install_message:
137
128
  rdoc_options: []
138
-
139
- require_paths:
129
+ require_paths:
140
130
  - lib
141
- required_ruby_version: !ruby/object:Gem::Requirement
131
+ required_ruby_version: !ruby/object:Gem::Requirement
142
132
  none: false
143
- requirements:
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- hash: 3
147
- segments:
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
148
138
  - 0
149
- segments_generated: true
150
- version: "0"
151
- required_rubygems_version: !ruby/object:Gem::Requirement
139
+ hash: -562607455023534771
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
141
  none: false
153
- requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- hash: 3
157
- segments:
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
158
147
  - 0
159
- segments_generated: true
160
- version: "0"
148
+ hash: -562607455023534771
161
149
  requirements: []
162
-
163
150
  rubyforge_project: teleport
164
- rubygems_version: 1.3.7
151
+ rubygems_version: 1.8.21
165
152
  signing_key:
166
153
  specification_version: 3
167
154
  summary: Teleport - opinionated Ubuntu server setup with Ruby.
168
155
  test_files: []
169
-