openhood-sinatra_app_gen 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.
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 1
3
+ :major: 0
4
+ :minor: 1
@@ -8,7 +8,7 @@ class SinatraAppGenerator < RubiGen::Base
8
8
  super
9
9
  usage if args.empty?
10
10
  @destination_root = File.expand_path(args.shift)
11
- @name = base_name
11
+ @name = (args.shift || base_name).camelize
12
12
  end
13
13
 
14
14
  def template(m, filename)
@@ -49,7 +49,7 @@ class SinatraAppGenerator < RubiGen::Base
49
49
  <<-EOS
50
50
  Creates a new Sinatra / Sequel / rspec / cucumber app.
51
51
 
52
- USAGE: #{spec.name} module_name
52
+ USAGE: #{spec.name} directory_name [module_name]
53
53
 
54
54
  EOS
55
55
  end
@@ -6,6 +6,7 @@ require "logger"
6
6
  require "haml"
7
7
  require "sequel"
8
8
  require "sequel/extensions/blank"
9
+ require "sequel/extensions/inflector"
9
10
  require "sinatra/base"
10
11
  require "sinatra/async"
11
12
  require "sinatra/respond_to"
@@ -13,7 +14,7 @@ require "rack-flash"
13
14
  require "string_cleaner"
14
15
  require "lib/rack_fix" # until rack escape UTF-8 as expected
15
16
 
16
- module <%= name.camelize %>
17
+ module <%= name %>
17
18
  class App < Sinatra::Base
18
19
 
19
20
  def self.base_path
@@ -47,13 +48,15 @@ module <%= name.camelize %>
47
48
  end
48
49
 
49
50
  # load helpers
50
- Dir.glob(File.join(base_path, "helpers", "*.rb")).each do |h|
51
- require h
52
- end
53
51
  helpers do
54
52
  alias_method :h, :escape_html
55
53
  def config
56
- <%= name.camelize %>::App.config
54
+ <%= name %>::App.config
55
+ end
56
+ Dir.glob(File.join(base_path, "helpers", "*.rb")).each do |h|
57
+ require h
58
+ module_name = "#{File.basename(h, ".rb").camelize}Helper"
59
+ include Blog.const_get(module_name) if Blog.const_defined?(module_name)
57
60
  end
58
61
  end
59
62
 
@@ -71,5 +74,5 @@ end
71
74
 
72
75
  # define default port if launched directly via "ruby app.rb"
73
76
  if $0 == __FILE__
74
- <%= name.camelize %>::App.run! :host => "localhost", :port => 4567
77
+ <%= name %>::App.run! :host => "localhost", :port => 4567
75
78
  end
@@ -19,14 +19,14 @@ Webrat.configure do |config|
19
19
  end
20
20
 
21
21
  # Set the Sinatra environment
22
- <%= name.camelize %>::App.configure do |c|
22
+ <%= name %>::App.configure do |c|
23
23
  c.set :environment, :test
24
24
  c.disable :run
25
25
  c.enable :raise_errors
26
26
  c.disable :logging
27
27
  end
28
28
 
29
- class <%= name.camelize %>World
29
+ class <%= name %>World
30
30
  include Rack::Test::Methods
31
31
  include Webrat::Methods
32
32
  include Webrat::Matchers
@@ -34,12 +34,12 @@ class <%= name.camelize %>World
34
34
  Webrat::Methods.delegate_to_session :response
35
35
 
36
36
  def app
37
- <%= name.camelize %>::App
37
+ <%= name %>::App
38
38
  end
39
39
  end
40
40
 
41
41
  # Cucumber world setup
42
- World { <%= name.camelize %>World.new }
42
+ World { <%= name %>World.new }
43
43
 
44
44
  Before do
45
45
  Sequel::Model.db.tables.each do |table_name|
@@ -11,6 +11,7 @@ gems:
11
11
  - name: kamk-pg
12
12
  - name: sequel
13
13
  - name: cucumber
14
+ verison: ">= 0.3.98"
14
15
  - name: rack-test
15
16
  version: ">= 0.4.1"
16
17
  - name: webrat
@@ -9,7 +9,7 @@ require "sequel/extensions/migration"
9
9
  require "rspec_sequel_matchers"
10
10
 
11
11
  # Set the Sinatra environment
12
- <%= name.camelize %>::App.configure do |c|
12
+ <%= name %>::App.configure do |c|
13
13
  c.set :environment, :test
14
14
  c.disable :run
15
15
  c.enable :raise_errors
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_app_gen}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jonathan Tron", "Joseph Halter"]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.files = [
18
18
  ".gitignore",
19
19
  "Rakefile",
20
- "VERSION",
20
+ "VERSION.yml",
21
21
  "bin/sinatra_app",
22
22
  "lib/generators/sinatra_app/sinatra_app_generator.rb",
23
23
  "lib/generators/sinatra_app/templates/Rakefile.erb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhood-sinatra_app_gen
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
  - Jonathan Tron
@@ -54,7 +54,7 @@ extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
56
  - Rakefile
57
- - VERSION
57
+ - VERSION.yml
58
58
  - bin/sinatra_app
59
59
  - lib/generators/sinatra_app/sinatra_app_generator.rb
60
60
  - lib/generators/sinatra_app/templates/Rakefile.erb
@@ -69,6 +69,7 @@ files:
69
69
  - sinatra_app_gen.gemspec
70
70
  has_rdoc: true
71
71
  homepage: http://github.com/openhood/sinatra_app_gen
72
+ licenses:
72
73
  post_install_message:
73
74
  rdoc_options:
74
75
  - --charset=UTF-8
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements: []
90
91
 
91
92
  rubyforge_project:
92
- rubygems_version: 1.2.0
93
+ rubygems_version: 1.3.5
93
94
  signing_key:
94
95
  specification_version: 3
95
96
  summary: Creates a new Sinatra / Sequel / rspec / cucumber app.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.0