rails_templater 0.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/CHANGELOG +17 -0
- data/README.textile +58 -0
- data/Rakefile +5 -0
- data/TODO.textile +5 -5
- data/bin/templater +0 -0
- data/lib/rails_templater.rb +14 -5
- data/lib/rails_templater/cli.rb +1 -1
- data/lib/rails_templater/fixture_replacement.rb +23 -0
- data/lib/rails_templater/javascript_framework.rb +23 -0
- data/lib/rails_templater/orm.rb +23 -0
- data/lib/rails_templater/templater.rb +49 -0
- data/lib/rails_templater/testing_framework.rb +23 -0
- data/lib/rails_templater/version.rb +1 -1
- data/lib/template_framework/core_ext.rb +15 -0
- data/lib/{template → template_framework}/generators/factory_girl.rb +0 -0
- data/lib/{template → template_framework}/generators/factory_girl/model/model_generator.rb +0 -0
- data/lib/{template → template_framework}/generators/factory_girl/model/templates/fixtures.rb +0 -0
- data/lib/template_framework/recipes/active_record.rb +5 -0
- data/lib/template_framework/recipes/cucumber.rb +37 -0
- data/lib/{template → template_framework}/recipes/default.rb +2 -5
- data/lib/template_framework/recipes/factory_girl.rb +11 -0
- data/lib/template_framework/recipes/git.rb +3 -0
- data/lib/template_framework/recipes/haml.rb +7 -0
- data/lib/template_framework/recipes/javascript_framework.rb +18 -0
- data/lib/template_framework/recipes/jquery.rb +10 -0
- data/lib/template_framework/recipes/mongoid.rb +11 -0
- data/lib/template_framework/recipes/orm.rb +19 -0
- data/lib/template_framework/recipes/remarkable.rb +12 -0
- data/lib/template_framework/recipes/rspec.rb +22 -0
- data/lib/template_framework/recipes/sass.rb +48 -0
- data/lib/template_framework/recipes/test_unit.rb +1 -0
- data/lib/template_framework/recipes/testing_framework.rb +19 -0
- data/lib/{template → template_framework}/snippets/cucumber/factory_girl +0 -0
- data/lib/{template/snippets/rails/generators → template_framework/snippets/factory_girl/generator} +0 -0
- data/lib/{template → template_framework}/snippets/rspec/mongoid +0 -0
- data/lib/template_framework/template_runner.rb +19 -0
- data/lib/template_framework/templates/active_record/config/database.yml +22 -0
- data/lib/{template → template_framework}/templates/git/gitignore +0 -0
- data/lib/{template → template_framework}/templates/haml/app/views/layouts/application.html.haml +0 -0
- data/lib/{template → template_framework}/templates/mongoid/features/step_definitions/mongoid_steps.rb +0 -0
- data/lib/{template → template_framework}/templates/mongoid/features/support/hooks.rb +0 -0
- data/rails_templater.gemspec +2 -0
- data/spec/fixtures/sample_snippet +1 -0
- data/spec/fixtures/sample_template.rb +0 -0
- data/spec/rails_templater/fixture_replacement_spec.rb +29 -0
- data/spec/rails_templater/javascript_framework_spec.rb +36 -0
- data/spec/rails_templater/orm_spec.rb +36 -0
- data/spec/rails_templater/templater_spec.rb +65 -0
- data/spec/rails_templater/testing_framework_spec.rb +35 -0
- data/spec/rails_templater_spec.rb +9 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/fixtures.rb +5 -0
- data/spec/support/paths.rb +1 -0
- metadata +65 -26
- data/README.md +0 -42
- data/lib/template/core_extensions.rb +0 -53
- data/lib/template/recipes/cucumber.rb +0 -22
- data/lib/template/recipes/design.rb +0 -16
- data/lib/template/recipes/factory_girl.rb +0 -5
- data/lib/template/recipes/haml.rb +0 -5
- data/lib/template/recipes/jquery.rb +0 -7
- data/lib/template/recipes/mongoid.rb +0 -7
- data/lib/template/recipes/remarkable.rb +0 -6
- data/lib/template/recipes/rspec.rb +0 -12
- data/lib/template/templater.rb +0 -23
@@ -0,0 +1 @@
|
|
1
|
+
TEMPLATE_FRAMEWORK_PATH = File.join(File.dirname(__FILE__), '..', '..','lib', 'template_framework')
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kevin Faustino
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-30 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,20 @@ dependencies:
|
|
62
62
|
version: 0.14.6
|
63
63
|
type: :runtime
|
64
64
|
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
segments:
|
74
|
+
- 2
|
75
|
+
- 4
|
76
|
+
version: "2.4"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
65
79
|
description: Template generator for Ruby on Rails 3 applications
|
66
80
|
email:
|
67
81
|
- kevin.faustino@gmail.com
|
@@ -73,37 +87,62 @@ extra_rdoc_files: []
|
|
73
87
|
|
74
88
|
files:
|
75
89
|
- .gitignore
|
90
|
+
- .rspec
|
91
|
+
- CHANGELOG
|
76
92
|
- Gemfile
|
77
93
|
- LICENSE
|
78
|
-
- README.
|
94
|
+
- README.textile
|
79
95
|
- Rakefile
|
80
96
|
- TODO.textile
|
81
97
|
- bin/templater
|
82
98
|
- lib/rails_templater.rb
|
83
99
|
- lib/rails_templater/cli.rb
|
100
|
+
- lib/rails_templater/fixture_replacement.rb
|
101
|
+
- lib/rails_templater/javascript_framework.rb
|
102
|
+
- lib/rails_templater/orm.rb
|
103
|
+
- lib/rails_templater/templater.rb
|
104
|
+
- lib/rails_templater/testing_framework.rb
|
84
105
|
- lib/rails_templater/version.rb
|
85
|
-
- lib/
|
86
|
-
- lib/
|
87
|
-
- lib/
|
88
|
-
- lib/
|
89
|
-
- lib/
|
90
|
-
- lib/
|
91
|
-
- lib/
|
92
|
-
- lib/
|
93
|
-
- lib/
|
94
|
-
- lib/
|
95
|
-
- lib/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
102
|
-
- lib/
|
103
|
-
- lib/
|
104
|
-
- lib/
|
105
|
-
- lib/
|
106
|
+
- lib/template_framework/core_ext.rb
|
107
|
+
- lib/template_framework/generators/factory_girl.rb
|
108
|
+
- lib/template_framework/generators/factory_girl/model/model_generator.rb
|
109
|
+
- lib/template_framework/generators/factory_girl/model/templates/fixtures.rb
|
110
|
+
- lib/template_framework/recipes/active_record.rb
|
111
|
+
- lib/template_framework/recipes/cucumber.rb
|
112
|
+
- lib/template_framework/recipes/default.rb
|
113
|
+
- lib/template_framework/recipes/factory_girl.rb
|
114
|
+
- lib/template_framework/recipes/git.rb
|
115
|
+
- lib/template_framework/recipes/haml.rb
|
116
|
+
- lib/template_framework/recipes/javascript_framework.rb
|
117
|
+
- lib/template_framework/recipes/jquery.rb
|
118
|
+
- lib/template_framework/recipes/mongoid.rb
|
119
|
+
- lib/template_framework/recipes/orm.rb
|
120
|
+
- lib/template_framework/recipes/remarkable.rb
|
121
|
+
- lib/template_framework/recipes/rspec.rb
|
122
|
+
- lib/template_framework/recipes/sass.rb
|
123
|
+
- lib/template_framework/recipes/test_unit.rb
|
124
|
+
- lib/template_framework/recipes/testing_framework.rb
|
125
|
+
- lib/template_framework/snippets/cucumber/factory_girl
|
126
|
+
- lib/template_framework/snippets/factory_girl/generator
|
127
|
+
- lib/template_framework/snippets/rspec/mongoid
|
128
|
+
- lib/template_framework/template_runner.rb
|
129
|
+
- lib/template_framework/templates/active_record/config/database.yml
|
130
|
+
- lib/template_framework/templates/git/gitignore
|
131
|
+
- lib/template_framework/templates/haml/app/views/layouts/application.html.haml
|
132
|
+
- lib/template_framework/templates/mongoid/features/step_definitions/mongoid_steps.rb
|
133
|
+
- lib/template_framework/templates/mongoid/features/support/hooks.rb
|
106
134
|
- rails_templater.gemspec
|
135
|
+
- spec/fixtures/sample_snippet
|
136
|
+
- spec/fixtures/sample_template.rb
|
137
|
+
- spec/rails_templater/fixture_replacement_spec.rb
|
138
|
+
- spec/rails_templater/javascript_framework_spec.rb
|
139
|
+
- spec/rails_templater/orm_spec.rb
|
140
|
+
- spec/rails_templater/templater_spec.rb
|
141
|
+
- spec/rails_templater/testing_framework_spec.rb
|
142
|
+
- spec/rails_templater_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/support/fixtures.rb
|
145
|
+
- spec/support/paths.rb
|
107
146
|
has_rdoc: true
|
108
147
|
homepage: http://rubygems.org/gems/rails_templater
|
109
148
|
licenses: []
|
data/README.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# Rails Templater
|
2
|
-
|
3
|
-
This is a template which allows creating new Ruby on Rails 3 applications quickly using some opinionated defaults. It is inspired by ffmike's [BigOldRailsTemplate](http://github.com/ffmike/BigOldRailsTemplate) Rails 2 template project.
|
4
|
-
|
5
|
-
## Install
|
6
|
-
|
7
|
-
gem install rails_templater
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
At the command prompt, create a new Rails application using the *templater* command:
|
12
|
-
|
13
|
-
templater myapp_name
|
14
|
-
|
15
|
-
## Generated Application
|
16
|
-
|
17
|
-
Rails Templater will generate the following:
|
18
|
-
|
19
|
-
### Ruby on Rails
|
20
|
-
|
21
|
-
* Uses [Haml](http://haml-lang.com) as the template engine
|
22
|
-
* Uses [Sass](http://sass-lang.com) for generating CSS
|
23
|
-
* [jQuery](http://jquery.com/) for JavaScript over Prototype
|
24
|
-
* Optionally uses [Compass](http://compass-style.org) for design with the blueprint/semantic framework
|
25
|
-
|
26
|
-
## Database
|
27
|
-
|
28
|
-
* Uses [Mongoid](http://mongoid.org/) as the Object Document Mapper
|
29
|
-
* TODO: Optionally add the ability for other databases
|
30
|
-
|
31
|
-
## Testing
|
32
|
-
|
33
|
-
* [RSpec](http://github.com/rspec/rspec) for testing
|
34
|
-
* [factory_girl](http://github.com/thoughtbot/factory_girl) for fixture replacement
|
35
|
-
* [remarkable](http://github.com/remarkable/remarkable) for ActiveModel RSpec matchers
|
36
|
-
* Optionally uses [Cucumber](http://github.com/aslakhellesoy/cucumber-rails) for integration tests
|
37
|
-
|
38
|
-
## Note on Patches/Pull Requests
|
39
|
-
|
40
|
-
* Fork the project.
|
41
|
-
* Make your feature addition or bug fix in a branch.
|
42
|
-
* Send me a pull request.
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
module Generators
|
3
|
-
module Actions
|
4
|
-
|
5
|
-
attr_accessor :post_bundler_strategies
|
6
|
-
attr_reader :template_options
|
7
|
-
|
8
|
-
def initialize_templater
|
9
|
-
@post_bundler_strategies = []
|
10
|
-
@template_options = {}
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute_post_bundler_strategies
|
14
|
-
post_bundler_strategies.each {|strategy| strategy.call }
|
15
|
-
end
|
16
|
-
|
17
|
-
def load_options
|
18
|
-
say "Would you like to use a design framework?\n", Thor::Shell::Color::BLUE
|
19
|
-
print_table [ ['Option','Framework'], ['1', 'Compass with blueprint semantic'] ], :ident => 2
|
20
|
-
design_input = ask("Option: ", Thor::Shell::Color::BLUE)
|
21
|
-
@template_options[:design] = case design_input
|
22
|
-
when "1"
|
23
|
-
:compass
|
24
|
-
else
|
25
|
-
:none
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def recipe(name)
|
30
|
-
File.join File.dirname(__FILE__), 'recipes', "#{name}.rb"
|
31
|
-
end
|
32
|
-
|
33
|
-
def load_snippet(name, group)
|
34
|
-
path = File.expand_path name, snippet_path(group)
|
35
|
-
File.read path
|
36
|
-
end
|
37
|
-
|
38
|
-
def load_template(name, group)
|
39
|
-
path = File.expand_path name, template_path(group)
|
40
|
-
File.read path
|
41
|
-
end
|
42
|
-
|
43
|
-
def snippet_path(name)
|
44
|
-
File.join(File.dirname(__FILE__), 'snippets', name)
|
45
|
-
end
|
46
|
-
|
47
|
-
def template_path(name)
|
48
|
-
File.join(File.dirname(__FILE__), 'templates', name)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
gem 'capybara', '0.4.0', :group => :test
|
2
|
-
gem 'cucumber-rails', :group => :test
|
3
|
-
gem 'launchy', :group => :test
|
4
|
-
|
5
|
-
post_bundler_strategies << lambda do
|
6
|
-
generate 'cucumber:install --rspec --capybara --skip-database'
|
7
|
-
|
8
|
-
gsub_file 'features/support/env.rb',
|
9
|
-
"require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript", ''
|
10
|
-
|
11
|
-
inject_into_file "features/support/env.rb",
|
12
|
-
"\nCapybara.save_and_open_page_path = 'tmp/capybara/'",
|
13
|
-
:after => 'Capybara.default_selector = :css'
|
14
|
-
|
15
|
-
inject_into_file "features/support/env.rb", load_snippet('factory_girl', 'cucumber'), :after => 'ActionController::Base.allow_rescue = false'
|
16
|
-
|
17
|
-
# Mongoid truncation strategy
|
18
|
-
create_file 'features/support/hooks.rb', load_template('features/support/hooks.rb', 'mongoid')
|
19
|
-
|
20
|
-
# Compliment to factory_girl step definitions
|
21
|
-
create_file 'features/step_definitions/mongoid_steps.rb', load_template('features/step_definitions/mongoid_steps.rb', 'mongoid')
|
22
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
if template_options[:design] == :compass
|
2
|
-
gem 'compass'
|
3
|
-
|
4
|
-
# TODO: support more than one framework from compass
|
5
|
-
compass_sass_dir = "app/stylesheets"
|
6
|
-
compass_css_dir = "public/stylesheets/compiled"
|
7
|
-
|
8
|
-
compass_command = "compass init rails . --using blueprint/semantic --css-dir=#{compass_css_dir} --sass-dir=#{compass_sass_dir} "
|
9
|
-
|
10
|
-
post_bundler_strategies << lambda do
|
11
|
-
puts "Beginning Compass setup"
|
12
|
-
run compass_command
|
13
|
-
puts "Compass has been setup"
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
gem 'remarkable_activemodel', '>=4.0.0.alpha4', :group => :test
|
2
|
-
gem 'remarkable_mongoid', :group => :test
|
3
|
-
|
4
|
-
post_bundler_strategies << lambda do
|
5
|
-
inject_into_file 'spec/spec_helper.rb', "\nrequire 'remarkable/active_model'\nrequire 'remarkable/mongoid'", :after => "require 'rspec/rails'"
|
6
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
gem 'rspec-rails', '>= 2.4.1', :group => [:development]
|
2
|
-
|
3
|
-
post_bundler_strategies << lambda do
|
4
|
-
generate 'rspec:install'
|
5
|
-
|
6
|
-
spec_helper_path = 'spec/spec_helper.rb'
|
7
|
-
|
8
|
-
gsub_file spec_helper_path, 'config.fixture_path = "#{::Rails.root}/spec/fixtures"', ''
|
9
|
-
gsub_file spec_helper_path, /(config.use_transactional_fixtures = true)/, '# \1'
|
10
|
-
inject_into_file spec_helper_path, load_snippet('mongoid', 'rspec'), :after => "# config.use_transactional_fixtures = true\n"
|
11
|
-
|
12
|
-
end
|
data/lib/template/templater.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'core_extensions.rb')
|
2
|
-
|
3
|
-
initialize_templater
|
4
|
-
|
5
|
-
required_recipes = %w(default mongoid jquery haml rspec factory_girl remarkable)
|
6
|
-
required_recipes.each {|required_recipe| apply recipe(required_recipe)}
|
7
|
-
|
8
|
-
say("\nInitial generation complete\n", Thor::Shell::Color::YELLOW)
|
9
|
-
|
10
|
-
load_options
|
11
|
-
apply(recipe('cucumber')) if yes?("\nWould you like to add integration testing with Cucumber? [y|n]: ", Thor::Shell::Color::BLUE)
|
12
|
-
apply recipe('design')
|
13
|
-
|
14
|
-
run 'bundle install'
|
15
|
-
|
16
|
-
execute_post_bundler_strategies
|
17
|
-
|
18
|
-
environment load_snippet('generators', 'rails')
|
19
|
-
|
20
|
-
directory File.join(File.dirname(__FILE__),'generators'), 'lib/generators'
|
21
|
-
|
22
|
-
git :add => "."
|
23
|
-
git :commit => "-m 'Initial commit'"
|