ona 0.4.1 → 1.0.1

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
  SHA256:
3
- metadata.gz: e2ebee33a8dd4f8e079ec27110ef2ddfd45b2ab845774c0bcf1047ded01834cb
4
- data.tar.gz: d0f12db18353a9304123342fc0e52398a1fdcaa5006abfdd65c2344630efc085
3
+ metadata.gz: a6e9b250c9f20e93f54249bdadc92dc5add7fc5f7fc240585a763786c36ba3f0
4
+ data.tar.gz: c31b065c2dfc9c9b4692e4af78c906d99aa9367ecbbed39fd301615b0ebb4fd9
5
5
  SHA512:
6
- metadata.gz: '04902e951aef11a85ee492f583719b5c2146f6f2913f24362d42f40ea47b83ee64874851fb6bbfaa0b2173c13df7907858acbf9211d101ebc5adb782ee38fc3e'
7
- data.tar.gz: 588c8ec69e18acfe8df482880efde255eb3cb6f233548ec2d178f1bef0b6c2389f382edddbd403baa89f9a1ee52a2f5d0a9b97549a74800e169a03c9dfc2bbec
6
+ metadata.gz: 58266d228b224e3fa99ad29308bc69c18f087514c213825bf80938a40849c148f63ad4f03e9e824c2be47ca5178787aba54d8329494adb6b8bdfed59476c7fd7
7
+ data.tar.gz: 60ccfff53a3dc42bfa250d42a23cb078ccdd7d23e4c6a012cfe6c6a8425e65dd32d3b1b98ad6ab0535c58b63b348ed930e9b22c3731199b696be51956aea9af1
data/bin/ona CHANGED
@@ -4,19 +4,11 @@ require 'rubygems'
4
4
  require 'readline'
5
5
  require 'ona'
6
6
 
7
- unless File.exists? 'Onafile'
7
+ unless File.exist? 'Onafile'
8
8
  abort 'Please create a file named:[Onafile] to start the shell.'
9
9
  end
10
10
 
11
- stack = Ona::Stack.new
12
11
  eval File.read 'Onafile'
13
- cli = Ona::Cli.new(stack)
14
12
 
15
- loop do
16
- line = Readline.readline("Ona> ", true)
17
- if (line == 'quit') || (line == 'exit')
18
- puts 'bye.'
19
- break
20
- end
21
- cli.parse(line)
22
- end
13
+ Ona.main
14
+
data/lib/ona.rb CHANGED
@@ -1,4 +1,164 @@
1
- require 'ona_cli'
2
- require 'ona_stack'
3
- require 'ona_server'
4
- require 'ona_instructions'
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ostruct'
4
+ require 'readline'
5
+ require 'isna'
6
+
7
+ class Ona
8
+ def self.resource(name, attributes)
9
+ @resources ||= {}
10
+ @resources[name] ||= {}
11
+ @resources[name][:class] = Struct.new(*attributes)
12
+ @resources[name][:entries] = []
13
+ @resources[name][:handlers] = []
14
+ @resources[name][:attributes] = attributes
15
+ _create_to_s_method(@resources[name])
16
+ nil
17
+ end
18
+ def self._create_to_s_method(resource)
19
+ attribute_sizes = resource[:attributes].map do |attribute|
20
+ attribute.to_s.size
21
+ end
22
+ resource[:class].send(:define_method, :to_s) do
23
+ max_attribute_length = attribute_sizes.sort.last + 4
24
+ resource[:attributes].sort.map do |attribute|
25
+ key = attribute.to_s.rjust(max_attribute_length, ' ')
26
+ "#{key.to_ansi.green.to_s} : #{send(attribute)}"
27
+ end * "\n"
28
+ end
29
+ end
30
+ def self.register(name, &block)
31
+ object = @resources[name][:class].new
32
+ block.call(object)
33
+ @resources[name][:entries].push(object)
34
+ nil
35
+ end
36
+ def self.action(hash, &block)
37
+ unless hash[:find]
38
+ _generic_action(hash, &block)
39
+ return
40
+ end
41
+ unless hash[:token]
42
+ $stderr.puts "No token for: #{hash.inspect}"
43
+ exit 1
44
+ end
45
+ _single_action(hash, &block)
46
+ end
47
+ def self._generic_action(hash, &block)
48
+ hash[:block] = block
49
+ @resources[hash[:resource]][:handlers].push(hash)
50
+ nil
51
+ end
52
+ def self._single_action(hash, &block)
53
+ Ona._generic_action(hash) do |resources, command, regex|
54
+ wanted_id = hash[:token].call(command.scan(regex))
55
+ wanted_id = wanted_id.to_i
56
+ resources.each_with_index do |array, id|
57
+ next if id != wanted_id
58
+ block.call(array, id)
59
+ end
60
+ end
61
+ end
62
+ def self.run(command)
63
+ @resources.each do |name, resource|
64
+ resource[:handlers].each do |handler|
65
+ next unless handler[:regex].match(command)
66
+ handler[:block].call(resource[:entries], command, handler[:regex])
67
+ return
68
+ end
69
+ end
70
+ nil
71
+ end
72
+ def self.prompt=(string)
73
+ @prompt = string
74
+ end
75
+ def self.prompt
76
+ @prompt
77
+ end
78
+ def self.main(use_defaults = true)
79
+ defaults if use_defaults
80
+ _prompt = (prompt || 'Ona').to_ansi.cyan.to_s + '> '
81
+ while input = Readline.readline(_prompt, true)
82
+ Ona.run(input)
83
+ end
84
+ puts ''
85
+ end
86
+ def self._get_max_regex_length
87
+ max = 0
88
+ @resources.each do |name, resource|
89
+ resource[:handlers].each do |handler|
90
+ if max < handler[:regex].inspect.size
91
+ max = handler[:regex].inspect.size
92
+ end
93
+ end
94
+ end
95
+ max
96
+ end
97
+ def self._get_max_example_length
98
+ max = 0
99
+ @resources.each do |name, resource|
100
+ resource[:handlers].each do |handler|
101
+ if max < handler[:example].size
102
+ max = handler[:example].size
103
+ end
104
+ end
105
+ end
106
+ max
107
+ end
108
+ def self._get_max_name_length
109
+ max = 0
110
+ @resources.each do |name, resource|
111
+ if max < name.size
112
+ max = name.size
113
+ end
114
+ end
115
+ max
116
+ end
117
+ def self.help
118
+ @resources.each do |name, resource|
119
+ pretty_name = "[#{name}]".to_s.rjust(_get_max_name_length + 2, ' ')
120
+ pretty_name = pretty_name.to_ansi.cyan.to_s
121
+ resource[:handlers].sort do |a, b|
122
+ a[:example] <=> b[:example]
123
+ end.each do |handler|
124
+ pretty_regex = handler[:regex].inspect.ljust(_get_max_regex_length, ' ')
125
+ pretty_regex = pretty_regex.to_s.to_ansi.pink.to_s
126
+ pretty_example = handler[:example].ljust(_get_max_example_length, ' ')
127
+ pretty_example = pretty_example.to_s.to_ansi.yellow.to_s
128
+ puts "#{pretty_name} #{pretty_example} #{handler[:text]}"
129
+ end
130
+ end
131
+ end
132
+ def self.defaults
133
+ Ona.resource(:any, [:empty])
134
+
135
+ Ona.action(
136
+ :regex => /(^)(quit|exit)($)/,
137
+ :resource => :any,
138
+ :text => 'Exit this program.',
139
+ :example => 'quit'
140
+ ) do |resource, command, regex|
141
+ puts 'bye.'
142
+ exit 0
143
+ end
144
+
145
+ Ona.action(
146
+ :regex => /^help$/,
147
+ :resource => :any,
148
+ :text => 'Print help.',
149
+ :example => 'help'
150
+ ) do |resource, command, regex|
151
+ Ona.help
152
+ end
153
+ end
154
+ def self.confirm(text, expected)
155
+ puts ''
156
+ puts "# " + " #{text} ".to_ansi.white.red_background.to_s
157
+ puts "# " + '=' * 78
158
+ puts "Type [#{expected.to_ansi.green.to_s}] to continue. or anything else to skip."
159
+ print 'What to do? >'
160
+ input = gets.chomp
161
+ input == expected
162
+ end
163
+ end
164
+
data/ona.gemspec CHANGED
@@ -1,47 +1,21 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "ona"
8
- s.version = "0.4.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["kazuyoshi tlacaelel"]
12
- s.date = "2013-12-14"
13
- s.description = "Simple shell for deployment."
14
- s.email = "kazu.dev@gmail.com"
15
- s.executables = ["ona"]
16
- s.extra_rdoc_files = [
17
- "LICENSE",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
1
+ Gem::Specification.new do |spec|
2
+ spec.name = %q{ona}
3
+ spec.version = "1.0.1"
4
+ spec.date = %q{2023-07-29}
5
+ spec.summary = %q{ona - utility to build shell tools}
6
+ spec.author = 'Kazuyoshi Tlacaelel'
7
+ spec.homepage = 'https://github.com/ktlacaelel/ona'
8
+ spec.email = 'kazu.dev@gmail.com'
9
+ spec.license = 'MIT'
10
+ spec.require_paths = ["lib"]
11
+ spec.bindir = 'bin'
12
+ spec.files = [
22
13
  "Gemfile",
23
14
  "Gemfile.lock",
24
15
  "LICENSE",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION",
28
16
  "bin/ona",
29
17
  "lib/ona.rb",
30
- "lib/ona_cli.rb",
31
- "lib/ona_instructions.rb",
32
- "lib/ona_server.rb",
33
- "lib/ona_stack.rb",
34
- "ona.gemspec",
35
- "test/helper.rb",
36
- "test/test_ona.rb"
18
+ "ona.gemspec"
37
19
  ]
38
- s.homepage = "http://github.com/ktlacaelel/ona"
39
- s.require_paths = ["lib"]
40
- s.rubygems_version = "1.8.25"
41
- s.summary = "Ona -- Deployment symplified."
42
-
43
- if s.respond_to? :specification_version then
44
- s.specification_version = 3
45
- end
20
+ spec.executables << 'ona'
46
21
  end
47
-
metadata CHANGED
@@ -1,44 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - kazuyoshi tlacaelel
8
- autorequire:
7
+ - Kazuyoshi Tlacaelel
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-14 00:00:00.000000000 Z
11
+ date: 2023-07-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Simple shell for deployment.
13
+ description:
14
14
  email: kazu.dev@gmail.com
15
15
  executables:
16
16
  - ona
17
17
  extensions: []
18
- extra_rdoc_files:
19
- - LICENSE
20
- - README.rdoc
18
+ extra_rdoc_files: []
21
19
  files:
22
- - ".document"
23
20
  - Gemfile
24
21
  - Gemfile.lock
25
22
  - LICENSE
26
- - README.rdoc
27
- - Rakefile
28
- - VERSION
29
23
  - bin/ona
30
24
  - lib/ona.rb
31
- - lib/ona_cli.rb
32
- - lib/ona_instructions.rb
33
- - lib/ona_server.rb
34
- - lib/ona_stack.rb
35
25
  - ona.gemspec
36
- - test/helper.rb
37
- - test/test_ona.rb
38
- homepage: http://github.com/ktlacaelel/ona
39
- licenses: []
26
+ homepage: https://github.com/ktlacaelel/ona
27
+ licenses:
28
+ - MIT
40
29
  metadata: {}
41
- post_install_message:
30
+ post_install_message:
42
31
  rdoc_options: []
43
32
  require_paths:
44
33
  - lib
@@ -53,8 +42,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
42
  - !ruby/object:Gem::Version
54
43
  version: '0'
55
44
  requirements: []
56
- rubygems_version: 3.0.6
57
- signing_key:
58
- specification_version: 3
59
- summary: Ona -- Deployment symplified.
45
+ rubygems_version: 3.3.7
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: ona - utility to build shell tools
60
49
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/README.rdoc DELETED
@@ -1,17 +0,0 @@
1
- = ona
2
-
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 kazuyoshi tlacaelel. See LICENSE for details.
data/Rakefile DELETED
@@ -1,53 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "ona"
8
- gem.summary = %Q{Ona -- Deployment symplified.}
9
- gem.description = %Q{Simple shell for deployment.}
10
- gem.email = "kazu.dev@gmail.com"
11
- gem.homepage = "http://github.com/ktlacaelel/ona"
12
- gem.authors = ["kazuyoshi tlacaelel"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
20
-
21
- require 'rake/testtask'
22
- Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
24
- test.pattern = 'test/**/test_*.rb'
25
- test.verbose = true
26
- end
27
-
28
- begin
29
- require 'rcov/rcovtask'
30
- Rcov::RcovTask.new do |test|
31
- test.libs << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
35
- rescue LoadError
36
- task :rcov do
37
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
- end
39
- end
40
-
41
- task :test => :check_dependencies
42
-
43
- task :default => :test
44
-
45
- require 'rake/rdoctask'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "ona #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.0
data/lib/ona_cli.rb DELETED
@@ -1,192 +0,0 @@
1
- module Ona
2
-
3
- class Cli
4
-
5
- TRANSLATION = {
6
- 'show' => { :method => :show, :id_required => true },
7
- 'setup' => { :method => :setup, :id_required => true },
8
- 'deploy' => { :method => :deploy, :id_required => true },
9
- 'ssh#' => { :method => :ssh_root, :id_required => true },
10
- 'ssh' => { :method => :ssh_deploy,:id_required => true },
11
- 'go' => { :method => :go_deploy, :id_required => true },
12
- 'go#' => { :method => :go_root, :id_required => true },
13
- 'http' => { :method => :http, :id_required => true },
14
- 'key' => { :method => :key, :id_required => true },
15
- 'keys' => { :method => :keys, :id_required => true },
16
- 'rake' => { :method => :rake, :id_required => true },
17
- 'ls' => { :method => :ls, :id_required => false },
18
- 'help' => { :method => :help, :id_required => false },
19
- }
20
-
21
- def initialize(stack)
22
- @stack = stack
23
- @instructions = Ona::Instructions.new(/[a-z]+[#]*/, /\d+/)
24
- end
25
-
26
- def parse command_string
27
- # Handle this separately for now.
28
- return run_instruction('ls', 0) if command_string == 'ls'
29
- return run_instruction('help', 0) if command_string == 'help'
30
-
31
- @instructions.define_command_string(command_string)
32
- group = @instructions.group_targets_by_instruction
33
- copy = group.dup
34
- copy.pop
35
-
36
- # Only last group has ids?
37
- if copy.all? { |x| x.values == [[]] }
38
- @instructions.instructions.each do |instruction|
39
- @instructions.targets.each do |target|
40
- run_instruction instruction, target
41
- end
42
- end
43
- return
44
- end
45
-
46
- # Run by group.
47
- group.each do |hash|
48
- instruction, targets = hash.to_a[0][0], hash.to_a[0][1]
49
- targets.each do |target|
50
- run_instruction instruction, target
51
- end
52
- end
53
- end
54
-
55
- def run_instruction instruction, target
56
- return unless TRANSLATION.keys.include?(instruction)
57
- hash = TRANSLATION[instruction]
58
- cmd = "#{TRANSLATION[instruction][:method]}"
59
- if (hash[:id_required])
60
- cmd << "(#{target.to_i})"
61
- end
62
- eval cmd
63
- end
64
-
65
- def help
66
- puts "
67
- Ona -- Deployment simplified.
68
-
69
- deploy 1 # Deploy a specific server
70
- exit # Same as *quit*
71
- go # Go to server without opening a new window.
72
- go# # Same as go but do it as root.
73
- help # Show this help
74
- http 1 # Open the server in default browser.
75
- key 1 # Uploads my public ssh-key to remote server (root)
76
- keys # Uploads my public ssh-key to all servers (root)
77
- ls # Short list for available servers
78
- quit # Termintes the ona shell.
79
- rake # Shows rake tasks.
80
- setup 1 # Upload ssh-keys and bootstrap server
81
- show 1 # Detailed info for a specific server
82
- ssh 1 # Open a ssh session as *deploy* on remote server (new window)
83
- ssh# 1 # Open a ssh session as *root* to a remote server (new window)
84
-
85
- --
86
-
87
- Note: 1 is a server id, you can use many ids!
88
-
89
- show 1 2 3 # Will display info for three servers.
90
-
91
- "
92
- end
93
-
94
- def http server_id
95
- @stack.find_all(server_id).each do |server|
96
- system server.to_http
97
- end
98
- end
99
-
100
- def key server_id
101
- @stack.find_all(server_id).each do |server|
102
- puts 'Setting up key for root'
103
- system server.setup_ssh
104
- end
105
- end
106
-
107
- def show server_id
108
- @stack.find_all(server_id).each do |server|
109
- puts server.to_s
110
- end
111
- end
112
-
113
- def ls
114
- @stack.to_a.each do |server|
115
- puts server.to_short_s
116
- end
117
- end
118
-
119
- def ssh_deploy server_id
120
- @stack.find_all(server_id).each do |server|
121
- system server.to_ssh 'deploy'
122
- end
123
- end
124
-
125
- def ssh_root server_id
126
- @stack.find_all(server_id).each do |server|
127
- system server.to_ssh 'root'
128
- end
129
- end
130
-
131
- def go_deploy server_id
132
- @stack.find_all(server_id).each do |server|
133
- system server.to_go 'deploy'
134
- end
135
- end
136
-
137
- def go_root server_id
138
- @stack.find_all(server_id).each do |server|
139
- system server.to_go 'root'
140
- end
141
- end
142
-
143
- def deploy server_id
144
- @stack.find_all(server_id).each do |server|
145
- prompt_for_continuation server
146
- system server.say_sure_to_deploy
147
- line = gets
148
- next unless line.chomp == 'yes'
149
- system server.deploy
150
- system server.say_deployed
151
- end
152
- end
153
-
154
- def setup server_id
155
- key server_id
156
- @stack.find_all(server_id).each do |server|
157
- prompt_for_continuation server
158
- system server.say_sure_to_setup
159
- line = gets
160
- next unless line.chomp == 'yes'
161
- system server.bootstrap
162
- system server.say_finished_setup
163
- end
164
- end
165
-
166
- def rake server_id
167
- @stack.find_all(server_id).each do |server|
168
- server.to_s
169
- server.rake.each do |task|
170
- puts task
171
- end
172
- end
173
- end
174
-
175
- def keys
176
- @stack.to_a.each do |server|
177
- puts 'Setting up key for root'
178
- system server.setup_ssh
179
- end
180
- end
181
-
182
- protected
183
-
184
- def prompt_for_continuation server
185
- puts server.to_s
186
- puts 'Type [yes] to continue. or anything else to skip.'
187
- print 'What to do? >'
188
- end
189
-
190
- end
191
-
192
- end
@@ -1,43 +0,0 @@
1
- module Ona
2
-
3
- class Instructions
4
-
5
- def initialize instruction_matcher, target_matcher
6
- define_instruction_matcher instruction_matcher
7
- define_target_matcher target_matcher
8
- end
9
-
10
- def define_command_string command_string
11
- @command_string = command_string
12
- end
13
-
14
- def define_instruction_matcher matcher_regex
15
- @instruction_matcher = matcher_regex
16
- end
17
-
18
- def define_target_matcher matcher_regex
19
- @target_matcher = matcher_regex
20
- end
21
-
22
- def targets
23
- @command_string.scan(@target_matcher)
24
- end
25
-
26
- def instructions
27
- @command_string.scan(@instruction_matcher)
28
- end
29
-
30
- def group_targets_by_instruction
31
- group = []
32
- chunks = (@command_string.split(@instruction_matcher) - [""])
33
- return group if chunks.size != instructions.size
34
- chunks.each_with_index do |instruction_targets, index|
35
- instruction_targets = (instruction_targets.scan(@target_matcher) - [])
36
- group << { instructions[index] => instruction_targets }
37
- end
38
- group
39
- end
40
-
41
- end
42
-
43
- end
data/lib/ona_server.rb DELETED
@@ -1,79 +0,0 @@
1
- module Ona
2
-
3
- class Server
4
-
5
- attr_accessor :id, :role, :ip, :pass, :desc, :dna
6
-
7
- def load_block id, &block
8
- @id = id
9
- yield(self)
10
- end
11
-
12
- def setup_ssh
13
- "rake upload_ssh_key server=root@#{ip} pass=#{pass} key=#{local_key}"
14
- end
15
-
16
- def say_deployed
17
- "say #{desc} deployed"
18
- end
19
-
20
- def say_finished_setup
21
- "say #{desc} setup terminated"
22
- end
23
-
24
- def say_sure_to_setup
25
- "say 'Are you sure to setup #{desc}'"
26
- end
27
-
28
- def say_sure_to_deploy
29
- "say 'Are you sure to deploy #{desc}'"
30
- end
31
-
32
- def bootstrap
33
- "rake bootstrap server=root@#{ip}"
34
- end
35
-
36
- def deploy
37
- "rake cook server=root@#{ip} dna=#{dna} instance_role=#{role}"
38
- end
39
-
40
- def to_ssh user
41
- "open ssh://#{user}@#{ip}"
42
- end
43
-
44
- def to_go user
45
- "ssh #{user}@#{ip}"
46
- end
47
-
48
- def to_http
49
- "open http://#{ip}"
50
- end
51
-
52
- def to_short_s
53
- "#{id}".ljust(5) + "#{desc}"
54
- end
55
-
56
- def to_s
57
- "
58
- #{id} - #{desc}
59
-
60
- Id #{id}
61
- Ip #{ip}
62
- Dna #{dna}
63
- Role #{role}
64
- Password #{pass}
65
-
66
- "
67
- end
68
-
69
- def rake
70
- [setup_ssh, bootstrap, deploy]
71
- end
72
-
73
- def local_key
74
- File.join(ENV['HOME'], '.ssh/id_rsa.pub')
75
- end
76
-
77
- end
78
-
79
- end
data/lib/ona_stack.rb DELETED
@@ -1,39 +0,0 @@
1
- module Ona
2
-
3
- class Stack
4
-
5
- def initialize
6
- @list = []
7
- @id = 0
8
- end
9
-
10
- def append &block
11
- @id += 1
12
- server = Server.new
13
- server.load_block(@id, &block)
14
- @list << server
15
- end
16
-
17
- def find num
18
- @list.each do |server|
19
- return server if server.id == num
20
- end
21
- nil
22
- end
23
-
24
- def find_all *args
25
- args.map { |id| find id }.compact
26
- end
27
-
28
- def exists? num
29
- return false if find(num).nil?
30
- true
31
- end
32
-
33
- def to_a
34
- @list
35
- end
36
-
37
- end
38
-
39
- end
data/test/helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'ona'
8
-
9
- class Test::Unit::TestCase
10
- end
data/test/test_ona.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestOna < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end