Commit 006b57f

mokha <mokha@cisco.com>
2019-02-25 01:30:01
create test client
1 parent a03ac8b
exe/minbox
@@ -1,3 +1,5 @@
 #!/usr/bin/env ruby
 
-require "minbox"
+require "minbox/cli"
+
+Minbox::Cli::Application.start(ARGV)
lib/minbox/cli.rb
@@ -0,0 +1,34 @@
+require 'thor'
+
+require 'minbox'
+
+module Minbox
+  module Cli
+    class Application < Thor
+      package_name "minbox"
+
+      desc 'client <HOST> <PORT>', 'SMTP client'
+      def client(host = 'localhost', port = 25)
+        mail = <<END_OF_MESSAGE
+From: Your Name <me@example.org>
+To: Destination Address <them@example.com>
+Subject: test message
+Date: Sat, 23 Jun 2001 16:26:43 +0900
+Message-Id: <unique.message.id.string@example.com>
+
+This is a test message.
+END_OF_MESSAGE
+
+        require 'net/smtp'
+        Net::SMTP.start(host, port) do |smtp|
+          smtp.send_message(mail, 'me@example.org', 'them@example.com')
+        end       
+      end
+
+      desc 'version', 'Display the current version'
+      def version
+        say Minbox::VERSION
+      end
+    end
+  end
+end
Gemfile.lock
@@ -0,0 +1,37 @@
+PATH
+  remote: .
+  specs:
+    minbox (0.1.0)
+      thor (~> 0.20)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    diff-lcs (1.3)
+    rake (10.5.0)
+    rspec (3.8.0)
+      rspec-core (~> 3.8.0)
+      rspec-expectations (~> 3.8.0)
+      rspec-mocks (~> 3.8.0)
+    rspec-core (3.8.0)
+      rspec-support (~> 3.8.0)
+    rspec-expectations (3.8.2)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.8.0)
+    rspec-mocks (3.8.0)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.8.0)
+    rspec-support (3.8.0)
+    thor (0.20.3)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  bundler (~> 2.0)
+  minbox!
+  rake (~> 10.0)
+  rspec (~> 3.0)
+
+BUNDLED WITH
+   2.0.1
minbox.gemspec
@@ -6,22 +6,20 @@ require "minbox/version"
 Gem::Specification.new do |spec|
   spec.name          = "minbox"
   spec.version       = Minbox::VERSION
-  spec.authors       = ["mokha"]
-  spec.email         = ["mokha@cisco.com"]
+  spec.authors       = ["mo khan"]
+  spec.email         = ["mo@mokhan.ca"]
 
-  spec.summary       = %q{TODO: Write a short summary, because RubyGems requires one.}
-  spec.description   = %q{TODO: Write a longer description or delete this line.}
-  spec.homepage      = "TODO: Put your gem's website or public repo URL here."
+  spec.summary       = %q{A minimal smtp server.}
+  spec.description   = %q{A minimal smtp server.}
+  spec.homepage      = "https://www.mokhan.ca/"
   spec.license       = "MIT"
 
   # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
   # to allow pushing to a single host or delete this section to allow pushing to any host.
   if spec.respond_to?(:metadata)
-    spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
-
     spec.metadata["homepage_uri"] = spec.homepage
-    spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
-    spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
+    spec.metadata["source_code_uri"] = "https://github.com/mokhan/minbox"
+    spec.metadata["changelog_uri"] = "https://github.com/mokhan/minbox/blob/CHANGELOG.md"
   else
     raise "RubyGems 2.0 or newer is required to protect against " \
       "public gem pushes."
@@ -36,6 +34,7 @@ Gem::Specification.new do |spec|
   spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
   spec.require_paths = ["lib"]
 
+  spec.add_dependency "thor", "~> 0.20"
   spec.add_development_dependency "bundler", "~> 2.0"
   spec.add_development_dependency "rake", "~> 10.0"
   spec.add_development_dependency "rspec", "~> 3.0"