mediumize 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1964c6e63a9d3561cd24cf4633fe846d3a6f0e94
4
- data.tar.gz: 9178c9913c3c51fd1ab7dc6b207aca3c03104cf0
3
+ metadata.gz: a403b3f1e67b6fef87f90a8872984e50f25f169b
4
+ data.tar.gz: c832638beb0ce86e1e7a0ac26750d611980140c7
5
5
  SHA512:
6
- metadata.gz: 28798849e33e8d8737c59257da79680a7124bb7046d60e60900f2ccc64c815fb7c0e48c3a8cff14841d003741dad94d4d62c2abb2d9737f1d08c6579cbc5dd92
7
- data.tar.gz: 66e52b03cbda0f4726239eafab854fe190392b87c331d06b97e5c6985451cdd432996acc26eb7bb9a3473e2ce835b0c5050a1bd5eb6a33acf07c570dec5766d1
6
+ metadata.gz: f60723f733d5a6ad97c376c3d6e6cb160667bb81595e6a9d29c13bdb3e6ef345b4021a7d2a6e01865d4645592e7e7435dc2ffe00e69b124e2841698857f5e806
7
+ data.tar.gz: 571aa774202c3e6aca58aa3c3036d1ccbf9db00ca4607cd0c378089e49806c697f7c0f456a2c1d975fca91336840d75b5ba19bcc7d7f16683a1f76019ab0d00d
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Mediumize
2
2
 
3
+ [![Gem Version](https://img.shields.io/gem/v/mediumize.svg)](https://rubygems.org/gems/mediumize)
3
4
  [![Build Status](https://travis-ci.org/jondot/mediumize.svg?branch=master)](https://travis-ci.org/jondot/mediumize)
4
5
 
5
6
  Automatically post (and cross-post) your markdown style blog posts to your [Medium](http://medium.com) account from [Jekyll](http://jekyllrb.com/), [Middleman](middlemanapp.com), [Hugo](http://gohugo.io/) and others.
@@ -3,6 +3,7 @@
3
3
  require "bundler/setup"
4
4
  require "mediumize"
5
5
  require "slop"
6
+ require "colorize"
6
7
 
7
8
  def bail(err, opts)
8
9
  puts err
@@ -13,8 +14,10 @@ end
13
14
 
14
15
  begin
15
16
  o = Slop::Options.new
16
- o.bool '-m', '--frontmatter', 'a hostname', default: true
17
- o.string '-t', '--token', 'your Medium integration token'
17
+ o.bool '-m', '--frontmatter', '(default: true) Use if files contain a frontmatter', default: true
18
+ o.bool '-h', '--headline', '(default: true) Use if you want to insert a main headline in addition to a title', default: true
19
+ o.string '-t', '--token', 'Your Medium integration token'
20
+ o.string '-b', '--base_url', 'Your blog base url, for relative images and resources. e.g. http://acme.org/blog'
18
21
  o.on '--version', 'print the version' do
19
22
  puts Mediumize::VERSION
20
23
  exit
@@ -29,9 +32,12 @@ begin
29
32
  bail "Error: please provide a token", opts
30
33
  end
31
34
 
35
+ puts opts.to_h
32
36
  p = Mediumize::Publisher.new(opts.to_h)
33
37
  opts.arguments.each do |arg|
34
- p.publish(arg)
38
+ res = p.publish(arg)
39
+ badge = "✔ draft ".colorize(:green)
40
+ puts "#{badge} #{res[:url]}"
35
41
  end
36
42
 
37
43
  rescue
@@ -29,7 +29,7 @@ module Mediumize
29
29
  class Publisher
30
30
  def initialize(opts={})
31
31
  @opts = opts
32
- @renderer = Mediumize::Renderer.new(opts.slice(:frontmatter))
32
+ @renderer = Mediumize::Renderer.new(opts)
33
33
  @client = Medium::Client.new(:integration_token => opts[:token])
34
34
  end
35
35
 
@@ -26,6 +26,10 @@ module Mediumize
26
26
  @normalizers.each{|n| doc = n.normalize(doc) }
27
27
 
28
28
  doc.title = opts[:title] if opts[:title]
29
+ if(@opts[:headline])
30
+ doc.at('body').children.first.add_previous_sibling("<h1>#{doc.title}</h1")
31
+ end
32
+
29
33
  {
30
34
  :title => doc.title,
31
35
  :content => doc.at('body').children.to_html,
@@ -1,3 +1,3 @@
1
1
  module Mediumize
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -22,8 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'nokogiri', '~> 1.6.7'
23
23
  spec.add_dependency 'github-markup', '~> 1.4.0'
24
24
  spec.add_dependency 'kramdown', '~> 1.9.0'
25
- spec.add_dependency 'medium-sdk-ruby'
25
+ spec.add_dependency 'medium-sdk-ruby', '~> 1.0.1'
26
26
  spec.add_dependency 'slop', '~> 4.2.1'
27
+ spec.add_dependency 'colorize', '~> 0.7.7'
27
28
 
28
29
  spec.add_development_dependency "bundler", "~> 1.10"
29
30
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediumize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dotan Nahum
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: medium-sdk-ruby
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 1.0.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 1.0.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: slop
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 4.2.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: colorize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.7.7
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.7
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +179,6 @@ files:
165
179
  - README.md
166
180
  - Rakefile
167
181
  - bin/mediumize
168
- - bin/setup
169
182
  - lib/mediumize.rb
170
183
  - lib/mediumize/frontmatter.rb
171
184
  - lib/mediumize/normalizers/links.rb
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here