writefully 0.6.3 → 0.6.4

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: 5b128b2eb034568554e540cf97bd82790c0c7fbf
4
- data.tar.gz: f48f6d8a1e854cc216583085c57df34485075f30
3
+ metadata.gz: 107413e2f5f67e1677bd0b5c2c20f6e3e1601a49
4
+ data.tar.gz: a02c05cc2abc00023ccdef3013808e48b401f60f
5
5
  SHA512:
6
- metadata.gz: 27213c0cb9f6bb00251428862d87d2c7d802dac5b4044065ee0b0110dac4b4a5d376503484bebcbb4e45debfbdc793e4d66907d9ae5af25204ac86f376bb247b
7
- data.tar.gz: f5d8af924e0ca1c76f9a5843900ed3dfddfbba3a673e10fe474591bb7d2a0f6d62dec860388e313f044f65fcd869c989fdf9bd242cef1385bcc26daba4f80ea5
6
+ metadata.gz: b353aed393e38291c257be472a5e8f49cef8134b9417b4cf118100f3bdd94d27453ec6d3ee260acfd8bb70b9251d51eb8f5f712f839730f2fa3bb98977dd8e41
7
+ data.tar.gz: 96770d5e23b8f7515d9e63d2a9cc9e7f9deb00e6369aef90e47223ed66ad6eade1e768a84419cbf908d0d1070a786d4b31757f7a519c73a18b42936525604e9a
data/bin/wf-write ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'active_support/inflector'
5
+
6
+ module Writefully
7
+ class Write < Thor
8
+ desc "new", "creates a new article in the current directory"
9
+
10
+ def new type, slug
11
+ create_content_with type, slug
12
+ end
13
+
14
+ no_tasks do
15
+ def create_content_with type, slug
16
+ new_position = get_last_post(type).split(/\//).last.match(/\A\d*/).to_s.to_i + 1
17
+ dir_name = File.join(type.pluralize, [new_position, slug].join('-'))
18
+ Dir.mkdir dir_name
19
+ add_assets dir_name
20
+ add_readme_md dir_name
21
+ add_meta dir_name
22
+ end
23
+
24
+ def add_readme_md dir_name
25
+ file = File.new File.join(dir_name, 'README.md'), "w"
26
+ file.puts("Replace with your content")
27
+ file.close
28
+ end
29
+
30
+ def add_assets dir_name
31
+ assets_dir_name = File.join(dir_name, 'assets')
32
+ Dir.mkdir assets_dir_name
33
+ end
34
+
35
+ def add_meta dir_name
36
+ meta = File.open(File.dirname(__FILE__) + "/../lib/sample/meta.yml").read
37
+ file = File.new File.join(dir_name, 'meta.yml'), "w"
38
+ file.puts meta
39
+ file.close
40
+ end
41
+
42
+ def get_last_post type
43
+ Dir.glob("#{type.pluralize}/*").sort_by do |item|
44
+ item.split(/\//).last.match(/\A\d*/).to_s.to_i
45
+ end.last
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ Writefully::Write.start(ARGV)
data/bin/writefully CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'writefully/loader'
4
3
  require 'writefully/cli'
5
4
 
6
-
7
- Writefully::CLI.start
5
+ Writefully::CLI.start(ARGV)
@@ -68,4 +68,4 @@ module Writefully
68
68
  end
69
69
  end
70
70
  end
71
- end
71
+ end
@@ -1,3 +1,3 @@
1
1
  module Writefully
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: writefully
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Siri
@@ -420,6 +420,7 @@ files:
420
420
  - app/views/writefully/sites/show/_processing.html.erb
421
421
  - app/views/writefully/sites/show/_tabs.html.erb
422
422
  - bin/rails
423
+ - bin/wf-write
423
424
  - bin/writefully
424
425
  - config/routes.rb
425
426
  - db/migrate/20140402091204_create_writefully_posts.rb