tempatra 0.0.2
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/LICENSE +20 -0
- data/README.md +66 -0
- data/Rakefile +68 -0
- data/VERSION +1 -0
- data/app_generators/tempatra/tempatra_generator.rb +192 -0
- data/app_generators/tempatra/templates/README.md.erb +17 -0
- data/app_generators/tempatra/templates/Rakefile.erb +40 -0
- data/app_generators/tempatra/templates/_gems +2 -0
- data/app_generators/tempatra/templates/_gitignore +4 -0
- data/app_generators/tempatra/templates/config.rb.erb +15 -0
- data/app_generators/tempatra/templates/config.ru.erb +8 -0
- data/app_generators/tempatra/templates/config.yml.erb +1 -0
- data/app_generators/tempatra/templates/features/homepage.feature.erb +3 -0
- data/app_generators/tempatra/templates/features/step_definitions/webrat_steps.rb +80 -0
- data/app_generators/tempatra/templates/features/support/env.rb.erb +25 -0
- data/app_generators/tempatra/templates/features/support/paths.rb +27 -0
- data/app_generators/tempatra/templates/lib/tempatra.rb.erb +17 -0
- data/app_generators/tempatra/templates/public/javascripts/application.js.erb +3 -0
- data/app_generators/tempatra/templates/public/javascripts/jquery-1.3.2.min.js +19 -0
- data/app_generators/tempatra/templates/spec/rcov.opts +1 -0
- data/app_generators/tempatra/templates/spec/spec.opts +4 -0
- data/app_generators/tempatra/templates/spec/spec_helper.rb.erb +35 -0
- data/app_generators/tempatra/templates/spec/tempatra_spec.rb.erb +10 -0
- data/app_generators/tempatra/templates/views/index.haml.erb +12 -0
- data/app_generators/tempatra/templates/views/layout.haml.erb +60 -0
- data/app_generators/tempatra/templates/views/stylesheets/ie.sass +15 -0
- data/app_generators/tempatra/templates/views/stylesheets/main.sass.erb +89 -0
- data/app_generators/tempatra/templates/views/stylesheets/partials/_base.sass.erb +11 -0
- data/app_generators/tempatra/templates/views/stylesheets/print.sass +3 -0
- data/bin/tempatra +21 -0
- data/lib/tempatra.rb +0 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/tempatra_spec.rb +17 -0
- metadata +200 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Olivier Lauzon
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
Tempatra
|
2
|
+
========
|
3
|
+
|
4
|
+
A RubiGen Sinatra application generator providing Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
$ sudo gem install olauzon-tempatra -s http://gems.github.com/
|
10
|
+
|
11
|
+
Basic Usage
|
12
|
+
-----------
|
13
|
+
|
14
|
+
To generate a new application:
|
15
|
+
|
16
|
+
$ tempatra your-app-name
|
17
|
+
|
18
|
+
Move into your new application:
|
19
|
+
|
20
|
+
$ cd your-app-name
|
21
|
+
|
22
|
+
Run your application:
|
23
|
+
|
24
|
+
$ thin start -p 4567 -R config.ru
|
25
|
+
|
26
|
+
Then go to [http://localhost:4567/](http://localhost:4567/) with your browser.
|
27
|
+
|
28
|
+
While you develop, continuously compile your Sass stylesheets with Compass (in another terminal):
|
29
|
+
|
30
|
+
$ compass --watch
|
31
|
+
|
32
|
+
And of course, use autospec (in yet another terminal)
|
33
|
+
|
34
|
+
$ autospec
|
35
|
+
|
36
|
+
|
37
|
+
Options
|
38
|
+
-------
|
39
|
+
|
40
|
+
Show all options
|
41
|
+
|
42
|
+
$ tempatra
|
43
|
+
|
44
|
+
Display Tempatra version number
|
45
|
+
|
46
|
+
$ tempatra -v
|
47
|
+
|
48
|
+
Create git repository
|
49
|
+
|
50
|
+
$ tempatra your-app-name -G
|
51
|
+
|
52
|
+
Create and push to Heroku
|
53
|
+
|
54
|
+
$ tempatra your-app-name -H
|
55
|
+
|
56
|
+
|
57
|
+
Inspiration
|
58
|
+
-----------
|
59
|
+
|
60
|
+
Aaron Quint's [sinatra-gen](http://github.com/quirkey/sinatra-gen) is a Sinatra application generator that provides many options.
|
61
|
+
|
62
|
+
|
63
|
+
Copyright
|
64
|
+
---------
|
65
|
+
|
66
|
+
Copyright (c) 2009 Olivier Lauzon. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "tempatra"
|
8
|
+
gem.summary = %Q{A RubiGen based Sinatra application generator.}
|
9
|
+
gem.description = %Q{A Sinatra application generator using Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.}
|
10
|
+
gem.email = "olauzon@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/olauzon/tempatra"
|
12
|
+
gem.authors = ["Olivier Lauzon"]
|
13
|
+
|
14
|
+
gem.add_dependency('chriseppstein-compass', '>= 0.8.12')
|
15
|
+
gem.add_dependency('cucumber', '>= 0.3.98')
|
16
|
+
gem.add_dependency('haml', '>= 2.2.3')
|
17
|
+
gem.add_dependency('rack-test', '>= 0.4.1')
|
18
|
+
gem.add_dependency('rake', '>= 0.8.7')
|
19
|
+
gem.add_dependency('rdiscount', '>= 1.3.5')
|
20
|
+
gem.add_dependency('rspec')
|
21
|
+
gem.add_dependency('rubigen', '>= 1.5.2')
|
22
|
+
gem.add_dependency('sinatra', '>= 0.9.4')
|
23
|
+
gem.add_dependency('thin', '>= 1.2.2')
|
24
|
+
gem.add_dependency('webrat', '>= 0.5.1')
|
25
|
+
|
26
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
27
|
+
gem.files = FileList[ 'app_generators/**/*',
|
28
|
+
'bin/*',
|
29
|
+
'lib/**/*.rb',
|
30
|
+
'[A-Z]*',
|
31
|
+
'spec/**/*'].to_a
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'spec/rake/spectask'
|
38
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
39
|
+
spec.libs << 'lib' << 'spec'
|
40
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
41
|
+
end
|
42
|
+
|
43
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
44
|
+
spec.libs << 'lib' << 'spec'
|
45
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
46
|
+
spec.rcov = true
|
47
|
+
spec.rcov_opts = lambda do
|
48
|
+
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
task :spec => :check_dependencies
|
53
|
+
|
54
|
+
task :default => :spec
|
55
|
+
|
56
|
+
require 'rake/rdoctask'
|
57
|
+
Rake::RDocTask.new do |rdoc|
|
58
|
+
if File.exist?('VERSION')
|
59
|
+
version = File.read('VERSION')
|
60
|
+
else
|
61
|
+
version = ""
|
62
|
+
end
|
63
|
+
|
64
|
+
rdoc.rdoc_dir = 'rdoc'
|
65
|
+
rdoc.title = "tempatra #{version}"
|
66
|
+
rdoc.rdoc_files.include('README*')
|
67
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
68
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class RubiGen::Commands::Create
|
4
|
+
|
5
|
+
def run(command, relative_path = '')
|
6
|
+
in_directory = destination_path(relative_path)
|
7
|
+
logger.run command
|
8
|
+
system("cd #{in_directory} && #{command}")
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class TempatraGenerator < RubiGen::Base
|
14
|
+
attr_reader :app_name,
|
15
|
+
:app_file_name,
|
16
|
+
:app_full_name,
|
17
|
+
:module_name,
|
18
|
+
:git_init,
|
19
|
+
:heroku
|
20
|
+
|
21
|
+
def initialize(runtime_args, runtime_options = {})
|
22
|
+
super
|
23
|
+
usage if args.empty?
|
24
|
+
@destination_root = args.shift
|
25
|
+
@app_name = File.basename(File.expand_path(@destination_root))
|
26
|
+
@app_file_name = app_name.gsub('-', '_')
|
27
|
+
@app_full_name = app_file_name.split('_').map{|w| w.capitalize }.join(' ')
|
28
|
+
@module_name = app_file_name.camelize
|
29
|
+
extract_options
|
30
|
+
end
|
31
|
+
|
32
|
+
def manifest
|
33
|
+
record do |m|
|
34
|
+
# Root directory and all subdirectories.
|
35
|
+
m.directory ''
|
36
|
+
BASEDIRS.each { |path| m.directory path }
|
37
|
+
|
38
|
+
# Root
|
39
|
+
m.template "_gems" , ".gems"
|
40
|
+
m.template "_gitignore" , ".gitignore"
|
41
|
+
m.template "config.rb.erb" , "config.rb"
|
42
|
+
m.template "config.ru.erb" , "config.ru"
|
43
|
+
m.template "config.yml.erb", "config.yml"
|
44
|
+
m.template "Rakefile.erb" , "Rakefile"
|
45
|
+
m.template "README.md.erb" , "README.md"
|
46
|
+
|
47
|
+
# Sinatra
|
48
|
+
m.template "lib/tempatra.rb.erb" , "lib/#{app_file_name}.rb"
|
49
|
+
|
50
|
+
# Haml
|
51
|
+
m.template "views/layout.haml.erb" , "views/layout.haml"
|
52
|
+
m.template "views/index.haml.erb" , "views/index.haml"
|
53
|
+
|
54
|
+
# jQuery
|
55
|
+
m.template "public/javascripts/jquery-1.3.2.min.js",
|
56
|
+
"public/javascripts/jquery-1.3.2.min.js"
|
57
|
+
|
58
|
+
m.template "public/javascripts/application.js.erb",
|
59
|
+
"public/javascripts/application.js"
|
60
|
+
|
61
|
+
# Cucumber
|
62
|
+
m.template "features/homepage.feature.erb",
|
63
|
+
"features/homepage.feature"
|
64
|
+
|
65
|
+
m.template "features/step_definitions/webrat_steps.rb",
|
66
|
+
"features/step_definitions/webrat_steps.rb"
|
67
|
+
|
68
|
+
m.template "features/support/env.rb.erb",
|
69
|
+
"features/support/env.rb"
|
70
|
+
|
71
|
+
m.template "features/support/paths.rb",
|
72
|
+
"features/support/paths.rb"
|
73
|
+
|
74
|
+
# RSpec
|
75
|
+
m.template "spec/rcov.opts",
|
76
|
+
"spec/rcov.opts"
|
77
|
+
|
78
|
+
m.template "spec/spec.opts",
|
79
|
+
"spec/spec.opts"
|
80
|
+
|
81
|
+
m.template "spec/spec_helper.rb.erb",
|
82
|
+
"spec/spec_helper.rb"
|
83
|
+
|
84
|
+
m.template "spec/tempatra_spec.rb.erb",
|
85
|
+
"spec/#{app_file_name}_spec.rb"
|
86
|
+
|
87
|
+
# Sass
|
88
|
+
m.template "views/stylesheets/ie.sass",
|
89
|
+
"views/stylesheets/ie.sass"
|
90
|
+
|
91
|
+
m.template "views/stylesheets/main.sass.erb",
|
92
|
+
"views/stylesheets/main.sass"
|
93
|
+
|
94
|
+
m.template "views/stylesheets/print.sass",
|
95
|
+
"views/stylesheets/print.sass"
|
96
|
+
|
97
|
+
m.template "views/stylesheets/partials/_base.sass.erb",
|
98
|
+
"views/stylesheets/partials/_base.sass"
|
99
|
+
|
100
|
+
# Compass
|
101
|
+
compass = which "compass"
|
102
|
+
unless File.exist?(File.expand_path(@destination_root) + '/public/images/grid.png')
|
103
|
+
m.run("#{compass} --force --grid-img --images-dir public/images")
|
104
|
+
end
|
105
|
+
m.run("#{compass}")
|
106
|
+
|
107
|
+
# Git
|
108
|
+
if git_init || heroku
|
109
|
+
git = which "git"
|
110
|
+
unless File.exist?(File.expand_path(@destination_root) + '/.git/config')
|
111
|
+
m.run("#{git} init")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Heroku
|
116
|
+
if heroku
|
117
|
+
heroku = which "heroku"
|
118
|
+
m.run("#{heroku} create")
|
119
|
+
m.run("#{git} add .")
|
120
|
+
m.run("#{git} commit -m 'Initial commit'")
|
121
|
+
m.run("#{git} push heroku master")
|
122
|
+
m.run("#{heroku} open")
|
123
|
+
end
|
124
|
+
|
125
|
+
# Display introductory message
|
126
|
+
m.puts "
|
127
|
+
----------------------
|
128
|
+
#{app_full_name}
|
129
|
+
|
130
|
+
Move into your new application
|
131
|
+
$ cd #{app_name}
|
132
|
+
|
133
|
+
To run your application
|
134
|
+
$ thin start -p 4567 -R config.ru
|
135
|
+
(Then go to http://localhost:4567/ with your browser)
|
136
|
+
|
137
|
+
While you develop, continuously compile your Sass stylesheets with Compass (in another terminal)
|
138
|
+
$ compass --watch
|
139
|
+
|
140
|
+
And of course, use autospec (in yet another terminal)
|
141
|
+
$ autospec
|
142
|
+
|
143
|
+
|
144
|
+
"
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
protected
|
150
|
+
|
151
|
+
def banner
|
152
|
+
<<-EOS
|
153
|
+
----------------------
|
154
|
+
Tempatra
|
155
|
+
|
156
|
+
A Sinatra application generator using Blueprint CSS, jQuery, Haml, Sass, Compass, RSpec, Cucumber, and Webrat.
|
157
|
+
|
158
|
+
Usage: tempatra your-app-name [options]
|
159
|
+
EOS
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_options!(opts)
|
163
|
+
opts.separator ''
|
164
|
+
opts.separator "Tempatra options:"
|
165
|
+
opts.on("-v", "--version", "Show the Tempatra version number and quit")
|
166
|
+
opts.on("-G", "--git-init", "Create a git repository") {|o| options[:git] = o}
|
167
|
+
opts.on("-H", "--heroku", "Create and push to Heroku") {|o| options[:heroku] = o}
|
168
|
+
end
|
169
|
+
|
170
|
+
BASEDIRS = %w(
|
171
|
+
features
|
172
|
+
features/step_definitions
|
173
|
+
features/support
|
174
|
+
lib
|
175
|
+
public
|
176
|
+
public/javascripts
|
177
|
+
spec
|
178
|
+
views
|
179
|
+
views/stylesheets
|
180
|
+
views/stylesheets/partials
|
181
|
+
)
|
182
|
+
|
183
|
+
def extract_options
|
184
|
+
@git_init = options[:git] ? true : false
|
185
|
+
@heroku = options[:heroku] ? true : false
|
186
|
+
end
|
187
|
+
|
188
|
+
def which(bin)
|
189
|
+
`which #{bin}`.strip
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# <%= app_full_name %> #
|
2
|
+
|
3
|
+
## Usage ##
|
4
|
+
|
5
|
+
To run your application:
|
6
|
+
|
7
|
+
$ thin start -p 4567 -R config.ru
|
8
|
+
|
9
|
+
Then go to http://localhost:4567/ with your browser.
|
10
|
+
|
11
|
+
While you develop, continuously compile your Sass stylesheets with Compass (in another terminal):
|
12
|
+
|
13
|
+
$ compass --watch
|
14
|
+
|
15
|
+
And of course, use autospec (in yet another terminal):
|
16
|
+
|
17
|
+
$ autospec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
require 'spec/rake/spectask'
|
6
|
+
|
7
|
+
|
8
|
+
task :default => [ :spec, :cucumber ]
|
9
|
+
|
10
|
+
desc "Run the code examples in spec/"
|
11
|
+
Spec::Rake::SpecTask.new do |t|
|
12
|
+
t.spec_opts = ['--options', "\"spec/spec.opts\""]
|
13
|
+
t.spec_files = FileList["spec/*_spec.rb"]
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :spec do
|
17
|
+
|
18
|
+
desc "Run all specs in spec directory with RCov"
|
19
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
20
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
21
|
+
t.spec_files = FileList['spec/*_spec.rb']
|
22
|
+
t.rcov = true
|
23
|
+
t.rcov_opts = lambda do
|
24
|
+
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Print Specdoc for all specs"
|
29
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
30
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
31
|
+
t.spec_files = FileList['spec/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'cucumber/rake/task'
|
37
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run all Cucumber features') do |t|
|
38
|
+
t.fork = true # You may get faster startup if you set this to false
|
39
|
+
t.cucumber_opts = "--tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
40
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Compass configuration
|
2
|
+
|
3
|
+
# Require any additional compass plugins here.
|
4
|
+
project_type = :stand_alone
|
5
|
+
|
6
|
+
# Set this to the root of your project when deployed:
|
7
|
+
http_path = "/"
|
8
|
+
css_dir = "public/stylesheets"
|
9
|
+
sass_dir = "views/stylesheets"
|
10
|
+
images_dir = "public/images"
|
11
|
+
http_images_path = http_path + 'images'
|
12
|
+
output_style = :compact
|
13
|
+
|
14
|
+
# To enable relative paths to assets via compass helper functions. Uncomment:
|
15
|
+
# relative_assets = true
|