cft_smartcloud 0.1.4

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.
Files changed (135) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +8 -0
  3. data/LICENSE +178 -0
  4. data/README.rdoc +71 -0
  5. data/Rakefile +53 -0
  6. data/VERSION +1 -0
  7. data/bin/smartcloud +37 -0
  8. data/cft_smartcloud.gemspec +176 -0
  9. data/lib/cli_tools/README.txt +50 -0
  10. data/lib/cli_tools/ic-add-keypair.cmd +29 -0
  11. data/lib/cli_tools/ic-add-keypair.sh +15 -0
  12. data/lib/cli_tools/ic-allocate-address.cmd +29 -0
  13. data/lib/cli_tools/ic-allocate-address.sh +14 -0
  14. data/lib/cli_tools/ic-attach-volume.cmd +27 -0
  15. data/lib/cli_tools/ic-attach-volume.sh +27 -0
  16. data/lib/cli_tools/ic-clone-image.cmd +27 -0
  17. data/lib/cli_tools/ic-clone-image.sh +14 -0
  18. data/lib/cli_tools/ic-clone-volume.cmd +27 -0
  19. data/lib/cli_tools/ic-clone-volume.sh +60 -0
  20. data/lib/cli_tools/ic-cmd.cmd +41 -0
  21. data/lib/cli_tools/ic-cmd.sh +38 -0
  22. data/lib/cli_tools/ic-create-instance.cmd +27 -0
  23. data/lib/cli_tools/ic-create-instance.sh +14 -0
  24. data/lib/cli_tools/ic-create-password.cmd +27 -0
  25. data/lib/cli_tools/ic-create-password.sh +14 -0
  26. data/lib/cli_tools/ic-create-volume.cmd +27 -0
  27. data/lib/cli_tools/ic-create-volume.sh +14 -0
  28. data/lib/cli_tools/ic-delete-image.cmd +27 -0
  29. data/lib/cli_tools/ic-delete-image.sh +14 -0
  30. data/lib/cli_tools/ic-delete-instance.cmd +27 -0
  31. data/lib/cli_tools/ic-delete-instance.sh +14 -0
  32. data/lib/cli_tools/ic-delete-volume.cmd +27 -0
  33. data/lib/cli_tools/ic-delete-volume.sh +14 -0
  34. data/lib/cli_tools/ic-describe-address-offerings.cmd +27 -0
  35. data/lib/cli_tools/ic-describe-address-offerings.sh +14 -0
  36. data/lib/cli_tools/ic-describe-addresses.cmd +27 -0
  37. data/lib/cli_tools/ic-describe-addresses.sh +14 -0
  38. data/lib/cli_tools/ic-describe-image-agreement.cmd +27 -0
  39. data/lib/cli_tools/ic-describe-image-agreement.sh +14 -0
  40. data/lib/cli_tools/ic-describe-image.cmd +27 -0
  41. data/lib/cli_tools/ic-describe-image.sh +14 -0
  42. data/lib/cli_tools/ic-describe-images.cmd +27 -0
  43. data/lib/cli_tools/ic-describe-images.sh +14 -0
  44. data/lib/cli_tools/ic-describe-instance.cmd +27 -0
  45. data/lib/cli_tools/ic-describe-instance.sh +14 -0
  46. data/lib/cli_tools/ic-describe-instances.cmd +27 -0
  47. data/lib/cli_tools/ic-describe-instances.sh +14 -0
  48. data/lib/cli_tools/ic-describe-keypair.cmd +27 -0
  49. data/lib/cli_tools/ic-describe-keypair.sh +14 -0
  50. data/lib/cli_tools/ic-describe-keypairs.cmd +27 -0
  51. data/lib/cli_tools/ic-describe-keypairs.sh +14 -0
  52. data/lib/cli_tools/ic-describe-location.cmd +14 -0
  53. data/lib/cli_tools/ic-describe-location.sh +14 -0
  54. data/lib/cli_tools/ic-describe-locations.cmd +14 -0
  55. data/lib/cli_tools/ic-describe-locations.sh +14 -0
  56. data/lib/cli_tools/ic-describe-request.cmd +27 -0
  57. data/lib/cli_tools/ic-describe-request.sh +14 -0
  58. data/lib/cli_tools/ic-describe-vlans.cmd +27 -0
  59. data/lib/cli_tools/ic-describe-vlans.sh +14 -0
  60. data/lib/cli_tools/ic-describe-volume-offerings.cmd +27 -0
  61. data/lib/cli_tools/ic-describe-volume-offerings.sh +14 -0
  62. data/lib/cli_tools/ic-describe-volume.cmd +27 -0
  63. data/lib/cli_tools/ic-describe-volume.sh +14 -0
  64. data/lib/cli_tools/ic-describe-volumes.cmd +27 -0
  65. data/lib/cli_tools/ic-describe-volumes.sh +14 -0
  66. data/lib/cli_tools/ic-detach-volume.cmd +27 -0
  67. data/lib/cli_tools/ic-detach-volume.sh +27 -0
  68. data/lib/cli_tools/ic-extend-reservation.cmd +27 -0
  69. data/lib/cli_tools/ic-extend-reservation.sh +14 -0
  70. data/lib/cli_tools/ic-generate-keypair.cmd +27 -0
  71. data/lib/cli_tools/ic-generate-keypair.sh +14 -0
  72. data/lib/cli_tools/ic-release-address.cmd +27 -0
  73. data/lib/cli_tools/ic-release-address.sh +14 -0
  74. data/lib/cli_tools/ic-remove-keypair.cmd +27 -0
  75. data/lib/cli_tools/ic-remove-keypair.sh +14 -0
  76. data/lib/cli_tools/ic-restart-instance.cmd +27 -0
  77. data/lib/cli_tools/ic-restart-instance.sh +14 -0
  78. data/lib/cli_tools/ic-save-instance.cmd +27 -0
  79. data/lib/cli_tools/ic-save-instance.sh +14 -0
  80. data/lib/cli_tools/ic-set-default-key.cmd +27 -0
  81. data/lib/cli_tools/ic-set-default-key.sh +14 -0
  82. data/lib/cli_tools/ic-update-instance.cmd +27 -0
  83. data/lib/cli_tools/ic-update-instance.sh +14 -0
  84. data/lib/cli_tools/ic-update-keypair.cmd +27 -0
  85. data/lib/cli_tools/ic-update-keypair.sh +14 -0
  86. data/lib/cli_tools/lib/DeveloperCloud_API_Client_JAR.jar +0 -0
  87. data/lib/cli_tools/lib/DeveloperCloud_CMD_Tool.jar +0 -0
  88. data/lib/cli_tools/lib/commons-beanutils-1.6.1.jar +0 -0
  89. data/lib/cli_tools/lib/commons-cli-1.2.jar +0 -0
  90. data/lib/cli_tools/lib/commons-codec-1.3.jar +0 -0
  91. data/lib/cli_tools/lib/commons-collections-3.2.1.jar +0 -0
  92. data/lib/cli_tools/lib/commons-digester-1.8.jar +0 -0
  93. data/lib/cli_tools/lib/commons-httpclient-3.1.jar +0 -0
  94. data/lib/cli_tools/lib/commons-lang-2.3.jar +0 -0
  95. data/lib/cli_tools/lib/commons-logging-1.1.1.jar +0 -0
  96. data/lib/cli_tools/logging.properties +7 -0
  97. data/lib/cli_tools/manifest.rmd +26 -0
  98. data/lib/config/config.yml +50 -0
  99. data/lib/hash_fix.rb +37 -0
  100. data/lib/mime-types-1.16/History.txt +107 -0
  101. data/lib/mime-types-1.16/Install.txt +17 -0
  102. data/lib/mime-types-1.16/Licence.txt +15 -0
  103. data/lib/mime-types-1.16/Manifest.txt +12 -0
  104. data/lib/mime-types-1.16/README.txt +28 -0
  105. data/lib/mime-types-1.16/Rakefile +316 -0
  106. data/lib/mime-types-1.16/lib/mime/types.rb +751 -0
  107. data/lib/mime-types-1.16/lib/mime/types.rb.data +1324 -0
  108. data/lib/mime-types-1.16/mime-types.gemspec +43 -0
  109. data/lib/mime-types-1.16/setup.rb +1585 -0
  110. data/lib/mime-types-1.16/test/test_mime_type.rb +356 -0
  111. data/lib/mime-types-1.16/test/test_mime_types.rb +122 -0
  112. data/lib/mock_smartcloud.rb +53 -0
  113. data/lib/rest-client-1.6.3/README.rdoc +276 -0
  114. data/lib/rest-client-1.6.3/Rakefile +66 -0
  115. data/lib/rest-client-1.6.3/VERSION +1 -0
  116. data/lib/rest-client-1.6.3/bin/restclient +92 -0
  117. data/lib/rest-client-1.6.3/history.md +112 -0
  118. data/lib/rest-client-1.6.3/lib/rest-client.rb +2 -0
  119. data/lib/rest-client-1.6.3/lib/rest_client.rb +2 -0
  120. data/lib/rest-client-1.6.3/lib/restclient/abstract_response.rb +106 -0
  121. data/lib/rest-client-1.6.3/lib/restclient/exceptions.rb +193 -0
  122. data/lib/rest-client-1.6.3/lib/restclient/net_http_ext.rb +21 -0
  123. data/lib/rest-client-1.6.3/lib/restclient/payload.rb +220 -0
  124. data/lib/rest-client-1.6.3/lib/restclient/raw_response.rb +34 -0
  125. data/lib/rest-client-1.6.3/lib/restclient/request.rb +314 -0
  126. data/lib/rest-client-1.6.3/lib/restclient/resource.rb +169 -0
  127. data/lib/rest-client-1.6.3/lib/restclient/response.rb +24 -0
  128. data/lib/rest-client-1.6.3/lib/restclient.rb +174 -0
  129. data/lib/restclient_fix.rb +41 -0
  130. data/lib/smartcloud.rb +616 -0
  131. data/lib/smartcloud_logger.rb +20 -0
  132. data/lib/xml-simple-1.0.12/lib/xmlsimple.rb +1028 -0
  133. data/script/console +3 -0
  134. data/test/helper.rb +22 -0
  135. metadata +196 -0
@@ -0,0 +1,28 @@
1
+ = README: Mime::Types for Ruby
2
+ This library allows for the identification of a file's likely MIME content
3
+ type. This is release 1.16. The identification of MIME content type is based
4
+ on a file's filename extensions.
5
+
6
+ MIME::Types for Ruby originally based on and synchronized with MIME::Types
7
+ for Perl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the
8
+ data format for the MIME::Type list has changed and the synchronization will
9
+ no longer happen.
10
+
11
+ Homepage:: http://mime-types.rubyforge.org/
12
+ Copyright:: 2002 - 2009, Austin Ziegler
13
+ Based in part on prior work copyright Mark Overmeer
14
+
15
+ == Licensing
16
+ MIME::Types is available under three disjunctive licences, as detailed in the
17
+ Licence.txt file.
18
+
19
+ == Copyright
20
+ MIME::Types
21
+ A Ruby implementation of a MIME Types information library. Based in spirit
22
+ on the Perl MIME::Types information library by Mark Overmeer.
23
+ http://rubyforge.org/projects/mime-types/
24
+
25
+ Licensed under the Ruby disjunctive licence with the GNU GPL or the Perl
26
+ Artistic licence. See Licence.txt for more information.
27
+
28
+ Copyright 2003 - 2009 Austin Ziegler
@@ -0,0 +1,316 @@
1
+ #! /usr/bin/env rake
2
+ #--
3
+ # MIME::Types
4
+ # A Ruby implementation of a MIME Types information library. Based in spirit
5
+ # on the Perl MIME::Types information library by Mark Overmeer.
6
+ # http://rubyforge.org/projects/mime-types/
7
+ #
8
+ # Licensed under the Ruby disjunctive licence with the GNU GPL or the Perl
9
+ # Artistic licence. See Licence.txt for more information.
10
+ #
11
+ # Copyright 2003 - 2009 Austin Ziegler
12
+ #++
13
+
14
+ require 'rubygems'
15
+ require 'hoe'
16
+
17
+ $LOAD_PATH.unshift('lib')
18
+
19
+ require 'mime/types'
20
+
21
+ PKG_NAME = 'mime-types'
22
+ PKG_VERSION = MIME::Types::VERSION
23
+ PKG_DIST = "#{PKG_NAME}-#{PKG_VERSION}"
24
+ PKG_TAR = "pkg/#{PKG_DIST}.tar.gz"
25
+ MANIFEST = File.read("Manifest.txt").split
26
+
27
+ hoe = Hoe.new PKG_NAME, PKG_VERSION do |p|
28
+ p.rubyforge_name = PKG_NAME
29
+ # This is a lie because I will continue to use Archive::Tar::Minitar.
30
+ p.need_tar = false
31
+ # need_zip - Should package create a zipfile? [default: false]
32
+
33
+ p.author = [ "Austin Ziegler" ]
34
+ p.email = %W(austin@rubyforge.org)
35
+ p.url = "http://mime-types.rubyforge.org/"
36
+ p.summary = %q{Manages a MIME Content-Type database that will return the Content-Type for a given filename.}
37
+ p.changes = p.paragraphs_of("History.txt", 0..0).join("\n\n")
38
+ p.description = p.paragraphs_of("README.txt", 1..1).join("\n\n")
39
+
40
+ p.extra_dev_deps << %w(archive-tar-minitar ~>0.5)
41
+ p.extra_dev_deps << %w(nokogiri ~>1.2)
42
+ p.extra_dev_deps << %w(rcov ~>0.8)
43
+
44
+ p.clean_globs << "coverage"
45
+
46
+ p.spec_extras[:extra_rdoc_files] = MANIFEST.grep(/txt$/) - ["Manifest.txt"]
47
+ end
48
+
49
+ begin
50
+ require 'rcov/rcovtask'
51
+ Rcov::RcovTask.new do |t|
52
+ t.libs << 'test'
53
+ t.test_files = hoe.test_files
54
+ t.verbose = true
55
+ end
56
+ rescue LoadError
57
+ puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
58
+ end
59
+
60
+ =begin
61
+ require 'cucumber/rake/task'
62
+ Cucumber::Rake::Task.new(:features)
63
+ rescue LoadError
64
+ puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
65
+ =end
66
+
67
+ desc "Build a MIME::Types .tar.gz distribution."
68
+ task :tar => [ PKG_TAR ]
69
+ file PKG_TAR => [ :test ] do |t|
70
+ require 'archive/tar/minitar'
71
+ require 'zlib'
72
+ files = MANIFEST.map { |f|
73
+ fn = File.join(PKG_DIST, f)
74
+ tm = File.stat(f).mtime
75
+
76
+ if File.directory?(f)
77
+ { :name => fn, :mode => 0755, :dir => true, :mtime => tm }
78
+ else
79
+ mode = if f =~ %r{^bin}
80
+ 0755
81
+ else
82
+ 0644
83
+ end
84
+ data = File.read(f)
85
+ { :name => fn, :mode => mode, :data => data, :size => data.size,
86
+ :mtime => tm }
87
+ end
88
+ }
89
+
90
+ begin
91
+ unless File.directory?(File.dirname(t.name))
92
+ require 'fileutils'
93
+ FileUtils.mkdir_p File.dirname(t.name)
94
+ end
95
+ tf = File.open(t.name, 'wb')
96
+ gz = Zlib::GzipWriter.new(tf)
97
+ tw = Archive::Tar::Minitar::Writer.new(gz)
98
+
99
+ files.each do |entry|
100
+ if entry[:dir]
101
+ tw.mkdir(entry[:name], entry)
102
+ else
103
+ tw.add_file_simple(entry[:name], entry) { |os|
104
+ os.write(entry[:data])
105
+ }
106
+ end
107
+ end
108
+ ensure
109
+ tw.close if tw
110
+ gz.close if gz
111
+ end
112
+ end
113
+ task :package => [ PKG_TAR ]
114
+
115
+ desc "Build the manifest file from the current set of files."
116
+ task :build_manifest do |t|
117
+ require 'find'
118
+
119
+ hoerc = File.join(File.dirname(__FILE__), ".hoerc")
120
+ hoerc = File.open(hoerc, "rb") { |f| f.read }
121
+ hoerc = YAML::load(hoerc)
122
+
123
+ paths = []
124
+ Find.find(".") do |path|
125
+ next if File.directory?(path) || path =~ hoerc["exclude"]
126
+ paths << path.sub(%r{^\./}, '')
127
+ end
128
+
129
+ paths = paths.sort.join("\n")
130
+
131
+ File.open("Manifest.txt", "w") do |f|
132
+ f.puts paths
133
+ end
134
+
135
+ puts paths
136
+ end
137
+
138
+ desc "Download the current MIME type registrations from IANA."
139
+ task :iana, :save, :destination do |t, args|
140
+ save_type = args.save || :text
141
+ save_type = save_type.to_sym
142
+
143
+ case save_type
144
+ when :text, :both, :html
145
+ nil
146
+ else
147
+ raise "Unknown save type provided. Must be one of text, both, or html."
148
+ end
149
+
150
+ destination = args.destination || "type-lists"
151
+
152
+ require 'open-uri'
153
+ require 'nokogiri'
154
+ require 'cgi'
155
+
156
+ class IANAParser
157
+ include Comparable
158
+
159
+ INDEX = %q(http://www.iana.org/assignments/media-types/)
160
+ CONTACT_PEOPLE = %r{http://www.iana.org/assignments/contact-people.html?#(.*)}
161
+ RFC_EDITOR = %r{http://www.rfc-editor.org/rfc/rfc(\d+).txt}
162
+ IETF_RFC = %r{http://www.ietf.org/rfc/rfc(\d+).txt}
163
+ IETF_RFC_TOOLS = %r{http://tools.ietf.org/html/rfc(\d+)}
164
+
165
+ class << self
166
+ def load_index
167
+ @types ||= {}
168
+
169
+ Nokogiri::HTML(open(INDEX) { |f| f.read }).xpath('//p/a').each do |tag|
170
+ href_match = %r{^/assignments/media-types/(.+)/$}.match(tag['href'])
171
+ next if href_match.nil?
172
+ type = href_match.captures[0]
173
+ @types[tag.content] = IANAParser.new(tag.content, type)
174
+ end
175
+ end
176
+
177
+ attr_reader :types
178
+ end
179
+
180
+ def initialize(name, type)
181
+ @name = name
182
+ @type = type
183
+ @url = File.join(INDEX, @type)
184
+ end
185
+
186
+ attr_reader :name
187
+ attr_reader :type
188
+ attr_reader :url
189
+ attr_reader :html
190
+
191
+ def download(name = nil)
192
+ @html = Nokogiri::HTML(open(name || @url) { |f| f.read })
193
+ end
194
+
195
+ def save_html
196
+ File.open("#@name.html", "wb") { |w| w.write @html }
197
+ end
198
+
199
+ def <=>(o)
200
+ self.name <=> o.name
201
+ end
202
+
203
+ def parse
204
+ nodes = html.xpath("//table//table//tr")
205
+
206
+ # How many <td> children does the first node have?
207
+ node_count = nodes.first.children.select { |node| node.elem? }.size
208
+
209
+ @mime_types = nodes.map do |node|
210
+ next if node == nodes.first
211
+ elems = node.children.select { |n| n.elem? }
212
+ next if elems.size.zero?
213
+ raise "size mismatch #{elems.size} != #{node_count}" if node_count != elems.size
214
+
215
+ case elems.size
216
+ when 3
217
+ subtype_index = 1
218
+ refnode_index = 2
219
+ when 4
220
+ subtype_index = 1
221
+ refnode_index = 3
222
+ else
223
+ raise "Unknown element size."
224
+ end
225
+
226
+ subtype = elems[subtype_index].content.chomp.strip
227
+ refnodes = elems[refnode_index].children.select { |n| n.elem? }.map { |ref|
228
+ case ref['href']
229
+ when CONTACT_PEOPLE
230
+ tag = CGI::unescape($1).chomp.strip
231
+ if tag == ref.content
232
+ "[#{ref.content}]"
233
+ else
234
+ "[#{ref.content}=#{tag}]"
235
+ end
236
+ when RFC_EDITOR, IETF_RFC, IETF_RFC_TOOLS
237
+ "RFC#$1"
238
+ when %r{(https?://.*)}
239
+ "{#{ref.content}=#$1}"
240
+ else
241
+ ref
242
+ end
243
+ }
244
+ refs = refnodes.join(',')
245
+
246
+ "#@type/#{subtype} 'IANA,#{refs}"
247
+ end.compact
248
+
249
+ @mime_types
250
+ end
251
+
252
+ def save_text
253
+ File.open("#@name.txt", "wb") { |w| w.write @mime_types.join("\n") }
254
+ end
255
+ end
256
+
257
+ puts "Downloading index of MIME types from #{IANAParser::INDEX}."
258
+ IANAParser.load_index
259
+
260
+ require 'fileutils'
261
+ FileUtils.mkdir_p destination
262
+ Dir.chdir destination do
263
+ IANAParser.types.values.sort.each do |parser|
264
+ next if parser.name == "example" or parser.name == "mime"
265
+ puts "Downloading #{parser.name} from #{parser.url}"
266
+ parser.download
267
+
268
+ if :html == save_type || :both == save_type
269
+ puts "Saving #{parser.name}.html"
270
+ parser.save_html
271
+ end
272
+
273
+ puts "Parsing #{parser.name} HTML"
274
+ parser.parse
275
+
276
+ if :text == save_type || :both == save_type
277
+ puts "Saving #{parser.name}.txt"
278
+ parser.save_text
279
+ end
280
+ end
281
+ end
282
+ end
283
+
284
+ desc "Shows known MIME type sources."
285
+ task :mime_type_sources do
286
+ puts <<-EOS
287
+ http://www.ltsw.se/knbase/internet/mime.htp
288
+ http://www.webmaster-toolkit.com/mime-types.shtml
289
+ http://plugindoc.mozdev.org/winmime.php
290
+ http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
291
+ http://www.feedforall.com/mime-types.htm
292
+ http://www.iana.org/assignments/media-types/
293
+ EOS
294
+ end
295
+
296
+ desc "Validate the RubyGem spec for GitHub."
297
+ task :github_validate_spec do |t|
298
+ require 'yaml'
299
+
300
+ require 'rubygems/specification'
301
+ data = File.read("#{PKG_NAME}.gemspec")
302
+ spec = nil
303
+
304
+ if data !~ %r{!ruby/object:Gem::Specification}
305
+ code = "$SAFE = 3\n#{data}"
306
+ p code.split($/)[44]
307
+ Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
308
+ else
309
+ spec = YAML.load(data)
310
+ end
311
+
312
+ spec.validate
313
+
314
+ puts spec
315
+ puts "OK"
316
+ end