melissadata 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/Gemfile +2 -0
  2. data/Gemfile.lock +46 -16
  3. data/README.md +50 -2
  4. data/Rakefile +58 -23
  5. data/Vagrantfile +12 -12
  6. data/bin/md_tcp_server +5 -0
  7. data/bin/md_unix_server +5 -0
  8. data/chef/cookbooks/apt/README.md +109 -0
  9. data/chef/cookbooks/apt/files/default/apt-cacher +9 -0
  10. data/chef/cookbooks/apt/files/default/apt-cacher.conf +144 -0
  11. data/chef/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  12. data/chef/cookbooks/apt/metadata.json +34 -0
  13. data/chef/cookbooks/apt/metadata.rb +13 -0
  14. data/chef/cookbooks/apt/providers/repository.rb +72 -0
  15. data/chef/cookbooks/apt/recipes/cacher-client.rb +37 -0
  16. data/chef/cookbooks/apt/recipes/cacher.rb +45 -0
  17. data/chef/cookbooks/apt/recipes/default.rb +33 -0
  18. data/chef/cookbooks/apt/resources/repository.rb +30 -0
  19. data/chef/cookbooks/build-essential/README.md +24 -0
  20. data/chef/cookbooks/build-essential/metadata.json +35 -0
  21. data/chef/cookbooks/build-essential/metadata.rb +10 -0
  22. data/chef/cookbooks/build-essential/recipes/default.rb +45 -0
  23. data/chef/cookbooks/melissadata/attributes/default.rb +5 -0
  24. data/chef/cookbooks/melissadata/metadata.rb +8 -0
  25. data/chef/cookbooks/melissadata/recipes/default.rb +37 -0
  26. data/chef/cookbooks/melissadata/templates/default/Makefile.erb +39 -0
  27. data/chef/cookbooks/melissadata/templates/default/md_tcp_server.init.erb +82 -0
  28. data/chef/cookbooks/melissadata/templates/default/md_unix_server.init.erb +81 -0
  29. data/chef/cookbooks/rvm/recipes/default.rb +1 -0
  30. data/chef/cookbooks/rvm/recipes/r187.rb +6 -0
  31. data/chef/cookbooks/rvm/recipes/r192.rb +6 -0
  32. data/chef/cookbooks/rvm/recipes/system.rb +28 -0
  33. data/chef/cookbooks/ubuntu/attributes/default.rb +24 -0
  34. data/chef/cookbooks/ubuntu/metadata.json +36 -0
  35. data/chef/cookbooks/ubuntu/metadata.rb +8 -0
  36. data/chef/cookbooks/ubuntu/recipes/default.rb +27 -0
  37. data/chef/cookbooks/ubuntu/templates/default/sources.list.erb +15 -0
  38. data/lib/melissadata.rb +1 -2
  39. data/lib/melissadata/client.rb +8 -0
  40. data/lib/melissadata/client/base.rb +56 -0
  41. data/lib/melissadata/client/tcp.rb +28 -0
  42. data/lib/melissadata/client/unix.rb +22 -0
  43. data/lib/melissadata/client/vagrant.rb +9 -0
  44. data/lib/melissadata/command.rb +1 -0
  45. data/lib/melissadata/command/base.rb +0 -1
  46. data/lib/melissadata/command/compile.rb +37 -0
  47. data/lib/melissadata/command/package.rb +32 -73
  48. data/lib/melissadata/constants.rb +6 -5
  49. data/lib/melissadata/melissadata.rb +26 -91
  50. data/lib/melissadata/native_object.rb +0 -8
  51. data/lib/melissadata/native_object/address.rb +2 -0
  52. data/lib/melissadata/native_object/base.rb +18 -5
  53. data/lib/melissadata/native_object/email.rb +2 -0
  54. data/lib/melissadata/native_object/geo.rb +2 -0
  55. data/lib/melissadata/native_object/ip_locator.rb +2 -0
  56. data/lib/melissadata/native_object/name.rb +2 -0
  57. data/lib/melissadata/native_object/phone.rb +2 -0
  58. data/lib/melissadata/server.rb +10 -0
  59. data/lib/melissadata/server/base.rb +145 -0
  60. data/lib/melissadata/server/tcp.rb +22 -0
  61. data/lib/melissadata/server/unix.rb +24 -0
  62. data/lib/melissadata/vagrant_plugin.rb +23 -0
  63. data/lib/melissadata/vagrant_plugin/actions.rb +9 -0
  64. data/lib/melissadata/vagrant_plugin/actions/base.rb +60 -0
  65. data/lib/melissadata/vagrant_plugin/actions/install.rb +78 -0
  66. data/lib/melissadata/vagrant_plugin/actions/update.rb +22 -0
  67. data/lib/melissadata/vagrant_plugin/command.rb +21 -0
  68. data/lib/melissadata/vagrant_plugin/config.rb +18 -0
  69. data/lib/melissadata/version.rb +1 -1
  70. data/locales/en.yml +16 -0
  71. data/melissadata.gemspec +11 -12
  72. data/pkg/melissadata-0.0.1.gem +0 -0
  73. data/spec/helpers/vagrant_helpers.rb +17 -0
  74. data/spec/melissadata/command/package_spec.rb +1 -1
  75. data/spec/melissadata/vagrant_plugin/actions/install_spec.rb +40 -0
  76. data/spec/melissadata/vagrant_plugin/config_spec.rb +17 -0
  77. data/spec/spec_helper.rb +12 -7
  78. metadata +201 -228
  79. data/bin/md +0 -4
  80. data/bin/md-rpc +0 -9
  81. data/bin/md-server +0 -18
  82. data/bin/melissadata +0 -4
  83. data/lib/melissadata/native_object/client.rb +0 -33
  84. data/lib/melissadata/prev/command_old.rb +0 -80
  85. data/lib/melissadata/prev/shared_objects.rb +0 -54
  86. data/lib/melissadata/rpc.rb +0 -39
  87. data/pkg/melissa-data-0.0.1.gem +0 -0
  88. data/pkg/melissa-data-0.0.2.gem +0 -0
  89. data/pkg/melissa-data-0.0.3.gem +0 -0
  90. data/templates/config.rb +0 -20
  91. data/templates/locales/en.yml +0 -4
data/bin/md DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'melissadata'
4
- MelissaData::CLI.start(ARGV)
data/bin/md-rpc DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'rubygems'
4
- require 'md'
5
- require 'irb'
6
- require 'melissa-data/rpc'
7
-
8
- MelissaData.client = MelissaData::RPC::Client.new
9
- IRB.start
data/bin/md-server DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
3
-
4
- license = ARGV.first || 'INVALID LICENSE'
5
- require 'melissa-data/rpc'
6
- require 'melissa-data/shared_objects'
7
- require 'msgpack/rpc/transport/unix'
8
-
9
- host = MelissaData::RPC::DEFAULT_ADDRESS
10
- port = 23456 # MelissaData::RPC::DEFAULT_PORT
11
- address = "/tmp/melissa-data"
12
- listener = MessagePack::RPC::UNIXServerTransport.new(address)
13
- api = MelissaData::SharedObjects::Client.new(license)
14
-
15
- svr = MessagePack::RPC::Server.new
16
- svr.listen(listener, api)
17
- puts "== RPC listening on #{host}:#{port}"
18
- svr.run
data/bin/melissadata DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'melissadata'
4
- MelissaData::CLI.start(ARGV)
@@ -1,33 +0,0 @@
1
- module MelissaData::NativeObject
2
-
3
- class Client
4
- attr_reader :license
5
-
6
- def initialize(license='INVALID LICENSE')
7
- @license = license
8
- @email_object = MelissaData::Email.new(:license => license)
9
- end
10
-
11
- def process_email(email=nil)
12
- email ||= ''
13
- output = {}
14
- input = {:email => email.to_s}
15
- output = @email_object.process(input)
16
- output.delete_if{ |k,v| v.to_s.strip == "" }
17
- output
18
- end
19
-
20
- def email_build_number
21
- @email_object.obj.GetBuildNumber
22
- end
23
-
24
- def version
25
- MelissaData::VERSION
26
- end
27
-
28
- def address
29
- "SharedObjects"
30
- end
31
- end
32
-
33
- end
@@ -1,80 +0,0 @@
1
- require 'melissa-data/melissa-data'
2
- require 'thor'
3
- require 'cloudfiles'
4
-
5
- module MelissaData
6
-
7
- class Command < Thor
8
- include Thor::Actions
9
-
10
- def self.source_root
11
- File.expand_path('../../templates', File.dirname(__FILE__))
12
- end
13
-
14
-
15
- def package
16
- invoke Commands::Package
17
- end
18
-
19
-
20
- # desc "package", "Zips up data files from DVD and uploads them to remote servers"
21
- # # method_option :path, :type => :string, :default => '/usr/lib/ruby/1.8/x86_64-linux', :desc => "Path to MelissaData DVD"
22
- # method_option :username, :aliases => '-u', :type => :string, :required => true, :desc => "CloudFiles Username"
23
- # method_option :api_key, :aliases => '-a', :type => :string, :required => true, :desc => "CloudFiles API Key"
24
- # method_option :bucket_name, :aliases => '-b', :type => :string, :desc => "CloudFiles Bucket name"
25
-
26
- # def package
27
- # source_dir = Dir['/Volumes/*'].detect{ |path| path =~ /DVD-\d{4}-\d{2}$/ }
28
- # raise "Can't find MelissaData DVD in /Volumes" if source_dir.blank?
29
-
30
- # dest_dir = "/tmp"
31
-
32
- # possible_objects = %w[ address email name phone ]
33
- # # objects = Dir.entries(source_dir).select{ |path| possible_objects.include?(path) }
34
- # objects = %w[ email name ]
35
-
36
- # objects.each do |obj|
37
- # data_file = "#{dest_dir}/#{obj}.tgz"
38
- # inside "#{source_dir}/#{obj}" do
39
- # run "tar czf #{data_file} data"
40
- # end
41
-
42
- # say_status :upload, "#{obj}.tgz to #{options[:bucket_name]}"
43
- # cf = CloudFiles::Connection.new(:username => options[:username], :api_key => options[:api_key])
44
- # cont = cf.container options[:bucket_name]
45
- # remote_object = cont.create_object "#{obj}.tgz", false
46
- # remote_object.load_from_filename data_file
47
-
48
- # # "#{source_dir}/#{obj}/linux/gcc34_64bit/*.h" => /opt/melissadata/src/
49
- # # "#{source_dir}/#{obj}/linux/gcc34_64bit/libmdEmail.so" => /opt/melissadata/lib/
50
- # # "#{source_dir}/#{obj}/linux/interfaces/ruby/mdEmailRubyWrapper.cpp" => /opt/melissadata/lib/
51
-
52
- # # inside "#{source_dir}/#{obj}/linux/gcc34_64bit" do
53
- # # run "tar czf #{data_file} data"
54
- # # end
55
- # end
56
- # end
57
-
58
-
59
- # desc "install", "Install MelissaData config, data files"
60
- # method_option :license, :required => true, :type => :string, :aliases => "-l", :desc => "MelissaData license string"
61
- # method_option :install_path, :type => :string, :default => '/opt/melissa_data', :desc => "Path to install to"
62
- # method_option :ruby_dir, :type => :string, :default => '/usr/lib/ruby/1.8/x86_64-linux', :desc => "Path to ruby libs"
63
-
64
- # method_option :data_bucket_name, :type => :string, :default => 'MelissaData', :aliases => "-b", :desc => "CloudFiles bucket name"
65
- # method_option :data_username, :required => true, :type => :string, :aliases => "-u", :desc => "Rackspace username"
66
- # method_option :data_api_key, :required => true, :type => :string, :aliases => "-a", :desc => "Rackspace API key"
67
-
68
- # def install
69
- # # options[:license] = ask("Enter your MelissaData license:", :blue) if options[:license].blank?
70
- # # options[:data_username] = ask("Enter your Rackspace username:", :blue) if options[:data_username].blank?
71
- # # options[:data_api_key] = ask("Enter your Rackspace API key:", :blue) if options[:data_api_key].blank?
72
-
73
- # config_dir = '~/.melissa-data'
74
- # empty_directory config_dir
75
-
76
- # template "config.rb", "#{config_dir}/config.rb"
77
- # end
78
- end
79
-
80
- end
@@ -1,54 +0,0 @@
1
- md_path = File.expand_path('../..', File.dirname(__FILE__))
2
- $LOAD_PATH.unshift md_path unless $LOAD_PATH.include?(md_path)
3
-
4
- require 'melissa-data/constants'
5
-
6
- module MelissaData
7
- module SharedObjects
8
-
9
- class Client
10
- attr_reader :license
11
-
12
- def initialize(license='INVALID LICENSE')
13
- @license = license
14
- @email_object = MelissaData::Email.new(:license => license)
15
- end
16
-
17
- def process_email(email=nil)
18
- email ||= ''
19
- output = {}
20
- input = {:email => email.to_s}
21
- output = @email_object.process(input)
22
- output.delete_if{ |k,v| v.to_s.strip == "" }
23
- output
24
- end
25
-
26
- def email_build_number
27
- @email_object.obj.GetBuildNumber
28
- end
29
-
30
- def version
31
- MelissaData::VERSION
32
- end
33
-
34
- def address
35
- "SharedObjects"
36
- end
37
- end
38
-
39
- end
40
- end
41
-
42
- %w[
43
- mdAddrRubyWrapper mdEmailRubyWrapper mdGeoRubyWrapper mdNameRubyWrapper mdPhoneRubyWrapper mdIpLocatorRubyWrapper
44
- ].each do |obj|
45
- require File.join(MelissaData::DEFAULT_SHARED_OBJECTS_PATH, obj)
46
- end
47
-
48
- require 'melissa-data/shared_objects/base'
49
- require 'melissa-data/shared_objects/email'
50
- require 'melissa-data/shared_objects/address'
51
- require 'melissa-data/shared_objects/geo'
52
- require 'melissa-data/shared_objects/ip_locator'
53
- require 'melissa-data/shared_objects/name'
54
- require 'melissa-data/shared_objects/phone'
@@ -1,39 +0,0 @@
1
- require 'melissa-data/melissa-data'
2
- require 'msgpack/rpc'
3
- require 'msgpack/rpc/transport/unix'
4
-
5
- module MelissaData
6
- module RPC
7
- include Constants
8
-
9
- class Client
10
- attr_reader :rpc
11
-
12
- def initialize
13
- @socket_file = "/tmp/melissa-data"
14
- @rpc = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, @socket_file)
15
- end
16
-
17
- # def method_missing(meth, *args, &blck)
18
- # rpc.call meth, args
19
- # end
20
-
21
- def process_email(email)
22
- rpc.call :process_email, email
23
- end
24
-
25
- def email_build_number
26
- rpc.call :email_build_number
27
- end
28
-
29
- def version
30
- rpc.call :version
31
- end
32
-
33
- def address
34
- "#{@host}:#{@port}"
35
- end
36
- end
37
-
38
- end
39
- end
Binary file
Binary file
Binary file
data/templates/config.rb DELETED
@@ -1,20 +0,0 @@
1
- config[:license] = "<%= options[:license] %>"
2
- config[:objects] = %w[ email name phone ]
3
- config[:path] = "<%= options[:install_path] %>"
4
- config[:ruby_dir] = "<%= options[:ruby_dir] %>"
5
- config[:remote_bucket] = "<%= options[:data_bucket_name] %>"
6
- config[:data_username] = "<%= options[:data_username] %>"
7
- config[:data_api_key] = "<%= options[:data_api_key] %>"
8
-
9
-
10
- # config['test'] = options[:test]
11
- #
12
- # import('shared')
13
- #
14
- # environment :production do
15
- # config['prod'] = 'my prod'
16
- # end
17
- #
18
- # environment :development do
19
- # config['dev'] = 'my dev'
20
- # end
@@ -1,4 +0,0 @@
1
- en:
2
- melissadata:
3
- errors:
4
- disc_not_found: "Can't find MelissaData DVD in /Volumes"