chake 0.4.3 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a71056a314743f325bbe972a713f1a6ac51542d4
4
- data.tar.gz: eff18b53b07f5f53cde6196e477886584c73b10d
3
+ metadata.gz: 825031afb9cace35e4f750ed736f80532e99d55b
4
+ data.tar.gz: 118d6e7f4a98d8215ba3bde42f4037405d1dd159
5
5
  SHA512:
6
- metadata.gz: a2ef4216d07f35e13ef892f9bb137ce6e1dff6ca30fbf5219b47f359cc859ff168807f77d72fa16ee47ffb7228b5b082f256973be28b7dc0c8ec5b36e36db34a
7
- data.tar.gz: cb6dc2327515a1f7d3e06c3dfecd553393ba5724148ba76977378ef41437f2324501d0d70d3b6887c21d635648d2456a0674f8db171cf3dd9d6fb92494a5997d
6
+ metadata.gz: f12ed797e7fe14c6f9db8f47483b55fc9bd671b8735b7f078cc8268f539782bfe7310fbba27958b19cf8b9b471eb4cfaa410711dc57b27e9e47599ad8b2d6dc6
7
+ data.tar.gz: 018fcbac5e10fad14bec70a18d8d69b23cbbf4ddf30c2b8d9b7b1c5c193b17d81c9e44439d27802a990a08aa625c56e5ca5e2909039356e6e245914a0dde9b9a
@@ -1,3 +1,8 @@
1
+ # 0.5
2
+
3
+ * Add a task login:$host that you can use to easily log in to any of your
4
+ hosts.
5
+
1
6
  # 0.4.3
2
7
 
3
8
  * When running remote commands as root, run `sudo COMMAND` directly instead of
data/README.md CHANGED
@@ -150,9 +150,15 @@ of the configuration.
150
150
  ### repository-local SSH configuration
151
151
 
152
152
  If you need special SSH configuration parameters, you can create a file called
153
- `.ssh_config` (or whatever name you have in the `$CHAKE_SSH_CONFIG` environment
154
- variable, see below for details) in at the root of your repository, and chake
155
- will use it when calling `ssh`.
153
+ `.ssh_config` (or whatever file name you have in the `$CHAKE_SSH_CONFIG`
154
+ environment variable, see below for details) in at the root of your repository,
155
+ and chake will use it when calling `ssh`.
156
+
157
+ ### Logging in to a host
158
+
159
+ To easily login to one of your host, just run `rake login:$HOSTNAME`. This will
160
+ automatically use the repository-local SSH configuration as above so you don't
161
+ have to type `-F .ssh_config` all the time.
156
162
 
157
163
  ### Converging local host
158
164
 
@@ -1,7 +1,19 @@
1
1
  $:.unshift '../../lib' # this shouldn't be needed when you have chake installed
2
2
  require 'chake'
3
3
 
4
+ manifest = %w[
5
+ Rakefile
6
+ cookbooks
7
+ cookbooks/example
8
+ cookbooks/example/recipes
9
+ cookbooks/example/recipes/default.rb
10
+ cookbooks/example/files
11
+ cookbooks/example/files/host-homer
12
+ cookbooks/example/files/host-homer/test.asc
13
+ config.rb
14
+ ]
15
+
4
16
  desc 'removes everything'
5
17
  task :clean do
6
- rm_rf Dir.glob('*') - ['Rakefile']
18
+ rm_rf Dir.glob('*') - manifest
7
19
  end
@@ -185,6 +185,11 @@ $nodes.each do |node|
185
185
  task "run:#{hostname}" => 'run_input' do
186
186
  node.run($cmd)
187
187
  end
188
+
189
+ desc "Logs in to a shell on #{hostname}"
190
+ task "login:#{hostname}" do
191
+ node.run_shell
192
+ end
188
193
  end
189
194
 
190
195
  task :run_input do
@@ -36,6 +36,10 @@ module Chake
36
36
  end
37
37
  end
38
38
 
39
+ def run_shell
40
+ system(*shell_command)
41
+ end
42
+
39
43
  def run_as_root(cmd)
40
44
  if node.remote_username == 'root'
41
45
  run(cmd)
@@ -10,6 +10,10 @@ module Chake
10
10
  ['sh', '-c']
11
11
  end
12
12
 
13
+ def shell_command
14
+ ENV.fetch('SHELL', Etc.getpwuid.shell)
15
+ end
16
+
13
17
  def skip?
14
18
  node.hostname != Socket.gethostname
15
19
  end
@@ -24,6 +24,10 @@ module Chake
24
24
  ['ssh', ssh_config, ssh_target].flatten.compact
25
25
  end
26
26
 
27
+ def shell_command
28
+ command_runner
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def rsync_ssh
@@ -49,7 +49,7 @@ module Chake
49
49
  @backend ||= Chake::Backend.get(@backend_name).new(self)
50
50
  end
51
51
 
52
- def_delegators :backend, :run, :run_as_root, :rsync, :rsync_dest, :scp, :scp_dest, :skip?
52
+ def_delegators :backend, :run, :run_as_root, :run_shell, :rsync, :rsync_dest, :scp, :scp_dest, :skip?
53
53
 
54
54
  end
55
55
 
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler