daiku 0.0.12

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +114 -0
  6. data/Rakefile +16 -0
  7. data/bin/daiku +9 -0
  8. data/daiku.gemspec +27 -0
  9. data/lib/daiku.rb +4 -0
  10. data/lib/daiku/_app/.env.tt +18 -0
  11. data/lib/daiku/_app/.gitignore +17 -0
  12. data/lib/daiku/_app/.ruby-version.tt +1 -0
  13. data/lib/daiku/_app/.slugignore +5 -0
  14. data/lib/daiku/_app/.travis.yml.tt +19 -0
  15. data/lib/daiku/_app/Gemfile.tt +69 -0
  16. data/lib/daiku/_app/Procfile.tt +5 -0
  17. data/lib/daiku/_app/Rakefile.tt +27 -0
  18. data/lib/daiku/_app/app.rb.tt +15 -0
  19. data/lib/daiku/_app/assets/images/.gitkeep +0 -0
  20. data/lib/daiku/_app/assets/javascripts/app.coffee +2 -0
  21. data/lib/daiku/_app/assets/pages/.gitkeep +0 -0
  22. data/lib/daiku/_app/assets/stylesheets/.gitkeep +0 -0
  23. data/lib/daiku/_app/assets/stylesheets/app.scss +0 -0
  24. data/lib/daiku/_app/bin/console +15 -0
  25. data/lib/daiku/_app/config.ru.tt +35 -0
  26. data/lib/daiku/_app/config/honeybadger.rb +8 -0
  27. data/lib/daiku/_app/config/puma.rb +4 -0
  28. data/lib/daiku/_app/lib/boot.rb.tt +40 -0
  29. data/lib/daiku/_app/lib/core_ext/frame_options.rb +14 -0
  30. data/lib/daiku/_app/lib/errors/.gitkeep +0 -0
  31. data/lib/daiku/_app/lib/errors/app.rb +6 -0
  32. data/lib/daiku/_app/lib/models/.gitkeep +0 -0
  33. data/lib/daiku/_app/lib/services/.gitkeep +0 -0
  34. data/lib/daiku/_app/lib/tasks/.gitkeep +0 -0
  35. data/lib/daiku/_app/lib/values/.gitkeep +0 -0
  36. data/lib/daiku/_app/public/assets/.gitkeep +0 -0
  37. data/lib/daiku/_app/public/fonts/.gitkeep +0 -0
  38. data/lib/daiku/_app/spec/app_spec.rb +20 -0
  39. data/lib/daiku/_app/spec/models/.gitkeep +0 -0
  40. data/lib/daiku/_app/spec/services/.gitkeep +0 -0
  41. data/lib/daiku/_app/spec/spec_helper.rb +12 -0
  42. data/lib/daiku/_app/views/index.slim.tt +1 -0
  43. data/lib/daiku/_app/views/layout.slim +23 -0
  44. data/lib/daiku/_grunt/.bowerrc +4 -0
  45. data/lib/daiku/_grunt/.grunt/aliases.yaml +14 -0
  46. data/lib/daiku/_grunt/.grunt/coffee.coffee +16 -0
  47. data/lib/daiku/_grunt/.grunt/imagemin.coffee +18 -0
  48. data/lib/daiku/_grunt/.grunt/robotstxt.coffee +39 -0
  49. data/lib/daiku/_grunt/.grunt/sass.coffee +11 -0
  50. data/lib/daiku/_grunt/.grunt/slim.coffee +15 -0
  51. data/lib/daiku/_grunt/.grunt/uglify.coffee +23 -0
  52. data/lib/daiku/_grunt/Gruntfile.coffee +6 -0
  53. data/lib/daiku/_grunt/bower.json.tt +8 -0
  54. data/lib/daiku/_grunt/package.json.tt +18 -0
  55. data/lib/daiku/_templates/bower.json.tt +9 -0
  56. data/lib/daiku/_templates/datamapper.rb.tt +8 -0
  57. data/lib/daiku/_templates/db_helper.rb +14 -0
  58. data/lib/daiku/_templates/pony.rb.tt +35 -0
  59. data/lib/daiku/_templates/sidekiq.rb.tt +7 -0
  60. data/lib/daiku/_templates/vcr_helper.rb +8 -0
  61. data/lib/daiku/cli.rb +84 -0
  62. data/lib/daiku/version.rb +3 -0
  63. metadata +148 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e26ebe168ec7594ccbb883882da0efb623e9930
4
+ data.tar.gz: 6164405c5eff7d1592e8575ced8988c10823d791
5
+ SHA512:
6
+ metadata.gz: bdb012bb7fcc62738027e84b8ee2c94990649deb47e9bb1f31037892b03fe19f8b5ebd11f68bb45025e0685ff80ebfa578ece5e5918feeb669e5a5ef7909655a
7
+ data.tar.gz: 16ffbdc2492ac696d5cc48df8f5ede19dee95e907a099e4eca9e6e07feb25373d7d4119ae7aa104db9b817315cf551a600da1dd016e3d25d89b09a85e8a40929
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ .DS_Store
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Eric Marden
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,114 @@
1
+ # Daiku
2
+ ## Craft lightweight ruby applications
3
+
4
+ ![Japanese Carpentry](http://upload.wikimedia.org/wikipedia/commons/0/0d/Wagoya_-_Japanese_Roof_Structure.jpg)
5
+
6
+
7
+ ### Installation
8
+
9
+ $ gem install daiku
10
+
11
+ ### Updating daiku
12
+
13
+ $ gem update daiku
14
+
15
+
16
+ ### Usage
17
+
18
+ To generate a basic app, run the `new` command, passing it the port your local server should listen to incoming requests on. The generated app is whole and complete, and ready to run.
19
+
20
+ $ daiku new myapp --port 5000
21
+ $ cd myapp
22
+ $ bundle install
23
+ $ bundle exec foreman start
24
+ $ open http://localhost:5000
25
+
26
+ ### Options
27
+
28
+ You can further customize the app that's generated by passing additional options. The built-in help system explains the available options.
29
+
30
+ $ daiku help new
31
+ Usage:
32
+ daiku new APP -p, --port=N
33
+
34
+ Options:
35
+ -p, --port=N # Port this app should run on locally.
36
+ [--ruby-version=RUBY_VERSION] # Specify the version of ruby this project should use.
37
+ # Default: 2.1.2
38
+ -m, [--models=MODELS] # Choose the data modeling tool this project uses.
39
+ # Default: datamapper
40
+ # Possible values: datamapper, none
41
+ -a, [--assets=ASSETS] # Choose the assets workflow this project uses.
42
+ # Default: grunt
43
+ # Possible values: grunt, none
44
+ [--honeybadger-private-key=HONEYBADGER-PRIVATE-KEY] # Honeybadger Private API Key
45
+ [--honeybadger-public-key=HONEYBADGER-PUBLIC-KEY] # Honeybadger Private API Key
46
+ [--no-newrelic] # Don't use New Relic.
47
+ [--with-vcr] # Include `vcr` in this project's TDD stack.
48
+ [--with-sidekiq] # Set this project up to use `sidekiq` for background processing.
49
+
50
+ Generate a new application with daiku
51
+
52
+
53
+ ### Example
54
+
55
+ Consider the following example:
56
+
57
+ $ daiku new myapp -p 5000 -m datamapper -a grunt --with-vcr --with-sidekiq
58
+
59
+ This will generate the following app:
60
+
61
+ ````
62
+ myapp
63
+ ├── Gemfile
64
+ ├── Gruntfile.coffee
65
+ ├── Procfile
66
+ ├── Rakefile
67
+ ├── app.rb
68
+ ├── assets
69
+ │   ├── images
70
+ │   ├── javascripts
71
+ │   │   ├── app.coffee
72
+ │   │   ├── config.coffee
73
+ │   │   └── main.coffee
74
+ │   └── stylesheets
75
+ │   └── app.scss
76
+ ├── bin
77
+ │   └── console
78
+ ├── bower.json
79
+ ├── config
80
+ │   ├── datamapper.rb
81
+ │   ├── honeybadger.rb
82
+ │   ├── puma.rb
83
+ │   └── sidekiq.rb
84
+ ├── config.ru
85
+ ├── lib
86
+ │   ├── boot.rb
87
+ │   ├── core_ext
88
+ │   │   └── frame_options.rb
89
+ │   ├── errors
90
+ │   │   └── app.rb
91
+ │   ├── jobs
92
+ │   ├── models
93
+ │   ├── services
94
+ │   ├── tasks
95
+ │   └── values
96
+ ├── package.json
97
+ ├── public
98
+ │   ├── assets
99
+ │   │   ├── development
100
+ │   │   ├── production
101
+ │   │   └── staging
102
+ │   └── fonts
103
+ ├── spec
104
+ │   ├── _cassettes
105
+ │   ├── app_spec.rb
106
+ │   ├── db_helper.rb
107
+ │   ├── models
108
+ │   ├── services
109
+ │   ├── spec_helper.rb
110
+ │   └── vcr_helper.rb
111
+ └── views
112
+ ├── index.slim
113
+ └── layout.slim
114
+ ````
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env rake
2
+
3
+ ENV['RACK_ENV'] ||= 'development'
4
+
5
+ lib_path = File.expand_path('../lib', __FILE__)
6
+ ($:.unshift lib_path) unless ($:.include? lib_path)
7
+
8
+ require 'rake'
9
+ require "bundler/gem_tasks"
10
+ require 'rake/testtask'
11
+
12
+ Rake::TestTask.new do |t|
13
+ t.libs << "spec"
14
+ t.pattern = "spec/**/*_spec.rb"
15
+ end
16
+ task :default => [:test]
data/bin/daiku ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # vim: set syntax=ruby
4
+
5
+ lib = File.expand_path('../../lib', __FILE__)
6
+ ($:.unshift lib) unless ($:.include? lib)
7
+
8
+ require 'daiku'
9
+ Daiku::CLI.start
data/daiku.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'daiku/version'
7
+
8
+ Gem::Specification.new do |gem|
9
+ gem.name = "daiku"
10
+ gem.version = Daiku::VERSION
11
+ gem.authors = ['Eric Marden']
12
+ gem.email = ['eric@xentek.net']
13
+ gem.summary = %q{Craft lightweight ruby applications}
14
+ gem.description = %q{Daiku, japanese for carpenter, helps you craft lightweight ruby applications}
15
+ gem.homepage = "https://github.com/xentek/daiku"
16
+ gem.license = "MIT"
17
+
18
+ gem.files = `git ls-files -z`.split("\x0")
19
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
+ gem.require_paths = ['lib']
22
+
23
+ gem.add_dependency 'thor', '~> 0.18.0'
24
+
25
+ gem.add_development_dependency 'bundler', '~> 1.5'
26
+ gem.add_development_dependency 'rake'
27
+ end
data/lib/daiku.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'daiku/cli'
2
+ require 'daiku/version'
3
+
4
+ module Daiku ; end
@@ -0,0 +1,18 @@
1
+ APP_NAME=<%= @app %>
2
+ APP_TITLE=<%= @app %>
3
+ ASSETS_BUILDER=<%= @assets %>
4
+ <% if @with_sidekiq -%>
5
+ AUTH_USERNAME=<%= @app %>
6
+ AUTH_PASSWORD=<%= @app %>
7
+ <% end -%>
8
+ <% if @datamapper -%>
9
+ DATABASE_URL=postgres://localhost/<%= @app %>
10
+ DB_NAME=<%= @app %>
11
+ <% end -%>
12
+ HONEYBADGER_PRIVATE_KEY=<%= @honeybadger_private_key %>
13
+ HONEYBADGER_PUBLIC_KEY=<%= @honeybadger_public_key %>
14
+ RACK_ENV=development
15
+ PORT=<%= @port %>
16
+ PUMA_MAX_THREADS=8
17
+ PUMA_MIN_THREADS=1
18
+ PUMA_WORKERS=0
@@ -0,0 +1,17 @@
1
+ *.rdb
2
+ *.swp
3
+ .#*
4
+ .bundle
5
+ .DS_Store
6
+ .env-*
7
+ .sass-cache
8
+ db/*.sqlite3
9
+ doc/*.csv
10
+ log/*
11
+ tags
12
+ TAGS
13
+ tmp/*
14
+ node_modules
15
+
16
+ # this should go last
17
+ !.gitkeep
@@ -0,0 +1 @@
1
+ <%= @ruby_version -%>
@@ -0,0 +1,5 @@
1
+ .env
2
+ .ssl
3
+ .certs
4
+ .ssl
5
+ ./assets
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - <%= @ruby_version %>
5
+ <% if @datamapper -%>
6
+ services:
7
+ - postgresql
8
+ addons:
9
+ postgresql: 9.3
10
+ before_script:
11
+ - psql -c 'create database "<%= @app -%>_test";' -U postgres
12
+ - 'bundle exec rake db:hstore'
13
+ - 'bundle exec rake db:migrate'
14
+ <% end -%>
15
+ notifications:
16
+ template:
17
+ - "%{repository}:%{branch} - %{message} [%{build_url}]"
18
+ on_success: change
19
+ on_failure: always
@@ -0,0 +1,69 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby <%= "'#{@ruby_version}'" %>
4
+
5
+ gem 'activesupport', '~> 4.0.0', require: false
6
+ gem 'dalli'
7
+ gem 'escape_utils'
8
+ gem 'honeybadger'
9
+ gem 'nokogiri'
10
+ gem 'oj'
11
+ gem 'pry', require: false
12
+ gem 'puma', require: false
13
+ <%= "gem 'sidekiq'\n" if @with_sidekiq -%>
14
+
15
+ <% if @datamapper -%>
16
+ group :datamapper do
17
+ gem 'dm-aspects'
18
+ gem 'dm-aggregates'
19
+ gem 'dm-core'
20
+ gem 'dm-migrations'
21
+ gem 'dm-pager'
22
+ gem 'dm-postgres-adapter'
23
+ gem 'dm-postgres-types'
24
+ gem 'dm-timestamps'
25
+ gem 'dm-transactions'
26
+ gem 'dm-validations'
27
+ end
28
+ <% end -%>
29
+
30
+ group :web do
31
+ gem 'sinatra', '~> 1.4.4', require: 'sinatra/base'
32
+ gem 'slim'
33
+ gem 'rack-cache', require: 'rack/cache'
34
+ end
35
+
36
+ group :production, :staging do
37
+ gem 'rack-ssl', require: 'rack/ssl', :group => :web
38
+ <%= " gem 'newrelic_rpm'\n" unless @no_newrelic -%>
39
+ end
40
+
41
+ group :rake do
42
+ gem 'rake'
43
+ end
44
+
45
+ group :test do
46
+ <%= " gem 'database_cleaner'\n" if @datamapper -%>
47
+ gem 'rack-test', require: 'rack/test'
48
+ gem 'minitest'
49
+ gem 'minitest-spec-context'
50
+ gem 'minitest-reporters', require: 'minitest/reporters'
51
+ gem 'mocha', require: 'mocha/setup'
52
+ <% if @with_vcr -%>
53
+ gem 'vcr', require: false
54
+ gem 'webmock', '< 1.12', require: false
55
+ <% end -%>
56
+ end
57
+
58
+ group :assets do
59
+ gem 'sass'
60
+ end
61
+
62
+ group :development do
63
+ gem 'debugger', require: false
64
+ end
65
+
66
+ group :development, :test do
67
+ gem 'foreman', require: false
68
+ gem 'dotenv'
69
+ end
@@ -0,0 +1,5 @@
1
+ web: bundle exec puma -t ${PUMA_MIN_THREADS:-0}:${PUMA_MAX_THREADS:-16} -w ${PUMA_WORKERS:-0} -p $PORT -e $RACK_ENV -C config/puma.rb
2
+ console: bundle exec ./bin/console
3
+ <% if @with_sidekiq -%>
4
+ sidekiq: bundle exec sidekiq -q default -r ./lib/boot.rb
5
+ <% end -%>
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+
3
+ # environment
4
+ ENV['RACK_ENV'] ||= 'development'
5
+
6
+ # load path
7
+ lib_path = File.expand_path('../lib', __FILE__)
8
+ ($:.unshift lib_path) unless ($:.include? lib_path)
9
+
10
+ # require farm
11
+ require 'bundler'
12
+ Bundler.require(:default, ENV['RACK_ENV'], :rake)
13
+ require 'dotenv/tasks'
14
+ require 'rake/testtask'
15
+
16
+ # tasks
17
+ Rake::TestTask.new do |t|
18
+ t.libs << "spec"
19
+ t.pattern = "spec/**/*_spec.rb"
20
+ end
21
+ task :default => [:environment, :test]
22
+
23
+ task :environment => :dotenv do
24
+ require 'boot'
25
+ end
26
+
27
+ Dir.glob('./lib/tasks/**/*.rake').each { |tasks| import tasks }
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ class App < Sinatra::Base
4
+ configure do
5
+ enable :logging
6
+ set :app_file, __FILE__
7
+ set :root, File.expand_path('../', __FILE__)
8
+ set :tmp_dir, File.join(root, 'tmp')
9
+ end
10
+
11
+ get '/' do
12
+ @title = '<%= @app %>'
13
+ slim :index
14
+ end
15
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ # namepspace
2
+ window.App = window.App || {}
File without changes
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['RACK_ENV'] ||= 'development'
3
+ # load path
4
+ lib_path = File.expand_path('../../lib', __FILE__)
5
+ ($:.unshift lib_path) unless ($:.include? lib_path)
6
+
7
+ # require farm
8
+ require 'bundler'
9
+ Bundler.require(:default, ENV['RACK_ENV'])
10
+ require 'pry'
11
+ require 'boot'
12
+
13
+ # fire up the ftl drive
14
+ Pry.config.prompt_name = "#{ENV['APP_NAME']}@#{ENV['RACK_ENV']}:pry"
15
+ Pry.start
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ # environment
4
+ ENV['RACK_ENV'] ||= 'development'
5
+
6
+ # load path
7
+ lib_path = File.expand_path('../lib', __FILE__)
8
+ ($:.unshift lib_path) unless ($:.include? lib_path)
9
+
10
+ # preparing for hyperspace
11
+ require 'boot'
12
+ Bundler.require(:default, :web)
13
+ require './app'
14
+
15
+ # middleware stack
16
+ use Honeybadger::Rack::ErrorNotifier
17
+ if %w(production staging).include? ENV['RACK_ENV']
18
+ use Rack::SSL, hsts: { subdomains: true }
19
+ end
20
+ use Rack::Cache, metastore: Dalli::Client.new, entitystore: Dalli::Client.new(nil, value_max_bytes: 10485760)
21
+ use Rack::Deflater
22
+ use Rack::Runtime
23
+
24
+ # make the jump
25
+ run App
26
+
27
+ <% if @with_sidekiq -%>
28
+ require 'sidekiq/web'
29
+ map '/sidekiq' do
30
+ Sidekiq::Web.use Rack::Auth::Basic do |username, password|
31
+ username == ENV['AUTH_USERNAME'] && password == ENV['AUTH_PASSWORD']
32
+ end
33
+ run Sidekiq::Web
34
+ end
35
+ <% end -%>
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ if ENV['HONEYBADGER_PRIVATE_KEY']
4
+ Honeybadger.configure do |config|
5
+ config.api_key = ENV['HONEYBADGER_PRIVATE_KEY']
6
+ config.environment_name = ENV['RACK_ENV']
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ preload_app!
2
+ #on_restart do
3
+ #Redis.current.client.reconnect
4
+ #end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ # environment
4
+ ENV['RACK_ENV'] ||= 'development'
5
+
6
+ GC::Profiler.enable
7
+
8
+ # load path
9
+ lib_path = File.expand_path('..', __FILE__)
10
+ ($:.unshift lib_path) unless ($:.include? lib_path)
11
+ $app_root = File.expand_path('../../', __FILE__)
12
+
13
+ # spinning up the ftl drive
14
+ require 'bundler'
15
+ Bundler.require(:default, ENV['RACK_ENV'])
16
+ Dotenv.load if defined?(Dotenv)
17
+
18
+ # stdlib
19
+ require 'active_support/core_ext/hash/keys'
20
+ require 'active_support/core_ext/object/blank'
21
+ require 'active_support/core_ext/object/try'
22
+ require 'active_support/core_ext/numeric/conversions'
23
+
24
+
25
+ # errors
26
+ require File.join($app_root, 'config/honeybadger')
27
+ require 'errors/app'
28
+
29
+ # models
30
+ <% if @datamapper -%>
31
+ require File.join($app_root, 'config/datamapper')
32
+ DataMapper.finalize
33
+ <% end -%>
34
+
35
+ # services
36
+
37
+ # reports
38
+
39
+ # values
40
+
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ # This monkeypatch is needed to ensure the X-Frame-Options header is
4
+ # never set by rack-protection.
5
+ module Rack
6
+ module Protection
7
+ class FrameOptions < Base
8
+ def call(env)
9
+ status, headers, body = @app.call(env)
10
+ [status, headers, body]
11
+ end
12
+ end
13
+ end
14
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ module Errors
4
+ class App < StandardError ; end
5
+ end
6
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ Bundler.require(:web)
5
+ require File.join($app_root, 'app')
6
+
7
+ describe App do
8
+ include Rack::Test::Methods
9
+
10
+ def app
11
+ App.new
12
+ end
13
+
14
+ describe "\n GET /" do
15
+ it "should respond successfully" do
16
+ get '/'
17
+ last_response.status.must_equal 200
18
+ end
19
+ end
20
+ end
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ ENV['RACK_ENV'] = 'test'
3
+ dbuser = (ENV['TRAVIS']) ? 'postgres@' : nil
4
+ ENV['DATABASE_URL'] = "postgres://#{dbuser}localhost/#{ENV['DB_NAME']}"
5
+ lib_path = File.expand_path('../../lib', __FILE__)
6
+ ($:.unshift lib_path) unless ($:.include? lib_path)
7
+ require 'boot'
8
+ Bundler.setup(:test)
9
+ DatabaseCleaner.strategy = :truncation
10
+ require 'sidekiq/testing'
11
+ require 'minitest/autorun'
12
+ MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
@@ -0,0 +1 @@
1
+ h1 Hello, <%= @app %>
@@ -0,0 +1,23 @@
1
+ doctype 5
2
+ /[if lt IE 7]
3
+ | <html class="ie ie6 lt-ie9 lt-ie8 lt-ie7">
4
+ /[if IE 7]
5
+ | <html class="ie ie7 lt-ie9 lt-ie8">
6
+ /[if IE 8]
7
+ | <html class="ie ie8 lt-ie9">
8
+ /[if IE 9]
9
+ | <html class="ie ie9">
10
+ | <!--[if (gte IE 9)|!(IE)]<!-->
11
+ html
12
+ | <!--<![endif]-->
13
+ head
14
+ title #{@title} - #{ENV['APP_TITLE']}
15
+ meta charset="utf-8"
16
+ meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
17
+ meta name="HandheldFriendly" content="True"
18
+ meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"
19
+ link rel="stylesheet" type="text/css" href="/assets/app.css"
20
+ script src="/assets/html5shiv.js"
21
+ body
22
+ == yield
23
+ script src="/assets/app.js"
@@ -0,0 +1,4 @@
1
+ {
2
+ "analytics": false,
3
+ "directory":"assets/vendor"
4
+ }
@@ -0,0 +1,14 @@
1
+ default:
2
+ - 'sass:default'
3
+ - 'coffee:default'
4
+ - 'uglify:default'
5
+ - 'imagemin:default'
6
+ - 'slim:default'
7
+ - 'robotstxt:default'
8
+ production:
9
+ - 'sass:production'
10
+ - 'coffee:production'
11
+ - 'uglify:production'
12
+ - 'imagemin:production'
13
+ - 'slim:production'
14
+ - 'robotstxt:production'
@@ -0,0 +1,16 @@
1
+ module.exports =
2
+ default:
3
+ files:
4
+ 'public/assets/app.js': [
5
+ 'assets/javascripts/app.coffee'
6
+ ]
7
+ options:
8
+ compress: false
9
+ expand: true
10
+ join: true
11
+ production:
12
+ files: '<%= coffee.default.files %>'
13
+ options:
14
+ compress: true
15
+ expand: true
16
+ join: true
@@ -0,0 +1,18 @@
1
+ module.exports =
2
+ default:
3
+ files: [
4
+ expand: true
5
+ cwd: 'assets/images'
6
+ src: ['**/*.{png,jpg,gif}']
7
+ dest: 'public/assets'
8
+ ]
9
+ options:
10
+ pngquant: false
11
+ optimizationLevel: 1
12
+ progressive: true
13
+ production:
14
+ files: '<%= imagemin.default.files %>'
15
+ options:
16
+ pngquant: false
17
+ optimizationLevel: 7
18
+ progressive: true
@@ -0,0 +1,39 @@
1
+ module.exports =
2
+ default:
3
+ dest: "public/"
4
+ policy: [
5
+ {
6
+ ua: "*"
7
+ disallow: "/"
8
+ }
9
+ {
10
+ sitemap: [
11
+ "http://staging.example.com/sitemap.xml"
12
+ ]
13
+ }
14
+ {
15
+ crawldelay: 100
16
+ }
17
+ {
18
+ host: "staging.example.com"
19
+ }
20
+ ]
21
+ production:
22
+ dest: "public/"
23
+ policy: [
24
+ {
25
+ ua: "*"
26
+ allow: "/"
27
+ }
28
+ {
29
+ sitemap: [
30
+ "http://www.example.com/sitemap.xml"
31
+ ]
32
+ }
33
+ {
34
+ crawldelay: 100
35
+ }
36
+ {
37
+ host: "www.example.com"
38
+ }
39
+ ]
@@ -0,0 +1,11 @@
1
+ module.exports =
2
+ default:
3
+ files: 'public/assets/main.css': [
4
+ 'assets/stylesheets/main.scss'
5
+ ]
6
+ options:
7
+ style: 'expanded'
8
+ production:
9
+ files: '<%= sass.default.files %>'
10
+ options:
11
+ style: 'compressed'
@@ -0,0 +1,15 @@
1
+ module.exports =
2
+ default:
3
+ files: [
4
+ expand: true,
5
+ cwd: 'assets/pages',
6
+ src: ['**/*.slim']
7
+ dest: 'public'
8
+ ext: '.html'
9
+ ]
10
+ options:
11
+ pretty: true
12
+ production:
13
+ files: '<%= slim.default.files %>'
14
+ options:
15
+ pretty: false
@@ -0,0 +1,23 @@
1
+ module.exports =
2
+ default:
3
+ files:
4
+ 'public/assets/html5shiv.js': [
5
+ 'assets/vendor/html5shiv/dist/html5shiv.js'
6
+ ]
7
+ 'public/assets/vendor.js': [
8
+ 'assets/vendor/jquery/dist/jquery.js'
9
+ 'assets/vendor/underscore/underscore.js'
10
+ ]
11
+ 'public/assets/main.js': [
12
+ 'public/assets/main.js'
13
+ ]
14
+ options:
15
+ beautify: true
16
+ mangle: false
17
+ banner: '/*! packaged on: <%= grunt.template.today("isoUtcDateTime") %> */'
18
+ production:
19
+ files: '<%= uglify.default.files %>'
20
+ options:
21
+ beautify: false
22
+ mangle: false
23
+ banner: '/*! packaged for production on: <%= grunt.template.today("isoUtcDateTime") %> */'
@@ -0,0 +1,6 @@
1
+ module.exports = (grunt) ->
2
+ path = require('path')
3
+ require('time-grunt')(grunt)
4
+ require('load-grunt-config')(grunt, {
5
+ configPath: path.join(process.cwd(), '.grunt')
6
+ })
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "<%= @app -%>",
3
+ "dependencies": {
4
+ "jquery": "~2.1.0",
5
+ "underscore": "~1.7.0",
6
+ "html5shiv": "~3.7.2",
7
+ }
8
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "<%= @app -%>",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "dependencies": {
6
+ "grunt": "~0.4.2",
7
+ "grunt-contrib-coffee": "~0.10.1",
8
+ "grunt-contrib-imagemin": "~0.4.0",
9
+ "grunt-contrib-sass": "~0.7.2",
10
+ "grunt-contrib-uglify": "~0.3.2",
11
+ "grunt-newer": "~0.6.1",
12
+ "grunt-robots-txt": "~0.3.0",
13
+ "grunt-slim": "^0.1.0",
14
+ "load-grunt-config": "~0.7.1",
15
+ "load-grunt-tasks": "~0.3.0",
16
+ "time-grunt": "~0.2.9"
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "<%= @app %>",
3
+ "main": ["assets/stylesheets/app.scss", "assets/javascripts/app.js"],
4
+ "dependencies": {
5
+ "jquery": "~2.0.3",
6
+ "requirejs": null,
7
+ "html5shiv": "~3.7.0",
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+ Bundler.require(:datamapper)
5
+ ENV['DATABASE_LOG_LEVEL'] ||= 'info'
6
+ DataMapper::Logger.new($stdout, ENV['DATABASE_LOG_LEVEL'])
7
+ DataMapper::Model.raise_on_save_failure = true
8
+ DataMapper.setup(:default, ENV['DATABASE_URL']) if ENV['DATABASE_URL']
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ require 'database_cleaner'
4
+ DatabaseCleaner.strategy = :transaction
5
+
6
+ class MiniTest::Spec
7
+ before(:each) do
8
+ DatabaseCleaner.start
9
+ end
10
+
11
+ after(:after) do
12
+ DatabaseCleaner.clean
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ via = (ENV['RACK_ENV'] == 'test') ? :test : :smtp
4
+ via_options = case ENV['RACK_ENV']
5
+ when 'development'
6
+ { address: 'localhost', port: '1025' }
7
+ when 'test'
8
+ {}
9
+ when 'staging'
10
+ {
11
+ address: 'mailtrap.io',
12
+ port: '2525',
13
+ user_name: 'example',
14
+ password: 'example',
15
+ authentication: :login,
16
+ domain: 'staging.example.com'
17
+ }
18
+ when 'production'
19
+ {
20
+ address: 'smtp.example.com',
21
+ port: '587',
22
+ user_name: 'example',
23
+ password: 'example',
24
+ authentication: :login,
25
+ domain: 'example.com'
26
+ }
27
+ end
28
+
29
+ Pony.options = {
30
+ charset: 'utf-8',
31
+ from: 'Example <example@example.com>',
32
+ text_part_charset: 'utf-8',
33
+ via: via,
34
+ via_options: via_options
35
+ }
@@ -0,0 +1,7 @@
1
+ Sidekiq.configure_server do |config|
2
+ config.redis = { namespace: ENV['APP_NAME'] }
3
+ end
4
+
5
+ Sidekiq.configure_client do |config|
6
+ config.redis = { namespace: ENV['APP_NAME'], size: 1 }
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'webmock'
2
+ require 'vcr'
3
+
4
+ VCR.configure do |c|
5
+ c.allow_http_connections_when_no_cassette = false
6
+ c.cassette_library_dir = 'spec/_cassettes'
7
+ c.hook_into :webmock
8
+ end
data/lib/daiku/cli.rb ADDED
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ require 'thor'
4
+
5
+ module Daiku
6
+ class CLI < Thor
7
+ include Thor::Actions
8
+
9
+ def self.source_root
10
+ File.expand_path('../', __FILE__)
11
+ end
12
+
13
+ desc "new APP", "Generate a new application with daiku"
14
+ method_option :port, required: true, aliases: '-p', type: :numeric, desc: 'Port this app should run on locally.'
15
+ method_option :ruby_version, default: '2.1.2', desc: 'Specify the version of ruby this project should use.'
16
+ method_option :models, default: 'datamapper', aliases: '-m', desc: 'Choose the data modeling tool this project uses.', enum: ['datamapper', 'none']
17
+ method_option :assets, default: 'grunt', aliases: '-a', desc: 'Choose the assets workflow this project uses.', enum: ['grunt', 'none']
18
+ method_option :'honeybadger-private-key', desc: "Honeybadger Private API Key"
19
+ method_option :'honeybadger-public-key', desc: "Honeybadger Private API Key"
20
+ method_option :'no-newrelic', type: :boolean, desc: "Don't use New Relic."
21
+ method_option :'with-vcr', type: :boolean, desc: "Include `vcr` in this project's TDD stack."
22
+ method_option :'with-sidekiq', type: :boolean, desc: "Set this project up to use `sidekiq` for background processing."
23
+ def new(app)
24
+ @app = app
25
+ @port = options[:port]
26
+ @ruby_version = options[:ruby_version]
27
+ @models = options[:models]
28
+ @assets = options[:assets]
29
+ @honeybadger_private_key = options[:'honeybadger-private-key']
30
+ @honeybadger_public_key = options[:'honeybadger-public-key']
31
+ @no_newrelic = options[:'no-newrelic']
32
+ @with_vcr = options[:'with-vcr']
33
+ @with_sidekiq = options[:'with-sidekiq']
34
+
35
+ case @models
36
+ when 'datamapper'
37
+ @datamapper = true
38
+ when 'none'
39
+ @datamapper = false
40
+ end
41
+
42
+ case @assets
43
+ when 'grunt'
44
+ @grunt = true
45
+ when 'none'
46
+ @grunt = false
47
+ end
48
+
49
+ # do the dew
50
+ say "Generating #{app} app..."
51
+ directory('_app', app)
52
+ chmod("#{app}/bin/console", 'a+x')
53
+ template("_templates/#{@models}.rb.tt", "#{app}/config/#{@models}.rb")
54
+ copy_file('_templates/db_helper.rb', "#{app}/spec/db_helper.rb") if @datamapper
55
+
56
+ if @grunt
57
+ directory('_grunt', app)
58
+ end
59
+
60
+ if @with_vcr
61
+ copy_file('_templates/vcr_helper.rb', "#{app}/spec/vcr_helper.rb")
62
+ empty_directory("#{app}/spec/_cassettes")
63
+ create_file("#{app}/spec/_cassettes/.gitkeep", "")
64
+ end
65
+
66
+ if @with_sidekiq
67
+ template('_templates/sidekiq.rb.tt', "#{app}/config/sidekiq.rb")
68
+ empty_directory("#{app}/lib/jobs")
69
+ create_file("#{app}/lib/jobs/.gitkeep", "")
70
+ append_to_file("#{app}/lib/boot.rb") do
71
+ "# jobs\n" +
72
+ "require File.join($app_root, 'config/sidekiq')"
73
+ end
74
+ end
75
+
76
+ say "Done!"
77
+ end
78
+
79
+ desc "version", "Prints version number"
80
+ def version
81
+ say "Daiku v#{Daiku::VERSION}"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,3 @@
1
+ module Daiku
2
+ VERSION = "0.0.12"
3
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: daiku
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.12
5
+ platform: ruby
6
+ authors:
7
+ - Eric Marden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Daiku, japanese for carpenter, helps you craft lightweight ruby applications
56
+ email:
57
+ - eric@xentek.net
58
+ executables:
59
+ - daiku
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/daiku
69
+ - daiku.gemspec
70
+ - lib/daiku.rb
71
+ - lib/daiku/_app/.env.tt
72
+ - lib/daiku/_app/.gitignore
73
+ - lib/daiku/_app/.ruby-version.tt
74
+ - lib/daiku/_app/.slugignore
75
+ - lib/daiku/_app/.travis.yml.tt
76
+ - lib/daiku/_app/Gemfile.tt
77
+ - lib/daiku/_app/Procfile.tt
78
+ - lib/daiku/_app/Rakefile.tt
79
+ - lib/daiku/_app/app.rb.tt
80
+ - lib/daiku/_app/assets/images/.gitkeep
81
+ - lib/daiku/_app/assets/javascripts/app.coffee
82
+ - lib/daiku/_app/assets/pages/.gitkeep
83
+ - lib/daiku/_app/assets/stylesheets/.gitkeep
84
+ - lib/daiku/_app/assets/stylesheets/app.scss
85
+ - lib/daiku/_app/bin/console
86
+ - lib/daiku/_app/config.ru.tt
87
+ - lib/daiku/_app/config/honeybadger.rb
88
+ - lib/daiku/_app/config/puma.rb
89
+ - lib/daiku/_app/lib/boot.rb.tt
90
+ - lib/daiku/_app/lib/core_ext/frame_options.rb
91
+ - lib/daiku/_app/lib/errors/.gitkeep
92
+ - lib/daiku/_app/lib/errors/app.rb
93
+ - lib/daiku/_app/lib/models/.gitkeep
94
+ - lib/daiku/_app/lib/services/.gitkeep
95
+ - lib/daiku/_app/lib/tasks/.gitkeep
96
+ - lib/daiku/_app/lib/values/.gitkeep
97
+ - lib/daiku/_app/public/assets/.gitkeep
98
+ - lib/daiku/_app/public/fonts/.gitkeep
99
+ - lib/daiku/_app/spec/app_spec.rb
100
+ - lib/daiku/_app/spec/models/.gitkeep
101
+ - lib/daiku/_app/spec/services/.gitkeep
102
+ - lib/daiku/_app/spec/spec_helper.rb
103
+ - lib/daiku/_app/views/index.slim.tt
104
+ - lib/daiku/_app/views/layout.slim
105
+ - lib/daiku/_grunt/.bowerrc
106
+ - lib/daiku/_grunt/.grunt/aliases.yaml
107
+ - lib/daiku/_grunt/.grunt/coffee.coffee
108
+ - lib/daiku/_grunt/.grunt/imagemin.coffee
109
+ - lib/daiku/_grunt/.grunt/robotstxt.coffee
110
+ - lib/daiku/_grunt/.grunt/sass.coffee
111
+ - lib/daiku/_grunt/.grunt/slim.coffee
112
+ - lib/daiku/_grunt/.grunt/uglify.coffee
113
+ - lib/daiku/_grunt/Gruntfile.coffee
114
+ - lib/daiku/_grunt/bower.json.tt
115
+ - lib/daiku/_grunt/package.json.tt
116
+ - lib/daiku/_templates/bower.json.tt
117
+ - lib/daiku/_templates/datamapper.rb.tt
118
+ - lib/daiku/_templates/db_helper.rb
119
+ - lib/daiku/_templates/pony.rb.tt
120
+ - lib/daiku/_templates/sidekiq.rb.tt
121
+ - lib/daiku/_templates/vcr_helper.rb
122
+ - lib/daiku/cli.rb
123
+ - lib/daiku/version.rb
124
+ homepage: https://github.com/xentek/daiku
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.2.2
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Craft lightweight ruby applications
148
+ test_files: []