herage 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/bin/herage +20 -0
- data/herage.gemspec +20 -0
- data/lib/herage/version.rb +3 -0
- data/lib/herage.rb +5 -0
- data/lib/template.rb +167 -0
- metadata +105 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 olistik
|
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,48 @@
|
|
1
|
+
# Herage
|
2
|
+
|
3
|
+
A RubyonRails application generator tailored to a very opinionated set of requirements:
|
4
|
+
|
5
|
+
* postgres
|
6
|
+
* foreman
|
7
|
+
* thin
|
8
|
+
* haml
|
9
|
+
* twitter bootstrap
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
* Postgres server
|
14
|
+
* Heroku gem
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
$ gem install herage
|
19
|
+
|
20
|
+
* by default it uses the username "olistik" and the blank password to acces the database. It's likely going to change in the next releases. ^_^
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```bash
|
25
|
+
herage <app_name>
|
26
|
+
```
|
27
|
+
|
28
|
+
wait 2-3 minutes..
|
29
|
+
|
30
|
+
```bash
|
31
|
+
cd <app_name>
|
32
|
+
heroku open
|
33
|
+
```
|
34
|
+
|
35
|
+
TODO
|
36
|
+
----
|
37
|
+
|
38
|
+
* split here-documents into separate template files
|
39
|
+
* set configurations in ~/.herage and allow the override of sensible defaults
|
40
|
+
* use `system` instead of `exec` ?
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
1. Fork it
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/herage
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'herage'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
app_name = ARGV[0]
|
7
|
+
|
8
|
+
if app_name.nil?
|
9
|
+
puts "Usage:\nherage <app_name>"
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
if app_name =~ /[^a-z]/
|
14
|
+
puts "Usage:\nherage <app_name>"
|
15
|
+
puts "<app_name> should be composed only by alphabetics characters, ie: \"awesomeapp\""
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
template_path = File.expand_path(File.join(__FILE__, '../../lib/template.rb'))
|
20
|
+
exec "rails new #{app_name} -d postgresql -m #{template_path}"
|
data/herage.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/herage/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["olistik"]
|
6
|
+
gem.email = ["maurizio.demagnis@gmail.com"]
|
7
|
+
gem.description = %q{A RubyonRails application generator tailored to a very opinionated set of requirements}
|
8
|
+
gem.summary = %q{Unleash the rage with Heroku and Rails}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.add_dependency 'pg'
|
12
|
+
gem.add_dependency 'heroku', '~> 2.25.0'
|
13
|
+
gem.add_dependency 'rails', '~> 3.2.6'
|
14
|
+
gem.files = `git ls-files`.split($\)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.name = "herage"
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.version = Herage::VERSION
|
20
|
+
end
|
data/lib/herage.rb
ADDED
data/lib/template.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# Usage:
|
2
|
+
# rails new <app_name> -d postgresql -m /path/to/template.rb
|
3
|
+
# cd <app_name>
|
4
|
+
# heroku open
|
5
|
+
|
6
|
+
git :init
|
7
|
+
git add: "."
|
8
|
+
git commit: "-a -m 'Genesis'"
|
9
|
+
|
10
|
+
insert_into_file 'Gemfile', "ruby '1.9.3'\n", after: "source 'https://rubygems.org'\n"
|
11
|
+
|
12
|
+
gem 'heroku'
|
13
|
+
gem 'foreman'
|
14
|
+
gem 'thin'
|
15
|
+
gem 'haml-rails'
|
16
|
+
gem 'twitter-bootstrap-rails', git: 'git://github.com/seyhunak/twitter-bootstrap-rails.git', branch: 'static'
|
17
|
+
gem_group :development do
|
18
|
+
gem 'pry'
|
19
|
+
end
|
20
|
+
# removes comments from the Gemfile
|
21
|
+
gsub_file 'Gemfile', /# .*\n/, ''
|
22
|
+
# removes empty lines
|
23
|
+
gsub_file 'Gemfile', /\s+\n/, "\n"
|
24
|
+
gsub_file 'Gemfile', /\n+/, "\n"
|
25
|
+
|
26
|
+
run 'bundle install --local'
|
27
|
+
run 'rbenv rehash'
|
28
|
+
|
29
|
+
remove_file 'public/index.html'
|
30
|
+
git rm: 'public/index.html'
|
31
|
+
generate(:controller, 'home index')
|
32
|
+
route "root :to => 'home#index'"
|
33
|
+
|
34
|
+
|
35
|
+
create_file 'Procfile', 'web: bundle exec thin start -p $PORT'
|
36
|
+
|
37
|
+
create_file '.env', ''
|
38
|
+
|
39
|
+
append_file '.gitignore' do
|
40
|
+
<<-eos
|
41
|
+
.env
|
42
|
+
.DS_Store
|
43
|
+
eos
|
44
|
+
end
|
45
|
+
|
46
|
+
gsub_file 'config/database.yml', /(username: ).+$/, '\1olistik'
|
47
|
+
|
48
|
+
rake "db:create", env: 'development'
|
49
|
+
rake "db:create", env: 'test'
|
50
|
+
|
51
|
+
remove_file 'app/views/layouts/application.html.erb'
|
52
|
+
git rm: 'app/views/layouts/application.html.erb'
|
53
|
+
create_file 'app/views/layouts/application.html.haml' do
|
54
|
+
<<-eos
|
55
|
+
!!! 5
|
56
|
+
%html{lang: I18n.locale}
|
57
|
+
%head
|
58
|
+
%title MyApp
|
59
|
+
= stylesheet_link_tag 'application', media: 'all'
|
60
|
+
= javascript_include_tag 'application'
|
61
|
+
= csrf_meta_tags
|
62
|
+
%body
|
63
|
+
= yield
|
64
|
+
eos
|
65
|
+
end
|
66
|
+
|
67
|
+
prepend_to_file 'config.ru' do
|
68
|
+
<<-eos
|
69
|
+
# Disable stdout buffering to enable Heroku's realtime logging.
|
70
|
+
$stdout.sync = true
|
71
|
+
eos
|
72
|
+
end
|
73
|
+
|
74
|
+
application do
|
75
|
+
<<-eos
|
76
|
+
# Heroku requires this to make deployments work.
|
77
|
+
config.assets.initialize_on_precompile = false
|
78
|
+
eos
|
79
|
+
end
|
80
|
+
|
81
|
+
remove_file 'app/assets/javascripts/application.js'
|
82
|
+
create_file 'app/assets/javascripts/application.js' do
|
83
|
+
<<-eos
|
84
|
+
//= require jquery
|
85
|
+
//= require jquery_ujs
|
86
|
+
//= require bootstrap
|
87
|
+
//= require_tree .
|
88
|
+
eos
|
89
|
+
end
|
90
|
+
|
91
|
+
remove_file 'app/assets/stylesheets/application.css'
|
92
|
+
create_file 'app/assets/stylesheets/application.css' do
|
93
|
+
<<-eos
|
94
|
+
/*
|
95
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
96
|
+
*= require_self
|
97
|
+
*= require bootstrap
|
98
|
+
*= require_tree .
|
99
|
+
*/
|
100
|
+
eos
|
101
|
+
end
|
102
|
+
|
103
|
+
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less'
|
104
|
+
remove_file 'app/assets/javascripts/bootstrap.js.coffee'
|
105
|
+
|
106
|
+
remove_file 'README.rdoc'
|
107
|
+
create_file 'README.md' do
|
108
|
+
<<-eos
|
109
|
+
# RAILS HEROKU APP
|
110
|
+
|
111
|
+
Usage
|
112
|
+
-----
|
113
|
+
|
114
|
+
```bash
|
115
|
+
foreman start
|
116
|
+
```
|
117
|
+
|
118
|
+
## .env
|
119
|
+
|
120
|
+
Put in .env file the environment variables. e.g.:
|
121
|
+
|
122
|
+
```
|
123
|
+
TWITTER_KEY=your-secret-key
|
124
|
+
TWITTER_SECRET=your-secret
|
125
|
+
```
|
126
|
+
|
127
|
+
TODO
|
128
|
+
____
|
129
|
+
|
130
|
+
License
|
131
|
+
-------
|
132
|
+
|
133
|
+
Copyright (c) 2012 Maurizio de Magnis. Distributed under the MIT License. See LICENSE.txt for further details.
|
134
|
+
eos
|
135
|
+
end
|
136
|
+
|
137
|
+
create_file 'LICENSE.txt' do
|
138
|
+
<<-eos
|
139
|
+
Copyright (c) 2012 Maurizio De Magnis
|
140
|
+
|
141
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
142
|
+
a copy of this software and associated documentation files (the
|
143
|
+
"Software"), to deal in the Software without restriction, including
|
144
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
145
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
146
|
+
permit persons to whom the Software is furnished to do so, subject to
|
147
|
+
the following conditions:
|
148
|
+
|
149
|
+
The above copyright notice and this permission notice shall be
|
150
|
+
included in all copies or substantial portions of the Software.
|
151
|
+
|
152
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
153
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
154
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
155
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
156
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
157
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
158
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
159
|
+
eos
|
160
|
+
end
|
161
|
+
|
162
|
+
git add: "."
|
163
|
+
git commit: "-a -m 'Setup'"
|
164
|
+
|
165
|
+
run "heroku apps:create --stack cedar #{app_name}"
|
166
|
+
run 'git push heroku master'
|
167
|
+
run 'heroku run rake db:migrate'
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: herage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- olistik
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pg
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: heroku
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.25.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.25.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.2.6
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.2.6
|
62
|
+
description: A RubyonRails application generator tailored to a very opinionated set
|
63
|
+
of requirements
|
64
|
+
email:
|
65
|
+
- maurizio.demagnis@gmail.com
|
66
|
+
executables:
|
67
|
+
- herage
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- .gitignore
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- bin/herage
|
77
|
+
- herage.gemspec
|
78
|
+
- lib/herage.rb
|
79
|
+
- lib/herage/version.rb
|
80
|
+
- lib/template.rb
|
81
|
+
homepage: ''
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.8.23
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Unleash the rage with Heroku and Rails
|
105
|
+
test_files: []
|