melodiest 0.4.0 → 1.0.0

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +17 -12
  5. data/lib/melodiest.rb +4 -2
  6. data/lib/melodiest/command.rb +1 -1
  7. data/lib/melodiest/generator.rb +36 -52
  8. data/lib/melodiest/setting.rb +1 -5
  9. data/lib/melodiest/templates/Gemfile.erb +16 -0
  10. data/lib/melodiest/templates/Rakefile.erb +23 -0
  11. data/lib/melodiest/templates/app.erb +47 -0
  12. data/lib/melodiest/templates/app/routes/home.erb +6 -0
  13. data/lib/melodiest/templates/app/views/home/index.erb +1 -0
  14. data/lib/melodiest/templates/app/views/layout.erb +22 -0
  15. data/lib/melodiest/templates/assets/javascripts/app.js +2 -0
  16. data/lib/melodiest/templates/assets/javascripts/main.js +1 -0
  17. data/lib/melodiest/templates/assets/javascripts/plugins.js +24 -0
  18. data/lib/melodiest/templates/assets/stylesheets/app.css.scss +1 -0
  19. data/lib/melodiest/templates/assets/stylesheets/main.css.scss +8 -0
  20. data/lib/melodiest/templates/config.ru.erb +5 -0
  21. data/lib/melodiest/templates/config/application.rb +7 -0
  22. data/lib/melodiest/templates/config/boot.rb +10 -0
  23. data/lib/melodiest/templates/public/.DS_Store +0 -0
  24. data/lib/melodiest/templates/public/404.html +60 -0
  25. data/lib/melodiest/templates/public/apple-touch-icon.png +0 -0
  26. data/lib/melodiest/templates/public/browserconfig.xml +12 -0
  27. data/lib/melodiest/templates/public/crossdomain.xml +15 -0
  28. data/lib/melodiest/templates/public/favicon.ico +0 -0
  29. data/lib/melodiest/templates/public/humans.txt +15 -0
  30. data/lib/melodiest/templates/public/robots.txt +5 -0
  31. data/lib/melodiest/templates/public/tile-wide.png +0 -0
  32. data/lib/melodiest/templates/public/tile.png +0 -0
  33. data/lib/melodiest/version.rb +1 -1
  34. data/spec/fixtures/app_routes_home.txt +6 -0
  35. data/spec/fixtures/config_ru.txt +5 -0
  36. data/spec/fixtures/with_db/app.txt +42 -0
  37. data/spec/fixtures/with_db/gemfile.txt +14 -0
  38. data/{lib/melodiest/templates/Rakefile → spec/fixtures/with_db/rakefile.txt} +6 -5
  39. data/spec/fixtures/without_db/app.txt +15 -0
  40. data/spec/fixtures/without_db/gemfile.txt +8 -0
  41. data/spec/fixtures/without_db/rakefile.txt +5 -0
  42. data/spec/melodiest/command_spec.rb +0 -1
  43. data/spec/melodiest/generator_spec.rb +137 -104
  44. data/spec/melodiest_spec.rb +15 -0
  45. data/spec/spec_helper.rb +1 -1
  46. metadata +35 -4
  47. data/spec/melodiest/setting_spec.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93b02593c830fd50c38d34209b6f17ed12526729
4
- data.tar.gz: 03253903a834bb4a6ecea68be9c3a10e2271025a
3
+ metadata.gz: eece355e0a6414d9bc928d73070eee099b9df27a
4
+ data.tar.gz: 18e71602d9b587def177b120c8bedf2947125d06
5
5
  SHA512:
6
- metadata.gz: 591c75d518583203dbf71107496474c838c59c661871213a7c5cf8a6ceea1c3c4a8b6a080ed7fd8397c4a9f237faf3d2b672cafd0d4941429578956b782aa073
7
- data.tar.gz: cb2ef996bafaa561fcac7a5fe5b81856a1a631339a7d75687c00fc33cebd90ed6c43bb6e6db68c14125c96c97b4c05ab27b0971332ced5686f5b73c4dc41bed6
6
+ metadata.gz: 34b276aab69efe0e3239d75441a06e82a86aabfd139fd6c2dfa46daed8c93f06d1e1020c569d5d6ad0b552d9487532e799ee4fdb164835347151a3bbcd6836a0
7
+ data.tar.gz: fbde39029c8854b4703a3a653499750e83faf28436e70c5000423a6e46a16cabe195731159393cdc4bb828dd0517c65d6dde102225f3fba2eb7a95e425b4fdbc
@@ -1,3 +1,15 @@
1
+ development:
2
+ * prevent tux to be required
3
+ * add sinatra assets pipeline extension
4
+ * restructure generated app
5
+ * use erb for app templates
6
+ * create Rakefile generator with and without database
7
+ * add new Sequel configuration when generating app with database
8
+ * add Sinatra::Cache extension
9
+ * remove Melodiest::Setting. Rename setup method to cookie_secret.
10
+ * restructure generated app
11
+ * add some configurations from h5bp
12
+
1
13
  0.4.0:
2
14
  * add SQL logger to development environment
3
15
  * generate public dir when running generator
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- melodiest (0.2.1)
4
+ melodiest (0.4.0)
5
5
  encrypted_cookie (= 0.0.4)
6
6
  sinatra (= 1.4.6)
7
7
  sinatra-contrib (= 1.4.2)
@@ -12,7 +12,7 @@ GEM
12
12
  backports (3.6.4)
13
13
  diff-lcs (1.2.5)
14
14
  encrypted_cookie (0.0.4)
15
- multi_json (1.11.0)
15
+ multi_json (1.11.2)
16
16
  rack (1.6.0)
17
17
  rack-protection (1.5.3)
18
18
  rack
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # Melodiest
1
+ # Background
2
2
 
3
- Melodiest is [Sinatra](http://www.sinatrarb.com/) application boilerplate. It provides generator and contains minimalist configuration to develop application with Sinatra.
3
+ Melodiest is [Sinatra](http://www.sinatrarb.com/) application boilerplate. It provides generator and contains minimum configuration to develop application with Sinatra.
4
+ The reason why I create Melodiest is because I want to create many small web application based on sinatra with other third party ruby gems as foundation.
5
+ Originally, I wanted to name this project as Harmony or Melody, but because it was already taken I decided to name this project as Melodiest.
4
6
 
5
7
  ### Installation
6
8
 
@@ -36,13 +38,13 @@ melodiest -n my_app -d
36
38
  ### Melodiest::Application
37
39
  Because Melodiest is already required Sinatra, you don't have to require 'sinatra' anymore, just require 'melodiest'.
38
40
 
39
- `Melodiest::Application` is subclass from `Sinatra::Application` and by default is using configuration from `Melodiest::Setting.setup` method.
41
+ `Melodiest::Application` is subclass from `Sinatra::Application`.
40
42
 
41
43
  ```ruby
42
44
  # my_app.rb
43
45
 
44
46
  class App < Melodiest::Application
45
- setup 'this_is_secret_for_encrypted_cookie'
47
+ cookie_secret 'this_is_secret_for_encrypted_cookie'
46
48
  ...
47
49
  end
48
50
  ```
@@ -83,10 +85,6 @@ For complete example see [github.com/kuntoaji/todo_melodiest](https://github.com
83
85
 
84
86
  ```ruby
85
87
  class MyApp
86
- get '/' do
87
- "hello world!"
88
- end
89
-
90
88
  get '/artists' do
91
89
  @artists = Artist.all
92
90
  erb :"artists/index"
@@ -122,11 +120,18 @@ For complete example see [github.com/kuntoaji/todo_melodiest](https://github.com
122
120
  10. run the server `bundle exec thin start`
123
121
  11. open url `localhost:3000/artists`
124
122
 
125
- ### Default Configuration
123
+ ### List of Ruby Gems
126
124
 
125
+ * sinatra (required by default)
126
+ * sinatra-contrib (required by default)
127
+ * encrypted_cookie (required by default)
127
128
  * `Sinatra::Reloader` in development environment only
128
- * `Thin` as default web server
129
+ * thin
129
130
  * `Rack::Session::EncryptedCookie`
130
131
  * `Rack::Csrf`
131
- * `Sequel` ORM
132
- * `sequel_pg` as PostgreSQL adapter
132
+ * sequel
133
+ * sequel_pg as PostgreSQL adapter
134
+ * sinatra-asset-pipeline
135
+ * uglifier
136
+ * tux for console
137
+ * `Sinatra::Cache` in production environment only
@@ -1,10 +1,12 @@
1
1
  require 'sinatra/base'
2
2
  require 'encrypted_cookie'
3
- require 'melodiest/setting'
4
3
 
5
4
  module Melodiest
6
5
  class Application < Sinatra::Application
7
- register Melodiest::Setting
6
+ def self.cookie_secret(secret)
7
+ use Rack::Session::EncryptedCookie,
8
+ secret: secret
9
+ end
8
10
 
9
11
  # http://www.sinatrarb.com/contrib/reloader.html
10
12
  configure :development do
@@ -45,10 +45,10 @@ module Melodiest
45
45
  generator = Melodiest::Generator.new args[:name],
46
46
  destination: args[:target], with_database: args[:database]
47
47
 
48
+ generator.generate_rakefile
48
49
  generator.generate_gemfile
49
50
  generator.generate_bundle_config
50
51
  generator.generate_app
51
- generator.copy_templates
52
52
 
53
53
  msg = "#{args[:name]} is successfully generated"
54
54
  msg << " in #{args[:target]}" if args[:target]
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'securerandom'
3
+ require 'erb'
3
4
  require_relative 'version'
4
5
 
5
6
  module Melodiest
@@ -21,83 +22,66 @@ module Melodiest
21
22
  @destination = File.expand_path(destination)
22
23
  end
23
24
 
25
+ def generate_rakefile
26
+ gemfile = File.read File.expand_path("../templates/Rakefile.erb", __FILE__)
27
+ erb = ERB.new gemfile, 0, '-'
28
+
29
+ File.open "#{@destination}/Rakefile", "w" do |f|
30
+ f.write erb.result(binding)
31
+ end
32
+ end
33
+
24
34
  def generate_gemfile
35
+ gemfile = File.read File.expand_path("../templates/Gemfile.erb", __FILE__)
36
+ erb = ERB.new gemfile, 0, '-'
37
+
25
38
  File.open "#{@destination}/Gemfile", "w" do |f|
26
- f.write("source 'https://rubygems.org'\n\n")
27
- f.write("gem 'melodiest', '#{Melodiest::VERSION}'\n")
28
- f.write("gem 'thin'\n")
29
- f.write("gem 'tux'\n")
30
- f.write("gem 'rack_csrf', require: 'rack/csrf'")
31
-
32
- if @with_database
33
- f.write("\ngem 'sequel'\n")
34
- f.write("gem 'sequel_pg', require: 'sequel'")
35
- end
39
+ f.write erb.result(binding)
36
40
  end
37
41
  end
38
42
 
39
43
  def generate_bundle_config
44
+ config_ru = File.read File.expand_path("../templates/config.ru.erb", __FILE__)
45
+ erb = ERB.new config_ru
46
+
40
47
  File.open "#{@destination}/config.ru", "w" do |f|
41
- f.write("ENV['RACK_ENV'] ||= 'development'\n\n")
42
- f.write("require 'rubygems'\n")
43
- f.write("require 'bundler'\n\n")
44
- f.write("Bundler.require :default, ENV['RACK_ENV'].to_sym\n\n")
45
- f.write("require './#{@app_name}'\n")
46
- f.write("run #{@app_class_name}\n")
48
+ f.write erb.result(binding)
47
49
  end
48
50
  end
49
51
 
50
52
  # https://github.com/sinatra/sinatra-book/blob/master/book/Organizing_your_application.markdown
51
53
  def generate_app
52
- content = {}
53
-
54
- if @with_database
55
- content[:yaml] = "require 'yaml'\n\n"
56
- content[:database] = " configure :development, :test do\n"
57
- content[:database] << " require 'logger'\n\n"
58
- content[:database] << " Sequel.connect YAML.load_file(File.expand_path(\"../config/database.yml\", __FILE__))[settings.environment.to_s],\n"
59
- content[:database] << " loggers: [Logger.new($stdout)]\n"
60
- content[:database] << " end\n\n"
61
- content[:database] << " configure :production do\n"
62
- content[:database] << " Sequel.connect YAML.load_file(File.expand_path(\"../config/database.yml\", __FILE__))['production']\n"
63
- content[:database] << " end\n"
64
- else
65
- content[:yaml] = nil
66
- content[:database] = " configure do\n"
67
- content[:database] << " # Load up database and such\n"
68
- content[:database] << " end\n"
69
- end
54
+ copy_templates
55
+ app = File.read File.expand_path("../templates/app.erb", __FILE__)
56
+ erb = ERB.new app, 0, '-'
70
57
 
71
58
  File.open "#{@destination}/#{@app_name}.rb", "w" do |f|
72
- f.write(content[:yaml])
73
- f.write("class #{app_class_name} < Melodiest::Application\n")
74
- f.write(" setup '#{SecureRandom.hex(32)}'\n\n")
75
- f.write(" set :app_file, __FILE__\n")
76
- f.write(" set :views, Proc.new { File.join(root, \"app/views\") }\n\n")
77
- f.write(" use Rack::Csrf, raise: true\n\n")
78
- f.write(content[:database])
79
- f.write("end\n\n")
80
- f.write("%w{app/models app/routes}.each do |dir|\n")
81
- f.write(" Dir[File.join(dir, '**/*.rb')].each do |file|\n")
82
- f.write(" require_relative file\n")
83
- f.write(" end\n")
84
- f.write("end\n")
59
+ f.write erb.result(binding)
85
60
  end
86
61
 
87
- FileUtils.mkdir "#{@destination}/public"
62
+ route = File.read File.expand_path("../templates/app/routes/home.erb", __FILE__)
63
+ erb = ERB.new route, 0, '-'
88
64
 
89
- app_dir = "#{@destination}/app"
90
- ["", "/routes", "/models", "/views"].each do |dir|
91
- FileUtils.mkdir "#{app_dir}/#{dir}"
65
+ File.open "#{@destination}/app/routes/home.rb", "w" do |f|
66
+ f.write erb.result(binding)
92
67
  end
68
+
69
+ FileUtils.rm "#{@destination}/app/routes/home.erb"
93
70
  end
94
71
 
72
+ private
73
+
95
74
  def copy_templates
75
+ FileUtils.cp_r File.expand_path("../templates/assets", __FILE__), @destination
96
76
  FileUtils.cp_r File.expand_path("../templates/config", __FILE__), @destination
77
+ FileUtils.cp_r File.expand_path("../templates/public", __FILE__), @destination
78
+ FileUtils.cp_r File.expand_path("../templates/app", __FILE__), @destination
97
79
 
98
80
  if @with_database
99
- FileUtils.cp File.expand_path("../templates/Rakefile", __FILE__), @destination
81
+ FileUtils.mkdir "#{@destination}/app/models"
100
82
  FileUtils.cp_r File.expand_path("../templates/db", __FILE__), @destination
83
+ else
84
+ FileUtils.rm "#{@destination}/config/database.yml.example"
101
85
  end
102
86
  end
103
87
  end
@@ -1,10 +1,6 @@
1
1
  module Melodiest
2
2
  module Setting
3
- def setup(cookie_secret, options={})
4
- {server: 'thin'}.merge(options).each do |key, value|
5
- set key, value
6
- end
7
-
3
+ def setup(cookie_secret)
8
4
  use Rack::Session::EncryptedCookie,
9
5
  secret: cookie_secret
10
6
  end
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'melodiest', '<%= Melodiest::VERSION %>'
4
+ gem 'thin'
5
+ gem 'tux', require: false
6
+ gem 'sinatra-asset-pipeline', require: 'sinatra/asset_pipeline'
7
+ gem 'uglifier', require: false
8
+ gem 'rack_csrf', require: 'rack/csrf'
9
+ <% if @with_database -%>
10
+ gem 'sequel'
11
+ gem 'sequel_pg', require: 'sequel'
12
+
13
+ group :production do
14
+ gem 'sinatra-cache'
15
+ end
16
+ <% end -%>
@@ -0,0 +1,23 @@
1
+ require_relative 'config/boot'
2
+ require_relative '<%= @app_name %>'
3
+ require 'sinatra/asset_pipeline/task'
4
+
5
+ Sinatra::AssetPipeline::Task.define! <%= @app_class_name %>
6
+ <% if @with_database %>
7
+ namespace :db do
8
+ desc "Run migrations"
9
+ task :migrate, [:version] do |t, args|
10
+ Sequel.extension :migration
11
+ db = Sequel.connect(YAML.load_file("#{Melodiest::ROOT}/config/database.yml")[ENV['RACK_ENV']])
12
+ migration_path = "#{Melodiest::ROOT}/db/migrations"
13
+
14
+ if args[:version]
15
+ puts "Migrating to version #{args[:version]}"
16
+ Sequel::Migrator.run(db, migration_path, target: args[:version].to_i)
17
+ else
18
+ puts "Migrating to latest"
19
+ Sequel::Migrator.run(db, migration_path)
20
+ end
21
+ end
22
+ end
23
+ <% end -%>
@@ -0,0 +1,47 @@
1
+ <%= "require 'yaml'\n\n" if @with_database -%>
2
+ class <%= @app_class_name %> < Melodiest::Application
3
+ cookie_secret '<%= SecureRandom.hex 32 %>'
4
+
5
+ set :app_file, __FILE__
6
+ set :views, Proc.new { File.join(root, "app/views") }
7
+ set :assets_css_compressor, :sass
8
+ set :assets_js_compressor, :uglifier
9
+
10
+ register Sinatra::AssetPipeline
11
+ use Rack::Csrf, raise: true
12
+
13
+ <% if @with_database -%>
14
+ configure do
15
+ Sequel::Database.extension :pagination
16
+ Sequel::Model.plugin :timestamps
17
+ Sequel::Model.plugin :auto_validations,
18
+ not_null: :presence, unique_opts: { only_if_modified: true }
19
+ end
20
+
21
+ configure :development do
22
+ require 'logger'
23
+
24
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['development'],
25
+ loggers: [Logger.new($stdout)]
26
+ end
27
+
28
+ configure :test do
29
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['test']
30
+ end
31
+
32
+ configure :production do
33
+ # Serve assets via Nginx or Apache
34
+ disable :static
35
+
36
+ register Sinatra::Cache
37
+ set :cache_enabled, true
38
+ set :cache_output_dir, Proc.new { File.join(root, "public/cache") }
39
+
40
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['production']
41
+ end
42
+ <% else -%>
43
+ configure do
44
+ # Load up database and such
45
+ end
46
+ <% end -%>
47
+ end
@@ -0,0 +1,6 @@
1
+ class <%= @app_class_name %>
2
+ get '/' do
3
+ @home = "Hello World from app/routes/home.rb"
4
+ erb :"home/index"
5
+ end
6
+ end
@@ -0,0 +1,22 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="id">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title>My Title</title>
7
+ <meta name="description" content="my description">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="apple-touch-icon" href="apple-touch-icon.png">
11
+ <link rel="stylesheet" type="text/css" href="<%= stylesheet_path 'app' %>">
12
+
13
+ <script src="<%= javascript_path 'app' %>"></script>
14
+ </head>
15
+ <body>
16
+ <!--[if lt IE 8]>
17
+ <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
18
+ <![endif]-->
19
+
20
+ <%= yield %>
21
+ </body>
22
+ </html>
@@ -0,0 +1,2 @@
1
+ //= require plugins
2
+ //= require main
@@ -0,0 +1 @@
1
+ /* custom js */
@@ -0,0 +1,24 @@
1
+ // Avoid `console` errors in browsers that lack a console.
2
+ (function() {
3
+ var method;
4
+ var noop = function () {};
5
+ var methods = [
6
+ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
7
+ 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
8
+ 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
9
+ 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
10
+ ];
11
+ var length = methods.length;
12
+ var console = (window.console = window.console || {});
13
+
14
+ while (length--) {
15
+ method = methods[length];
16
+
17
+ // Only stub undefined methods.
18
+ if (!console[method]) {
19
+ console[method] = noop;
20
+ }
21
+ }
22
+ }());
23
+
24
+ // Place any jQuery/helper plugins in here.
@@ -0,0 +1,8 @@
1
+ /* custom css */
2
+
3
+ .browserupgrade {
4
+ margin: 0.2em 0;
5
+ background: #ccc;
6
+ color: #000;
7
+ padding: 0.2em 0;
8
+ }
@@ -0,0 +1,5 @@
1
+ require File.expand_path('../config/boot.rb', __FILE__)
2
+ require Melodiest::ROOT + '/<%= @app_name %>'
3
+ require Melodiest::ROOT + '/config/application'
4
+
5
+ run <%= @app_class_name %>
@@ -0,0 +1,7 @@
1
+ %w{/app/models /app/helpers /app/routes}.each do |dir|
2
+ resource_dir = Melodiest::ROOT + dir
3
+
4
+ Dir[File.join(resource_dir, '**/*.rb')].each do |file|
5
+ require file
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ ENV['RACK_ENV'] ||= 'development'
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+
6
+ Bundler.require :default, ENV['RACK_ENV'].to_sym
7
+
8
+ module Melodiest
9
+ ROOT = File.expand_path('../../', __FILE__)
10
+ end
@@ -0,0 +1,60 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Page Not Found</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <style>
8
+
9
+ * {
10
+ line-height: 1.2;
11
+ margin: 0;
12
+ }
13
+
14
+ html {
15
+ color: #888;
16
+ display: table;
17
+ font-family: sans-serif;
18
+ height: 100%;
19
+ text-align: center;
20
+ width: 100%;
21
+ }
22
+
23
+ body {
24
+ display: table-cell;
25
+ vertical-align: middle;
26
+ margin: 2em auto;
27
+ }
28
+
29
+ h1 {
30
+ color: #555;
31
+ font-size: 2em;
32
+ font-weight: 400;
33
+ }
34
+
35
+ p {
36
+ margin: 0 auto;
37
+ width: 280px;
38
+ }
39
+
40
+ @media only screen and (max-width: 280px) {
41
+
42
+ body, p {
43
+ width: 95%;
44
+ }
45
+
46
+ h1 {
47
+ font-size: 1.5em;
48
+ margin: 0 0 0.3em;
49
+ }
50
+
51
+ }
52
+
53
+ </style>
54
+ </head>
55
+ <body>
56
+ <h1>Page Not Found</h1>
57
+ <p>Sorry, but the page you were trying to view does not exist.</p>
58
+ </body>
59
+ </html>
60
+ <!-- IE needs 512+ bytes: http://blogs.msdn.com/b/ieinternals/archive/2010/08/19/http-error-pages-in-internet-explorer.aspx -->
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Please read: http://msdn.microsoft.com/en-us/library/ie/dn455106.aspx -->
3
+ <browserconfig>
4
+ <msapplication>
5
+ <tile>
6
+ <square70x70logo src="tile.png"/>
7
+ <square150x150logo src="tile.png"/>
8
+ <wide310x150logo src="tile-wide.png"/>
9
+ <square310x310logo src="tile.png"/>
10
+ </tile>
11
+ </msapplication>
12
+ </browserconfig>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
3
+ <cross-domain-policy>
4
+ <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
5
+
6
+ <!-- Most restrictive policy: -->
7
+ <site-control permitted-cross-domain-policies="none"/>
8
+
9
+ <!-- Least restrictive policy: -->
10
+ <!--
11
+ <site-control permitted-cross-domain-policies="all"/>
12
+ <allow-access-from domain="*" to-ports="*" secure="false"/>
13
+ <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
14
+ -->
15
+ </cross-domain-policy>
@@ -0,0 +1,15 @@
1
+ # humanstxt.org/
2
+ # The humans responsible & technology colophon
3
+
4
+ # TEAM
5
+
6
+ <name> -- <role> -- <twitter>
7
+
8
+ # THANKS
9
+
10
+ <name>
11
+
12
+ # TECHNOLOGY COLOPHON
13
+
14
+ HTML5, CSS3
15
+ jQuery, Modernizr
@@ -0,0 +1,5 @@
1
+ # www.robotstxt.org/
2
+
3
+ # Allow crawling of all content
4
+ User-agent: *
5
+ Disallow:
@@ -1,3 +1,3 @@
1
1
  module Melodiest
2
- VERSION = '0.4.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -0,0 +1,6 @@
1
+ class MyApp
2
+ get '/' do
3
+ @home = "Hello World from app/routes/home.rb"
4
+ erb :"home/index"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ require File.expand_path('../config/boot.rb', __FILE__)
2
+ require Melodiest::ROOT + '/my_app'
3
+ require Melodiest::ROOT + '/config/application'
4
+
5
+ run MyApp
@@ -0,0 +1,42 @@
1
+ require 'yaml'
2
+
3
+ class MyApp < Melodiest::Application
4
+ cookie_secret 'supersecretcookiefromgenerator'
5
+
6
+ set :app_file, __FILE__
7
+ set :views, Proc.new { File.join(root, "app/views") }
8
+ set :assets_css_compressor, :sass
9
+ set :assets_js_compressor, :uglifier
10
+
11
+ register Sinatra::AssetPipeline
12
+ use Rack::Csrf, raise: true
13
+
14
+ configure do
15
+ Sequel::Database.extension :pagination
16
+ Sequel::Model.plugin :timestamps
17
+ Sequel::Model.plugin :auto_validations,
18
+ not_null: :presence, unique_opts: { only_if_modified: true }
19
+ end
20
+
21
+ configure :development do
22
+ require 'logger'
23
+
24
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['development'],
25
+ loggers: [Logger.new($stdout)]
26
+ end
27
+
28
+ configure :test do
29
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['test']
30
+ end
31
+
32
+ configure :production do
33
+ # Serve assets via Nginx or Apache
34
+ disable :static
35
+
36
+ register Sinatra::Cache
37
+ set :cache_enabled, true
38
+ set :cache_output_dir, Proc.new { File.join(root, "public/cache") }
39
+
40
+ Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['production']
41
+ end
42
+ end
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'melodiest', '0.4.0'
4
+ gem 'thin'
5
+ gem 'tux', require: false
6
+ gem 'sinatra-asset-pipeline', require: 'sinatra/asset_pipeline'
7
+ gem 'uglifier', require: false
8
+ gem 'rack_csrf', require: 'rack/csrf'
9
+ gem 'sequel'
10
+ gem 'sequel_pg', require: 'sequel'
11
+
12
+ group :production do
13
+ gem 'sinatra-cache'
14
+ end
@@ -1,14 +1,15 @@
1
- require 'sequel'
2
- require 'yaml'
1
+ require_relative 'config/boot'
2
+ require_relative 'my_app'
3
+ require 'sinatra/asset_pipeline/task'
3
4
 
4
- env = ENV['RACK_ENV'] || 'development'
5
+ Sinatra::AssetPipeline::Task.define! MyApp
5
6
 
6
7
  namespace :db do
7
8
  desc "Run migrations"
8
9
  task :migrate, [:version] do |t, args|
9
10
  Sequel.extension :migration
10
- db = Sequel.connect(YAML.load_file(File.expand_path("../config/database.yml", __FILE__))[env])
11
- migration_path = File.expand_path("../db/migrations", __FILE__)
11
+ db = Sequel.connect(YAML.load_file("#{Melodiest::ROOT}/config/database.yml")[ENV['RACK_ENV']])
12
+ migration_path = "#{Melodiest::ROOT}/db/migrations"
12
13
 
13
14
  if args[:version]
14
15
  puts "Migrating to version #{args[:version]}"
@@ -0,0 +1,15 @@
1
+ class MyApp < Melodiest::Application
2
+ cookie_secret 'supersecretcookiefromgenerator'
3
+
4
+ set :app_file, __FILE__
5
+ set :views, Proc.new { File.join(root, "app/views") }
6
+ set :assets_css_compressor, :sass
7
+ set :assets_js_compressor, :uglifier
8
+
9
+ register Sinatra::AssetPipeline
10
+ use Rack::Csrf, raise: true
11
+
12
+ configure do
13
+ # Load up database and such
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'melodiest', '0.4.0'
4
+ gem 'thin'
5
+ gem 'tux', require: false
6
+ gem 'sinatra-asset-pipeline', require: 'sinatra/asset_pipeline'
7
+ gem 'uglifier', require: false
8
+ gem 'rack_csrf', require: 'rack/csrf'
@@ -0,0 +1,5 @@
1
+ require_relative 'config/boot'
2
+ require_relative 'my_app'
3
+ require 'sinatra/asset_pipeline/task'
4
+
5
+ Sinatra::AssetPipeline::Task.define! MyApp
@@ -42,7 +42,6 @@ describe Melodiest::Command do
42
42
  it "has --database option" do
43
43
  app = Melodiest::Command.parse %w(-n my_app --target /tmp -d)
44
44
 
45
- puts `ls /tmp/my_app`
46
45
  expect(app).to include "my_app is successfully generated in /tmp"
47
46
  expect(Dir.exists?("/tmp/my_app/db")).to be_truthy
48
47
  end
@@ -31,7 +31,9 @@ describe Melodiest::Generator do
31
31
  end
32
32
 
33
33
  it "has default destination path app_name" do
34
+ FileUtils.rm_r @app if Dir.exists?(@app)
34
35
  expect(Melodiest::Generator.new(@app).destination).to eq File.expand_path(@app)
36
+ FileUtils.rm_r @app
35
37
  end
36
38
 
37
39
  it "sets new destination path even if it's not exist yet" do
@@ -45,15 +47,10 @@ describe Melodiest::Generator do
45
47
  it "should generate Gemfile without sequel" do
46
48
  generator.generate_gemfile
47
49
  file_content = File.read(gemfile)
50
+ expected_file_content = File.read(File.expand_path("../../fixtures/without_db/gemfile.txt", __FILE__))
48
51
 
49
52
  expect(File.exists?(gemfile)).to be_truthy
50
- expect(file_content).to include "source 'https://rubygems.org'"
51
- expect(file_content).to include "gem 'melodiest', '#{Melodiest::VERSION}'"
52
- expect(file_content).to include "gem 'thin'"
53
- expect(file_content).to include "gem 'tux'"
54
- expect(file_content).to include "gem 'rack_csrf', require: 'rack/csrf'"
55
- expect(file_content).to_not include "gem 'sequel'"
56
- expect(file_content).to_not include "gem 'sequel_pg'"
53
+ expect(file_content).to eq(expected_file_content)
57
54
  end
58
55
  end
59
56
 
@@ -63,8 +60,10 @@ describe Melodiest::Generator do
63
60
  it "should generate Gemfile with sequel" do
64
61
  generator_with_db.generate_gemfile
65
62
  file_content = File.read(gemfile)
66
- expect(file_content).to include "gem 'sequel'"
67
- expect(file_content).to include "gem 'sequel_pg'"
63
+ expected_file_content = File.read(File.expand_path("../../fixtures/with_db/gemfile.txt", __FILE__))
64
+
65
+ expect(File.exists?(gemfile)).to be_truthy
66
+ expect(file_content).to eq(expected_file_content)
68
67
  end
69
68
  end
70
69
  end
@@ -75,132 +74,166 @@ describe Melodiest::Generator do
75
74
  it "should generate config.ru with correct content" do
76
75
  generator.generate_bundle_config
77
76
  file_content = File.read(bundle_config)
77
+ expected_file_content = File.read(File.expand_path("../../fixtures/config_ru.txt", __FILE__))
78
78
 
79
79
  expect(File.exists?(bundle_config)).to be_truthy
80
- expect(file_content).to include "ENV['RACK_ENV'] ||= 'development'"
81
- expect(file_content).to include "require 'rubygems'"
82
- expect(file_content).to include "require 'bundler'"
83
- expect(file_content).to include "Bundler.require :default, ENV['RACK_ENV'].to_sym"
84
- expect(file_content).to include "require './my_app'"
85
- expect(file_content).to include "run MyApp"
80
+ expect(file_content).to eq(expected_file_content)
86
81
  end
87
82
  end
88
83
 
89
84
  describe "#generate_app" do
90
- let(:secret) { "supersecretcookiefromgenerator" }
91
- before { allow(SecureRandom).to receive(:hex).with(32).and_return(secret) }
85
+ before { FileUtils.rm_r @dest if Dir.exists?(@dest) }
86
+ before { FileUtils.rm_r @dest_with_db if Dir.exists?(@dest_with_db) }
92
87
 
93
- it "generates <app_name>.rb, public dir, and app dir" do
94
- FileUtils.rm_r @dest if Dir.exists?(@dest)
88
+ it "generates home route" do
95
89
  generator.generate_app
96
- app_file = "#{target_dir}/my_app.rb"
97
- file_content = File.read(app_file)
98
-
99
- expected_file_content =
100
- <<DOC
101
- class MyApp < Melodiest::Application
102
- setup '#{secret}'
103
90
 
104
- set :app_file, __FILE__
105
- set :views, Proc.new { File.join(root, "app/views") }
106
-
107
- use Rack::Csrf, raise: true
108
-
109
- configure do
110
- # Load up database and such
111
- end
112
- end
113
-
114
- %w{app/models app/routes}.each do |dir|
115
- Dir[File.join(dir, '**/*.rb')].each do |file|
116
- require_relative file
117
- end
118
- end
119
- DOC
91
+ app_file = "#{target_dir}/app/routes/home.rb"
92
+ erb_file = "#{target_dir}/app/routes/home.erb"
93
+ file_content = File.read(app_file)
94
+ expected_file_content = File.read(File.expand_path("../../fixtures/app_routes_home.txt", __FILE__))
120
95
 
121
96
  expect(File.exists?(app_file)).to be_truthy
97
+ expect(File.exists?(erb_file)).to be_falsey
122
98
  expect(file_content).to eq expected_file_content
123
- expect(Dir.exists?("#{target_dir}/public")).to be_truthy
124
- expect(Dir.exists?("#{target_dir}/app")).to be_truthy
125
- expect(Dir.exists?("#{target_dir}/app/routes")).to be_truthy
126
- expect(Dir.exists?("#{target_dir}/app/models")).to be_truthy
127
- expect(Dir.exists?("#{target_dir}/app/views")).to be_truthy
128
99
  end
129
100
 
130
- context "with sequel" do
131
- it "has sequel database connector" do
132
- FileUtils.rm_r @dest_with_db if Dir.exists?(@dest_with_db)
133
- generator_with_db.generate_app
134
- app_file = "#{target_dir_with_db}/my_app.rb"
135
- file_content = File.read(app_file)
101
+ context "when generating without database" do
102
+ describe "copy_templates" do
103
+ let(:config_dir) { "#{target_dir}/config" }
104
+ let(:assets_dir) { "#{target_dir}/assets" }
105
+ let(:public_dir) { "#{target_dir}/public" }
106
+ let(:without_db_sample_migration) { "#{target_dir}/db_migrations/000_example.rb" }
107
+
108
+ it "copies from melodiest templates" do
109
+ expect(File.exists?(config_dir)).to be_falsey
110
+ expect(File.exists?(without_db_sample_migration)).to be_falsey
111
+ expect(File.exists?(assets_dir)).to be_falsey
112
+ expect(File.exists?(public_dir)).to be_falsey
113
+
114
+ expect(Dir.exists?("#{target_dir}/app")).to be_falsey
115
+ expect(Dir.exists?("#{target_dir}/app/routes")).to be_falsey
116
+ expect(Dir.exists?("#{target_dir}/app/models")).to be_falsey
117
+ expect(Dir.exists?("#{target_dir}/app/views")).to be_falsey
118
+ expect(File.exists?("#{target_dir}/app/views/layout.erb")).to be_falsey
119
+ expect(File.exists?("#{target_dir}/app/views/home/index.erb")).to be_falsey
120
+
121
+ generator.generate_app
122
+
123
+ expect(File.exists?(config_dir)).to be_truthy
124
+ expect(File.exists?("#{config_dir}/database.yml.example")).to be_falsey
125
+ expect(File.exists?(without_db_sample_migration)).to be_falsey
126
+ expect(File.exists?(assets_dir)).to be_truthy
127
+ expect(File.exists?(public_dir)).to be_truthy
128
+
129
+ expect(Dir.exists?("#{target_dir}/app")).to be_truthy
130
+ expect(Dir.exists?("#{target_dir}/app/routes")).to be_truthy
131
+ expect(Dir.exists?("#{target_dir}/app/models")).to be_falsey
132
+ expect(Dir.exists?("#{target_dir}/app/views")).to be_truthy
133
+ expect(File.exists?("#{target_dir}/app/views/layout.erb")).to be_truthy
134
+ expect(File.exists?("#{target_dir}/app/views/home/index.erb")).to be_truthy
135
+ end
136
+ end
136
137
 
137
- expected_file_content =
138
- <<DOC
139
- require 'yaml'
138
+ describe "app file" do
139
+ let(:secret) { "supersecretcookiefromgenerator" }
140
+ before { allow(SecureRandom).to receive(:hex).with(32).and_return(secret) }
140
141
 
141
- class MyApp < Melodiest::Application
142
- setup '#{secret}'
142
+ it "generates <app_name>.rb, public dir, and app dir" do
143
+ generator.generate_app
143
144
 
144
- set :app_file, __FILE__
145
- set :views, Proc.new { File.join(root, "app/views") }
145
+ app_file = "#{target_dir}/my_app.rb"
146
+ file_content = File.read(app_file)
147
+ expected_file_content = File.read(File.expand_path("../../fixtures/without_db/app.txt", __FILE__))
146
148
 
147
- use Rack::Csrf, raise: true
149
+ expect(File.exists?(app_file)).to be_truthy
150
+ expect(file_content).to eq expected_file_content
151
+ end
152
+ end
153
+ end
148
154
 
149
- configure :development, :test do
150
- require 'logger'
155
+ context "when generating with database" do
156
+ describe "copy templates" do
157
+ let(:config_dir) { "#{target_dir_with_db}/config" }
158
+ let(:assets_dir) { "#{target_dir_with_db}/assets" }
159
+ let(:public_dir) { "#{target_dir_with_db}/public" }
160
+ let(:with_db_sample_migration) { "#{target_dir_with_db}/db/migrations/000_example.rb" }
161
+
162
+ it "copies from melodiest templates" do
163
+ expect(File.exists?(config_dir)).to be_falsey
164
+ expect(File.exists?("#{config_dir}/database.yml.example")).to be_falsey
165
+ expect(File.exists?("#{config_dir}/boot.rb")).to be_falsey
166
+ expect(File.exists?("#{config_dir}/application.rb")).to be_falsey
167
+
168
+ expect(File.exists?(with_db_sample_migration)).to be_falsey
169
+ expect(File.exists?(assets_dir)).to be_falsey
170
+ expect(File.exists?(public_dir)).to be_falsey
171
+
172
+ expect(Dir.exists?("#{target_dir_with_db}/app")).to be_falsey
173
+ expect(Dir.exists?("#{target_dir_with_db}/app/routes")).to be_falsey
174
+ expect(Dir.exists?("#{target_dir_with_db}/app/models")).to be_falsey
175
+ expect(Dir.exists?("#{target_dir_with_db}/app/views")).to be_falsey
176
+ expect(File.exists?("#{target_dir_with_db}/app/views/layout.erb")).to be_falsey
177
+ expect(File.exists?("#{target_dir_with_db}/app/views/home/index.erb")).to be_falsey
178
+
179
+ generator_with_db.generate_app
180
+
181
+ expect(File.exists?(config_dir)).to be_truthy
182
+ expect(File.exists?("#{config_dir}/database.yml.example")).to be_truthy
183
+ expect(File.exists?("#{config_dir}/boot.rb")).to be_truthy
184
+ expect(File.exists?("#{config_dir}/application.rb")).to be_truthy
185
+
186
+ expect(File.exists?(with_db_sample_migration)).to be_truthy
187
+ expect(File.exists?(assets_dir)).to be_truthy
188
+ expect(File.exists?(public_dir)).to be_truthy
189
+
190
+ expect(Dir.exists?("#{target_dir_with_db}/app")).to be_truthy
191
+ expect(Dir.exists?("#{target_dir_with_db}/app/routes")).to be_truthy
192
+ expect(Dir.exists?("#{target_dir_with_db}/app/models")).to be_truthy
193
+ expect(Dir.exists?("#{target_dir_with_db}/app/views")).to be_truthy
194
+ expect(File.exists?("#{target_dir_with_db}/app/views/layout.erb")).to be_truthy
195
+ expect(File.exists?("#{target_dir_with_db}/app/views/home/index.erb")).to be_truthy
196
+ end
197
+ end
151
198
 
152
- Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))[settings.environment.to_s],
153
- loggers: [Logger.new($stdout)]
154
- end
199
+ describe "app file" do
200
+ let(:secret) { "supersecretcookiefromgenerator" }
201
+ before { allow(SecureRandom).to receive(:hex).with(32).and_return(secret) }
155
202
 
156
- configure :production do
157
- Sequel.connect YAML.load_file(File.expand_path("../config/database.yml", __FILE__))['production']
158
- end
159
- end
203
+ it "has sequel database connector" do
204
+ generator_with_db.generate_app
160
205
 
161
- %w{app/models app/routes}.each do |dir|
162
- Dir[File.join(dir, '**/*.rb')].each do |file|
163
- require_relative file
164
- end
165
- end
166
- DOC
206
+ app_file = "#{target_dir_with_db}/my_app.rb"
207
+ file_content = File.read(app_file)
208
+ expected_file_content = File.read(File.expand_path("../../fixtures/with_db/app.txt", __FILE__))
167
209
 
168
- expect(file_content).to eq expected_file_content
210
+ expect(file_content).to eq expected_file_content
211
+ end
169
212
  end
170
213
  end
171
214
  end
172
215
 
173
- describe "#copy_templates" do
174
- context "when generating without database" do
175
- let(:config_dir) { "#{target_dir}/config" }
176
- let(:without_db_rakefile) { "#{target_dir}/Rakefile" }
177
- let(:without_db_sample_migration) { "#{target_dir}/db_migrations/000_example.rb" }
178
-
179
- it "copies config dir" do
180
- expect(File.exists?(config_dir)).to be_falsey
181
- expect(File.exists?("#{config_dir}/database.yml.example")).to be_falsey
182
- expect(File.exists?(without_db_rakefile)).to be_falsey
183
- expect(File.exists?(without_db_sample_migration)).to be_falsey
184
- generator.copy_templates
185
-
186
- expect(File.exists?(config_dir)).to be_truthy
187
- expect(File.exists?("#{config_dir}/database.yml.example")).to be_truthy
188
- expect(File.exists?(without_db_rakefile)).to be_falsey
189
- expect(File.exists?(without_db_sample_migration)).to be_falsey
190
- end
216
+ describe "#generate_rakefile" do
217
+ it "generate basic Rakefile tasks" do
218
+ expected_rakefile_content =
219
+ expected_rakefile_content = File.read(File.expand_path("../../fixtures/without_db/rakefile.txt", __FILE__))
220
+
221
+ generator.generate_rakefile
222
+ rakefile = "#{target_dir}/Rakefile"
223
+ rakefile_content = File.read(rakefile)
224
+
225
+ expect(rakefile_content).to eq expected_rakefile_content
191
226
  end
192
227
 
193
- context "when generating with database" do
194
- let(:with_db_rakefile) { "#{target_dir_with_db}/Rakefile" }
195
- let(:with_db_sample_migration) { "#{target_dir_with_db}/db/migrations/000_example.rb" }
228
+ context "with database" do
229
+ it "generates db related tasks" do
230
+ expected_rakefile_content = File.read(File.expand_path("../../fixtures/with_db/rakefile.txt", __FILE__))
196
231
 
197
- it "copies Rakefile" do
198
- expect(File.exists?(with_db_rakefile)).to be_falsey
199
- expect(File.exists?(with_db_sample_migration)).to be_falsey
200
- generator_with_db.copy_templates
232
+ generator_with_db.generate_rakefile
233
+ rakefile = "#{target_dir_with_db}/Rakefile"
234
+ rakefile_content = File.read(rakefile)
201
235
 
202
- expect(File.exists?(with_db_rakefile)).to be_truthy
203
- expect(File.exists?(with_db_sample_migration)).to be_truthy
236
+ expect(rakefile_content).to eq expected_rakefile_content
204
237
  end
205
238
  end
206
239
  end
@@ -0,0 +1,15 @@
1
+ describe Melodiest::Application do
2
+ let(:my_app) do
3
+ class MyApp < Melodiest::Application
4
+ cookie_secret 'mysupersecretcookie'
5
+ end
6
+
7
+ MyApp
8
+ end
9
+
10
+
11
+ it "use encrypted cookie" do
12
+ expect(my_app.instance_variable_get("@middleware")).to include
13
+ [Rack::Session::EncryptedCookie, [{:secret => "mysupersecretcookie"}], nil]
14
+ end
15
+ end
@@ -79,7 +79,7 @@ RSpec.configure do |config|
79
79
  end
80
80
 
81
81
  class SpecApp < Melodiest::Application
82
- setup 'supersecretcookiespec'
82
+ cookie_secret 'supersecretcookiespec'
83
83
  end
84
84
 
85
85
  def app
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: melodiest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kunto Aji Kristianto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-09 00:00:00.000000000 Z
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,45 @@ files:
114
114
  - lib/melodiest/command.rb
115
115
  - lib/melodiest/generator.rb
116
116
  - lib/melodiest/setting.rb
117
- - lib/melodiest/templates/Rakefile
117
+ - lib/melodiest/templates/Gemfile.erb
118
+ - lib/melodiest/templates/Rakefile.erb
119
+ - lib/melodiest/templates/app.erb
120
+ - lib/melodiest/templates/app/routes/home.erb
121
+ - lib/melodiest/templates/app/views/home/index.erb
122
+ - lib/melodiest/templates/app/views/layout.erb
123
+ - lib/melodiest/templates/assets/javascripts/app.js
124
+ - lib/melodiest/templates/assets/javascripts/main.js
125
+ - lib/melodiest/templates/assets/javascripts/plugins.js
126
+ - lib/melodiest/templates/assets/stylesheets/app.css.scss
127
+ - lib/melodiest/templates/assets/stylesheets/main.css.scss
128
+ - lib/melodiest/templates/config.ru.erb
129
+ - lib/melodiest/templates/config/application.rb
130
+ - lib/melodiest/templates/config/boot.rb
118
131
  - lib/melodiest/templates/config/database.yml.example
119
132
  - lib/melodiest/templates/db/migrations/000_example.rb
133
+ - lib/melodiest/templates/public/.DS_Store
134
+ - lib/melodiest/templates/public/404.html
135
+ - lib/melodiest/templates/public/apple-touch-icon.png
136
+ - lib/melodiest/templates/public/browserconfig.xml
137
+ - lib/melodiest/templates/public/crossdomain.xml
138
+ - lib/melodiest/templates/public/favicon.ico
139
+ - lib/melodiest/templates/public/humans.txt
140
+ - lib/melodiest/templates/public/robots.txt
141
+ - lib/melodiest/templates/public/tile-wide.png
142
+ - lib/melodiest/templates/public/tile.png
120
143
  - lib/melodiest/version.rb
121
144
  - melodiest.gemspec
145
+ - spec/fixtures/app_routes_home.txt
146
+ - spec/fixtures/config_ru.txt
147
+ - spec/fixtures/with_db/app.txt
148
+ - spec/fixtures/with_db/gemfile.txt
149
+ - spec/fixtures/with_db/rakefile.txt
150
+ - spec/fixtures/without_db/app.txt
151
+ - spec/fixtures/without_db/gemfile.txt
152
+ - spec/fixtures/without_db/rakefile.txt
122
153
  - spec/melodiest/command_spec.rb
123
154
  - spec/melodiest/generator_spec.rb
124
- - spec/melodiest/setting_spec.rb
155
+ - spec/melodiest_spec.rb
125
156
  - spec/spec_helper.rb
126
157
  homepage: http://github.com/kuntoaji/melodiest
127
158
  licenses:
@@ -1,25 +0,0 @@
1
- describe Melodiest::Setting do
2
- describe ".setup" do
3
- let(:my_app) do
4
- class MyApp < Melodiest::Application
5
- setup 'mysupersecretcookie', server: 'puma'
6
- end
7
-
8
- MyApp
9
- end
10
-
11
- it "set thin as server" do
12
- expect(app.settings.server).to eq("thin")
13
- end
14
-
15
- it "overrides default setting" do
16
- expect(my_app.settings.server).to eq("puma")
17
- end
18
-
19
- it "use encrypted cookie" do
20
- expect(my_app.instance_variable_get("@middleware")).to include
21
- [Rack::Session::EncryptedCookie, [{:secret => "mysupersecretcookie"}], nil]
22
- end
23
-
24
- end
25
- end