diff options
| -rw-r--r-- | TODO.md | 28 | ||||
| -rw-r--r-- | lib/dsl.rb | 2 | ||||
| -rw-r--r-- | test/lib/dslkeywords/file_test.rb | 16 | ||||
| -rw-r--r-- | test/lib/dslkeywords/only_when_test.rb | 4 |
4 files changed, 36 insertions, 14 deletions
@@ -1,5 +1,25 @@ -* `only_when { uname is :OpenBSD or uname is :Linux }` -* `JSON.generate(obj) for debug mode` -* Rename `RCM` to `Rcm` in the code? - +# TODO +* Recursively install a directory +* Backup of files when changed +* Support for file deletion +* Support for file modes (owner, chmod) +* Support for symlinks +* User and group management + * Fedora + * FreeBSD + * OpenBSD +* CRON jobs + * Fedora + * FreeBSD + * OpenBSD +* Binary installation support (file copy from source to dest) + * Local file system + * scp? git? http/s? +* Object dependencies / ensuring correct order of evaluation +* Manage services (start, stop, restart (subscribe)) +* Manage packages (install, update, deinstall) + * Fedora + * FreeBSD + * OpenBSD + * Homebrew (macOS) @@ -46,3 +46,5 @@ def configure(reset: false, &block) rcm.evaluate! if rcm.conds_met end end + +def configure_from_scratch(&block) = configure(reset: true, &block) diff --git a/test/lib/dslkeywords/file_test.rb b/test/lib/dslkeywords/file_test.rb index 7cd0f5e..d0afd92 100644 --- a/test/lib/dslkeywords/file_test.rb +++ b/test/lib/dslkeywords/file_test.rb @@ -14,13 +14,13 @@ class RCMFileTest < Minitest::Test def test_create_file_from_string text = 'Hello World!' - configure(reset: true) { file(FILE_PATH) { text } } + configure_from_scratch { file(FILE_PATH) { text } } assert_equal text, File.read(FILE_PATH) end def test_create_file_from_array arr = %w[Hello World and Hello Universe] - configure(reset: true) { file(FILE_PATH) { arr } } + configure_from_scratch { file(FILE_PATH) { arr } } assert_equal arr.join("\n"), File.read(FILE_PATH) end @@ -29,19 +29,19 @@ class RCMFileTest < Minitest::Test source_path = "#{FILE_PATH}.source.tmp" File.write(source_path, text) - configure(reset: true) do + configure_from_scratch do file FILE_PATH do from_sourcefile source_path end end assert_equal File.read(source_path), File.read(FILE_PATH) - - File.unlink(source_path) + ensure + File.unlink(source_path) if File.file?(source_path) end def test_create_file_from_template - configure(reset: true) do + configure_from_scratch do file FILE_PATH do from_template 'One plus two is <%= 1 + 2 %>!' @@ -52,13 +52,13 @@ class RCMFileTest < Minitest::Test def test_ensure_line File.write(FILE_PATH, "Hey there\n") - configure(reset: true) { file(FILE_PATH) { ensure_line 'Whats up?' } } + configure_from_scratch { file(FILE_PATH) { ensure_line 'Whats up?' } } assert_equal "Hey there\nWhats up?\n", File.read(FILE_PATH) end def test_create_parent_directory file_path = "#{DIR_PATH}/foo/bar/baz/foo.txt" - configure(reset: true) do + configure_from_scratch do file file_path do create_parent_directory :content diff --git a/test/lib/dslkeywords/only_when_test.rb b/test/lib/dslkeywords/only_when_test.rb index 9eaf5ac..94ebe79 100644 --- a/test/lib/dslkeywords/only_when_test.rb +++ b/test/lib/dslkeywords/only_when_test.rb @@ -5,14 +5,14 @@ require_relative '../../../lib/dsl' class RCMOnlyWhenTest < Minitest::Test def test_hostname - rcm = configure(reset: true) do + rcm = configure_from_scratch do only_when { hostname Socket.gethostname } end assert rcm.conds_met end def test_hostname_negative - rcm = configure(reset: true) do + rcm = configure_from_scratch do only_when { hostname "#{Socket.gethostname}.invalid" } end refute rcm.conds_met |
