sinatra_generator 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb29a37ff62006294c417ae6279632dde6732e35
4
- data.tar.gz: fc8616025a0b1029543f30ce93e4b0a9f60e5967
3
+ metadata.gz: c40d1f01b92a2fbaa3a6a743b822010cc1d756f3
4
+ data.tar.gz: aa5d252c1a5dcd67d3cc4925421c71c5e1a1c92a
5
5
  SHA512:
6
- metadata.gz: ad1b9af34a0f7b28820ebd5aa8e251a909ab20c3a0d2101722bc4fc5ab7e4dfa08dda42ea1871747c791b532801f548fd3ddcc1195431a36b4d84b3557497a4a
7
- data.tar.gz: 723d08a3629ecbfd93dd21e01ff6e30658461549a506fffeada2c20a2ef5f261e02dcaf57cae5c9ecf81896149f7d04eae0e305dcf73d0e777b824a846f0660f
6
+ metadata.gz: 2bedb86c1aff3f564048b2c3280754ab82ab04f09d780b712b2bcd52a2054dd79acdafd66c5c469a263440567592ae85915d13e6bce28f5793d020a52dd40860
7
+ data.tar.gz: e69bb4278440e02ead0f8211a9802b141c4a034316b9806f3e6c972e03ff2aa6287dda028440762d2f54233c956833f092fc88af427abac3442d4982a02a6fc1
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # SinatraGenerator
2
2
 
3
- quick demo of how to make a gem
4
-
5
3
  generate a simple hello world sinatra app
6
4
 
7
5
  ## Installation
@@ -10,8 +8,32 @@ Install it yourself as:
10
8
 
11
9
  $ gem install sinatra_generator
12
10
 
13
- ## Usage
14
11
 
15
- sinatra new app_name
12
+ ## Usage:
13
+
14
+ sinatra new [APP_NAME]
15
+
16
+ ## Options:
17
+
18
+ -m, [--modular=MODULAR] # modular style. Inherits from Sinatra::Base
19
+ -v, [--views=VIEWS] # include views folder, index.erb and layout.erb
20
+ -a, [--assets=ASSETS] # include public, javascripts and stylesheets folder
21
+ -p, [--procfile=PROCFILE] # include Procfile
22
+
23
+ ## example
16
24
 
17
- eg: sinatra new blog
25
+ sinatra new blog -mvpa
26
+
27
+ .
28
+ ├── config.ru
29
+ ├── Gemfile
30
+ ├── main.rb
31
+ ├── Procfile
32
+ ├── public
33
+ │   ├── javascripts
34
+ │   │   └── application.js
35
+ │   └── stylesheets
36
+ │   └── main.css
37
+ └── views
38
+ ├── index.erb
39
+ └── layout.erb
@@ -57,7 +57,7 @@ module SinatraGenerator
57
57
  directory "#{Generator.source_root}/templates/public", "#{folder_name}/public"
58
58
 
59
59
  if options[:views]
60
- insert_into_file "#{folder_name}/views/layout.erb", '<link rel="stylesheet" href="/stylesheets/main.css">',
60
+ insert_into_file "#{folder_name}/views/layout.erb", "\n <link rel='stylesheet' href='/stylesheets/main.css'>",
61
61
  :after => '<title>Hello World</title>'
62
62
  end
63
63
  end
@@ -1,22 +1,21 @@
1
- <% if options[:modular] %>
2
-
1
+ <%- options[:views] ? @view = 'erb: index' : @view = 'hello world' -%>
2
+ <%- if options[:modular] -%>
3
3
  require 'sinatra/base'
4
4
 
5
5
  class HelloWorld < Sinatra::Base
6
6
  get '/' do
7
- 'hello world'
7
+ <%= @view %>
8
8
  end
9
9
  end
10
10
 
11
- <% else %>
12
-
11
+ <%- else -%>
13
12
  require 'sinatra'
14
13
 
15
14
  get '/' do
16
- 'hello world'
15
+ <%= @view %>
17
16
  end
18
17
 
19
- <% end %>
18
+ <%- end -%>
20
19
 
21
20
 
22
21
 
@@ -1,3 +1,3 @@
1
1
  module SinatraGenerator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["tsui.daniel@gmail.com"]
11
11
  spec.summary = %q{Generate a simple hello world sinatra app}
12
12
  spec.description = %q{Intended as a quick demo on how to make a ruby gem. Generate a simple hello world sinatra app}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/epoch/sinatra_generator"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
data/test/cli_test.rb CHANGED
@@ -38,6 +38,7 @@ class CLI < MiniTest::Unit::TestCase
38
38
  SinatraGenerator::CLI.start ['new','blog', '-v']
39
39
  Dir.chdir 'blog' do
40
40
  assert File.directory?('views'), 'views not found'
41
+ assert_includes File.read('main.rb'), "erb: index"
41
42
  Dir.chdir 'views' do
42
43
  assert_equal File.read('index.erb'), File.read("#{@templates_path}/index.erb")
43
44
  end
@@ -52,8 +53,7 @@ class CLI < MiniTest::Unit::TestCase
52
53
  assert File.directory?('views'), 'views not found'
53
54
 
54
55
  Dir.chdir 'views' do
55
- assert_match /<link rel="stylesheet" href="\/stylesheets\/main.css">/, File.read('layout.erb')
56
- # assert_includes File.read('layout.erb'), '<link rel="stylesheet" href="/stylesheets/main.css">'
56
+ assert_match /\n\s\s<link rel='stylesheet' href='\/stylesheets\/main.css'>/, File.read('layout.erb')
57
57
  end
58
58
  end
59
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Tsui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,7 +110,7 @@ files:
110
110
  - sinatra_generator.gemspec
111
111
  - test/cli_test.rb
112
112
  - test/test_helper.rb
113
- homepage: ''
113
+ homepage: https://github.com/epoch/sinatra_generator
114
114
  licenses:
115
115
  - MIT
116
116
  metadata: {}