rails_templater 0.2.1 → 0.3.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 (52) hide show
  1. data/CHANGELOG +17 -4
  2. data/README.textile +1 -0
  3. data/lib/rails_templater.rb +0 -1
  4. data/lib/rails_templater/cli.rb +1 -2
  5. data/lib/rails_templater/fixture_replacement.rb +6 -7
  6. data/lib/rails_templater/javascript_framework.rb +5 -6
  7. data/lib/rails_templater/orm.rb +5 -6
  8. data/lib/rails_templater/template_engine.rb +1 -2
  9. data/lib/rails_templater/templater.rb +0 -1
  10. data/lib/rails_templater/testing_framework.rb +3 -5
  11. data/lib/rails_templater/version.rb +1 -1
  12. data/lib/template_framework/core_ext.rb +1 -3
  13. data/lib/template_framework/recipes/compass.rb +45 -0
  14. data/lib/template_framework/recipes/cover_me.rb +1 -1
  15. data/lib/template_framework/recipes/cucumber.rb +7 -21
  16. data/lib/template_framework/recipes/erb.rb +2 -0
  17. data/lib/template_framework/recipes/fabrication.rb +7 -0
  18. data/lib/template_framework/recipes/factory_girl.rb +5 -10
  19. data/lib/template_framework/recipes/fixture_replacement.rb +18 -0
  20. data/lib/template_framework/recipes/haml.rb +0 -1
  21. data/lib/template_framework/recipes/javascript_framework.rb +11 -4
  22. data/lib/template_framework/recipes/mongoid.rb +3 -2
  23. data/lib/template_framework/recipes/orm.rb +1 -1
  24. data/lib/template_framework/recipes/pry.rb +4 -0
  25. data/lib/template_framework/recipes/rspec.rb +6 -5
  26. data/lib/template_framework/recipes/shoulda_matchers.rb +1 -0
  27. data/lib/template_framework/recipes/slim.rb +1 -1
  28. data/lib/template_framework/recipes/template_engine.rb +2 -3
  29. data/lib/template_framework/recipes/test_unit.rb +1 -0
  30. data/lib/template_framework/recipes/testing_framework.rb +1 -1
  31. data/lib/template_framework/snippets/cucumber/factory_girl +1 -1
  32. data/lib/template_framework/snippets/fabrication/generator_rspec +4 -0
  33. data/lib/template_framework/snippets/fabrication/generator_test_unit +5 -0
  34. data/lib/template_framework/snippets/factory_girl/{generator → generator_rspec} +0 -0
  35. data/lib/template_framework/snippets/factory_girl/generator_test_unit +5 -0
  36. data/lib/template_framework/template_runner.rb +1 -1
  37. data/lib/template_framework/templates/erb/app/views/layouts/application.html.erb +15 -0
  38. data/lib/template_framework/templates/git/gitignore +1 -3
  39. data/lib/template_framework/templates/haml/app/views/layouts/application.html.haml +1 -1
  40. data/lib/template_framework/templates/jquery/app/assets/javascripts/application.js +14 -0
  41. data/lib/template_framework/templates/mongoid/lib/tasks/assets.rake +14 -0
  42. data/lib/template_framework/templates/prototype/app/assets/javascripts/application.js +15 -0
  43. data/lib/template_framework/templates/slim/app/views/layouts/application.html.slim +1 -1
  44. data/rails_templater.gemspec +3 -4
  45. metadata +58 -78
  46. data/lib/template_framework/generators/factory_girl.rb +0 -11
  47. data/lib/template_framework/generators/factory_girl/model/model_generator.rb +0 -14
  48. data/lib/template_framework/generators/factory_girl/model/templates/fixtures.rb +0 -9
  49. data/lib/template_framework/recipes/jquery.rb +0 -10
  50. data/lib/template_framework/recipes/remarkable.rb +0 -12
  51. data/lib/template_framework/recipes/sass.rb +0 -54
  52. data/lib/template_framework/templates/mongoid/features/support/hooks.rb +0 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ In Development
2
+
3
+ 0.3.0 (March 14, 2012)
4
+ * Updated to work with Rails Asset Pipeline
5
+ * Removed Sass recipe as it is now the default in Rails
6
+ * Added Pry recipe for IRB Replacement
7
+ * Added Fabrication as recommended option for Fixture Replacement
8
+ * Removed Remarkable, replaced with mongo
9
+ * When Erb is selected as the template framework, layout.html.erb matches Haml & Slim recipes
10
+ * Removed custom FactoryGirl generators, using factory_girl_rails
11
+ * Adding mongoid-rspec for matchers option when Mongoid & RSpec are selected
12
+ * Adding should-matchers for ActiveRecord matchers for RSpec & TestUnit
13
+
1
14
  0.2.1 (February 9, 2011)
2
15
  * Fixed path-generation not being pluralized in Rails 3.0.4 [tariksin]
3
16
 
@@ -7,7 +20,7 @@
7
20
  * Added CoverMe code coverage recipe for Ruby 1.9 (via guilleiguaran)
8
21
  * Added RCov code coverage recipe for Ruby 1.8 (via guilleiguaran)
9
22
  * Mongoid recipe is now using 2.0.0.rc.7
10
-
23
+
11
24
  0.1.2 (February 1, 2011)
12
25
 
13
26
  * Added the Slim template engine (via fredwu)
@@ -21,11 +34,11 @@
21
34
  * Add Prototype as a JavaScript Framework option
22
35
  * Remarkable RSpec matchers are optional and are dependent on the RSpec recipe
23
36
  * Haml is an optional choice for your View Templates
24
- * Sass is an optional choice for composing Stylesheets
37
+ * Sass is an optional choice for composing Stylesheets
25
38
  * Compass is now dependent on the Sass recipe
26
- * Compass has three options: core, blueprint semantic, and blueprint basic
39
+ * Compass has three options: core, blueprint semantic, and blueprint basic
27
40
  * Cucumber is an optional choice for Integration Testing
28
-
41
+
29
42
  0.0.2 (January 23, 2011)
30
43
 
31
44
  * Add a custom generator for FactoryGirl which uses the new 2.0.0 syntax
@@ -39,6 +39,7 @@ h4. Integration Testing
39
39
  h4. Code Coverage
40
40
 
41
41
  * "RCov":http://github.com/relevance/rcov (optional, only for Ruby 1.8)
42
+ * "CoverMe":https://github.com/markbates/cover_me (optional, only for Ruby 1.9)
42
43
 
43
44
  h3. JavaScript
44
45
 
@@ -16,5 +16,4 @@ module RailsTemplater
16
16
  def template_runner
17
17
  File.join(File.dirname(__FILE__), 'template_framework', 'template_runner.rb')
18
18
  end
19
-
20
19
  end
@@ -6,8 +6,7 @@ module RailsTemplater
6
6
  desc "Generates a new Rails application with templater'"
7
7
 
8
8
  def run_templater
9
- system("rails new #{application_name} -O -m #{RailsTemplater::template_runner}")
9
+ system("rails new #{application_name} -JO --skip-bundle -m #{RailsTemplater::template_runner}")
10
10
  end
11
-
12
11
  end
13
12
  end
@@ -1,23 +1,22 @@
1
1
  module RailsTemplater
2
2
  class FixtureReplacement
3
-
3
+
4
4
  DEFAULT = :factory_girl
5
- SUPPORTED_TYPES = [:factory_girl]
6
-
5
+ SUPPORTED_TYPES = [:factory_girl, :fabrication]
6
+
7
7
  def type
8
- @type || DEFAULT
8
+ @type || DEFAULT
9
9
  end
10
-
10
+
11
11
  def type=(value)
12
12
  raise NotSupportedError unless SUPPORTED_TYPES.include?(value)
13
13
  @type = value
14
14
  end
15
-
15
+
16
16
  SUPPORTED_TYPES.each do |type|
17
17
  define_method "#{type}?" do
18
18
  self.type == type
19
19
  end
20
20
  end
21
-
22
21
  end
23
22
  end
@@ -1,23 +1,22 @@
1
1
  module RailsTemplater
2
2
  class JavaScriptFramework
3
-
3
+
4
4
  DEFAULT = :jquery
5
5
  SUPPORTED_TYPES = [:jquery, :prototype]
6
-
6
+
7
7
  def type
8
- @type || DEFAULT
8
+ @type || DEFAULT
9
9
  end
10
-
10
+
11
11
  def type=(value)
12
12
  raise NotSupportedError unless SUPPORTED_TYPES.include?(value)
13
13
  @type = value
14
14
  end
15
-
15
+
16
16
  SUPPORTED_TYPES.each do |type|
17
17
  define_method "#{type}?" do
18
18
  self.type == type
19
19
  end
20
20
  end
21
-
22
21
  end
23
22
  end
@@ -1,23 +1,22 @@
1
1
  module RailsTemplater
2
2
  class Orm
3
-
3
+
4
4
  DEFAULT = :mongoid
5
5
  SUPPORTED_TYPES = [:active_record, :mongoid]
6
6
 
7
7
  def type
8
8
  @type || DEFAULT
9
9
  end
10
-
10
+
11
11
  def type=(value)
12
12
  raise NotSupportedError unless SUPPORTED_TYPES.include?(value)
13
13
  @type = value
14
14
  end
15
-
15
+
16
16
  SUPPORTED_TYPES.each do |type|
17
17
  define_method "#{type}?" do
18
18
  self.type == type
19
19
  end
20
- end
21
-
20
+ end
22
21
  end
23
- end
22
+ end
@@ -18,6 +18,5 @@ module RailsTemplater
18
18
  self.type == type
19
19
  end
20
20
  end
21
-
22
21
  end
23
- end
22
+ end
@@ -48,6 +48,5 @@ module RailsTemplater
48
48
  def testing_framework
49
49
  @testing_framework ||= TestingFramework.new
50
50
  end
51
-
52
51
  end
53
52
  end
@@ -1,23 +1,21 @@
1
1
  module RailsTemplater
2
2
  class TestingFramework
3
-
4
3
  DEFAULT = :rspec
5
4
  SUPPORTED_TYPES = [:rspec, :test_unit]
6
-
5
+
7
6
  def type
8
7
  @type || DEFAULT
9
8
  end
10
-
9
+
11
10
  def type=(value)
12
11
  raise NotSupportedError unless SUPPORTED_TYPES.include?(value)
13
12
  @type ||= value
14
13
  end
15
-
14
+
16
15
  SUPPORTED_TYPES.each do |type|
17
16
  define_method "#{type}?" do
18
17
  self.type == type
19
18
  end
20
19
  end
21
-
22
20
  end
23
21
  end
@@ -1,3 +1,3 @@
1
1
  module RailsTemplater
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -1,15 +1,13 @@
1
1
  module Rails
2
2
  module Generators
3
3
  module Actions
4
-
5
4
  def templater
6
5
  @templater ||= RailsTemplater::Templater.new
7
6
  end
8
-
7
+
9
8
  def execute_post_bundler_strategies
10
9
  templater.post_bundler_strategies.each {|strategy| strategy.call }
11
10
  end
12
-
13
11
  end
14
12
  end
15
13
  end
@@ -0,0 +1,45 @@
1
+ if yes?("\n[Stylesheets] Would you like to use Compass? [y|n]: ", Thor::Shell::Color::BLUE)
2
+ design_options = {
3
+ 'Option' => 'Design Framework',
4
+ '1' => 'Compass',
5
+ '2' => 'Compass with blueprint semantic',
6
+ '3' => 'Compass with blueprint basic',
7
+ '4' => 'Compass with 960.gs'
8
+ }
9
+
10
+ print_table design_options.to_a, :ident => 4
11
+ design_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
12
+
13
+ design_framework = case design_selection
14
+ when "1"
15
+ :compass
16
+ when "2"
17
+ :compass_blueprint_semantic
18
+ when "3"
19
+ :compass_blueprint
20
+ when "4"
21
+ :compass_960
22
+ else
23
+ :none
24
+ end
25
+
26
+ unless design_framework == :none
27
+ remove_file 'app/assets/stylesheets/application.css'
28
+
29
+ gem 'compass-rails', group: :assets
30
+
31
+ framework_option = case design_framework
32
+ when :compass_blueprint
33
+ "--using blueprint/basic"
34
+ when :compass_blueprint_semantic
35
+ "--using blueprint/semantic"
36
+ when :compass_960
37
+ gem 'compass-960-plugin'
38
+ "-r ninesixty --using 960"
39
+ end
40
+
41
+ templater.post_bundler do
42
+ run "bundle exec compass init rails . #{framework_option}"
43
+ end
44
+ end
45
+ end
@@ -1,4 +1,4 @@
1
- gem 'cover_me', '>= 1.0.0.rc5', :group => :test
1
+ gem 'cover_me', '~> 1.2', :group => :test
2
2
 
3
3
  templater.post_bundler do
4
4
  generate "cover_me:install"
@@ -1,37 +1,23 @@
1
1
  if yes?("\n[Integration Testing] Would you like to add integration testing with Cucumber? [y|n]: ", Thor::Shell::Color::BLUE)
2
2
 
3
- gem 'capybara', '0.4.0', :group => :test
4
- gem 'cucumber-rails', :group => :test
5
- gem 'launchy', :group => :test
3
+ gem 'cucumber-rails', '~> 1.3', :group => :test
4
+ gem 'database_cleaner', :group => :test
6
5
 
7
- cucumber_generate_command = "cucumber:install --capybara"
6
+ cucumber_generate_command = "cucumber:install"
8
7
  cucumber_generate_command << ' --skip-database' if templater.orm.mongoid?
9
- cucumber_generate_command << ' --rspec' if templater.testing_framework.rspec?
10
- cucumber_generate_command << ' --testunit' if templater.testing_framework.test_unit?
11
8
 
12
9
  templater.post_bundler do
13
10
  generate cucumber_generate_command
14
11
 
15
- gsub_file 'features/support/env.rb',
16
- "require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript", ''
17
-
18
- inject_into_file "features/support/env.rb",
19
- "\nCapybara.save_and_open_page_path = 'tmp/capybara/'",
20
- :after => 'Capybara.default_selector = :css'
21
-
22
- if templater.testing_framework.rspec? && templater.fixture_replacement.factory_girl?
12
+ if templater.fixture_replacement.factory_girl?
23
13
  inject_into_file "features/support/env.rb", templater.load_snippet("factory_girl", 'cucumber'), :after => 'ActionController::Base.allow_rescue = false'
14
+ elsif templater.fixture_replacement.fabrication?
15
+ generate 'fabrication:cucumber_steps'
24
16
  end
25
17
 
26
18
  # Mongoid truncation strategy
27
19
  if templater.orm.mongoid?
28
- create_file 'features/support/hooks.rb', templater.load_template('features/support/hooks.rb', 'mongoid')
29
-
30
- # Compliment to factory_girl step definitions
31
- if templater.fixture_replacement.factory_girl?
32
- create_file 'features/step_definitions/mongoid_steps.rb', templater.load_template('features/step_definitions/mongoid_steps.rb', 'mongoid')
33
- end
20
+ gsub_file 'features/support/env.rb', 'DatabaseCleaner.strategy = :transaction', 'DatabaseCleaner.strategy = :truncation'
34
21
  end
35
-
36
22
  end
37
23
  end
@@ -0,0 +1,2 @@
1
+ remove_file 'app/views/layouts/application.html.erb'
2
+ create_file 'app/views/layouts/application.html.erb', templater.load_template('app/views/layouts/application.html.erb', 'erb')
@@ -0,0 +1,7 @@
1
+ say("\nReplacing Fixtures with Fabrication\n", Thor::Shell::Color::YELLOW)
2
+
3
+ gem 'fabrication'
4
+
5
+ templater.post_bundler do
6
+ environment templater.load_snippet("generator_#{templater.testing_framework.type}", 'fabrication')
7
+ end
@@ -1,11 +1,6 @@
1
- if templater.testing_framework.rspec?
2
- say("\nReplacing Fixtures with FactoryGirl\n", Thor::Shell::Color::YELLOW)
3
- gem 'factory_girl_rails', '1.1.beta1', :group => :test
1
+ say("\nReplacing Fixtures with FactoryGirl\n", Thor::Shell::Color::YELLOW)
2
+ gem 'factory_girl_rails', '~> 1.2', :group => [:development, :test]
4
3
 
5
- templater.post_bundler do
6
- inject_into_file 'spec/spec_helper.rb', "\nrequire 'factory_girl'", :after => "require 'rspec/rails'"
7
-
8
- environment templater.load_snippet('generator', 'factory_girl')
9
- directory File.expand_path('./../../generators', __FILE__), 'lib/generators'
10
- end
11
- end
4
+ templater.post_bundler do
5
+ environment templater.load_snippet("generator_#{templater.testing_framework.type}", 'factory_girl')
6
+ end
@@ -0,0 +1,18 @@
1
+ say "\nWhich Fixture Replacement library would you like to use?\n", Thor::Shell::Color::BLUE
2
+
3
+ fixture_replacement_options = {
4
+ 'Option' => 'Factory Library',
5
+ '1' => 'Fabrication',
6
+ '2' => 'FactoryGirl'
7
+ }
8
+
9
+ print_table fixture_replacement_options.to_a, :ident => 4
10
+
11
+ fixture_replacement_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
12
+ if fixture_replacement_options.keys[1..-1].include?(fixture_replacement_selection)
13
+ templater.fixture_replacement.type = fixture_replacement_options[fixture_replacement_selection].downcase.underscore.to_sym
14
+ end
15
+
16
+ $stdout << "\n\n"
17
+
18
+ apply templater.recipe(templater.fixture_replacement.type)
@@ -1,6 +1,5 @@
1
1
  say "\nReplacing ERb with Haml as your Template Engine\n", Thor::Shell::Color::YELLOW
2
2
 
3
- gem 'haml'
4
3
  gem "haml-rails"
5
4
 
6
5
  remove_file 'app/views/layouts/application.html.erb'
@@ -3,16 +3,23 @@ say "\nWhich JavaScript Framework would you like to use?\n", Thor::Shell::Color:
3
3
  javascript_framework_options = {
4
4
  'Option' => 'JavaScript Framework',
5
5
  '1' => 'jquery',
6
- '2' => 'Prototype'
6
+ '2' => 'prototype'
7
7
  }
8
8
 
9
9
  print_table javascript_framework_options.to_a, :ident => 4
10
10
 
11
11
  javascript_framework_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
12
- if javascript_framework_selection.present?
13
- templater.javascript_framework.type = javascript_framework_options[javascript_framework_selection].underscore.to_sym
12
+ if javascript_framework_options.keys[1..-1].include?(javascript_framework_selection)
13
+ templater.javascript_framework.type = javascript_framework_options[javascript_framework_selection].downcase.to_sym
14
14
  end
15
15
 
16
16
  $stdout << "\n\n"
17
17
 
18
- apply templater.recipe('jquery') if templater.javascript_framework.jquery?
18
+ if templater.javascript_framework.jquery?
19
+ gem 'jquery-rails'
20
+ else
21
+ gem 'prototype-rails'
22
+ end
23
+
24
+ remove_file 'app/assets/javascripts/application.js'
25
+ create_file 'app/assets/javascripts/application.js', templater.load_template('app/assets/javascripts/application.js', templater.javascript_framework.type)
@@ -1,11 +1,12 @@
1
1
  say("\nReplacing ActiveRecord with Mongoid\n", Thor::Shell::Color::YELLOW )
2
2
 
3
- gem 'mongoid', '2.0.0.rc.7'
4
- gem 'bson_ext', '~> 1.2'
3
+ gem 'mongoid', '~> 2.4'
4
+ gem 'bson_ext', '~> 1.6'
5
5
 
6
6
  gsub_file 'config/application.rb', 'require "active_record/railtie"', '# require "active_record/railtie"'
7
7
 
8
8
  templater.post_bundler do
9
9
  generate 'mongoid:config'
10
10
  run 'cp config/mongoid.yml config/mongoid.yml.example'
11
+ create_file 'lib/tasks/assets.rake', templater.load_template('lib/tasks/assets.rake', 'mongoid')
11
12
  end
@@ -9,7 +9,7 @@ orm_options = {
9
9
  print_table orm_options.to_a, :ident => 4
10
10
 
11
11
  orm_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
12
- if orm_selection.present?
12
+ if orm_options.keys[1..-1].include?(orm_selection)
13
13
  templater.orm.type = orm_options[orm_selection].underscore.to_sym
14
14
  end
15
15
 
@@ -0,0 +1,4 @@
1
+ if yes?("\n[Console] Pry over IRB for your Rails console? [y|n]: ", Thor::Shell::Color::BLUE)
2
+ gem 'pry-rails', group: :development
3
+ gem 'pry-nav', group: :development
4
+ end
@@ -1,6 +1,6 @@
1
1
  say("\nReplacing TestUnit with RSpec as your Testing Framework\n", Thor::Shell::Color::YELLOW )
2
2
 
3
- gem 'rspec-rails', '>= 2.4.1', :group => [:development]
3
+ gem 'rspec-rails', '~> 2.8', :group => [:development]
4
4
 
5
5
  remove_dir 'test'
6
6
  gsub_file 'config/application.rb', 'require "rails/test_unit/railtie"', '# require "rails/test_unit/railtie"'
@@ -18,7 +18,8 @@ templater.post_bundler do
18
18
  end
19
19
  end
20
20
 
21
- apply(templater.recipe('remarkable')) if yes?("\n\nWould you like to add Remarkable RSpec matchers? [y|n]: ", Thor::Shell::Color::BLUE)
22
-
23
- # Fixture Replacement
24
- apply templater.recipe('factory_girl')
21
+ if templater.orm.mongoid?
22
+ gem('mongoid-rspec', '~> 1.4', :group => :test) if yes?("\n\nWould you like to add Mongoid RSpec matchers? [y|n]: ", Thor::Shell::Color::BLUE)
23
+ else
24
+ apply templater.recipe('shoulda_matchers')
25
+ end
@@ -0,0 +1 @@
1
+ gem('shoulda-matchers', '~> 1.0', :group => :test) if yes?("\n\nWould you like to add shoulda matchers? [y|n]: ", Thor::Shell::Color::BLUE)
@@ -1,6 +1,6 @@
1
1
  say "\nReplacing ERb with Slim as your Template Engine\n", Thor::Shell::Color::YELLOW
2
2
 
3
- gem 'slim', :require => 'slim/rails'
3
+ gem 'slim-rails'
4
4
 
5
5
  remove_file 'app/views/layouts/application.html.erb'
6
6
  create_file 'app/views/layouts/application.html.slim', templater.load_template('app/views/layouts/application.html.slim', 'slim')
@@ -10,11 +10,10 @@ template_engine_options = {
10
10
  print_table template_engine_options.to_a, :ident => 4
11
11
 
12
12
  template_engine_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
13
- if template_engine_selection.present?
13
+ if template_engine_options.keys[1..-1].include?(template_engine_selection)
14
14
  templater.template_engine.type = template_engine_options[template_engine_selection].downcase.to_sym
15
15
  end
16
16
 
17
17
  $stdout << "\n\n"
18
18
 
19
- apply templater.recipe('haml') if templater.template_engine.haml?
20
- apply templater.recipe('slim') if templater.template_engine.slim?
19
+ apply templater.recipe(templater.template_engine.type)
@@ -4,4 +4,5 @@ if yes?("\nWould you like to use Shoulda contexts? [y|n]: ", Thor::Shell::Color:
4
4
  gem 'shoulda-context', :group => :test
5
5
  end
6
6
 
7
+ apply templater.recipe('shoulda_matchers')
7
8
 
@@ -9,7 +9,7 @@ testing_framework_options = {
9
9
  print_table testing_framework_options.to_a, :ident => 4
10
10
 
11
11
  testing_framework_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
12
- if testing_framework_selection.present?
12
+ if testing_framework_options.keys[1..-1].include?(testing_framework_selection)
13
13
  templater.testing_framework.type = testing_framework_options[testing_framework_selection].underscore.to_sym
14
14
  end
15
15
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'factory_girl'
4
4
  require 'factory_girl/step_definitions'
5
- Dir[File.expand_path(File.join(File.dirname(__FILE__),'..','..','spec','factories','*.rb'))].each {|f| require f}
5
+ FactoryGirl.find_definitions
@@ -0,0 +1,4 @@
1
+
2
+ config.generators do |g|
3
+ g.fixture_replacement :fabrication
4
+ end
@@ -0,0 +1,5 @@
1
+
2
+ config.generators do |g|
3
+ g.test_framework :test_unit, :fixture_replacement => :fabrication
4
+ g.fixture_replacement :fabrication, :dir => "test/fabricators"
5
+ end
@@ -0,0 +1,5 @@
1
+
2
+ config.generators do |g|
3
+ g.test_framework :test_unit, :fixture_replacement => :factory_girl
4
+ g.fixture_replacement :factory_girl, :dir => "test/factories"
5
+ end
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(File.expand_path('./../../', __FILE__))
3
3
  require 'rails_templater'
4
4
  require File.join(File.dirname(__FILE__), 'core_ext.rb')
5
5
 
6
- %w(default orm testing_framework code_coverage javascript_framework template_engine sass cucumber).each do |recipe|
6
+ %w(default orm testing_framework fixture_replacement code_coverage javascript_framework template_engine compass cucumber pry).each do |recipe|
7
7
  apply templater.recipe(recipe)
8
8
  end
9
9
 
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= csrf_meta_tags %>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <!--[if lt IE 9]>
7
+ <%= javascript_include_tag "application" %>
8
+ <![endif]-->
9
+ </head>
10
+ <body>
11
+ <%= yield %>
12
+
13
+ <%= javascript_include_tag "application" %>
14
+ </body>
15
+ </html>
@@ -1,9 +1,7 @@
1
- .ackrc
2
- .rvmrc
3
1
  config/database.yml
4
2
  config/mongoid.yml
5
3
  public/cache/
6
- public/stylesheets/compiled/
7
4
  public/system/*
8
5
  tmp/restart.txt
9
6
  coverage/
7
+ coverage.data
@@ -6,4 +6,4 @@
6
6
  = javascript_include_tag 'html5'
7
7
  %body
8
8
  = yield
9
- = javascript_include_tag :defaults
9
+ = javascript_include_tag 'application'
@@ -0,0 +1,14 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require_tree .
@@ -0,0 +1,14 @@
1
+ asset_task = Rake::Task['assets:environment']
2
+ Rake.application.send(:eval, "@tasks.delete('assets:environment')")
3
+
4
+ namespace :assets do
5
+ task :environment do
6
+ module ::Mongoid
7
+ def load!(config_file)
8
+ puts "Skipping connection to Mongo DB"
9
+ end
10
+ end
11
+
12
+ asset_task.execute
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require prototype
14
+ //= require prototype_ujs
15
+ //= require_tree .
@@ -7,4 +7,4 @@ html
7
7
  /![endif]
8
8
  body
9
9
  = yield
10
- = javascript_include_tag :defaults
10
+ = javascript_include_tag 'application'
@@ -14,12 +14,11 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "rails_templater"
16
16
 
17
- s.add_dependency "rails", "~> 3.0"
18
- s.add_development_dependency "bundler", "~> 1.0.0"
19
- s.add_development_dependency("rspec", ["~> 2.4"])
17
+ s.add_dependency "rails", "~> 3.1"
18
+ s.add_development_dependency "bundler", "~> 1.0"
19
+ s.add_development_dependency("rspec", ["~> 2.8"])
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
23
23
  s.require_path = 'lib'
24
-
25
24
  end
metadata CHANGED
@@ -1,75 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rails_templater
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Kevin Faustino
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-02-09 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-14 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70269718191460 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 0
31
- version: "3.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: bundler
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70269718191460
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70269718190920 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
29
+ requirements:
40
30
  - - ~>
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 0
45
- - 0
46
- version: 1.0.0
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
47
33
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: rspec
51
34
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70269718190920
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70269718190160 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
40
+ requirements:
55
41
  - - ~>
56
- - !ruby/object:Gem::Version
57
- segments:
58
- - 2
59
- - 4
60
- version: "2.4"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.8'
61
44
  type: :development
62
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *70269718190160
63
47
  description: Template generator for Ruby on Rails 3 applications
64
- email:
48
+ email:
65
49
  - kevin.faustino@gmail.com
66
- executables:
50
+ executables:
67
51
  - templater
68
52
  extensions: []
69
-
70
53
  extra_rdoc_files: []
71
-
72
- files:
54
+ files:
73
55
  - .gitignore
74
56
  - .rspec
75
57
  - CHANGELOG
@@ -89,38 +71,44 @@ files:
89
71
  - lib/rails_templater/testing_framework.rb
90
72
  - lib/rails_templater/version.rb
91
73
  - lib/template_framework/core_ext.rb
92
- - lib/template_framework/generators/factory_girl.rb
93
- - lib/template_framework/generators/factory_girl/model/model_generator.rb
94
- - lib/template_framework/generators/factory_girl/model/templates/fixtures.rb
95
74
  - lib/template_framework/recipes/active_record.rb
96
75
  - lib/template_framework/recipes/code_coverage.rb
76
+ - lib/template_framework/recipes/compass.rb
97
77
  - lib/template_framework/recipes/cover_me.rb
98
78
  - lib/template_framework/recipes/cucumber.rb
99
79
  - lib/template_framework/recipes/default.rb
80
+ - lib/template_framework/recipes/erb.rb
81
+ - lib/template_framework/recipes/fabrication.rb
100
82
  - lib/template_framework/recipes/factory_girl.rb
83
+ - lib/template_framework/recipes/fixture_replacement.rb
101
84
  - lib/template_framework/recipes/git.rb
102
85
  - lib/template_framework/recipes/haml.rb
103
86
  - lib/template_framework/recipes/javascript_framework.rb
104
- - lib/template_framework/recipes/jquery.rb
105
87
  - lib/template_framework/recipes/mongoid.rb
106
88
  - lib/template_framework/recipes/orm.rb
89
+ - lib/template_framework/recipes/pry.rb
107
90
  - lib/template_framework/recipes/rcov.rb
108
- - lib/template_framework/recipes/remarkable.rb
109
91
  - lib/template_framework/recipes/rspec.rb
110
- - lib/template_framework/recipes/sass.rb
92
+ - lib/template_framework/recipes/shoulda_matchers.rb
111
93
  - lib/template_framework/recipes/slim.rb
112
94
  - lib/template_framework/recipes/template_engine.rb
113
95
  - lib/template_framework/recipes/test_unit.rb
114
96
  - lib/template_framework/recipes/testing_framework.rb
115
97
  - lib/template_framework/snippets/cucumber/factory_girl
116
- - lib/template_framework/snippets/factory_girl/generator
98
+ - lib/template_framework/snippets/fabrication/generator_rspec
99
+ - lib/template_framework/snippets/fabrication/generator_test_unit
100
+ - lib/template_framework/snippets/factory_girl/generator_rspec
101
+ - lib/template_framework/snippets/factory_girl/generator_test_unit
117
102
  - lib/template_framework/snippets/rspec/mongoid
118
103
  - lib/template_framework/template_runner.rb
119
104
  - lib/template_framework/templates/active_record/config/database.yml
105
+ - lib/template_framework/templates/erb/app/views/layouts/application.html.erb
120
106
  - lib/template_framework/templates/git/gitignore
121
107
  - lib/template_framework/templates/haml/app/views/layouts/application.html.haml
108
+ - lib/template_framework/templates/jquery/app/assets/javascripts/application.js
122
109
  - lib/template_framework/templates/mongoid/features/step_definitions/mongoid_steps.rb
123
- - lib/template_framework/templates/mongoid/features/support/hooks.rb
110
+ - lib/template_framework/templates/mongoid/lib/tasks/assets.rake
111
+ - lib/template_framework/templates/prototype/app/assets/javascripts/application.js
124
112
  - lib/template_framework/templates/slim/app/views/layouts/application.html.slim
125
113
  - rails_templater.gemspec
126
114
  - spec/fixtures/sample_snippet
@@ -135,39 +123,31 @@ files:
135
123
  - spec/spec_helper.rb
136
124
  - spec/support/fixtures.rb
137
125
  - spec/support/paths.rb
138
- has_rdoc: true
139
126
  homepage: http://rubygems.org/gems/rails_templater
140
127
  licenses: []
141
-
142
128
  post_install_message:
143
129
  rdoc_options: []
144
-
145
- require_paths:
130
+ require_paths:
146
131
  - lib
147
- required_ruby_version: !ruby/object:Gem::Requirement
132
+ required_ruby_version: !ruby/object:Gem::Requirement
148
133
  none: false
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- segments:
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ segments:
153
139
  - 0
154
- version: "0"
155
- required_rubygems_version: !ruby/object:Gem::Requirement
140
+ hash: -4157809068450485296
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
142
  none: false
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- segments:
161
- - 1
162
- - 3
163
- - 6
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
164
146
  version: 1.3.6
165
147
  requirements: []
166
-
167
148
  rubyforge_project: rails_templater
168
- rubygems_version: 1.3.7
149
+ rubygems_version: 1.8.10
169
150
  signing_key:
170
151
  specification_version: 3
171
152
  summary: Template generator for Ruby on Rails 3 applications
172
153
  test_files: []
173
-
@@ -1,11 +0,0 @@
1
- require 'rails/generators/named_base'
2
-
3
- module FactoryGirl
4
- module Generators
5
- class Base < Rails::Generators::NamedBase #:nodoc:
6
- def self.source_root
7
- @_factory_girl_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'factory_girl', generator_name, 'templates'))
8
- end
9
- end
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- require 'generators/factory_girl'
2
-
3
- module FactoryGirl
4
- module Generators
5
- class ModelGenerator < Base
6
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
7
- class_option :dir, :type => :string, :default => "spec/factories", :desc => "The directory where the factories should go"
8
-
9
- def create_fixture_file
10
- template 'fixtures.rb', File.join(options[:dir], "#{table_name}.rb")
11
- end
12
- end
13
- end
14
- end
@@ -1,9 +0,0 @@
1
- # Read about factories at http://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :<%= singular_name %> do
5
- <% for attribute in attributes -%>
6
- <%= attribute.name %> <%= attribute.default.inspect %>
7
- <% end -%>
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- say("\nReplacing Prototype with JQuery as your JavaScript Framework\n", Thor::Shell::Color::YELLOW )
2
-
3
- gem 'jquery-rails'
4
-
5
- remove_file 'public/javascripts/rails.js'
6
- gsub_file 'config/application.rb', /(config.action_view.javascript_expansions\[:defaults\] = %w\(\))/, '# \1'
7
-
8
- templater.post_bundler do
9
- generate 'jquery:install'
10
- end
@@ -1,12 +0,0 @@
1
- if templater.orm.mongoid?
2
- gem 'remarkable_activemodel', '>=4.0.0.alpha4', :group => :test
3
- gem 'remarkable_mongoid', :group => :test
4
- require_remarkable = "\nrequire 'remarkable/active_model'\nrequire 'remarkable/mongoid'"
5
- elsif templater.orm.active_record?
6
- gem 'remarkable_activerecord', '>=4.0.0.alpha4', :group => :test
7
- require_remarkable = "\nrequire 'remarkable/active_record'"
8
- end
9
-
10
- templater.post_bundler do
11
- inject_into_file 'spec/spec_helper.rb', require_remarkable, :after => "require 'rspec/rails'"
12
- end
@@ -1,54 +0,0 @@
1
- if yes?("\n[Stylesheets] Would you like to use Sass for Syntactically Awesome Stylesheets? [y|n]: ", Thor::Shell::Color::BLUE)
2
-
3
- # gem 'sass' # TODO: Wait until Sass 3.1 is released
4
- gem 'haml'
5
-
6
- if yes?("\nWould you like to use Compass? [y|n]: ", Thor::Shell::Color::BLUE)
7
- design_options = {
8
- 'Option' => 'Design Framework',
9
- '1' => 'Compass',
10
- '2' => 'Compass with blueprint semantic',
11
- '3' => 'Compass with blueprint basic',
12
- '4' => 'Compass with 960.gs'
13
- }
14
-
15
- print_table design_options.to_a, :ident => 4
16
- design_selection = ask("\nOption: ", Thor::Shell::Color::BLUE)
17
-
18
- design_framework = case design_selection
19
- when "1"
20
- :compass
21
- when "2"
22
- :compass_blueprint_semantic
23
- when "3"
24
- :compass_blueprint
25
- when "4"
26
- :compass_960
27
- else
28
- :none
29
- end
30
-
31
- unless design_framework == :none
32
- gem 'compass'
33
-
34
- compass_sass_dir = "app/stylesheets"
35
- compass_css_dir = "public/stylesheets/compiled"
36
- framework_option = case design_framework
37
- when :compass_blueprint
38
- "--using blueprint/basic"
39
- when :compass_blueprint_semantic
40
- "--using blueprint/semantic"
41
- when :compass_960
42
- gem 'compass-960-plugin'
43
- "-r ninesixty --using 960"
44
- end
45
-
46
- compass_command = "bundle exec compass init rails . #{framework_option} --css-dir=#{compass_css_dir} --sass-dir=#{compass_sass_dir} "
47
-
48
- templater.post_bundler do
49
- run compass_command
50
- end
51
-
52
- end
53
- end
54
- end
@@ -1,3 +0,0 @@
1
- Before do |scenario|
2
- Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
3
- end