nippou 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nippou.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Fujimura Daisuke
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # Nippou
2
+
3
+ Nippou editor for hackers
4
+
5
+ ## Installation
6
+
7
+ $ gem install nippou
8
+
9
+ ## Usage
10
+
11
+ $ nippou
12
+
13
+ ## Contributing
14
+
15
+ 1. Fork it
16
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
17
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
18
+ 4. Push to the branch (`git push origin my-new-feature`)
19
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/TODO.md ADDED
@@ -0,0 +1,7 @@
1
+ # Todos
2
+
3
+ * Create and save template
4
+
5
+ * Replace pit with better configuration management tool
6
+
7
+ * Save history
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+ require File.join(File.dirname(__FILE__) + '/../lib/nippou')
3
+
4
+ Nippou::Base.deliver
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'tempfile'
3
+
4
+ module Editable
5
+
6
+ # Edit self by $EDITOR
7
+ #
8
+ def edit!
9
+ temp = Tempfile.new(self.object_id.to_s)
10
+ temp << self unless self.empty?
11
+ temp.read # TODO?
12
+
13
+ system(ENV["EDITOR"], temp.path)
14
+
15
+ temp.open
16
+ edited = temp.read
17
+ temp.close!
18
+
19
+ self.replace edited
20
+ end
21
+ end
22
+
23
+ String.send :include, Editable
@@ -0,0 +1,35 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+
3
+ require 'pit'
4
+ require 'mail'
5
+ require 'core_ext/editable'
6
+ require "nippou/version"
7
+ module Nippou
8
+ class Base
9
+ DEFAULT_CHARSET = 'utf-8'
10
+ def self.deliver
11
+ config = Pit.get("nippou", :require => {
12
+ "name" => "Your name",
13
+ "email" => "Your email",
14
+ "password" => "Password of your email",
15
+ "recipients" => "Recipients"})
16
+
17
+ mail = Mail.new
18
+ mail.to = config['recipients']
19
+ mail.from = config['email']
20
+ mail.charset = DEFAULT_CHARSET
21
+ mail.body = (config['body'] || 'write your nippou here').dup.edit! # OMG
22
+ mail.delivery_method :smtp, {
23
+ :address => 'smtp.gmail.com',
24
+ :port => 587,
25
+ :domain => (config['domain'] || 'smtp.gmail.com'),
26
+ :user_name => config['email'],
27
+ :password => config['password'],
28
+ :authentication => :plain,
29
+ :enable_starttls_auto => true
30
+ }
31
+
32
+ mail.deliver
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module Nippou
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/nippou/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Fujimura Daisuke"]
6
+ gem.email = ["me@fujimuradaisuke.com"]
7
+ gem.description = %q{Nippou editor for Hacker}
8
+ gem.summary = %q{Create, edit and send daily nippou with your $EDITOR}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "nippou"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Nippou::VERSION
17
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nippou
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fujimura Daisuke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-21 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Nippou editor for Hacker
15
+ email:
16
+ - me@fujimuradaisuke.com
17
+ executables:
18
+ - nippou
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - TODO.md
28
+ - bin/nippou
29
+ - lib/core_ext/editable.rb
30
+ - lib/nippou.rb
31
+ - lib/nippou/version.rb
32
+ - nippou.gemspec
33
+ homepage: ''
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.11
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Create, edit and send daily nippou with your $EDITOR
57
+ test_files: []
58
+ has_rdoc: