simba 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simba/base_app/Gemfile +6 -0
- data/lib/simba/base_app/Rakefile +3 -2
- data/lib/simba/base_app/app/helpers/application_helper.rb +1 -1
- data/lib/simba/base_app/config/boot.rb +10 -3
- data/lib/simba/base_app/config/database.yml +2 -0
- data/lib/simba/base_app/lib/tasks/db.rake +9 -8
- data/lib/simba/base_app/lib/tasks/test.rake +7 -0
- data/lib/simba/base_app/test/factory/user_factory.rb +5 -2
- data/lib/simba/base_app/test/functional/user_controller_test.rb +4 -0
- data/lib/simba/base_app/test/test_helper.rb +4 -4
- data/lib/simba/base_app/test/unit/user_test.rb +4 -4
- data/lib/simba/version.rb +1 -1
- metadata +6 -4
data/lib/simba/base_app/Gemfile
CHANGED
@@ -7,6 +7,7 @@ gem "sequel"
|
|
7
7
|
gem "sinatra"
|
8
8
|
gem "coffee-script"
|
9
9
|
gem "sinatra-contrib"
|
10
|
+
gem "sinatra-flash"
|
10
11
|
gem "sinatra-assetpack", :require => "sinatra/assetpack"
|
11
12
|
|
12
13
|
group :development, :test do
|
@@ -22,3 +23,8 @@ group :test do
|
|
22
23
|
gem "factory_girl"
|
23
24
|
gem "database_cleaner"
|
24
25
|
end
|
26
|
+
|
27
|
+
group :deploy do
|
28
|
+
gem "uglifier"
|
29
|
+
gem "capistrano"
|
30
|
+
end
|
data/lib/simba/base_app/Rakefile
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "bundler"
|
3
|
-
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
# require "bundle gems"
|
4
6
|
ENV["RACK_ENV"] ||= "development"
|
5
7
|
Bundler.require(:default, ENV["RACK_ENV"].to_sym)
|
8
|
+
|
6
9
|
# init database
|
7
|
-
DB = Sequel.
|
10
|
+
DB = Sequel.connect(YAML.load_file("./config/database.yml")["default"]["url"])
|
11
|
+
|
8
12
|
# init sinatra
|
9
13
|
set :sessions, true
|
10
14
|
set :root, File.expand_path(".")
|
11
15
|
set :views, settings.root + "/app/views"
|
16
|
+
|
12
17
|
# sinatra reloader
|
13
18
|
if development?
|
14
19
|
require "sinatra/reloader"
|
15
20
|
also_reload "lib/**/*.rb", "app/{models,helpers}/**/*.rb"
|
16
21
|
end
|
22
|
+
|
17
23
|
# assetpack support
|
18
24
|
assets do
|
19
25
|
serve "/js", :from => "app/assets/js"
|
@@ -26,7 +32,8 @@ assets do
|
|
26
32
|
js :application, ["/js/*.js"]
|
27
33
|
css :application, ["/css/*.css"]
|
28
34
|
end
|
29
|
-
|
35
|
+
|
36
|
+
# require project files
|
30
37
|
Dir.glob "./{lib,app/models,app/helpers,app/controllers}/**/*.rb" do |f|
|
31
38
|
require f
|
32
39
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
1
3
|
namespace :db do
|
2
|
-
|
3
|
-
|
4
|
-
DB = Sequel.sqlite('db/test.db')
|
4
|
+
|
5
|
+
database_url = YAML.load_file("./config/database.yml")["default"]["url"]
|
5
6
|
|
6
7
|
desc "Perform migration reset (full erase and migration up)"
|
7
8
|
task :setup do
|
8
|
-
|
9
|
-
|
9
|
+
puts `sequel -Etm ./db/migrations -M 0 #{database_url}`
|
10
|
+
puts `sequel -Etm ./db/migrations #{database_url}`
|
10
11
|
puts "<= sq:migrate:reset executed"
|
11
12
|
end
|
12
13
|
|
@@ -14,19 +15,19 @@ namespace :db do
|
|
14
15
|
task :version do
|
15
16
|
version = ENV['VERSION'].to_i
|
16
17
|
raise "No VERSION was provided" if version.nil?
|
17
|
-
|
18
|
+
puts `sequel -Etm db/migrations -M #{version} #{database_url}`
|
18
19
|
puts "<= sq:migrate:to version=[#{version}] executed"
|
19
20
|
end
|
20
21
|
|
21
22
|
desc "Perform migration up to latest migration available"
|
22
23
|
task :migrate do
|
23
|
-
|
24
|
+
puts `sequel -Etm ./db/migrations #{database_url}`
|
24
25
|
puts "<= sq:migrate:up executed"
|
25
26
|
end
|
26
27
|
|
27
28
|
desc "Perform migration down (erase all data)"
|
28
29
|
task :rollback do
|
29
|
-
|
30
|
+
puts `sequel -Etm ./db/migrations -M 0 #{database_url}`
|
30
31
|
puts "<= sq:migrate:down executed"
|
31
32
|
end
|
32
33
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
ENV['RACK_ENV'] ||= "test"
|
2
2
|
require_relative "../config/boot.rb"
|
3
|
+
|
3
4
|
# factory_girl
|
4
5
|
dir = File.expand_path File.dirname(__FILE__)
|
5
6
|
Dir.glob "#{dir}/factory/**/*_factory.rb" do |f|
|
6
7
|
require f
|
7
8
|
end
|
8
|
-
|
9
|
+
|
9
10
|
require "minitest/autorun"
|
10
|
-
# rack test
|
11
11
|
require "rack/test"
|
12
|
-
# database_clean
|
13
12
|
DatabaseCleaner.strategy = :truncation
|
14
13
|
|
15
14
|
class TestCase < MiniTest::Unit::TestCase
|
15
|
+
include FactoryGirl::Syntax::Methods
|
16
16
|
def initialize *xs
|
17
17
|
super
|
18
18
|
DatabaseCleaner.clean
|
@@ -24,4 +24,4 @@ class FunctionalTestCase < TestCase
|
|
24
24
|
def app
|
25
25
|
Sinatra::Application
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/lib/simba/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70255967802680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.14.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70255967802680
|
25
25
|
description: simba is a generator for sinatra applications.
|
26
26
|
email:
|
27
27
|
- saitowu@gmail.com
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/simba/base_app/app/views/layout.slim.tt
|
51
51
|
- lib/simba/base_app/config.ru
|
52
52
|
- lib/simba/base_app/config/boot.rb
|
53
|
+
- lib/simba/base_app/config/database.yml
|
53
54
|
- lib/simba/base_app/db/migrations/1_create_users.rb
|
54
55
|
- lib/simba/base_app/lib/tasks/db.rake
|
55
56
|
- lib/simba/base_app/lib/tasks/stat.rake
|
@@ -85,3 +86,4 @@ signing_key:
|
|
85
86
|
specification_version: 3
|
86
87
|
summary: simba aim to set up ruby off rails best practice.
|
87
88
|
test_files: []
|
89
|
+
has_rdoc:
|