hardbound 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/hardbound +19 -0
  2. data/lib/hardbound.rb +16 -3
  3. metadata +4 -2
data/bin/hardbound ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hardbound'
4
+
5
+ if ARGV.size > 0
6
+
7
+ action = ARGV[0]
8
+ method = ARGV[1]
9
+
10
+ if action == "server"
11
+ p "Starting the hardbound server"
12
+ elsif action == "new"
13
+ p ">> Creating new hardbound book in ./#{method}"
14
+ Hardbound::Book.new(method)
15
+ else
16
+ p "Invalid command"
17
+ end
18
+
19
+ end
data/lib/hardbound.rb CHANGED
@@ -1,5 +1,18 @@
1
- class Hardbound
2
- def self.hi
3
- puts "Hello world!"
1
+ module Hardbound
2
+
3
+ class Book
4
+ def new(title)
5
+ # Main app setup
6
+ Dir.mkdir("./#{title}")
7
+ File.open("./#{title}/app.rb", 'w') {|f| f.write("get '/' do\n 'hello world'\nend") }
8
+ File.open("./#{title}/Gemfile", 'w') {|f| f.write("source :rubygems\ngem 'sinatra'") }
9
+
10
+ # Chapters
11
+ Dir.mkdir("./#{title}/pages")
12
+ File.open("./#{title}/pages/layout.erb", 'w') {|f| f.write("# Chapter 1:") }
13
+ File.open("./#{title}/pages/cover.erb", 'w') {|f| f.write("# Chapter 1:") }
14
+ File.open("./#{title}/pages/1.md", 'w') {|f| f.write("# Chapter 1:") }
15
+ end
4
16
  end
17
+
5
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hardbound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,13 @@ date: 2012-11-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A web-framework built on top of Sinatra that lets you make online books.
15
15
  email: nbashaw@gmail.com
16
- executables: []
16
+ executables:
17
+ - hardbound
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/hardbound.rb
22
+ - bin/hardbound
21
23
  homepage: http://github.com/nbashaw/hardbound
22
24
  licenses: []
23
25
  post_install_message: