simba 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.
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .Ds_Store
7
+ .sass-cache/
8
+ *.db
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in simba.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Saito
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Simba
2
+
3
+ simba is a generator for sinatra applications.
4
+
5
+ simba choose slim + sinatra + sequel to build your awesome app.
6
+
7
+ simba aim to set up ruby off rails's best practice.
8
+
9
+ ## Installation
10
+
11
+ $ gem install simba
12
+
13
+ ## Usage
14
+
15
+ $ simba appname
16
+
17
+ ## Contributing
18
+
19
+ 1. Fork it
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
21
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
22
+ 4. Push to the branch (`git push origin my-new-feature`)
23
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/simba ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + "/../lib/simba"
4
+ arguments = ARGV.any? ? ARGV : ['-h']
5
+ Simba::SkeletonGenerator.start(arguments)
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ .sass-cache
3
+ *.db
4
+ public/*.*
5
+ coverage/
@@ -0,0 +1,24 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "slim"
4
+ gem "sass"
5
+ gem "sqlite3"
6
+ gem "sequel"
7
+ gem "sinatra"
8
+ gem "coffee-script"
9
+ gem "sinatra-contrib", :require => "sinatra/contrib/all"
10
+ gem "sinatra-assetpack", :require => "sinatra/assetpack"
11
+
12
+ group :development do
13
+ gem "pry"
14
+ end
15
+
16
+ group :production do
17
+ gem "thin"
18
+ end
19
+
20
+ group :test do
21
+ gem "rack-test"
22
+ gem "factory_girl"
23
+ gem "database_cleaner"
24
+ end
@@ -0,0 +1,6 @@
1
+ #load rake tasks
2
+ Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext }
3
+ #load assetpacket tasks
4
+ APP_FILE = './config/boot.rb'
5
+ APP_CLASS = 'Sinatra::Application'
6
+ require 'sinatra/assetpack/rake'
File without changes
@@ -0,0 +1,3 @@
1
+ get '/' do
2
+ slim :index
3
+ end
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ class User < Sequel::Model
2
+ end
@@ -0,0 +1 @@
1
+ h1 Hello
@@ -0,0 +1,9 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title Simba
5
+ meta name="keywords" content="simba"
6
+ == js :application
7
+ == css :application
8
+ body
9
+ == yield
@@ -0,0 +1,32 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+ #require "bundle gems"
4
+ ENV["RACK_ENV"] ||= "development"
5
+ Bundler.require(:default, ENV["RACK_ENV"].to_sym)
6
+ # init database
7
+ DB = Sequel.sqlite("./db/#{ENV["RACK_ENV"]}.db")
8
+ # init sinatra
9
+ set :sessions, true
10
+ set :root, File.expand_path(".")
11
+ set :views, settings.root + "/app/views"
12
+ # assetpack support
13
+ assets do
14
+ css_compression :sass
15
+ js_compression :uglify
16
+
17
+ serve "/js", :from => "app/assets/js"
18
+ serve "/css", :from => "app/assets/css"
19
+ serve "/img", :from => "app/assets/img"
20
+
21
+ js :application, [
22
+ "/js/*.js"
23
+ ]
24
+
25
+ css :application, [
26
+ "/css/*.css"
27
+ ]
28
+ end
29
+ # require sinatra files
30
+ Dir.glob "./{lib,app/models,app/helpers,app/controllers}/**/*.rb" do |f|
31
+ require f
32
+ end
@@ -0,0 +1,2 @@
1
+ require "./config/boot.rb"
2
+ run Sinatra::Application
@@ -0,0 +1,8 @@
1
+ Sequel.migration do
2
+ change do
3
+ create_table(:users) do
4
+ primary_key :id
5
+ String :name, :null=>false
6
+ end
7
+ end
8
+ end
File without changes
@@ -0,0 +1,32 @@
1
+ namespace :db do
2
+ require "sequel"
3
+ Sequel.extension :migration
4
+ DB = Sequel.sqlite('db/test.db')
5
+
6
+ desc "Perform migration reset (full erase and migration up)"
7
+ task :setup do
8
+ Sequel::Migrator.run(DB, "db/migrations", :target => 0)
9
+ Sequel::Migrator.run(DB, "db/migrations")
10
+ puts "<= sq:migrate:reset executed"
11
+ end
12
+
13
+ desc "Perform migration up/down to VERSION"
14
+ task :version do
15
+ version = ENV['VERSION'].to_i
16
+ raise "No VERSION was provided" if version.nil?
17
+ Sequel::Migrator.run(DB, "db/migrations", :target => version)
18
+ puts "<= sq:migrate:to version=[#{version}] executed"
19
+ end
20
+
21
+ desc "Perform migration up to latest migration available"
22
+ task :migrate do
23
+ Sequel::Migrator.run(DB, "db/migrations")
24
+ puts "<= sq:migrate:up executed"
25
+ end
26
+
27
+ desc "Perform migration down (erase all data)"
28
+ task :rollback do
29
+ Sequel::Migrator.run(DB, "db/migrations", :target => 0)
30
+ puts "<= sq:migrate:down executed"
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ namespace :metric do
2
+
3
+ desc "project statistics"
4
+ task 'stat' do
5
+ puts "All:"
6
+ stat_files Dir.glob('**/*.{rb,slim,coffee,scss}')
7
+ puts "\nRuby:"
8
+ stat_files Dir.glob('**/*.rb') - Dir.glob('test/**/*.rb')
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def stat_files fs
15
+ c = 0
16
+ fc = 0
17
+ total_size = 0.0
18
+ fs.each do |f|
19
+ fc += 1
20
+ data = File.binread f
21
+ c += data.count "\n"
22
+ total_size += data.bytesize
23
+ end
24
+ puts "files: #{fc}"
25
+ puts "lines: #{c}"
26
+ puts "chars: #{total_size.to_i}"
27
+ end
@@ -0,0 +1,8 @@
1
+ %w[unit functional integration performance].each do |type|
2
+ desc "run #{type} tests"
3
+ task "test:#{type}" do
4
+ Dir.glob "./test/#{type}/*_test.rb" do |f|
5
+ require f
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ Factory.define :user do |u|
2
+ u.name "simba"
3
+ end
@@ -0,0 +1,27 @@
1
+ ENV['RACK_ENV'] ||= "test"
2
+ require_relative "../config/boot.rb"
3
+ # factory_girl
4
+ dir = File.expand_path File.dirname(__FILE__)
5
+ Dir.glob "#{dir}/factory/**/*_factory.rb" do |f|
6
+ require f
7
+ end
8
+ # minitest
9
+ require "minitest/autorun"
10
+ # rack test
11
+ require "rack/test"
12
+ # database_clean
13
+ DatabaseCleaner.strategy = :truncation
14
+
15
+ class TestCase < MiniTest::Unit::TestCase
16
+ def initialize *xs
17
+ super
18
+ DatabaseCleaner.clean
19
+ end
20
+ end
21
+
22
+ class FunctionalTestCase < TestCase
23
+ include Rack::Test::Methods
24
+ def app
25
+ Sinatra::Application
26
+ end
27
+ end
@@ -0,0 +1,11 @@
1
+ require_relative "../test_helper"
2
+
3
+ class UserTest < TestCase
4
+ def setup
5
+ Factory(:user)
6
+ end
7
+
8
+ def test_user_name
9
+ #dummy
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Simba
2
+ VERSION = "0.0.1"
3
+ end
data/lib/simba.rb ADDED
@@ -0,0 +1,33 @@
1
+ require "thor"
2
+ require "thor/group"
3
+ require_relative "simba/version"
4
+
5
+ module Simba
6
+ class SkeletonGenerator < Thor::Group
7
+ include Thor::Actions
8
+
9
+ def self.source_root
10
+ File.dirname(__FILE__)
11
+ end
12
+
13
+ def self.banner
14
+ "simba [app_name]"
15
+ end
16
+
17
+ desc "Description:\n\n\tsimba is a generator for Sinatra applications."
18
+
19
+ argument :name, :desc => "The name of your sinatra app"
20
+
21
+ def setup_skeleton
22
+ self.destination_root = name
23
+ directory("simba/base_app/", self.destination_root)
24
+ end
25
+
26
+ def bundle_dependencies
27
+ say "Bundling application dependencies using bundler."
28
+ in_root do
29
+ run 'bundle install'
30
+ end
31
+ end
32
+ end
33
+ end
data/simba.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/simba/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Saito"]
6
+ gem.email = ["saitowu@gmail.com"]
7
+ gem.description = %q{simba is a generator for sinatra applications.}
8
+ gem.summary = %q{simba aim to set up ruby off rails best practice.}
9
+ gem.homepage = "https://github.com/SaitoWu/simba"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "simba"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Simba::VERSION
17
+
18
+ gem.add_dependency("thor", "~> 0.14.6")
19
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simba
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Saito
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &70169268115760 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.14.6
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70169268115760
25
+ description: simba is a generator for sinatra applications.
26
+ email:
27
+ - saitowu@gmail.com
28
+ executables:
29
+ - simba
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - bin/simba
39
+ - lib/simba.rb
40
+ - lib/simba/base_app/.gitignore
41
+ - lib/simba/base_app/Gemfile
42
+ - lib/simba/base_app/Rakefile
43
+ - lib/simba/base_app/app/assets/css/application.scss
44
+ - lib/simba/base_app/app/assets/img/.gitkeep
45
+ - lib/simba/base_app/app/assets/js/application.coffee
46
+ - lib/simba/base_app/app/controllers/app.rb
47
+ - lib/simba/base_app/app/helpers/.gitkeep
48
+ - lib/simba/base_app/app/mailers/.gitkeep
49
+ - lib/simba/base_app/app/models/user.rb
50
+ - lib/simba/base_app/app/views/index.slim
51
+ - lib/simba/base_app/app/views/layout.slim
52
+ - lib/simba/base_app/config.ru
53
+ - lib/simba/base_app/config/boot.rb
54
+ - lib/simba/base_app/db/migrations/1_create_users.rb
55
+ - lib/simba/base_app/lib/.gitkeep
56
+ - lib/simba/base_app/lib/tasks/db.rake
57
+ - lib/simba/base_app/lib/tasks/stat.rake
58
+ - lib/simba/base_app/lib/tasks/test.rake
59
+ - lib/simba/base_app/test/factory/user_factory.rb
60
+ - lib/simba/base_app/test/functional/user_controller_test.rb
61
+ - lib/simba/base_app/test/test_helper.rb
62
+ - lib/simba/base_app/test/unit/user_test.rb
63
+ - lib/simba/version.rb
64
+ - simba.gemspec
65
+ homepage: https://github.com/SaitoWu/simba
66
+ licenses: []
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.16
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: simba aim to set up ruby off rails best practice.
89
+ test_files: []