hazel 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +6 -1
- data/lib/hazel/cli.rb +2 -2
- data/lib/hazel/version.rb +1 -1
- data/lib/templates/Gemfile +6 -5
- data/lib/templates/Rakefile +10 -11
- data/lib/templates/config/initializers/redis.rb +4 -2
- data/lib/templates/spec/spec_helper.rb +11 -0
- metadata +6 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -13,6 +13,7 @@ A simple Sinatra app generator, heavily based on [snfn](https://github.com/zachp
|
|
13
13
|
* `-d` Database. Options are "postgres," "mysql," "sqlite", and "mongo."
|
14
14
|
Default is "sqlite."
|
15
15
|
* `--redis` Include Redis configuration options.
|
16
|
+
* `--rvm-gemset` Create a new RVM Gemset under the current Ruby
|
16
17
|
* `--no-database` Don't include any database config options.
|
17
18
|
* `--no-bundle-install` Don’t run bundle install after generating the app
|
18
19
|
* `--no-git-repo` Don’t initialize a Git repository
|
@@ -31,6 +32,10 @@ App using MongoDB and Redis, but don’t run bundle install.
|
|
31
32
|
|
32
33
|
hazel my_app -d mongo --redis --no-bundle-install
|
33
34
|
|
35
|
+
App using Redis, a RVM Gemset, but no database or Git repo
|
36
|
+
|
37
|
+
hazel my_app --redis --rvm-gemset --no-database --no-git-repo
|
38
|
+
|
34
39
|
## Architecture
|
35
40
|
|
36
41
|
The template autoloads files in config/initializers and
|
@@ -41,7 +46,7 @@ and are loaded via `config/initializers/database.rb`.
|
|
41
46
|
|
42
47
|
[Sequel](http://sequel.rubyforge.org) is used as an ORM for
|
43
48
|
relational databases, and migrations are stored in db/migrate.
|
44
|
-
Migrations can be run using the rake command `rake
|
49
|
+
Migrations can be run using the rake command `rake db:migrate`.
|
45
50
|
|
46
51
|
[mongodb_model](https://github.com/alexeypetrushin/mongodb_model)
|
47
52
|
is used for Mongo apps, with the config options
|
data/lib/hazel/cli.rb
CHANGED
@@ -75,7 +75,7 @@ module Hazel
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def create_rakefile
|
78
|
-
|
78
|
+
template "Rakefile", File.join(@app_path, "Rakefile")
|
79
79
|
end
|
80
80
|
|
81
81
|
def create_readme
|
@@ -114,7 +114,7 @@ module Hazel
|
|
114
114
|
|
115
115
|
unless @no_bundle_install
|
116
116
|
rvm_env.chdir(@app_path) do
|
117
|
-
|
117
|
+
say_status :installing, "All dependencies into #{rvm_ruby}"
|
118
118
|
rvm_env.system "gem install bundler"
|
119
119
|
rvm_env.system "bundle install"
|
120
120
|
end
|
data/lib/hazel/version.rb
CHANGED
data/lib/templates/Gemfile
CHANGED
@@ -15,7 +15,7 @@ gem "pg"
|
|
15
15
|
<% elsif @database == "mysql" -%>
|
16
16
|
gem "mysql2"
|
17
17
|
<% elsif @database == "mongo" -%>
|
18
|
-
gem "bson_ext", "~> 1.
|
18
|
+
gem "bson_ext", "~> 1.6"
|
19
19
|
gem "mongodb_model", "~> 2.1"
|
20
20
|
<% end -%>
|
21
21
|
<% end -%>
|
@@ -23,11 +23,12 @@ gem "mongodb_model", "~> 2.1"
|
|
23
23
|
<% if @redis -%>
|
24
24
|
# Redis
|
25
25
|
gem "hiredis", "~> 0.4"
|
26
|
-
gem "redis", "~>
|
26
|
+
gem "redis", "~> 3.0", :require => ["redis/connection/hiredis", "redis"]
|
27
|
+
gem "fakeredis", "~> 0.4"
|
27
28
|
<% end -%>
|
28
29
|
|
29
30
|
group :development do
|
30
|
-
gem "rake", "~> 0.9
|
31
|
-
gem "minitest", "~> 2
|
32
|
-
gem "rack-test", "~> 0.6
|
31
|
+
gem "rake", "~> 0.9"
|
32
|
+
gem "minitest", "~> 3.2"
|
33
|
+
gem "rack-test", "~> 0.6"
|
33
34
|
end
|
data/lib/templates/Rakefile
CHANGED
@@ -5,9 +5,17 @@ task :default => :spec
|
|
5
5
|
Rake::TestTask.new(:spec) do |t|
|
6
6
|
t.test_files = FileList['spec/*_spec.rb']
|
7
7
|
t.ruby_opts = ['-rubygems'] if defined? Gem
|
8
|
-
t.ruby_opts << '-I.'
|
9
8
|
end
|
10
9
|
|
10
|
+
task :kicker do
|
11
|
+
exec 'kicker -r ruby -e "clear && bundle exec rake" spec lib'
|
12
|
+
end
|
13
|
+
|
14
|
+
task :sass do
|
15
|
+
exec 'sass --watch --scss --style compressed sass/main.scss:public/stylesheets/main.css'
|
16
|
+
end
|
17
|
+
|
18
|
+
<% unless @no_database -%>
|
11
19
|
namespace :db do
|
12
20
|
desc "Run all migrations in db/migrate"
|
13
21
|
task :migrate => :connect do
|
@@ -19,13 +27,4 @@ namespace :db do
|
|
19
27
|
require "./config/initializers/database"
|
20
28
|
end
|
21
29
|
end
|
22
|
-
|
23
|
-
task :environment, [:env] do |cmd, args|
|
24
|
-
Bundler.require
|
25
|
-
ENV['RACK_ENV'] = args[:env] || "development"
|
26
|
-
%w{ ./config/initializers ./lib }.each do
|
27
|
-
Find.find(lib) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
|
30
|
+
<%end%>
|
@@ -1,3 +1,5 @@
|
|
1
1
|
# Redis Configuration
|
2
|
-
|
3
|
-
|
2
|
+
unless ENV['RACK_ENV'] == 'test'
|
3
|
+
redis_settings = YAML::load_file("config/redis.yml")
|
4
|
+
REDIS = Redis.new(redis_settings[ENV['RACK_ENV']])
|
5
|
+
end
|
@@ -5,10 +5,21 @@ require 'bundler'
|
|
5
5
|
Bundler.setup
|
6
6
|
Bundler.require
|
7
7
|
|
8
|
+
ENV["RACK_ENV"] = "test"
|
9
|
+
|
8
10
|
require 'minitest/pride'
|
9
11
|
require 'minitest/autorun'
|
10
12
|
require 'minitest/spec'
|
11
13
|
require 'rack/test'
|
14
|
+
<% if @redis %>
|
15
|
+
require 'fakeredis'
|
16
|
+
REDIS = Redis.new
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
require "find"
|
20
|
+
%w{./config/initializers ./lib}.each do |load_path|
|
21
|
+
Find.find(load_path) { |f| require f if f.match(/\.rb$/) }
|
22
|
+
end
|
12
23
|
|
13
24
|
class MiniTest::Spec
|
14
25
|
include Rack::Test::Methods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hazel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70344124506980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.14.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70344124506980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70344124505380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.1'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70344124505380
|
36
36
|
description: Hazel is a generator for Sinatra apps, heavily based on snfn
|
37
37
|
email: peter@c7.se
|
38
38
|
executables:
|