itamae 1.0.0.beta8 → 1.0.0.beta9

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: 42aaacb52f264283b58b0fe62dd723ec02a6f6f5
4
- data.tar.gz: c288561f91f88f46979c43c4bd809f0ccb8a38b8
3
+ metadata.gz: 316546d4d9112ec266c35d0e68ac945bff9c89db
4
+ data.tar.gz: c0f441c234e8a246ef88c5b986b40fe303aa3641
5
5
  SHA512:
6
- metadata.gz: 8977726e0c923e4055af6ce1c0492e5e375cc461cc3d67516650c12354e6a6aff10cdd1aac4317fb5866609246efe204c1a8191de2164b55b1d93f6ec7c9f97b
7
- data.tar.gz: b500d236ff804664009b79747be7e52068462a28dedb3b099f5a72f547da1f8df631d9e5bc3851b3e26a335a5ba1f984ce5fe279558d68a84fc76f356868f002
6
+ metadata.gz: 9e09edb03f591ab95907efa644c85ba8a4a3d8ce4acbd158812ffe6785bd1c22c022987e17a9988fcfb9216f41c6e03bc42a9e85c5778a53175582f5df07d27a
7
+ data.tar.gz: 706adb717f18b87638c9aa0933b767e7b8c33eb44a9dfe6e474e95c0642a8a6f491d4791371731719b4987599b2eb933d7e08587f161ab6387853c9058f6ee09
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Itamae [![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae)
1
+ # Itamae [![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae) [![wercker status](https://app.wercker.com/status/d44df82d2f4529ff664f32fa54ce12f5/s/master "wercker status")](https://app.wercker.com/project/bykey/d44df82d2f4529ff664f32fa54ce12f5)
2
2
 
3
3
  Simple and lightweight configuration management tool inspired by Chef.
4
4
 
data/Rakefile CHANGED
@@ -3,6 +3,8 @@ require 'rspec/core/rake_task'
3
3
  require 'tempfile'
4
4
  require 'net/ssh'
5
5
 
6
+ vagrant_bin = ENV['CI'] ? 'vagrant' : '/usr/bin/vagrant'
7
+
6
8
  desc 'Run unit and integration specs.'
7
9
  task :spec => ['spec:unit', 'spec:integration:all']
8
10
 
@@ -15,7 +17,7 @@ namespace :spec do
15
17
  namespace :integration do
16
18
  targets = []
17
19
  Bundler.with_clean_env do
18
- `cd spec/integration && /usr/bin/vagrant status`.split("\n\n")[1].each_line do |line|
20
+ `cd spec/integration && #{vagrant_bin} status`.split("\n\n")[1].each_line do |line|
19
21
  targets << line.match(/^[^ ]+/)[0]
20
22
  end
21
23
  end
@@ -31,8 +33,8 @@ namespace :spec do
31
33
  Bundler.with_clean_env do
32
34
  config = Tempfile.new('', Dir.tmpdir)
33
35
  env = {"VAGRANT_CWD" => File.expand_path('./spec/integration')}
34
- system env, "/usr/bin/vagrant up #{target}"
35
- system env, "/usr/bin/vagrant ssh-config #{target} > #{config.path}"
36
+ system env, "#{vagrant_bin} up #{target}"
37
+ system env, "#{vagrant_bin} ssh-config #{target} > #{config.path}"
36
38
  options = Net::SSH::Config.for(target, [config.path])
37
39
 
38
40
  cmd = "bundle exec bin/itamae ssh"
@@ -75,3 +77,4 @@ namespace :release do
75
77
  system "git commit -m 'Bump up version'"
76
78
  end
77
79
  end
80
+
@@ -109,13 +109,18 @@ module Itamae
109
109
  private
110
110
 
111
111
  def method_missing(method, *args, &block)
112
- if args.size == 1 && self.class.defined_attributes[method]
113
- return @attributes[method] = args.first
114
- elsif args.size == 0 && block_given?
115
- return @attributes[method] = block
116
- elsif args.size == 0 && @attributes.has_key?(method)
112
+ if self.class.defined_attributes[method]
113
+ if args.size == 1
114
+ return @attributes[method] = args.first
115
+ elsif args.size == 0 && block_given?
116
+ return @attributes[method] = block
117
+ end
118
+ end
119
+
120
+ if args.size == 0 && @attributes.has_key?(method)
117
121
  return @attributes[method]
118
122
  end
123
+
119
124
  super
120
125
  end
121
126
 
@@ -136,7 +141,11 @@ module Itamae
136
141
  def show_differences
137
142
  @current_attributes.each_pair do |key, current_value|
138
143
  value = @attributes[key]
139
- if current_value == value || value.nil?
144
+ if current_value.nil? && value.nil?
145
+ # ignore
146
+ elsif current_value.nil? && !value.nil?
147
+ Logger.info " #{key} will be '#{value}'"
148
+ elsif current_value == value || value.nil?
140
149
  Logger.info " #{key} will not change (current value is '#{current_value}')"
141
150
  else
142
151
  Logger.info " #{key} will change from '#{current_value}' to '#{value}'"
@@ -1 +1 @@
1
- 1.0.0.beta8
1
+ 1.0.0.beta9
@@ -6,14 +6,29 @@ VAGRANTFILE_API_VERSION = "2"
6
6
 
7
7
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
8
  config.vm.define :trusty do |c|
9
- c.vm.box = "ubuntu/trusty64"
9
+ c.vm.hostname = 'itamae-trusty'
10
+ c.vm.hostname += "-#{ENV['WERCKER_BUILD_ID']}" if ENV['WERCKER_BUILD_ID']
11
+ c.vm.provider :virtualbox do |provider, override|
12
+ override.vm.box = "ubuntu/trusty64"
13
+ override.vm.provision :shell, inline: <<-EOC
14
+ cat /etc/apt/sources.list | sed -e 's|http://[^ ]*|mirror://mirrors.ubuntu.com/mirrors.txt|g' > /tmp/sources.list
15
+ if !(diff -q /etc/apt/sources.list /tmp/sources.list); then
16
+ mv /tmp/sources.list /etc/apt/sources.list
17
+ apt-get update
18
+ fi
19
+ EOC
20
+ end
10
21
 
11
- c.vm.provision :shell, inline: <<-EOC
12
- cat /etc/apt/sources.list | sed -e 's|http://[^ ]*|mirror://mirrors.ubuntu.com/mirrors.txt|g' > /tmp/sources.list
13
- if !(diff -q /etc/apt/sources.list /tmp/sources.list); then
14
- mv /tmp/sources.list /etc/apt/sources.list
15
- apt-get update
16
- fi
17
- EOC
22
+ c.vm.provider :digital_ocean do |provider, override|
23
+ override.ssh.private_key_path = '~/.ssh/id_rsa.vagrant'
24
+ override.vm.box = 'digital_ocean'
25
+ override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
26
+
27
+ provider.ssh_key_name = ENV['WERCKER'] ? 'vagrant/wercker/itamae' : 'Vagrant'
28
+ provider.token = ENV['DIGITALOCEAN_TOKEN']
29
+ provider.image = 'Ubuntu 14.04 x64'
30
+ provider.region = 'nyc2'
31
+ provider.size = '512mb'
32
+ end
18
33
  end
19
34
  end
@@ -16,8 +16,8 @@ end
16
16
  describe file('/tmp/directory') do
17
17
  it { should be_directory }
18
18
  it { should be_mode 700 }
19
- it { should be_owned_by "vagrant" }
20
- it { should be_grouped_into "vagrant" }
19
+ it { should be_owned_by "itamae" }
20
+ it { should be_grouped_into "itamae" }
21
21
  end
22
22
 
23
23
  describe file('/tmp/template') do
@@ -1,3 +1,8 @@
1
+ # TODO: replace with user resource
2
+ execute 'id itamae || useradd itamae'
3
+
4
+ ######
5
+
1
6
  package 'dstat' do
2
7
  action :install
3
8
  end
@@ -50,8 +55,8 @@ end
50
55
 
51
56
  directory "/tmp/directory" do
52
57
  mode "700"
53
- owner "vagrant"
54
- group "vagrant"
58
+ owner "itamae"
59
+ group "itamae"
55
60
  end
56
61
 
57
62
  template "/tmp/template" do
data/wercker.yml ADDED
@@ -0,0 +1,76 @@
1
+ box: wercker/rvm
2
+ # Build definition
3
+ build:
4
+ # The steps that will be executed on build
5
+ # See the Ruby section on the wercker devcenter:
6
+ # http://devcenter.wercker.com/articles/languages/ruby.html
7
+ steps:
8
+ # Uncomment this to force RVM to use a specific Ruby version
9
+ - rvm-use:
10
+ version: 2.1.1
11
+
12
+ # A step that executes `bundle install` command
13
+ - bundle-install
14
+
15
+ # A custom script step, name value is used in the UI
16
+ # and the code value contains the command that get executed
17
+ - script:
18
+ name: echo ruby information
19
+ code: |
20
+ echo "ruby version $(ruby --version) running"
21
+ echo "from location $(which ruby)"
22
+ echo -p "gem list: $(gem list)"
23
+
24
+ - script:
25
+ name: create .ssh directory
26
+ code: mkdir -p $HOME/.ssh
27
+
28
+ - create-file:
29
+ name: put private key
30
+ filename: $HOME/.ssh/id_rsa.vagrant
31
+ overwrite: true
32
+ hide-from-log: true
33
+ content: $DIGITALOCEAN_PRIVATE_KEY
34
+
35
+ - create-file:
36
+ name: put public key
37
+ filename: $HOME/.ssh/id_rsa.vagrant.pub
38
+ overwrite: true
39
+ hide-from-log: true
40
+ content: $DIGITALOCEAN_PUBLIC_KEY
41
+
42
+ - script:
43
+ name: chmod 600 id_rsa
44
+ code: chmod 600 $HOME/.ssh/id_rsa.vagrant
45
+
46
+ - script:
47
+ name: download vagrant
48
+ code: wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.3_x86_64.deb
49
+
50
+ - script:
51
+ name: install vagrant
52
+ code: sudo dpkg -i vagrant_1.6.3_x86_64.deb
53
+
54
+ - script:
55
+ name: install libxml and libxslt
56
+ code: sudo apt-get install libxml2-dev libxslt1-dev
57
+
58
+ - script:
59
+ name: install vagrant-digitalocean
60
+ code: NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-digitalocean
61
+
62
+ - script:
63
+ name: start vm
64
+ code: vagrant up --provider=digital_ocean
65
+ cwd: spec/integration
66
+
67
+ # Add more steps here:
68
+ - script:
69
+ name: rspec
70
+ code: bundle exec rake spec
71
+
72
+ after-steps:
73
+ - script:
74
+ name: shutdown vm
75
+ code: vagrant destroy -f
76
+ cwd: spec/integration
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta8
4
+ version: 1.0.0.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -146,7 +146,6 @@ extra_rdoc_files: []
146
146
  files:
147
147
  - ".gitignore"
148
148
  - ".rspec"
149
- - ".travis.yml"
150
149
  - Gemfile
151
150
  - LICENSE.txt
152
151
  - README.md
@@ -192,6 +191,7 @@ files:
192
191
  - spec/unit/lib/itamae/resource_spec.rb
193
192
  - spec/unit/lib/itamae/runner_spec.rb
194
193
  - spec/unit/spec_helper.rb
194
+ - wercker.yml
195
195
  homepage: https://github.com/ryotarai/itamae
196
196
  licenses:
197
197
  - MIT
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.0.0"
4
- - "1.9.3"
5
- script:
6
- - bundle exec rake spec:unit