blogster 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/blogster.gemspec +1 -0
- data/exe/blogster +99 -0
- data/lib/blogster/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ff4e8849e14f72f60d5ee2e8cf6961b96d3d37f
|
4
|
+
data.tar.gz: 84f07a0c65b4abb9921beca9191e89dd2731d155
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcdaa91c1c6083889d8060ddee4a5cbc9e43bba5b1b925b0c65eac0e246bed03e49aedff19d0cf60160501aa6a88d465b5faaa1475175841aec3e1c8dc7a17c4
|
7
|
+
data.tar.gz: 28c4ad4a1a6525e8d48156998c8a25730318a4c1555b930316d5a2ada825c36f471631f3e7eb4385900f6bfac9f5096cd2e49c7838e98f7efbbec34cc03a6d2e
|
data/blogster.gemspec
CHANGED
data/exe/blogster
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/blogster.rb'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
user_path = ENV['PWD']
|
7
|
+
command = ARGV.first
|
8
|
+
|
9
|
+
|
10
|
+
if command == 'run'
|
11
|
+
unless File.exist?("#{user_path}/.blogster")
|
12
|
+
puts 'You need to be inside a project root directory.'
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
sub_directories = Dir['*/'].map { |file| File.join(user_path, file) }
|
17
|
+
parsed_files = Blogster::TemplatesParser.new(sub_directories)
|
18
|
+
templates = parsed_files.to_templates
|
19
|
+
|
20
|
+
Blogster.create(templates)
|
21
|
+
Blogster.run!
|
22
|
+
elsif command == 'generate'
|
23
|
+
|
24
|
+
page = ARGV[1]
|
25
|
+
template_name = ARGV[2]
|
26
|
+
|
27
|
+
unless File.exist?("#{user_path}/.blogster")
|
28
|
+
puts 'You need to be in a blogster file structure.'
|
29
|
+
puts 'Run the new command first.'
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
|
33
|
+
if ARGV.size < 3
|
34
|
+
puts 'You need to supply two arguments - a page and a template.'
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
|
38
|
+
template_path = File.join(user_path, "_#{page.downcase}")
|
39
|
+
template = File.join(template_path.downcase, "#{template_name}.md".downcase)
|
40
|
+
|
41
|
+
puts "Creating #{template_path} folder."
|
42
|
+
FileUtils.mkdir_p template_path
|
43
|
+
|
44
|
+
if File.exist?(template)
|
45
|
+
puts 'This template already exists.'
|
46
|
+
puts 'Delete the old one first and then run the command again.'
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
puts "Generating markdown file: #{template}"
|
51
|
+
File.open(template, 'w') do |file|
|
52
|
+
time = Time.now.strftime('%d/%m/%Y at %I:%M%p')
|
53
|
+
|
54
|
+
puts "Published on #{time}"
|
55
|
+
file.puts <<-PAGE_TEMPLATE
|
56
|
+
# #{page.capitalize}
|
57
|
+
|
58
|
+
## #{template_name.capitalize}
|
59
|
+
|
60
|
+
*published on #{time}*
|
61
|
+
|
62
|
+
1. Template generated.
|
63
|
+
2. **You can edit this markdown however you want.**
|
64
|
+
3. You can inline HTML and all the cool stuff you get with markdown files.
|
65
|
+
|
66
|
+
**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.**
|
67
|
+
|
68
|
+
|
69
|
+
*Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.*
|
70
|
+
PAGE_TEMPLATE
|
71
|
+
end
|
72
|
+
|
73
|
+
puts 'Finished.'
|
74
|
+
elsif command == 'new'
|
75
|
+
|
76
|
+
project_name = ARGV.second
|
77
|
+
root = File.dirname(__dir__)
|
78
|
+
template_path = File.join(root, 'template_folder', '.')
|
79
|
+
|
80
|
+
if ARGV.size < 2
|
81
|
+
puts 'You must run new command with an app_name argument.'
|
82
|
+
puts 'In which the project will be generated.'
|
83
|
+
exit
|
84
|
+
end
|
85
|
+
|
86
|
+
project_path = File.join(user_path, project_name)
|
87
|
+
|
88
|
+
puts 'Creating new blogster project...'
|
89
|
+
|
90
|
+
puts "Generating project's path."
|
91
|
+
FileUtils.mkdir_p(project_path)
|
92
|
+
|
93
|
+
puts 'Generating project templates.'
|
94
|
+
FileUtils.cp_r(template_path, project_path)
|
95
|
+
|
96
|
+
puts 'Finished.'
|
97
|
+
else
|
98
|
+
puts "You must construct addition pylons. I mean you must add additional arguments"
|
99
|
+
end
|
data/lib/blogster/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blogster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Jichev
|
@@ -126,6 +126,7 @@ description: You can create static blogs with this gem.
|
|
126
126
|
email:
|
127
127
|
- njichev@gmail.com
|
128
128
|
executables:
|
129
|
+
- blogster
|
129
130
|
- generate
|
130
131
|
- new
|
131
132
|
- run
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- bin/setup
|
146
147
|
- blogster.gemspec
|
147
148
|
- config.ru
|
149
|
+
- exe/blogster
|
148
150
|
- exe/generate
|
149
151
|
- exe/new
|
150
152
|
- exe/run
|