producer-stdlib 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12668879dd856f64bc93fbd6da0e6052e864ac3a
4
- data.tar.gz: 269b27e52519a682a76bd0ae188a03150f3012a3
3
+ metadata.gz: 72c4348461bc2a8c12dcd47ee307e8604cc50fa1
4
+ data.tar.gz: a3ede50542093af7e758db40fbd03404f2d426f5
5
5
  SHA512:
6
- metadata.gz: ad2be9732b1b07866e1f0791c1989951c2706d55dbfc4f81ec9649459e395772e3ee8837ce27fb962150b6b23b5d855da21f312a30d89895ef95618a7830c6b2
7
- data.tar.gz: e35a30d4052332c235472304933c48629b5605a92525c167b12fe85f99d36ef38e6d9d98e56f4074d3287a4d4981b3d46910580e8eb7d87cfe6c6b76752ddb67
6
+ metadata.gz: 65092fab528abd92d9dda816f860d0a6659bb50c2d649ac55d4b3c163c41c24b9a17068978fa728ce5400b2bb29868ef5450ed663b2a5fc5488fd68e0f6b5d63
7
+ data.tar.gz: 0dd96d62208c5cc855a39d3c623bbec20f3e2cb28795a3c93f2637f16b226376051ab654416f93fde9233f9f112dade25e66e224a54b2a0ef62083423bf2fffa
@@ -5,6 +5,10 @@ module Producer
5
5
  ::Producer::Core::Recipe.define_macro(name, block)
6
6
  end
7
7
 
8
+ def compose_macro(*args)
9
+ ::Producer::Core::Recipe.compose_macro(*args)
10
+ end
11
+
8
12
  def define_test(name, &block)
9
13
  ::Producer::Core::Condition.define_test(name, block)
10
14
  end
@@ -10,14 +10,24 @@ module Producer
10
10
  MAKE_CONF_PATH = '/etc/make.conf'.freeze
11
11
 
12
12
 
13
- STDLib.define_test(:rc_enabled?) do |service|
13
+ STDLib.compose_macro :loader_conf, :file_write_once, LOADER_CONF_PATH
14
+
15
+ STDLib.compose_macro :rc_conf, :file_write_once, RC_CONF_PATH
16
+
17
+ STDLib.compose_macro :sysctl_conf, :file_write_once, SYSCTL_CONF_PATH
18
+
19
+ STDLib.compose_macro :periodic_conf, :file_write_once, PERIODIC_CONF_PATH
20
+
21
+ STDLib.compose_macro :make_conf, :file_write_once, MAKE_CONF_PATH
22
+
23
+ STDLib.define_test :rc_enabled? do |service|
14
24
  sh "service #{service} enabled > /dev/null"
15
25
  end
16
26
 
17
27
  STDLib.define_macro :rc_enable do |service|
18
28
  condition { no_rc_enabled? service }
19
29
 
20
- file_append RC_CONF_PATH, %{\n#{service}_enable=\"YES\"\n}
30
+ file_append RC_CONF_PATH, %{\n#{service}_enable="YES"\n}
21
31
  sh "service #{service} start"
22
32
  end
23
33
 
@@ -29,41 +39,6 @@ module Producer
29
39
  file_replace_content RC_CONF_PATH, /^hostname=.+$/, rc_conf_value
30
40
  end
31
41
 
32
- # FIXME: refactor with file_add macro?
33
- STDLib.define_macro :loader_conf do |conf|
34
- condition { no_file_contains LOADER_CONF_PATH, conf }
35
-
36
- file_append LOADER_CONF_PATH, "\n%s" % conf
37
- end
38
-
39
- # FIXME: refactor with file_add macro?
40
- STDLib.define_macro :rc_conf do |conf|
41
- condition { no_file_contains RC_CONF_PATH, conf }
42
-
43
- file_append RC_CONF_PATH, "\n%s" % conf
44
- end
45
-
46
- # FIXME: refactor with file_add macro?
47
- STDLib.define_macro :sysctl_conf do |conf|
48
- condition { no_file_contains SYSCTL_CONF_PATH, conf }
49
-
50
- file_append SYSCTL_CONF_PATH, "\n%s" % conf
51
- end
52
-
53
- # FIXME: refactor with file_add macro?
54
- STDLib.define_macro :periodic_conf do |conf|
55
- condition { no_file_contains PERIODIC_CONF_PATH, conf }
56
-
57
- file_append PERIODIC_CONF_PATH, "\n%s" % conf
58
- end
59
-
60
- # FIXME: refactor with file_add macro?
61
- STDLib.define_macro :ports_config do |config|
62
- condition { no_file_contains MAKE_CONF_PATH, config }
63
-
64
- file_write MAKE_CONF_PATH, config
65
- end
66
-
67
42
  STDLib.define_macro :chsh do |shell|
68
43
  condition { no_env? :shell, shell }
69
44
 
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module STDLib
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '0.0.5'.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.2', '>= 0.2.13'
17
+ s.add_dependency 'producer-core', '~> 0.3', '>= 0.3.2'
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.3'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.2.13
22
+ version: 0.3.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.2'
29
+ version: '0.3'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.13
32
+ version: 0.3.2
33
33
  description: |
34
34
  Standard library for producer (gem: producer-core).
35
35
  email: tj@a13.fr