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 +4 -4
- data/bin/wf-write +51 -0
- data/bin/writefully +1 -3
- data/lib/writefully/cli.rb +1 -1
- data/lib/writefully/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 107413e2f5f67e1677bd0b5c2c20f6e3e1601a49
|
4
|
+
data.tar.gz: a02c05cc2abc00023ccdef3013808e48b401f60f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/writefully/cli.rb
CHANGED
data/lib/writefully/version.rb
CHANGED
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.
|
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
|