newblogpost 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/newblogpost +6 -0
- data/lib/newblogpost.rb +40 -0
- data/lib/newblogpost/version.rb +3 -0
- data/newblogpost.gemspec +23 -0
- data/sample.txt +0 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ed606dc939aa84ae1811ba4ebb140c3dea86cddf
|
4
|
+
data.tar.gz: 39fbd054cfdd4680157519f13b6fcfc76614e783
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61b8466fc5bf54c5f1c23aeeea365fa13ca6cc27c4bdb8370e2f21f1e25e72c373b12bc4ff5ccb03395c0d1f04bc5dcc5da16be7c3fc291166cc6818225fee2b
|
7
|
+
data.tar.gz: 762efb9faf25326b8c55779709bf4466bb1a1c39ec25ff15eb0e24e43b434a2250fe09ed8357337b5d57beb6af882637da6578be453f29143be48d5e66a1c28c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Craig Wermert
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Newblogpost
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'newblogpost'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install newblogpost
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/newblogpost/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/newblogpost
ADDED
data/lib/newblogpost.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "newblogpost/version"
|
2
|
+
require "date"
|
3
|
+
|
4
|
+
module Newblogpost
|
5
|
+
class Post
|
6
|
+
def make_post
|
7
|
+
check_for_git = `which git`.strip
|
8
|
+
red_asterics = "\033[31m*\033[0m"
|
9
|
+
if ARGV[0] == 'help' && check_for_git.empty?
|
10
|
+
puts "#{red_asterics}\n#{red_asterics} To generate a new post, enter #{"\033[32mnewblogpost \"Your post title\" \"Your Name\"\033[0m"}\n#{red_asterics}\n#{red_asterics} This will generate a new file in the \"posts\" directory.\n#{red_asterics}"
|
11
|
+
elsif ARGV[0] == 'help' && !check_for_git.empty?
|
12
|
+
puts "#{red_asterics}\n#{red_asterics} To generate a new post, enter #{"\033[32mnewblogpost \"Your post title\"\033[0m"}\n#{red_asterics}\n#{red_asterics} This will generate a new file in the \"posts\" directory.\n#{red_asterics}"
|
13
|
+
end
|
14
|
+
|
15
|
+
if ARGV[0] != 'help'
|
16
|
+
|
17
|
+
title = ARGV[0]
|
18
|
+
|
19
|
+
if check_for_git.empty? && ARGV[1].empty?
|
20
|
+
puts "You need to specify an author name."
|
21
|
+
elsif check_for_git.empty? && ARGV > 1
|
22
|
+
name = ARGV[1]
|
23
|
+
else
|
24
|
+
name = `git config --global user.name`.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
28
|
+
date = DateTime.now
|
29
|
+
|
30
|
+
if File.directory?("posts")
|
31
|
+
File.open("sample.txt", "w")
|
32
|
+
File.open("posts/#{date.strftime('%m-%d-%Y')}-#{slug}.md", "w"){ |newpost| newpost.puts "<% title '#{title}' %>\n<% date '#{date.strftime('%B %d, %Y')}' %>\n<% author '#{name}' %>\n\n#Replace me with the body of your post."}
|
33
|
+
else
|
34
|
+
Dir.mkdir 'posts'
|
35
|
+
File.open("posts/#{date.strftime('%m-%d-%Y')}-#{slug}.md", "w"){ |newpost| newpost.puts "<% title '#{title}' %>\n<% date '#{date.strftime('%B %d, %Y')}' %>\n<% author '#{name}' %>\n\n#Replace me with the body of your post."}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/newblogpost.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require File.expand_path('../lib/newblogpost/version', __FILE__)
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'newblogpost/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.authors = ["Craig Wermert"]
|
9
|
+
gem.email = ["craig.wermert@osumc.edu"]
|
10
|
+
gem.description = %q{Generates a new blog post in markdown.}
|
11
|
+
gem.summary = %q{Parses your command line input into a new post. You shouldn't use this.}
|
12
|
+
gem.homepage = "https://bmi.osumc.edu"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($\)
|
15
|
+
gem.executables = ["newblogpost"]
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.name = "newblogpost"
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_development_dependency "bundler", "~> 1.5"
|
20
|
+
gem.add_development_dependency 'rake', '~> 0'
|
21
|
+
gem.version = Newblogpost::VERSION
|
22
|
+
gem.post_install_message = "\nType \"newblogpost help\" for usage instructions. \n\033[1mBut you probably shouldn't be using this, anyway.\033[0m"
|
23
|
+
end
|
data/sample.txt
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newblogpost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Craig Wermert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Generates a new blog post in markdown.
|
42
|
+
email:
|
43
|
+
- craig.wermert@osumc.edu
|
44
|
+
executables:
|
45
|
+
- newblogpost
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/newblogpost
|
55
|
+
- lib/newblogpost.rb
|
56
|
+
- lib/newblogpost/version.rb
|
57
|
+
- newblogpost.gemspec
|
58
|
+
- sample.txt
|
59
|
+
homepage: https://bmi.osumc.edu
|
60
|
+
licenses: []
|
61
|
+
metadata: {}
|
62
|
+
post_install_message: "\nType \"newblogpost help\" for usage instructions. \n\e[1mBut
|
63
|
+
you probably shouldn't be using this, anyway.\e[0m"
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.1
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Parses your command line input into a new post. You shouldn't use this.
|
83
|
+
test_files: []
|