hazel 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 476c2c8050f244f6be328c559ee19625c12795a1
4
- data.tar.gz: fd4dcc8d2d27ea9ed0c9b467afc349f6fbb4a457
3
+ metadata.gz: 55a61a6e65125bc65a4d3f6e2c550fa1bfdcea0a
4
+ data.tar.gz: d83d2631b83a726ef444fb1d0df13a357975d268
5
5
  SHA512:
6
- metadata.gz: fccc8651a3af90178da451378b0840d0a5a89055fb4079ad2f6a62c4dc6478013ce6f835ad2265af06515364512f7da84c2702f88e9490371b24167e7fc5c8de
7
- data.tar.gz: 6dfd2038ecc138c85d8242656ea8c44371ba9257e39f750fdeae8661bdc11acf4fc47f7a0c981f3c735c4c1b9f7ddc13336e0e1f496413e55b4a18ada9d526f3
6
+ metadata.gz: d8758ab8dcf73792e56b551a5310c65151d42717027bcc946853ea9029f4f9ff18b9c917086f80c5045c35160098ad935632857c810cb75929c213b5c9b03941
7
+ data.tar.gz: 2a437308acb55c714ec8f0745809ea2dc73677cc0dc9654e11e13bfb06163e99b8537323de2205673d35603c128e0d078d12b657c5a1b2bd0a1b0270e17509d5
data/Gemfile.lock CHANGED
@@ -1,23 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hazel (0.0.7)
5
- thor (~> 0.17)
4
+ hazel (0.0.8)
5
+ thor (~> 0.18)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- fakefs (0.4.2)
11
- minitest (4.6.2)
12
- rake (10.0.3)
13
- thor (0.17.0)
10
+ fakefs (0.4.3)
11
+ minitest (5.2.0)
12
+ rake (10.1.1)
13
+ thor (0.18.1)
14
14
 
15
15
  PLATFORMS
16
16
  ruby
17
17
 
18
18
  DEPENDENCIES
19
- bundler (~> 1.3)
19
+ bundler (~> 1.5.1)
20
20
  fakefs (~> 0.4)
21
21
  hazel!
22
- minitest (~> 4.6)
22
+ minitest (~> 5.2)
23
23
  rake (~> 10.0)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Peter Hellberg
1
+ Copyright (c) 2014 Peter Hellberg
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -10,14 +10,13 @@ A simple Sinatra app generator, heavily based on [snfn](https://github.com/zachp
10
10
 
11
11
  ## Configuration
12
12
 
13
- * `--capistrano` Include Capistrano configuration
14
- * `-d` Database. Options are "postgres," "mysql," "sqlite", and "mongo."
15
- Default is "sqlite."
16
- * `--redis` Include Redis configuration options.
17
- * `--rvm-gemset` Create a new RVM Gemset under the current Ruby
18
- * `--no-database` Don't include any database config options.
19
- * `--no-bundle-install` Don’t run bundle install after generating the app
20
- * `--no-git-repo` Don’t initialize a Git repository
13
+ * `--capistrano` Include Capistrano
14
+ * `-d` Database. Options are "postgres," "mysql," "sqlite", and "mongo."
15
+ Default is ""
16
+ * `--redis` Include Redis configuration options.
17
+ * `--rvm` Create .ruby-version (ruby-2.1.0) and .ruby-gemset
18
+ * `--bundle` Run bundle after generating the app
19
+ * `--git` Initialize a Git repository
21
20
 
22
21
  ## Example
23
22
 
@@ -29,13 +28,13 @@ App using MySQL and Redis.
29
28
 
30
29
  hazel my_app -d mysql --redis
31
30
 
32
- App using MongoDB and Redis, but don’t run bundle install.
31
+ App using MongoDB and Redis, then run bundle install.
33
32
 
34
- hazel my_app -d mongo --redis --no-bundle-install
33
+ hazel my_app -d mongo --redis --bundle
35
34
 
36
- App using Redis, a RVM Gemset, but no database or Git repo
35
+ App using Redis, RVM, and Git repo
37
36
 
38
- hazel my_app --redis --rvm-gemset --no-database --no-git-repo
37
+ hazel my_app --redis --rvm --git-repo
39
38
 
40
39
  ## Architecture
41
40
 
@@ -61,8 +60,8 @@ and `config/initializers/database.rb`).
61
60
 
62
61
  ## License
63
62
 
64
- Copyright (c) 2013 Peter Hellberg
65
-
63
+ Copyright (c) 2014 Peter Hellberg
64
+
66
65
  Permission is hereby granted, free of charge, to any person obtaining
67
66
  a copy of this software and associated documentation files (the
68
67
  "Software"), to deal in the Software without restriction, including
@@ -70,10 +69,10 @@ and `config/initializers/database.rb`).
70
69
  distribute, sublicense, and/or sell copies of the Software, and to
71
70
  permit persons to whom the Software is furnished to do so, subject to
72
71
  the following conditions:
73
-
72
+
74
73
  The above copyright notice and this permission notice shall be
75
74
  included in all copies or substantial portions of the Software.
76
-
75
+
77
76
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
78
77
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79
78
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
- require 'rake/testtask'
2
+
3
+ require "rake/testtask"
4
+ require "bundler/gem_tasks"
3
5
 
4
6
  Rake::TestTask.new(:spec) do |test|
5
7
  test.libs << 'lib' << 'spec'
data/lib/hazel/cli.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require "rubygems"
4
3
  require "extensions/string"
5
4
  require "thor/group"
6
5
 
@@ -11,12 +10,11 @@ module Hazel
11
10
  desc "Creates a new Sinatra application"
12
11
  argument :name, :type => :string, :desc => "The name of the new application"
13
12
  class_option :capistrano, :type => :boolean, :desc => "Include Capistrano configuration"
14
- class_option :database, :aliases => "-d", :default => "sqlite", :desc => "The type of database to use"
15
- class_option :no_database, :type => :boolean, :desc => "Exclude all database configuration files"
13
+ class_option :database, :aliases => "-d", :default => "", :desc => "The type of database to use"
16
14
  class_option :redis, :type => :boolean, :desc => "Include Redis configuration"
17
- class_option :rvm_gemset, :type => :boolean, :desc => "Create a new RVM Gemset under the current Ruby"
18
- class_option :no_bundle_install, :type => :boolean, :desc => "Don’t run bundle install after generating the app"
19
- class_option :no_git_repo, :type => :boolean, :desc => "Don’t initialize a Git repository"
15
+ class_option :rvm, :type => :boolean, :desc => "Create .ruby-version (ruby-2.1.0) and .ruby-gemset"
16
+ class_option :bundle, :type => :boolean, :desc => "Run bundle after generating the app"
17
+ class_option :git, :type => :boolean, :desc => "Initialize a Git repository"
20
18
 
21
19
  # Creates instance variables from options passed to hazel.
22
20
  def setup
@@ -34,11 +32,11 @@ module Hazel
34
32
 
35
33
  # Create empty directories
36
34
  def create_empty_directories
37
- %w{config/initializers lib log tmp spec}.each do |dir|
35
+ %w{config/initializers lib spec}.each do |dir|
38
36
  empty_directory File.join(@app_path, dir)
39
37
  end
40
38
 
41
- empty_directory File.join(@app_path, 'db/migrate') unless @no_database
39
+ empty_directory File.join(@app_path, 'db/migrate') unless @database.empty?
42
40
 
43
41
  create_file File.join(@app_path, "lib", ".gitkeep")
44
42
  end
@@ -83,21 +81,12 @@ module Hazel
83
81
  copy_file "README.md", File.join(@app_path, "README.md")
84
82
  end
85
83
 
86
- def create_capistrano_config
87
- if @capistrano
88
- copy_file "Capfile", File.join(@app_path, "Capfile")
89
- empty_directory File.join(@app_path, 'config/deploy')
90
- template "config/deploy.rb", File.join(@app_path, "config/deploy.rb")
91
- template "config/deploy/production.rb", File.join(@app_path, "config/deploy/production.rb")
92
- end
93
- end
94
-
95
84
  def create_db_config
96
- template("config/db.yml", File.join(@app_path, "config/db.yml")) unless @no_database
85
+ template("config/db.yml", File.join(@app_path, "config/db.yml")) unless @database.empty?
97
86
  end
98
87
 
99
88
  def create_database_initializer
100
- template("config/initializers/database.rb", File.join(@app_path, "config/initializers/database.rb")) unless @no_database
89
+ template("config/initializers/database.rb", File.join(@app_path, "config/initializers/database.rb")) unless @database.empty?
101
90
  end
102
91
 
103
92
  def create_redis_config
@@ -108,42 +97,33 @@ module Hazel
108
97
  template("config/initializers/redis.rb", File.join(@app_path, "config/initializers/redis.rb")) if @redis
109
98
  end
110
99
 
111
- def create_rvm_gemset
112
- if @rvm_gemset
113
- rvm_path = File.expand_path(ENV['rvm_path'] || '~/.rvm')
114
- require 'rvm'
115
-
116
- rvm_env = RVM::Environment.new(ENV['RUBY_VERSION'])
117
-
118
- rvm_env.gemset_create(@app_path)
119
- rvm_env.gemset_use(@app_path)
120
-
121
- gemset = "#{ENV['RUBY_VERSION']}@#{@app_path}"
122
-
123
- create_file(File.join(@app_path, '.rvmrc'), "rvm use #{gemset}")
124
- run("rvm rvmrc trust #{@app_path}")
100
+ def create_capistrano_config
101
+ if @capistrano
102
+ inside(@app_path) do
103
+ run('cap install')
104
+ end
105
+ end
106
+ end
125
107
 
126
- unless @no_bundle_install
127
- rvm_env.chdir(@app_path) do
128
- say_status :installing, "All dependencies into #{gemset}"
129
- rvm_env.system "gem install bundler"
130
- rvm_env.run_command 'bundle install'
131
- end
108
+ def create_rvm_gemset
109
+ if @rvm
110
+ create_file(File.join(@app_path, '.ruby-version'), 'ruby-2.1.0')
111
+ create_file(File.join(@app_path, '.ruby-gemset'), @app_path)
132
112
 
133
- @no_bundle_install = true
134
- end
113
+ @bundle = false
114
+ puts "You need to run 'bundle install' manually."
135
115
  end
136
116
  end
137
117
 
138
- def install_dependencies
118
+ def initialize_git_repo
139
119
  inside(@app_path) do
140
- run('bundle install') unless @no_bundle_install
120
+ run('git init .') if @git
141
121
  end
142
122
  end
143
123
 
144
- def initialize_git_repo
124
+ def install_dependencies
145
125
  inside(@app_path) do
146
- run('git init .') unless @no_git_repo
126
+ run('bundle') if @bundle
147
127
  end
148
128
  end
149
129
  end
data/lib/hazel/version.rb CHANGED
@@ -2,7 +2,7 @@ module Hazel
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,9 +1,9 @@
1
1
  source "https://rubygems.org/"
2
2
 
3
3
  # App Stack
4
- gem "sinatra", "~> 1.3"
4
+ gem "sinatra", "~> 1.4"
5
5
 
6
- <% unless @no_database -%>
6
+ <% unless @database.empty? -%>
7
7
  # Database Stack
8
8
  <% unless @database == 'mongo' -%>
9
9
  gem "sequel"
@@ -29,13 +29,12 @@ gem "fakeredis", "~> 0.4"
29
29
  <% end -%>
30
30
  group :development do
31
31
  gem "rake", "~> 10.0"
32
- gem "minitest", "~> 4.6"
32
+ gem "minitest", "~> 5.2"
33
33
  gem "rack-test", "~> 0.6"
34
34
  <% if @capistrano -%>
35
- gem "capistrano", "~> 2.14"
36
- gem "capistrano-ext", "~> 1.2"
35
+ gem "capistrano", "~> 3.0"
37
36
  <% if @rvm_gemset -%>
38
- gem "rvm-capistrano", "~> 1.2"
37
+ gem "capistrano-rvm"
39
38
  <% end -%>
40
39
  <% end -%>
41
40
  end
@@ -1,13 +1,12 @@
1
- %w{ rubygems bundler find rake/testtask}.each { |lib| require lib }
1
+ %w{ bundler find rake/testtask}.each { |lib| require lib }
2
2
 
3
3
  task :default => :spec
4
4
 
5
5
  Rake::TestTask.new(:spec) do |t|
6
6
  t.test_files = FileList['spec/*_spec.rb']
7
- t.ruby_opts = ['-rubygems'] if defined? Gem
8
7
  end
9
8
 
10
- <% unless @no_database -%>
9
+ <% unless @database.empty? -%>
11
10
  namespace :db do
12
11
  desc "Run all migrations in db/migrate"
13
12
  task :migrate => :connect do
@@ -1,13 +1,16 @@
1
1
  # Load path and gems/bundler
2
2
  $LOAD_PATH << File.expand_path(File.dirname(__FILE__))
3
- require "rubygems"
3
+
4
4
  require "bundler"
5
5
  Bundler.require
6
6
 
7
7
  # Local config
8
8
  require "find"
9
+
9
10
  %w{config/initializers lib}.each do |load_path|
10
- Find.find(load_path) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) }
11
+ Find.find(load_path) { |f|
12
+ require f unless f.match(/\/\..+$/) || File.directory?(f)
13
+ }
11
14
  end
12
15
 
13
16
  # Load app
@@ -1,4 +1,4 @@
1
- <% unless @no_database -%>
1
+ <% unless @database.empty? -%>
2
2
  require "yaml"
3
3
  settings = YAML::load_file("config/db.yml")
4
4
  <% if @database != 'mongo' -%>
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,3 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'minitest/pride'
4
- require 'minitest/spec'
5
3
  require 'minitest/autorun'
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hazel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Hellberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-07 00:00:00.000000000 Z
11
+ date: 2014-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.17'
19
+ version: '0.18'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.17'
26
+ version: '0.18'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: 1.5.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: 1.5.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.6'
47
+ version: '5.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.6'
54
+ version: '5.2'
55
55
  description: Hazel is a generator for Sinatra apps, heavily based on snfn
56
56
  email: peter@c7.se
57
57
  executables:
@@ -59,41 +59,38 @@ executables:
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - Gemfile
63
+ - Gemfile.lock
64
+ - MIT-LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - bin/hazel
62
68
  - lib/extensions/string.rb
63
69
  - lib/hazel/cli.rb
64
70
  - lib/hazel/version.rb
71
+ - lib/templates/Gemfile
72
+ - lib/templates/README.md
73
+ - lib/templates/Rakefile
65
74
  - lib/templates/app.rb
66
- - lib/templates/Capfile
75
+ - lib/templates/config.ru
67
76
  - lib/templates/config/db.yml
68
- - lib/templates/config/deploy/production.rb
69
- - lib/templates/config/deploy.rb
70
77
  - lib/templates/config/initializers/database.rb
71
78
  - lib/templates/config/initializers/redis.rb
72
79
  - lib/templates/config/redis.yml
73
- - lib/templates/config.ru
74
- - lib/templates/Gemfile
75
80
  - lib/templates/public/favicon.ico
81
+ - lib/templates/public/images/.gitkeep
76
82
  - lib/templates/public/images/hazel_icon.png
77
83
  - lib/templates/public/images/hazel_small.png
84
+ - lib/templates/public/javascripts/.gitkeep
78
85
  - lib/templates/public/stylesheets/main.css
79
- - lib/templates/Rakefile
80
- - lib/templates/README.md
81
86
  - lib/templates/spec/app_spec.rb
82
87
  - lib/templates/spec/spec_helper.rb
83
88
  - lib/templates/views/layout.erb.tt
84
89
  - lib/templates/views/welcome.erb
85
- - lib/templates/public/images/.gitkeep
86
- - lib/templates/public/javascripts/.gitkeep
87
90
  - spec/hazel/cli_spec.rb
88
91
  - spec/hazel/version_spec.rb
89
92
  - spec/spec_helper.rb
90
93
  - spec/string_extension_spec.rb
91
- - Gemfile
92
- - Gemfile.lock
93
- - MIT-LICENSE
94
- - README.md
95
- - Rakefile
96
- - bin/hazel
97
94
  homepage: http://c7.github.com/hazel/
98
95
  licenses:
99
96
  - MIT-LICENSE
@@ -104,19 +101,18 @@ require_paths:
104
101
  - lib
105
102
  required_ruby_version: !ruby/object:Gem::Requirement
106
103
  requirements:
107
- - - '>='
104
+ - - ">="
108
105
  - !ruby/object:Gem::Version
109
106
  version: '0'
110
107
  required_rubygems_version: !ruby/object:Gem::Requirement
111
108
  requirements:
112
- - - '>='
109
+ - - ">="
113
110
  - !ruby/object:Gem::Version
114
111
  version: '0'
115
112
  requirements: []
116
113
  rubyforge_project:
117
- rubygems_version: 2.0.2
114
+ rubygems_version: 2.2.0.rc.1
118
115
  signing_key:
119
116
  specification_version: 4
120
117
  summary: A simple Sinatra app generator.
121
118
  test_files: []
122
- has_rdoc:
@@ -1,3 +0,0 @@
1
- load 'deploy'
2
- Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3
- load 'config/deploy'
@@ -1,87 +0,0 @@
1
- <% if @rvm_gemset -%>
2
- require "rvm/capistrano"
3
-
4
- set :rvm_ruby_string, "ruby-1.9.3"
5
- set :rvm_type, :system
6
-
7
- <% end -%>
8
- require "bundler/capistrano"
9
- require "capistrano/ext/multistage"
10
-
11
- #############################################################
12
- # Stages
13
- #############################################################
14
-
15
- set :default_stage, "production"
16
- set :stages, %w(production)
17
-
18
- #############################################################
19
- # Application
20
- #############################################################
21
-
22
- set :application, "<%= @name %>"
23
- set :deploy_to, "/var/www/apps/#{application}"
24
- set :keep_releases, 2
25
-
26
- after "deploy:update", "deploy:cleanup"
27
-
28
- #############################################################
29
- # Settings
30
- #############################################################
31
-
32
- set :user, "deploy"
33
- set :use_sudo, false
34
-
35
- ssh_options[:forward_agent] = true
36
-
37
- #############################################################
38
- # Git
39
- #############################################################
40
-
41
- set :scm, :git
42
- set :deploy_via, :remote_cache
43
-
44
- set :repository, "git@github.com:/GITHUB_USER/#{application}.git"
45
-
46
- namespace :deploy do
47
- task :set_branch do
48
- set(:branch) { Capistrano::CLI.ui.ask("Branch to deploy (or press ENTER to deploy from master): ") }
49
-
50
- if branch.empty?
51
- set :branch, "master"
52
- end
53
- end
54
-
55
- before "deploy:update" , "deploy:set_branch"
56
- end
57
-
58
- <% if @rvm_gemset -%>
59
- #############################################################
60
- # RVM
61
- #############################################################
62
-
63
- after "deploy", "rvm:trust_rvmrc"
64
-
65
- namespace :rvm do
66
- task :trust_rvmrc do
67
- run "rvm rvmrc trust #{current_release}"
68
- run "rvm rvmrc trust /var/www/apps/#{application}/current"
69
- end
70
- end
71
-
72
- <% end -%>
73
- #############################################################
74
- # Passenger
75
- #############################################################
76
-
77
- namespace :deploy do
78
- task :start do
79
- end
80
-
81
- task :stop do
82
- end
83
-
84
- task :restart, :roles => :app, :except => { :no_release => true } do
85
- run "touch #{File.join(current_path,'tmp','restart.txt')}"
86
- end
87
- end
@@ -1,3 +0,0 @@
1
- role :web, "<%= @name %>.tld"
2
- role :app, "<%= @name %>.tld"
3
- role :db, "<%= @name %>.tld", :primary => true