automateit 0.70923
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +1 -0
- data/CHANGES.txt +100 -0
- data/Hoe.rake +35 -0
- data/Manifest.txt +111 -0
- data/README.txt +44 -0
- data/Rakefile +284 -0
- data/TESTING.txt +57 -0
- data/TODO.txt +26 -0
- data/TUTORIAL.txt +390 -0
- data/bin/ai +3 -0
- data/bin/aifield +82 -0
- data/bin/aitag +128 -0
- data/bin/automateit +117 -0
- data/docs/friendly_errors.txt +50 -0
- data/docs/previews.txt +86 -0
- data/env.sh +4 -0
- data/examples/basic/Rakefile +26 -0
- data/examples/basic/config/automateit_env.rb +16 -0
- data/examples/basic/config/fields.yml +3 -0
- data/examples/basic/config/tags.yml +13 -0
- data/examples/basic/dist/README.txt +9 -0
- data/examples/basic/dist/myapp_server.erb +30 -0
- data/examples/basic/install.log +15 -0
- data/examples/basic/lib/README.txt +10 -0
- data/examples/basic/recipes/README.txt +4 -0
- data/examples/basic/recipes/install.rb +53 -0
- data/examples/basic/recipes/uninstall.rb +6 -0
- data/gpl.txt +674 -0
- data/lib/automateit.rb +66 -0
- data/lib/automateit/account_manager.rb +106 -0
- data/lib/automateit/account_manager/linux.rb +171 -0
- data/lib/automateit/account_manager/passwd.rb +69 -0
- data/lib/automateit/account_manager/portable.rb +136 -0
- data/lib/automateit/address_manager.rb +165 -0
- data/lib/automateit/address_manager/linux.rb +80 -0
- data/lib/automateit/address_manager/portable.rb +37 -0
- data/lib/automateit/cli.rb +80 -0
- data/lib/automateit/common.rb +65 -0
- data/lib/automateit/constants.rb +33 -0
- data/lib/automateit/edit_manager.rb +292 -0
- data/lib/automateit/error.rb +10 -0
- data/lib/automateit/field_manager.rb +103 -0
- data/lib/automateit/interpreter.rb +641 -0
- data/lib/automateit/package_manager.rb +242 -0
- data/lib/automateit/package_manager/apt.rb +63 -0
- data/lib/automateit/package_manager/egg.rb +64 -0
- data/lib/automateit/package_manager/gem.rb +179 -0
- data/lib/automateit/package_manager/portage.rb +69 -0
- data/lib/automateit/package_manager/yum.rb +65 -0
- data/lib/automateit/platform_manager.rb +47 -0
- data/lib/automateit/platform_manager/darwin.rb +30 -0
- data/lib/automateit/platform_manager/debian.rb +26 -0
- data/lib/automateit/platform_manager/freebsd.rb +25 -0
- data/lib/automateit/platform_manager/gentoo.rb +26 -0
- data/lib/automateit/platform_manager/lsb.rb +40 -0
- data/lib/automateit/platform_manager/struct.rb +78 -0
- data/lib/automateit/platform_manager/uname.rb +29 -0
- data/lib/automateit/platform_manager/windows.rb +33 -0
- data/lib/automateit/plugin.rb +7 -0
- data/lib/automateit/plugin/base.rb +32 -0
- data/lib/automateit/plugin/driver.rb +218 -0
- data/lib/automateit/plugin/manager.rb +232 -0
- data/lib/automateit/project.rb +460 -0
- data/lib/automateit/root.rb +14 -0
- data/lib/automateit/service_manager.rb +79 -0
- data/lib/automateit/service_manager/chkconfig.rb +39 -0
- data/lib/automateit/service_manager/rc_update.rb +37 -0
- data/lib/automateit/service_manager/sysv.rb +126 -0
- data/lib/automateit/service_manager/update_rcd.rb +35 -0
- data/lib/automateit/shell_manager.rb +261 -0
- data/lib/automateit/shell_manager/base_link.rb +67 -0
- data/lib/automateit/shell_manager/link.rb +24 -0
- data/lib/automateit/shell_manager/portable.rb +421 -0
- data/lib/automateit/shell_manager/symlink.rb +32 -0
- data/lib/automateit/shell_manager/which.rb +25 -0
- data/lib/automateit/tag_manager.rb +63 -0
- data/lib/automateit/tag_manager/struct.rb +101 -0
- data/lib/automateit/tag_manager/tag_parser.rb +91 -0
- data/lib/automateit/tag_manager/yaml.rb +29 -0
- data/lib/automateit/template_manager.rb +55 -0
- data/lib/automateit/template_manager/base.rb +172 -0
- data/lib/automateit/template_manager/erb.rb +17 -0
- data/lib/ext/metaclass.rb +17 -0
- data/lib/ext/object.rb +18 -0
- data/lib/hashcache.rb +22 -0
- data/lib/helpful_erb.rb +63 -0
- data/lib/nested_error.rb +33 -0
- data/lib/queued_logger.rb +68 -0
- data/lib/tempster.rb +239 -0
- data/misc/index_gem_repository.rb +303 -0
- data/misc/setup_egg.rb +12 -0
- data/misc/setup_gem_dependencies.sh +7 -0
- data/misc/setup_rubygems.sh +21 -0
- data/misc/which.cmd +6 -0
- data/spec/extras/automateit_service_sysv_test +50 -0
- data/spec/extras/scratch.rb +15 -0
- data/spec/extras/simple_recipe.rb +8 -0
- data/spec/integration/account_manager_spec.rb +218 -0
- data/spec/integration/address_manager_linux_spec.rb +119 -0
- data/spec/integration/address_manager_portable_spec.rb +30 -0
- data/spec/integration/cli_spec.rb +215 -0
- data/spec/integration/examples_spec.rb +54 -0
- data/spec/integration/examples_spec_editor.rb +71 -0
- data/spec/integration/package_manager_spec.rb +104 -0
- data/spec/integration/platform_manager_spec.rb +69 -0
- data/spec/integration/service_manager_sysv_spec.rb +115 -0
- data/spec/integration/shell_manager_spec.rb +471 -0
- data/spec/integration/template_manager_erb_spec.rb +31 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/unit/edit_manager_spec.rb +162 -0
- data/spec/unit/field_manager_spec.rb +79 -0
- data/spec/unit/hashcache_spec.rb +28 -0
- data/spec/unit/interpreter_spec.rb +98 -0
- data/spec/unit/platform_manager_spec.rb +44 -0
- data/spec/unit/plugins_spec.rb +253 -0
- data/spec/unit/tag_manager_spec.rb +189 -0
- data/spec/unit/template_manager_erb_spec.rb +137 -0
- metadata +249 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.-P���KҠV�!�7CD�oZN캌<|,Q��ˤ!;�8i�r���Ɣ�S]�e{��M��p;E�F�ȧ!���x��`�h�2%Zd(�2eh����sbU��sj�ɰ�����g�݉Ѳڻ���oj�_�/�&q���G:�(�.bn��8�=���L��8O�6�4Ct�������3U�.?<�Bs�}�3n �t������-�n�Q9.�hf�n%�"�VA����*�9��_�����H ča�yϩ3
|
data/CHANGES.txt
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
0.70923:
|
2
|
+
Date: Sun, 23 Sep 2007 16:01:03 -0700
|
3
|
+
Desc:
|
4
|
+
- Fixed hard link and symlink detection on Windows, spec will now skip these examples.
|
5
|
+
- Fixed cli_spec so it can invoke Windows version of rake.
|
6
|
+
|
7
|
+
0.70922:
|
8
|
+
Date: Sat, 22 Sep 2007 22:56:39 -0700
|
9
|
+
Desc:
|
10
|
+
- Refactored AccountManager::Linux and extracted Passwd driver.
|
11
|
+
- Refactored Shellmanager::Portable and extracted Which, Link and Symlink drivers.
|
12
|
+
- Improved Plugin::Driver, added a depends_on :libraries option.
|
13
|
+
|
14
|
+
0.70921:
|
15
|
+
Date: Fri, 21 Sep 2007 18:29:24 -0700
|
16
|
+
Desc:
|
17
|
+
- Improved AccountManager::Linux to work around a race condition in PTY/Expect that happens about 1% of the time when setting a password.
|
18
|
+
- Improved executables (e.g., bin/automateit) to display help with "-h", in addition to "--help".
|
19
|
+
- Improved executables (e.g., bin/automateit) to display version with "-v" and "--version".
|
20
|
+
- Refactored EditSession and its documentation.
|
21
|
+
- Refactored TemplateManager, moved common logic into BaseDriver.
|
22
|
+
- Refactored Rakefile for clarity.
|
23
|
+
- Replaced GemSpec with Hoe in preparation to uploading AutomateIt to RubyForge.
|
24
|
+
|
25
|
+
0.70919:
|
26
|
+
Date: Wed, 19 Sep 2007 22:08:42 -0700
|
27
|
+
Desc:
|
28
|
+
- (!) Normalized PackageManager methods and ShellManager#chperm to use consistent ':details => true' option.
|
29
|
+
- (!) Refactored PackageManager with :details mode to return both a boolean and list of affected packages, previously it only returned packages.
|
30
|
+
- Fixed bug in ShellManager and Tempster that created temporary files and directories in preview mode.
|
31
|
+
- Created 'preview' methods to replace old 'noop' commands. Improved documentation for previewing commands.
|
32
|
+
- Made it easier to embed the Interpreter using new methods 'include_in' and 'add_method_missing_to'. Included Rakefile with default and example projects to demonstrate embedding.
|
33
|
+
- Improved AccountManager, it can set and change passwords on user accounts.
|
34
|
+
- Improved TagManager, it lazy-loads tags to speed startup.
|
35
|
+
- Improved ShellManager, TemplateManager and EditManager so they translate :owner to :user for Cfengine refugees.
|
36
|
+
- Improved support for Darwin and JRuby. Reworked methods and drivers to let these access more features.
|
37
|
+
|
38
|
+
0.70915:
|
39
|
+
Date: Sat, 15 Sep 2007 23:09:26 -0700
|
40
|
+
Desc:
|
41
|
+
- Improved Interpreter with friendly error messages that make it easier for users to see what's wrong with a recipe. These new messages display the cause, a snapshot of the problematic code, shortened paths, and only the relevant stack frames. Also provided way to get complete, raw backtraces for debugging internals.
|
42
|
+
- Improved plugins that use ERB by creating a new HelpfulERB class that provides sane behavior and provides friendly, contextual error messages making it much easier for users to identify and fix problems in templates.
|
43
|
+
|
44
|
+
0.70914:
|
45
|
+
Date: Fri, 14 Sep 2007 17:37:48 -0700
|
46
|
+
Desc:
|
47
|
+
- (%) Fixed bug in ShellManager::Portable that caused 'cp' to actually copy even when in 'noop' mode.
|
48
|
+
- Ported code to work with JRuby.
|
49
|
+
- Wrote TagParser that works with JRuby and handles arbitrarily complex and deep rules with correct precedence.
|
50
|
+
- Improved PackageManager commands to accept hash of names to paths, e.g., if package 'TracTags' isn't present, installs it from a directory.
|
51
|
+
- Improved PackageManager commands to accept annotated, free-form strings with comments.
|
52
|
+
- Improved Interpreter.invoke to search a project's recipes directory, making it easier for recipes to invoke other recipes.
|
53
|
+
- Improved EditSession to provide easier access to Interpreter methods.
|
54
|
+
- Improved ServiceManager to provide 'start_and_enable' and 'start_or_restart' convenience commands.
|
55
|
+
|
56
|
+
0.70913:
|
57
|
+
Date: Thu, 13 Sep 2007 06:35:50 -0700
|
58
|
+
Desc:
|
59
|
+
- (%) Fixed bug in PackageManager::Gem, it wasn't recognizing packages installed multiple times as being installed.
|
60
|
+
- Provided complete support for CentOS and RedHat.
|
61
|
+
- Provided complete support for Gentoo with new PackageManager::Portage and ServiceManager::RC_Update drivers.
|
62
|
+
- Provided basic support for FreeBSD with new PlatformManager::FreeBSD.
|
63
|
+
- Rewrote AddressManager::Linux using pure 'ifconfig' calls, which provide more universal support than 'iproute'.
|
64
|
+
- Reworked examples to create a user for the application, demonstrating the use of AccountManager and eliminating need for workarounds to platform-specific differences for the 'nobody' account.
|
65
|
+
- Added new 'depends_on' option to check complex dependencies using callbacks, e.g., ensure a specific version of ifconfig.
|
66
|
+
- Included examples/basic in Gem distribution, the code used in the Screenshots.
|
67
|
+
|
68
|
+
0.70912:
|
69
|
+
Date: Wed, 12 Sep 2007 18:54:10 -0700
|
70
|
+
Desc:
|
71
|
+
- (%) Fixed bug where a project's fields were sometimes accidentally cleared. Wrote tests to make sure this won't happen again.
|
72
|
+
- Added tests for examples/basic recipes.
|
73
|
+
- Added ServiceManager started? and stopped? methods with wait timeouts.
|
74
|
+
0.70910:
|
75
|
+
Date: Mon, 10 Sep 2007 19:34:25 -0700
|
76
|
+
Desc:
|
77
|
+
- (!) Reworked Plugins so drivers find managers by inheritance, rather than by name. Simplifies code and allows drivers in different namespaces than their manager. Should be one of the last changes that breaks backwards-compatibility in Plugins for a while.
|
78
|
+
|
79
|
+
0.70909:
|
80
|
+
Date: Sun, 09 Sep 2007 16:39:58 -0700
|
81
|
+
Desc:
|
82
|
+
- Added initial support for Apple Mac OS X. Includes a PlatformManager driver for Darwin, and assorted changes needed for AutomateIt to run on the old Ruby 1.8.2 bundled with Tiger.
|
83
|
+
- Fixed AddressManager by eliminating exceptions raised on misconfigured systems that didn't have IPs for local hostnames.
|
84
|
+
|
85
|
+
0.70907:
|
86
|
+
Date: Fri, 07 Sep 2007 23:48:55 -0700
|
87
|
+
Desc:
|
88
|
+
- (!) Created AbstractDriver classes for each plugin and made the concrete drivers subclass these.
|
89
|
+
- Wrote tests for CLI, which create projects, invoke recipes, run the interactive shell, etc.
|
90
|
+
- Eliminated need for custom drivers to run 'setup' on their associated plugin instance.
|
91
|
+
|
92
|
+
0.70906:
|
93
|
+
Date: Thu, 06 Sep 2007 23:55:30 -0700
|
94
|
+
Desc:
|
95
|
+
- Massive improvements to documentation -- thanks Amy!
|
96
|
+
- Renamed "UNIX" to "Unix" to avoid trademark issues.
|
97
|
+
0.70903:
|
98
|
+
Date: Sun, 03 Sep 2007 10:02:56 -0700
|
99
|
+
Desc:
|
100
|
+
- Initial beta release.
|
data/Hoe.rake
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift('lib')
|
4
|
+
require 'automateit'
|
5
|
+
@interpreter = AutomateIt.new
|
6
|
+
|
7
|
+
HoeInclude = {
|
8
|
+
:executables => Dir['bin/*'].reject{|t|t.match(/~/)}.map{|t|File.basename(t)},
|
9
|
+
:files => (%w(env.sh gpl.txt CHANGES.txt Hoe.rake Manifest.txt Rakefile README.txt TESTING.txt TODO.txt TUTORIAL.txt) + FileList["{bin,examples,docs,lib,misc,spec}/**/*"]).to_a.reject{|t| File.directory?(t)},
|
10
|
+
:test_files => FileList["{spec}/**/*"].to_a,
|
11
|
+
}
|
12
|
+
|
13
|
+
desc "Create manifest"
|
14
|
+
task :manifest do
|
15
|
+
# Diff: rake -f Hoe.rake check_manifest
|
16
|
+
items = Set.new(HoeInclude[:files])
|
17
|
+
File.open("Manifest.txt", "w+"){|h| h.write(items.to_a.sort.join("\n")+"\n")}
|
18
|
+
end
|
19
|
+
|
20
|
+
Hoe.new("AutomateIt", AutomateIt::VERSION.to_s) do |s|
|
21
|
+
s.author = "Igal Koshevoy"
|
22
|
+
s.changes = s.paragraphs_of('CHANGES.txt', 0).join("\n")
|
23
|
+
s.description = "AutomateIt is an open-source tool for automating the setup and maintenance of UNIX-like systems"
|
24
|
+
s.email = "igal@pragmaticraft.com"
|
25
|
+
s.extra_deps = [["activesupport", ">= 1.4"], ["open4", ">= 0.9"]]
|
26
|
+
s.name = "automateit"
|
27
|
+
s.summary = "AutomateIt is an open-source tool for automating the setup and maintenance of UNIX-like systems"
|
28
|
+
s.url = "http://automateit.org/"
|
29
|
+
s.spec_extras = {
|
30
|
+
:platform => Gem::Platform::RUBY,
|
31
|
+
:rdoc_options => %w(--main README.txt --promiscuous --accessor class_inheritable_accessor=R --title) << 'AutomateIt is an open-source tool for automating the setup and maintenance of UNIX-like systems.' << %w(lib docs),
|
32
|
+
:extra_rdoc_files => FileList[%w(README.txt TUTORIAL.txt TESTING.txt), "docs/*.txt"],
|
33
|
+
}
|
34
|
+
s.spec_extras.merge!(HoeInclude)
|
35
|
+
end
|
data/Manifest.txt
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
CHANGES.txt
|
2
|
+
Hoe.rake
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
TESTING.txt
|
7
|
+
TODO.txt
|
8
|
+
TUTORIAL.txt
|
9
|
+
bin/ai
|
10
|
+
bin/aifield
|
11
|
+
bin/aitag
|
12
|
+
bin/automateit
|
13
|
+
docs/friendly_errors.txt
|
14
|
+
docs/previews.txt
|
15
|
+
env.sh
|
16
|
+
examples/basic/Rakefile
|
17
|
+
examples/basic/config/automateit_env.rb
|
18
|
+
examples/basic/config/fields.yml
|
19
|
+
examples/basic/config/tags.yml
|
20
|
+
examples/basic/dist/README.txt
|
21
|
+
examples/basic/dist/myapp_server.erb
|
22
|
+
examples/basic/install.log
|
23
|
+
examples/basic/lib/README.txt
|
24
|
+
examples/basic/recipes/README.txt
|
25
|
+
examples/basic/recipes/install.rb
|
26
|
+
examples/basic/recipes/uninstall.rb
|
27
|
+
gpl.txt
|
28
|
+
lib/automateit.rb
|
29
|
+
lib/automateit/account_manager.rb
|
30
|
+
lib/automateit/account_manager/linux.rb
|
31
|
+
lib/automateit/account_manager/portable.rb
|
32
|
+
lib/automateit/address_manager.rb
|
33
|
+
lib/automateit/address_manager/linux.rb
|
34
|
+
lib/automateit/address_manager/portable.rb
|
35
|
+
lib/automateit/cli.rb
|
36
|
+
lib/automateit/common.rb
|
37
|
+
lib/automateit/constants.rb
|
38
|
+
lib/automateit/edit_manager.rb
|
39
|
+
lib/automateit/error.rb
|
40
|
+
lib/automateit/field_manager.rb
|
41
|
+
lib/automateit/interpreter.rb
|
42
|
+
lib/automateit/package_manager.rb
|
43
|
+
lib/automateit/package_manager/apt.rb
|
44
|
+
lib/automateit/package_manager/egg.rb
|
45
|
+
lib/automateit/package_manager/gem.rb
|
46
|
+
lib/automateit/package_manager/portage.rb
|
47
|
+
lib/automateit/package_manager/yum.rb
|
48
|
+
lib/automateit/platform_manager.rb
|
49
|
+
lib/automateit/platform_manager/darwin.rb
|
50
|
+
lib/automateit/platform_manager/debian.rb
|
51
|
+
lib/automateit/platform_manager/freebsd.rb
|
52
|
+
lib/automateit/platform_manager/gentoo.rb
|
53
|
+
lib/automateit/platform_manager/lsb.rb
|
54
|
+
lib/automateit/platform_manager/struct.rb
|
55
|
+
lib/automateit/platform_manager/uname.rb
|
56
|
+
lib/automateit/platform_manager/windows.rb
|
57
|
+
lib/automateit/plugin.rb
|
58
|
+
lib/automateit/plugin/base.rb
|
59
|
+
lib/automateit/plugin/driver.rb
|
60
|
+
lib/automateit/plugin/manager.rb
|
61
|
+
lib/automateit/project.rb
|
62
|
+
lib/automateit/root.rb
|
63
|
+
lib/automateit/service_manager.rb
|
64
|
+
lib/automateit/service_manager/chkconfig.rb
|
65
|
+
lib/automateit/service_manager/rc_update.rb
|
66
|
+
lib/automateit/service_manager/sysv.rb
|
67
|
+
lib/automateit/service_manager/update_rcd.rb
|
68
|
+
lib/automateit/shell_manager.rb
|
69
|
+
lib/automateit/shell_manager/portable.rb
|
70
|
+
lib/automateit/shell_manager/unix.rb
|
71
|
+
lib/automateit/tag_manager.rb
|
72
|
+
lib/automateit/tag_manager/struct.rb
|
73
|
+
lib/automateit/tag_manager/tag_parser.rb
|
74
|
+
lib/automateit/tag_manager/yaml.rb
|
75
|
+
lib/automateit/template_manager.rb
|
76
|
+
lib/automateit/template_manager/base.rb
|
77
|
+
lib/automateit/template_manager/erb.rb
|
78
|
+
lib/ext/metaclass.rb
|
79
|
+
lib/ext/object.rb
|
80
|
+
lib/hashcache.rb
|
81
|
+
lib/helpful_erb.rb
|
82
|
+
lib/nested_error.rb
|
83
|
+
lib/queued_logger.rb
|
84
|
+
lib/tempster.rb
|
85
|
+
misc/index_gem_repository.rb
|
86
|
+
misc/setup_egg.rb
|
87
|
+
misc/setup_gem_dependencies.sh
|
88
|
+
misc/setup_rubygems.sh
|
89
|
+
spec/extras/automateit_service_sysv_test
|
90
|
+
spec/extras/scratch.rb
|
91
|
+
spec/extras/simple_recipe.rb
|
92
|
+
spec/integration/account_manager_spec.rb
|
93
|
+
spec/integration/address_manager_linux_spec.rb
|
94
|
+
spec/integration/address_manager_portable_spec.rb
|
95
|
+
spec/integration/cli_spec.rb
|
96
|
+
spec/integration/examples_spec.rb
|
97
|
+
spec/integration/examples_spec_editor.rb
|
98
|
+
spec/integration/package_manager_spec.rb
|
99
|
+
spec/integration/platform_manager_spec.rb
|
100
|
+
spec/integration/service_manager_sysv_spec.rb
|
101
|
+
spec/integration/shell_manager_spec.rb
|
102
|
+
spec/integration/template_manager_erb_spec.rb
|
103
|
+
spec/spec_helper.rb
|
104
|
+
spec/unit/edit_manager_spec.rb
|
105
|
+
spec/unit/field_manager_spec.rb
|
106
|
+
spec/unit/hashcache_spec.rb
|
107
|
+
spec/unit/interpreter_spec.rb
|
108
|
+
spec/unit/platform_manager_spec.rb
|
109
|
+
spec/unit/plugins_spec.rb
|
110
|
+
spec/unit/tag_manager_spec.rb
|
111
|
+
spec/unit/template_manager_erb_spec.rb
|
data/README.txt
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
== AutomateIt
|
2
|
+
|
3
|
+
<em>AutomateIt is an open-source tool for automating the setup and maintenance of servers.</em>
|
4
|
+
|
5
|
+
Information about AutomateIt is best read in the following order:
|
6
|
+
1. http://AutomateIt.org -- website explaining what it is and why it's useful
|
7
|
+
2. Screenshots[http://AutomateIt.org/screenshots] -- quick tour of sample AutomateIt code
|
8
|
+
3. TUTORIAL.txt[link:files/TUTORIAL_txt.html] -- hands-on tutorial
|
9
|
+
4. TESTING.txt[link:files/TESTING_txt.html] -- instructions on running the AutomateIt self-test
|
10
|
+
5. Links on the left provide technical documentation for specific classes and methods
|
11
|
+
|
12
|
+
=== Quick links
|
13
|
+
|
14
|
+
Commands, run these with <tt>--help</tt> for help:
|
15
|
+
* +automateit+ or +ai+ -- Run a recipe or create a project.
|
16
|
+
* +aitag+ -- Query project's tags.
|
17
|
+
* +aifield+ -- Query project's fields.
|
18
|
+
|
19
|
+
Execution:
|
20
|
+
* AutomateIt::Interpreter -- Runs AutomateIt commands.
|
21
|
+
* AutomateIt::Project -- Collection of related recipes, tags, fields and custom plugins.
|
22
|
+
|
23
|
+
Plugins:
|
24
|
+
* AutomateIt::AccountManager -- Manipulates users and groups.
|
25
|
+
* AutomateIt::AddressManager -- Manipulates host's network addresses.
|
26
|
+
* AutomateIt::EditManager -- Edits files and strings.
|
27
|
+
* AutomateIt::EditManager::EditSession -- Commands for editing files.
|
28
|
+
* AutomateIt::FieldManager -- Queries configuration variables.
|
29
|
+
* AutomateIt::PackageManager -- Manipulates software packages.
|
30
|
+
* AutomateIt::PlatformManager -- Queries platform, such as its OS version.
|
31
|
+
* AutomateIt::ServiceManager -- Manipulates services, such as Unix daemons.
|
32
|
+
* AutomateIt::ShellManager -- Manipulates files and executes Unix commands.
|
33
|
+
* AutomateIt::TagManager -- Groups hosts by role and queries membership.
|
34
|
+
* AutomateIt::TemplateManager -- Renders templates to files.
|
35
|
+
|
36
|
+
=== Legal
|
37
|
+
|
38
|
+
Copyright (C) 2007 Igal Koshevoy (igal@pragmaticraft.com)
|
39
|
+
|
40
|
+
AutomateIt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
|
41
|
+
|
42
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
43
|
+
|
44
|
+
You should have received a copy of the GNU General Public License along with this program. If not, see: http://www.gnu.org/licenses/
|
data/Rakefile
ADDED
@@ -0,0 +1,284 @@
|
|
1
|
+
require 'spec/rake/spectask'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
task :default => :spec
|
5
|
+
|
6
|
+
#---[ Wrappers ]--------------------------------------------------------
|
7
|
+
|
8
|
+
# Return an AutomateIt interpreter
|
9
|
+
def automateit
|
10
|
+
return @automateit ||= begin
|
11
|
+
$LOAD_PATH.unshift('lib')
|
12
|
+
require 'automateit'
|
13
|
+
AutomateIt.new
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Run a hoe +task+.
|
18
|
+
#
|
19
|
+
def hoe(task)
|
20
|
+
# XXX Hoe provides many tasks I don't need, don't like the implementation of,
|
21
|
+
# or don't like their names. I'd use Rake's 'import' and 'invoke' but the Hoe
|
22
|
+
# tasks have names that clash with the ones in this Rakefile. The lame
|
23
|
+
# workaround is to invoke Rake via shell, rather than through Ruby.
|
24
|
+
sh "rake -f Hoe.rake #{task}"
|
25
|
+
end
|
26
|
+
|
27
|
+
#---[ RSpec ]-----------------------------------------------------------
|
28
|
+
|
29
|
+
# Run rspec on the +files+
|
30
|
+
def specify(*files)
|
31
|
+
Spec::Rake::SpecTask.new(:spec_internal) do |t|
|
32
|
+
t.rcov = @rcov
|
33
|
+
t.rcov_opts = ['--text-summary', '--include', 'lib', '--exclude', 'spec,.irbrc']
|
34
|
+
t.spec_files = FileList[*files]
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::Task[:spec_internal].invoke
|
38
|
+
|
39
|
+
# Change the ownership of the newly-created coverage directory back to that
|
40
|
+
# of the user which owns the top-level directory.
|
41
|
+
if @rcov
|
42
|
+
Rake::Task[:chown].invoke
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Run the unit test suite"
|
47
|
+
task "spec" do
|
48
|
+
target = ENV['F'] || ENV['FILE'] || 'spec/unit/**/*_spec.rb'
|
49
|
+
specify(target)
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Generate a code coverage report for the unit tests in the 'coverage' directory"
|
53
|
+
task "rcov" do
|
54
|
+
@rcov = true
|
55
|
+
Rake::Task["spec"].invoke
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Run all the test suites, including unit and integration"
|
59
|
+
task "spec:all" do
|
60
|
+
puts "=> Running integration test suite. This may take a few minutes and nothing may seem to be happening for a while -- this is normal and expected."
|
61
|
+
specify('spec/unit/**/*_spec.rb', 'spec/functional/**/*_spec.rb', 'spec/integration/**/*_spec.rb')
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Generate a code coverage report for the unit and integration tests"
|
65
|
+
task "rcov:all" do
|
66
|
+
@rcov = true
|
67
|
+
Rake::Task["spec:all"].invoke
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Print verbose descriptions while running specs"
|
71
|
+
task "verbose" do
|
72
|
+
ENV["SPEC_OPTS"] = "-fs"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Profile the specs"
|
76
|
+
task :prof do
|
77
|
+
sh "ruby-prof -f prof.txt `which spec` spec/unit/*.rb"
|
78
|
+
end
|
79
|
+
|
80
|
+
#---[ Lines of code ]---------------------------------------------------
|
81
|
+
|
82
|
+
class Numeric
|
83
|
+
def commify() (s=self.to_s;x=s.length;s).rjust(x+(3-(x%3))).gsub(/(\d)(?=\d{3}+(\.\d*)?$)/,'\1,').strip end
|
84
|
+
end
|
85
|
+
|
86
|
+
desc "Display the lines of source code and how many lines were changed in the repository"
|
87
|
+
task :loc => [:loclines, :locdiff, :locchurn, :sloc]
|
88
|
+
|
89
|
+
desc "Display the lines of source code"
|
90
|
+
task :loclines do
|
91
|
+
require 'find'
|
92
|
+
lines = 0
|
93
|
+
bytes = 0
|
94
|
+
Find.find(*%w(bin lib spec Rakefile ../web/Rakefile ../web/src )) do |path|
|
95
|
+
Find.prune if path.match(/.*(\b(.hg|.svn|CVS)\b|(.sw.?|.pyc)$)/)
|
96
|
+
next if File.directory?(path)
|
97
|
+
if path.match(/(\bbin\b|.*\.(env|pl|py|rb|rake|java|sql|ftl|jsp|xml|properties|css|rcss|html|rhtml|erb|po|haml|sass)$)/)
|
98
|
+
data = File.read(path)
|
99
|
+
bytes += data.size
|
100
|
+
lines += data.scan(/^.+$/).size
|
101
|
+
end
|
102
|
+
end
|
103
|
+
puts "Lines: "+lines.commify
|
104
|
+
puts "Bytes: "+bytes.commify
|
105
|
+
end
|
106
|
+
|
107
|
+
desc "Display the lines of code changed in the repository"
|
108
|
+
task :locdiff do
|
109
|
+
if File.directory?(".hg")
|
110
|
+
puts "%s lines added and removed through SCM operations" % `hg log --patch`.scan(/^[+-][^+-].+/).size.commify
|
111
|
+
else
|
112
|
+
raise NotImplementedError.new("Sorry, this only works for a Mercurial checkout")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Display lines of churn"
|
117
|
+
task :locchurn do
|
118
|
+
require 'active_support'
|
119
|
+
puts "%s lines of Hg churn" % (`hg churn`.scan(/^[^\s]+\s+(\d+)\s/).flatten.map(&:to_i).sum).commify
|
120
|
+
end
|
121
|
+
|
122
|
+
task :sloc do
|
123
|
+
sh "sloccount lib spec misc examples bin"
|
124
|
+
end
|
125
|
+
|
126
|
+
#---[ RubyGems ]--------------------------------------------------------
|
127
|
+
|
128
|
+
desc "Regenerate Gem"
|
129
|
+
task :regem do
|
130
|
+
archive_path = "../gem_archive"
|
131
|
+
has_archive = File.directory?(archive_path)
|
132
|
+
puts "WARNING: Archive of previously released gems at '#{archive_path}' is not available, do not upload without these." unless has_archive
|
133
|
+
rm_r Dir["pkg/*"]
|
134
|
+
mkdir_p "pkg/pub/gems"
|
135
|
+
cp FileList["#{archive_path}/*.gem"], "pkg/pub/gems", :preserve => true if has_archive and not Dir["#{archive_path}/*.gem"].empty?
|
136
|
+
Rake::Task[:gem].invoke
|
137
|
+
cp Dir["pkg/*.gem"], "pkg/pub/gems", :preserve => true
|
138
|
+
cp Dir["pkg/*.gem"], "#{archive_path}", :preserve => true if has_archive
|
139
|
+
sh "cd pkg/pub && ruby ../../misc/index_gem_repository.rb" if has_archive
|
140
|
+
end
|
141
|
+
|
142
|
+
desc "Generate manifest"
|
143
|
+
task :manifest do
|
144
|
+
hoe(:manifest)
|
145
|
+
end
|
146
|
+
|
147
|
+
desc "RFC-822 time for right now, optional D=x where x is delta like '1.day' ago"
|
148
|
+
task :now do
|
149
|
+
require 'active_support'
|
150
|
+
time = Time.now
|
151
|
+
if delta = ENV["D"]
|
152
|
+
time = eval "time - #{delta}"
|
153
|
+
end
|
154
|
+
puts time.to_s(:rfc822)
|
155
|
+
end
|
156
|
+
|
157
|
+
namespace :gem do
|
158
|
+
desc "View Gem metadata"
|
159
|
+
task :metadata do
|
160
|
+
sh "cd pkg/; tar xvf *.gem; gunzip *.gz; less metadata"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
task :gem do
|
165
|
+
hoe(:gem)
|
166
|
+
end
|
167
|
+
|
168
|
+
#---[ Install and uninstall ]-------------------------------------------
|
169
|
+
|
170
|
+
=begin
|
171
|
+
# Uninstall is similar to:
|
172
|
+
gem uninstall -a -x automateit
|
173
|
+
rm -rf /usr/lib/ruby/gems/*/gems/automateit-*/ /usr/bin/{automateit,field_lookup} /usr/lib/ruby/gems/*/doc/automateit-*/
|
174
|
+
|
175
|
+
# Install is similar to:
|
176
|
+
gem install -y pkg/automateit-*.gem --no-ri --no-rdoc
|
177
|
+
=end
|
178
|
+
|
179
|
+
namespace :install do
|
180
|
+
desc "Install Gem from 'pkg' dir without docs, removing existing Gem first"
|
181
|
+
task :local do
|
182
|
+
Rake::Task[:uninstall].invoke
|
183
|
+
#sh "sudo gem install -y pkg/*.gem --no-ri --no-rdoc"
|
184
|
+
puts automateit.package_manager.install({"automateit" => Dir["pkg/*.gem"].first}, :with => :gem, :docs => false)
|
185
|
+
end
|
186
|
+
|
187
|
+
desc "Install Gem from website without docs, removing existing Gem first"
|
188
|
+
task :remote do
|
189
|
+
Rake::Task[:uninstall].invoke
|
190
|
+
#sh "sudo gem install -y -r -s http://automateit.org/pub automateit --no-ri --no-rdoc"
|
191
|
+
sh "gem sources -r http://automateit.org/pub" rescue nil
|
192
|
+
automateit.package_manager.install("automateit", :source => "http://automateit.org/pub", :with => :gem, :docs => false)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
task :uninstall do
|
197
|
+
automateit.package_manager.uninstall "automateit", :with => :gem
|
198
|
+
end
|
199
|
+
|
200
|
+
#---[ RDoc ]------------------------------------------------------------
|
201
|
+
|
202
|
+
namespace :rdoc do
|
203
|
+
desc "Generate documentation"
|
204
|
+
task :make do
|
205
|
+
# Uses Jamis Buck's RDoc template from http://weblog.jamisbuck.org/2005/4/8/rdoc-template
|
206
|
+
sh "rdoc --template=jamis --main README.txt --promiscuous --accessor class_inheritable_accessor=R --title 'AutomateIt is an open-source tool for automating the setup and maintenance of UNIX-like systems.' lib docs/*.txt README.txt TUTORIAL.txt TESTING.txt"
|
207
|
+
# Create a tutorial index
|
208
|
+
File.open("doc/tutorial.html", "w+") do |writer|
|
209
|
+
writer.write(File.read("doc/index.html").sub(/README_txt.html/, 'TUTORIAL_txt.html'))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
desc "Rewrite RDoc HTML by interpolating custom tags"
|
214
|
+
task :rewrite do
|
215
|
+
require 'cgi'
|
216
|
+
pattern = /(\[{3})\s*(.+?)\s*(\]{3})/m
|
217
|
+
for filename in Dir["doc/**/*.html"]
|
218
|
+
input = File.read(filename)
|
219
|
+
next unless input and input.match(pattern)
|
220
|
+
puts filename
|
221
|
+
output = input.gsub(pattern){|m| CGI.unescapeHTML($2)}
|
222
|
+
if input != output
|
223
|
+
FileUtils.mv(filename, filename+".bak", :verbose => true)
|
224
|
+
File.open(filename, "w+"){|h| h.write(output)}
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
desc "Undo rewrite by restoring backups"
|
230
|
+
task :undo do
|
231
|
+
for filename in Dir["doc/**/*.html.bak"]
|
232
|
+
FileUtils.mv(filename, filename.sub(/\.bak$/, ''), :verbose => true)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
desc "Generate documentation for specific files in an endless loop"
|
237
|
+
task :loop do
|
238
|
+
sources_and_targets = {
|
239
|
+
"doc/files/TUTORIAL_txt.html" => "TUTORIAL.txt"
|
240
|
+
}
|
241
|
+
|
242
|
+
while true
|
243
|
+
different = false
|
244
|
+
for source, target in sources_and_targets
|
245
|
+
if ! File.exists?(target) or (File.exists?(target) and File.mtime(target) > File.mtime(source))
|
246
|
+
different = true
|
247
|
+
break
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
puts "checking %s" % File.mtime(target)
|
252
|
+
puts "different" if different
|
253
|
+
|
254
|
+
sh "rdoc --template=jamis --promiscuous --accessor class_inheritable_accessor=R --title 'AutomateIt is an open-source tool for automating the setup and maintenance of UNIX-like systems.' %s" % sources_and_targets.values.join(" ") if different
|
255
|
+
sleep 1
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
task :rdoc => ["rdoc:make", "rdoc:rewrite"]
|
261
|
+
|
262
|
+
desc "List aliased_methods for inclusion into rdoc"
|
263
|
+
task :aliased_methods do
|
264
|
+
automateit.instance_eval do
|
265
|
+
methods_and_plugins = []
|
266
|
+
plugins.values.each{|plugin| plugin.aliased_methods && plugin.aliased_methods.each{|method| methods_and_plugins << [method.to_s, plugin.class.to_s]}}
|
267
|
+
|
268
|
+
for method, plugin in methods_and_plugins.sort_by{|x| x[0]}
|
269
|
+
puts " # * %s -- %s#%s" % [method, plugin, method]
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
#---[ Misc ]------------------------------------------------------------
|
275
|
+
|
276
|
+
desc "Chown files if needed"
|
277
|
+
task :chown do
|
278
|
+
if automateit.superuser?
|
279
|
+
stat = File.stat("..")
|
280
|
+
automateit.chown_R(stat.uid, stat.gid, FileList["*", ".*"], :details => true)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
#===[ fin ]=============================================================
|