producer-stdlib 0.0.6 → 0.0.7

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: 6807d8926b2ba935351acb4c3c0f184ede8deff7
4
- data.tar.gz: f164843bdf28498cef2e8bea7e8081057919112d
3
+ metadata.gz: 61167336d12da40074cc617c7f73c4068455ea43
4
+ data.tar.gz: 5124f9aa5afdf16372f77f03e9940c2f084bfdd6
5
5
  SHA512:
6
- metadata.gz: c7e6e8d3d728ce574554ff8db4152c69db0315b29cbcb19b2c3c217a21785595df9a40fe29e31d960d226ac19761b7a803e84fb55be7f5a5cf7f8976af7bea21
7
- data.tar.gz: 9cbebdaf22c7fd154331a6f72fbe929d513c5db9c12303612c3f23e4335c78558b069c62102b335f34dbaf48d4fd01699ddde7131e00687b896cc37e6bd88150
6
+ metadata.gz: 4600f297b06e66c9d46c6a1f9c1b94d9b55b195896d280fdc4717279b39926cc96dda7ff98787335d860e6987d3d5ae1754ef11c38fb282367848d207f888bf1
7
+ data.tar.gz: b6fbe67d4ed9e63108e035231f87f544ea6f97cb3fc526ad09a895c6427567a6dd92848a5f55b46a31469509b00893899225e2b6aa31bd30b889872734364185
@@ -20,10 +20,33 @@ module Producer
20
20
 
21
21
  STDLib.compose_macro :make_conf, :file_write_once, MAKE_CONF_PATH
22
22
 
23
+ STDLib.define_test :rc_conf? do |key, value|
24
+ file_contains '/etc/rc.conf', "#{key}=#{value}\n"
25
+ end
26
+
23
27
  STDLib.define_test :rc_enabled? do |service|
24
28
  sh "service #{service} enabled > /dev/null"
25
29
  end
26
30
 
31
+ STDLib.define_macro :rc_conf_update do |key, value|
32
+ condition { no_rc_conf? key, value }
33
+
34
+ file_replace_content RC_CONF_PATH, /^#{key}=.+$/, "#{key}=#{value}"
35
+ end
36
+
37
+ # FIXME: should update existing values
38
+ STDLib.define_macro :rc_conf_add do |attributes|
39
+ attributes.each do |k, v|
40
+ value = case v
41
+ when true then '"YES"'
42
+ when false then '"NO"'
43
+ else '"%s"' % v
44
+ end
45
+
46
+ file_append_once RC_CONF_PATH, "#{k}=#{value}\n"
47
+ end
48
+ end
49
+
27
50
  STDLib.define_macro :rc_enable do |service|
28
51
  condition { no_rc_enabled? service }
29
52
 
@@ -31,14 +54,14 @@ module Producer
31
54
  sh "service #{service} start"
32
55
  end
33
56
 
34
- STDLib.define_macro :hostname do |hostname|
35
- rc_conf_value = "hostname=#{hostname}"
57
+ STDLib.define_macro :rc_disable do |service|
58
+ condition { rc_enabled? service }
36
59
 
37
- condition { no_file_contains RC_CONF_PATH, rc_conf_value }
38
-
39
- file_replace_content RC_CONF_PATH, /^hostname=.+$/, rc_conf_value
60
+ rc_conf_update "#{service}_enable", '"NO"'
40
61
  end
41
62
 
63
+ STDLib.compose_macro :hostname, :rc_conf_update, 'hostname'
64
+
42
65
  STDLib.define_macro :chsh do |shell|
43
66
  condition { no_env? :shell, shell }
44
67
 
@@ -94,14 +117,14 @@ module Producer
94
117
  condition { no_sh 'pkg -N' }
95
118
 
96
119
  # FIXME: must not disable signature
97
- sh "PACKAGESITE=#{repo_uri} SIGNATURE_TYPE=NONE ASSUME_ALWAYS_YES=YES pkg bootstrap"
98
- sh "PACKAGESITE=#{repo_uri} pkg update"
120
+ sh "env PACKAGESITE=#{repo_uri} SIGNATURE_TYPE=NONE ASSUME_ALWAYS_YES=YES pkg bootstrap"
121
+ sh "env PACKAGESITE=#{repo_uri} pkg update"
99
122
  end
100
123
 
101
124
  STDLib.define_macro :pkg_install do |pkg|
102
125
  condition { no_pkg? pkg }
103
126
 
104
- sh 'ASSUME_ALWAYS_YES=YES pkg install %s' % pkg
127
+ sh 'env ASSUME_ALWAYS_YES=YES pkg install %s' % pkg
105
128
  end
106
129
  end
107
130
  end
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module STDLib
3
- VERSION = '0.0.6'.freeze
3
+ VERSION = '0.0.7'.freeze
4
4
  end
5
5
  end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.files = `git ls-files`.split $/
16
16
 
17
- s.add_dependency 'producer-core', '~> 0.3', '>= 0.3.2'
17
+ s.add_dependency 'producer-core', '~> 0.3', '>= 0.3.9'
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-25 00:00:00.000000000 Z
11
+ date: 2014-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: producer-core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.3'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.2
22
+ version: 0.3.9
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.3'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.3.2
32
+ version: 0.3.9
33
33
  description: |
34
34
  Standard library for producer (gem: producer-core).
35
35
  email: tj@a13.fr