FluxTuna 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rvmrc ADDED
@@ -0,0 +1,27 @@
1
+ ruby_string="ruby-1.9.2-p180"
2
+ gemset_name="whitecloth"
3
+
4
+ if rvm list strings | grep -q "${ruby_string}" ; then
5
+
6
+ # Load or create the specified environment
7
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
8
+ && -s "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}" ]] ; then
9
+ \. "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}"
10
+ else
11
+ rvm --create "${ruby_string}@${gemset_name}"
12
+ fi
13
+
14
+ # Ensure that Bundler is installed, install it if it is not.
15
+ if ! command -v bundle ; then
16
+ gem install bundler
17
+ fi
18
+
19
+ # Bundle while reducing excess noise.
20
+ bundle | grep -v 'Using' | grep -v 'complete' | sed '/^$/d'
21
+
22
+ else
23
+
24
+ # Notify the user to install the desired interpreter before proceeding.
25
+ echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
26
+
27
+ fi
data/Gemfile ADDED
@@ -0,0 +1,51 @@
1
+ ###
2
+ ### Sources
3
+ ###
4
+
5
+ # Main Ruby Gems site
6
+ source "http://rubygems.org"
7
+
8
+ ###
9
+ ### Core Gems. These are required in _all_ environments (additional environments
10
+ ### follow).
11
+ ###
12
+
13
+ # Additional data structures
14
+ gem "algorithms"
15
+
16
+ # GUID library
17
+ gem "uuidtools"
18
+
19
+ # Gem required for linking to the Redis server
20
+ gem "hiredis", "~> 0.3.1"
21
+ gem "em-synchrony"
22
+ gem "redis", "~> 2.2.0", :require => ["redis/connection/synchrony", "redis"]
23
+
24
+ # Command line parser
25
+ gem "cli"
26
+ gem "cri"
27
+
28
+ # Simpler access to the OpenSSL library
29
+ gem "gibberish"
30
+
31
+ ###
32
+ ### Development Gems. All _additional_ gems required by development (as opposed to
33
+ ### production environments). If it is required at run-time, it
34
+ ### belongs above.
35
+ group :development do
36
+
37
+ # Gem management tools
38
+ gem "bundler", "~> 1.0.0"
39
+ gem "jeweler", "~> 1.6.0"
40
+
41
+ # Documentation Tools
42
+ gem "yard", "~> 0.6.0"
43
+ gem "vclog"
44
+
45
+ # Testing Tools
46
+ gem "minitest", ">= 0"
47
+ gem "rcov", ">= 0"
48
+ gem "riot"
49
+ gem "reek", "~> 1.2.8"
50
+
51
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ algorithms (0.3.0)
5
+ ansi (1.2.5)
6
+ cli (0.0.1.2)
7
+ cri (1.0.1)
8
+ em-synchrony (0.2.0)
9
+ eventmachine (>= 0.12.9)
10
+ eventmachine (0.12.10)
11
+ facets (2.9.1)
12
+ gibberish (1.0.2)
13
+ git (1.2.5)
14
+ hiredis (0.3.1)
15
+ jeweler (1.6.0)
16
+ bundler (~> 1.0.0)
17
+ git (>= 1.2.5)
18
+ rake
19
+ minitest (2.1.0)
20
+ rake (0.8.7)
21
+ rcov (0.9.9)
22
+ redis (2.2.0)
23
+ reek (1.2.8)
24
+ ruby2ruby (~> 1.2)
25
+ ruby_parser (~> 2.0)
26
+ sexp_processor (~> 3.0)
27
+ riot (0.12.3)
28
+ rr
29
+ rr (1.0.2)
30
+ ruby2ruby (1.2.5)
31
+ ruby_parser (~> 2.0)
32
+ sexp_processor (~> 3.0)
33
+ ruby_parser (2.0.6)
34
+ sexp_processor (~> 3.0)
35
+ sexp_processor (3.0.5)
36
+ uuidtools (2.1.2)
37
+ vclog (1.8.1)
38
+ ansi (>= 1.2)
39
+ facets (>= 2.4)
40
+ yard (0.6.8)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ algorithms
47
+ bundler (~> 1.0.0)
48
+ cli
49
+ cri
50
+ em-synchrony
51
+ gibberish
52
+ hiredis (~> 0.3.1)
53
+ jeweler (~> 1.6.0)
54
+ minitest
55
+ rcov
56
+ redis (~> 2.2.0)
57
+ reek (~> 1.2.8)
58
+ riot
59
+ uuidtools
60
+ vclog
61
+ yard (~> 0.6.0)
data/HISTORY ADDED
@@ -0,0 +1,16 @@
1
+ RELEASE HISTORY
2
+
3
+ HEAD / 2011-05-17
4
+
5
+ Current Development (David Love)
6
+
7
+ Changes:
8
+
9
+ * 1 Patch Enhancements
10
+
11
+ * Basic framework for the application added. No functionality yet.
12
+
13
+ * 1 General Enhancements
14
+
15
+ * Initial commit to WhiteCloth.
16
+
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2011 David Love <david@homeunix.org.uk>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,20 @@
1
+ = WhiteCloth
2
+
3
+ This is an _experimental_ language framework, attempting to put my theoretical work on semi-formal structures to work. At the moment it doesn't do a lot: hopefully that will change soon.
4
+
5
+
6
+ == Contributing to WhiteCloth
7
+
8
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
9
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
10
+ * Fork the project
11
+ * Start a feature/bugfix branch
12
+ * Commit and push until you are happy with your contribution
13
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
14
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2011 David Love. See LICENSE for
19
+ further details.
20
+
data/Rakefile ADDED
@@ -0,0 +1,100 @@
1
+ # Copyright (c) 2011 David Love
2
+ #
3
+ # Permission to use, copy, modify, and/or distribute this software for
4
+ # any purpose with or without fee is hereby granted, provided that the
5
+ # above copyright notice and this permission notice appear in all copies.
6
+ #
7
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
+ #
15
+ # encoding: utf-8
16
+
17
+ ###
18
+ ### Set-up. Actions to run before all tasks
19
+ ###
20
+
21
+ ## Use Bundler to make sure the gem environment is up-to-date
22
+ require 'rubygems'
23
+ require 'bundler'
24
+ begin
25
+ Bundler.setup(:default, :development)
26
+ rescue Bundler::BundlerError => e
27
+ $stderr.puts e.message
28
+ $stderr.puts "Run `bundle install` to install missing gems"
29
+ exit e.status_code
30
+ end
31
+ require 'rake'
32
+
33
+ ###
34
+ ### Gemspec. Mangage the creation of the relevant gem and gemspec files. Most of this
35
+ ### is delegated to Jeweler
36
+ ###
37
+
38
+ require 'jeweler'
39
+ Jeweler::Tasks.new do |gem|
40
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
41
+ gem.name = "FluxTuna"
42
+ gem.homepage = "http://github.com/dlove24/FluxTuna"
43
+ gem.license = "ISC"
44
+ gem.summary = "Experimental Framework for exploiting Semi-Formal Structures"
45
+ gem.description = "See: http://research.homeunix.org.uk"
46
+ gem.email = "david@homeunix.org.uk"
47
+ gem.authors = ["David Love"]
48
+ # dependencies defined in Gemfile
49
+ end
50
+ Jeweler::RubygemsDotOrgTasks.new
51
+
52
+ ###
53
+ ### Testing. Run the unit/system/integration tests
54
+ ###
55
+
56
+ require 'rake/testtask'
57
+
58
+ desc "Run all our tests"
59
+ task :test do
60
+ Rake::TestTask.new do |t|
61
+ t.libs << "test"
62
+ t.verbose = false
63
+
64
+ # List of files. We need to specifiy these explicity so they
65
+ # are loaded in the correct order: init, data, then the tests
66
+ # themselves
67
+ t.test_files = ["test/init_test.rb",
68
+
69
+ "test/data/data_test.rb",
70
+
71
+ "test/dir_walk/create_witness_test.rb"]
72
+ end
73
+ end
74
+
75
+ ## Set testing as the default action
76
+ task :default => :test
77
+
78
+ ###
79
+ ### Documentation. Generate/update the project documentation
80
+ ###
81
+
82
+ ## Use Yard to generate the documentations
83
+ require 'yard'
84
+ YARD::Rake::YardocTask.new
85
+
86
+ ###
87
+ ### Release. Additional actions to take when releasing the gem
88
+ ###
89
+
90
+ ## Additional actions for the release task
91
+ task :before_release do
92
+ # Update the HISTORY file
93
+ `vclog history -f gnu > HISTORY`
94
+ end
95
+
96
+ ## Update the HISTORY file before a version bump
97
+ Rake::Task["version:bump:major"].enhance([:before_release])
98
+ Rake::Task["version:bump:minor"].enhance([:before_release])
99
+ Rake::Task["version:bump:patch"].enhance([:before_release])
100
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/whitecloth ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ### Copyright (c) 2011 David Love <david@homeunix.org.uk>
4
+ ###
5
+ ### Permission to use, copy, modify, and/or distribute this software for
6
+ ### any purpose with or without fee is hereby granted, provided that the
7
+ ### above copyright notice and this permission notice appear in all copies.
8
+ ###
9
+ ### THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ ### WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ ### MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ### ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ ### WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ### ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ ### OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+ ###
17
+
18
+ ### @author David Love
19
+ ###
20
+ ### Bootstraping Command. Used to initalize various aspects of the Mercury
21
+ ### environment.
22
+ ###
23
+ ### @note The sub-commands provided by the bootstrap command assume (at-least)
24
+ ### a minimally working Ruby environment, with the required gems installed. Various
25
+ ### 'First Boot' scripts are available in the `scripts` directory for different
26
+ ### platforms which will achive at least this minimal state
27
+ ###
28
+
29
+ # Add lib to load path
30
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
31
+
32
+ # Load the rubygems library
33
+ require 'rubygems'
34
+
35
+ # Load core application library
36
+ require 'whitecloth'
37
+
38
+ # Load command line handler
39
+ require 'whitecloth/cli'
40
+
41
+ # Load the commands from the cmds dir
42
+ plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../cmds')
43
+
44
+ Dir[plugin_dir + '/*.rb'].sort.each{|file|
45
+ require file
46
+ }
47
+
48
+ # Run base
49
+ WhiteCloth::CLI::Base.new.run(ARGV)
data/lib/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Denis Defreyne and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/lib/WhiteCloth.rb ADDED
@@ -0,0 +1,24 @@
1
+ ### Copyright (c) 2010, David Love
2
+ ###
3
+ ### Permission to use, copy, modify, and/or distribute this software for
4
+ ### any purpose with or without fee is hereby granted, provided that the
5
+ ### above copyright notice and this permission notice appear in all copies.
6
+ ###
7
+ ### THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ ### WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ ### MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ### ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ ### WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ### ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ ### OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
+ ###
15
+
16
+ module WhiteCloth
17
+
18
+ ## Define Application Global constants
19
+
20
+ # The current WhiteCloth client version.
21
+ VERSION = '0.1'
22
+
23
+ end
24
+
@@ -0,0 +1,102 @@
1
+ # Copyright (c) 2009 Denis Defreyne, 2010-2011 David Love
2
+ #
3
+ # Permission to use, copy, modify, and/or distribute this software for
4
+ # any purpose with or without fee is hereby granted, provided that the
5
+ # above copyright notice and this permission notice appear in all copies.
6
+ #
7
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
+ #
15
+
16
+ # @author Denis Defreyne
17
+ # @author David Love
18
+ #
19
+ # The +CLI+ module acts as the gathering place for all the gloabl options
20
+ # and the sub-commands which the +whitecloth+ command can deal with.
21
+ # Sub-commands are themselves defined in the {WhiteCloth::CLI::Commands}
22
+ # module
23
+ module WhiteCloth::CLI
24
+
25
+ # @author Denis Defreyne
26
+ # @author David Love
27
+ #
28
+ # Details the global options applicable to all commands, and the code necessary
29
+ # to process those options. Each sub-command also needs to be registered with
30
+ # this class for it to work: strange things will happen if the sub-command is
31
+ # not set-up here!
32
+ #
33
+ # When creating a new sub-command, the constructor for that sub-command needs
34
+ # to be added to the {Base#initialize} function of *this* class as well. Be sure to
35
+ # also add the path to the file where the sub-command is defined to the file
36
+ # +lib/whitecloth/cli/commands.rb+, otherwise you will get warnings of unknown
37
+ # classes.
38
+ class Base < Cri::Base
39
+
40
+ # Instantiates the sub-commands by creating a single reference to each
41
+ # known sub-command.
42
+ #
43
+ # @note This means that if your sub-command is not in this constructor
44
+ # it *will not* be found, and *will not* appear as a valid sub-command.
45
+ # If something is missing from the 'help' command, check this method!
46
+ def initialize
47
+ super('whitecloth')
48
+
49
+ # Add help command
50
+ self.help_command = WhiteCloth::CLI::Commands::Help.new
51
+ add_command(self.help_command)
52
+
53
+ # Add other commands
54
+ add_command(WhiteCloth::CLI::Commands::Bootstrap.new)
55
+ add_command(WhiteCloth::CLI::Commands::Show.new)
56
+ end
57
+
58
+ # Returns the list of global option definitionss.
59
+ def global_option_definitions
60
+ [
61
+ {
62
+ :long => 'help', :short => 'h', :argument => :forbidden,
63
+ :desc => 'show this help message and quit'
64
+ },
65
+ {
66
+ :long => 'no-color', :short => 'C', :argument => :forbidden,
67
+ :desc => 'disable color'
68
+ },
69
+ {
70
+ :long => 'version', :short => 'v', :argument => :forbidden,
71
+ :desc => 'show version information and quit'
72
+ },
73
+ {
74
+ :long => 'verbose', :short => 'V', :argument => :forbidden,
75
+ :desc => 'make whitecloth output more detailed'
76
+ }
77
+ ]
78
+ end
79
+
80
+ # Process the global options, and set/change the application state from them
81
+ def handle_option(option)
82
+ # Handle version option
83
+ if option == :version
84
+ puts "WhiteCloth Bootstrap Client #{WhiteCloth::VERSION} (c) 2011 David Love."
85
+ puts "Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) running on #{RUBY_PLATFORM}"
86
+ exit 0
87
+ # Handle verbose option
88
+ elsif option == :verbose
89
+ WhiteCloth::CLI::Logger.instance.level = :low
90
+ # Handle no-color option
91
+ elsif option == :'no-color'
92
+ WhiteCloth::CLI::Logger.instance.color = false
93
+ # Handle help option
94
+ elsif option == :help
95
+ show_help
96
+ exit 0
97
+ end
98
+ end
99
+
100
+ end
101
+
102
+ end
@@ -0,0 +1,103 @@
1
+ # Copyright (c) 2009 Denis Defreyne, 2010-2011 David Love
2
+ #
3
+ # Permission to use, copy, modify, and/or distribute this software for
4
+ # any purpose with or without fee is hereby granted, provided that the
5
+ # above copyright notice and this permission notice appear in all copies.
6
+ #
7
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
+
15
+
16
+ module WhiteCloth::CLI::Commands
17
+
18
+ # @author David Love
19
+ #
20
+ # The +bootstrap+ command prepared the basic WhiteCloth realms (if
21
+ # needed), and then links the current host to those realms. The basic
22
+ # realms consists of
23
+ #
24
+ # +Realm 0+: *Namespace*. All the named realms stored in this domain.
25
+ #
26
+ # +Realm 1+: *Realm Handlers*. The basic gateways needed to create/store/update
27
+ # other realms.
28
+ #
29
+ # +Realm 5+: *Realm Code*. Libraries and other code which the realm handlers
30
+ # should use by preference when conducting operations on the realms.
31
+ #
32
+ # If the IP address of a server (or a server name) is given to as an argument
33
+ # to this command, then we will use that IP address (name) for as the WhiteCloth
34
+ # realm server to contact. Otherwise we will look for the same data from the file
35
+ # +/etc/whitecloth.conf+: aborting if the file cannot be found.
36
+ #
37
+ # Once we have made contact with the server, we look at the basic realms listed
38
+ # above, and attempt to ensure they can be found. If not, an attempt is made to
39
+ # create the basic realms: aborting if this attempt fails.
40
+ #
41
+ # Finally, once everything has been set-up, we upload the core realm code (or
42
+ # update the existing code)
43
+ class Bootstrap < Cri::Command
44
+
45
+ # The name of the sub-command (as it appears in the command line app)
46
+ def name
47
+ 'bootstrap'
48
+ end
49
+
50
+ # The aliases this sub-command is known by
51
+ def aliases
52
+ []
53
+ end
54
+
55
+ # A short help text describing the purpose of this command
56
+ def short_desc
57
+ 'Create a link between this host and the whitecloth servers.'
58
+ end
59
+
60
+ # A longer description, detailing both the purpose and the
61
+ # use of this command
62
+ def long_desc
63
+ 'Look for the specified server, adding the data required to link the ' +
64
+ 'current host to that server. If the found server has not been set-up ' +
65
+ 'then this command also performs the setup of the base realms as well. '
66
+ end
67
+
68
+ # Show the user the basic syntax of this command
69
+ def usage
70
+ "whitecloth bootstrap [-s server]"
71
+ end
72
+
73
+ # Define the options for this command
74
+ def option_definitions
75
+ [
76
+ { :short => 's', :long => 'server', :argument => :optional }
77
+ ]
78
+ end
79
+
80
+ # Execute the command
81
+ def run(options, arguments)
82
+
83
+ # The first thing we need to do is to find the relevant server. So we
84
+ # check the options and see if they can help
85
+ unless options[:server].nil? or options[:server].empty? then
86
+ #
87
+ else
88
+
89
+ # The user has not specified a server, so we will attempt to get one
90
+ # from the system configuration
91
+ if File.exists?("/etc/whitecloth.conf") then
92
+ #
93
+
94
+ # Everything has failed, so we abort
95
+ else
96
+ WhiteCloth::CLI::Logger.instance.log_level(:high, :error, "Cannot locate a WhiteCloth server. Either specify the server to connect to using the 'server' option, or create an appropriate configuration file.")
97
+ end
98
+ end
99
+ end
100
+
101
+ end
102
+
103
+ end