fast_track 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- class FastTrack
1
+ module FastTrack
2
2
  module TrackMethods
3
3
  # Do a `bundle install`
4
4
  def bundle_install
@@ -24,5 +24,55 @@ class FastTrack
24
24
  model_columns = columns.map {|k, v| "#{k}:#{v}" }
25
25
  generate "model", model_name, *model_columns
26
26
  end
27
+
28
+ # If you need to get the base-level generator object, it's
29
+ # available here.
30
+ def g
31
+ generator
32
+ end
33
+
34
+ # Add a gem
35
+ #
36
+ # TODO: Find a way to consolidate all gems at once, so we only have to run
37
+ # `bundle install` once.
38
+ def gem(*args)
39
+ g.gem(*args)
40
+ end
41
+
42
+ # Run rake
43
+ def rake(*args)
44
+ g.rake(*args)
45
+ end
46
+
47
+ # Run any command
48
+ def run(*args)
49
+ g.run(*args)
50
+ end
51
+
52
+ alias :bundle_install! :bundle_install
53
+
54
+ def generate(*args)
55
+ g.generate(*args)
56
+ end
57
+
58
+ # Add a route to config/routes.rb
59
+ def route(*args)
60
+ g.route(*args)
61
+ end
62
+
63
+ # Add a file
64
+ def create_file(*args)
65
+ g.create_file(*args)
66
+ end
67
+
68
+ # Create a gem group
69
+ def gem_group(*args, &block)
70
+ generator.gem_group(*args, &block)
71
+ end
72
+
73
+ # Read a file from the templates directory
74
+ def read_file(file_name)
75
+ File.read(File.join(FastTrack.template_root, template_directory, file_name))
76
+ end
27
77
  end
28
78
  end
@@ -1,3 +1,3 @@
1
1
  module FastTrack
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,22 +1,23 @@
1
- class FastTrack
2
- class AwesomeDefaults < Track
3
- gemfile do
4
- gem_group :development do
5
- gem 'better_errors'
6
- gem 'binding_of_caller'
7
- gem 'quiet_assets'
8
- gem 'pry'
9
- gem 'pry-rails'
10
- end
1
+ track "awesome_defaults" do
2
+ desc "Adds better_errors, quiet_assets, rspec, factory_girl, email_spec & pry"
11
3
 
12
- gem_group :test do
13
- gem 'rspec-rails'
14
- gem 'factory_girl_rails'
15
- gem 'database_cleaner'
16
- gem 'email_spec'
17
- gem 'pry'
18
- gem 'pry-rails'
19
- end
4
+ gemfile do
5
+ gem_group :development do
6
+ gem 'better_errors'
7
+ gem 'binding_of_caller'
8
+ gem 'quiet_assets'
9
+ gem 'pry'
10
+ gem 'pry-rails'
11
+ end
12
+
13
+ gem_group :test do
14
+ gem 'rspec'
15
+ gem 'rspec-rails'
16
+ gem 'factory_girl_rails'
17
+ gem 'database_cleaner'
18
+ gem 'email_spec'
19
+ gem 'pry'
20
+ gem 'pry-rails'
20
21
  end
21
22
  end
22
23
  end
@@ -1,41 +1,25 @@
1
- class FastTrack
2
- class BackboneOnRails
3
- rubygem "backbone-on-rails"
4
- github_url "https://github.com/meleyal/backbone-on-rails"
5
- github_description "
6
- A simple gem for using Backbone.js with Rails (>= 3.1),
7
- based on thoughtbot's 'Backbone.js on Rails'.
1
+ track "backbone_on_rails" do
2
+ rubygem "backbone-on-rails"
3
+ github_url "https://github.com/meleyal/backbone-on-rails"
8
4
 
9
- http://git.io/backbone-on-rails
10
- "
11
-
12
- gemfile do
13
- gem 'backbone-on-rails'
14
- end
15
-
16
- def invoke
17
- generate "backbone:install"
18
- end
5
+ gemfile do
6
+ gem 'backbone-on-rails'
19
7
  end
20
8
 
21
- class BackboneRails
22
- rubygem "backbone-rails"
23
- github_url "https://github.com/aflatter/backbone-rails"
24
-
25
- github_description "
26
- Developing javascript applications on top of rails just got faster thanks to the Rails 3.1 asset pipeline. Like jquery-rails, this gem bundles some javascript files to make them available to your application:
9
+ before_migrate do
10
+ generate "backbone:install"
11
+ end
12
+ end
27
13
 
28
- * backbone
29
- * underscore
30
- * json2
31
- "
14
+ track "backbone_rails" do
15
+ rubygem "backbone-rails"
16
+ github_url "https://github.com/aflatter/backbone-rails"
32
17
 
33
- gemfile do
34
- gem "rails-backbone"
35
- end
18
+ gemfile do
19
+ gem "rails-backbone"
20
+ end
36
21
 
37
- def invoke
38
- generate "backbone:install"
39
- end
22
+ before_migrate do
23
+ generate "backbone:install"
40
24
  end
41
25
  end
@@ -1,20 +1,16 @@
1
- class FastTrack
2
- class BetterExceptions
3
- author ""
4
- description "Render your http errors in your layout reducing the need for static files."
5
- github_url "https://github.com/eric1234/better_exception_app"
6
- rubygem_url "https://rubygems.org/gems/better_exception_app"
1
+ track "better_exception_app" do
2
+ rubygem "better_exception_app"
3
+ github_url "https://github.com/eric1234/better_exception_app"
7
4
 
8
- gemfile do
9
- gem_group :production do
10
- gem 'better_exception_app'
11
- end
5
+ gemfile do
6
+ gem_group :production do
7
+ gem 'better_exception_app'
12
8
  end
9
+ end
13
10
 
14
- def invoke
15
- remove_file "public/404.html"
16
- remove_file "public/422.html"
17
- remove_file "public/500.html"
18
- end
11
+ before_migrate do
12
+ remove_file "public/404.html"
13
+ remove_file "public/422.html"
14
+ remove_file "public/500.html"
19
15
  end
20
16
  end
data/lib/tracks/cancan.rb CHANGED
@@ -1,12 +1,11 @@
1
- class FastTrack
2
- # https://github.com/EppO/rolify/wiki/Tutorial
3
- class Cancan < Track
4
- gemfile do
5
- gem 'cancan'
6
- end
1
+ track "cancan" do
2
+ desc "Control user authorization using CanCan"
7
3
 
8
- before_migrate do
9
- generate "cancan:ability"
10
- end
4
+ gemfile do
5
+ gem 'cancan'
6
+ end
7
+
8
+ before_migrate do
9
+ generate "cancan:ability"
11
10
  end
12
11
  end
data/lib/tracks/devise.rb CHANGED
@@ -1,94 +1,66 @@
1
- class FastTrack
2
- # Vanilla Devise
3
- class Devise < Track
4
- gemfile do
5
- gem 'devise'
6
- end
1
+ track "devise" do
2
+ name "Vanilla Devise"
3
+ desc "Plain devise with no config options"
7
4
 
8
- before_migrate do
9
- generate "devise:install"
10
- generate "devise", config.user_class
11
- end
12
-
13
- def invoke
14
- end
5
+ gemfile do
6
+ gem 'devise'
15
7
  end
16
8
 
17
- # Devise with views
18
- class DeviseWithViews < Track
19
- gemfile do
20
- gem 'devise'
21
- end
9
+ before_migrate do
10
+ generate "devise:install"
11
+ end
12
+ end
22
13
 
23
- before_migrate do
24
- generate "devise:install"
25
- generate "devise", config.user_class
26
- generate "devise:views"
27
- end
14
+ track "devise_user_class" do
15
+ name "Devise User class"
16
+ desc "Install devise, and add a devise class called 'User'"
28
17
 
29
- def invoke
30
- end
18
+ before_migrate do
19
+ generate "devise", "User"
31
20
  end
21
+ end
32
22
 
33
- # Devise User with a Profile class, for storing personal information about the user.
34
- class DeviseWithProfile < Track
35
- gemfile do
36
- gem 'devise'
37
- end
38
-
39
- before_migrate do
40
- generate "devise:install"
41
- generate "devise", config.user_class
42
- generate "devise:views"
43
- end
23
+ track "devise_views" do
24
+ name "Devise views"
25
+ desc "Install devise views"
44
26
 
45
- def invoke
46
- model config.profile_class, {
47
- "first_name" => "string",
48
- "last_name" => "string",
49
- "favorite_color" => "string",
50
- "#{config.user_class}_id" => "integer"
51
- }
52
- end
27
+ before_migrate do
28
+ generate "devise:views"
53
29
  end
30
+ end
54
31
 
55
- # TODO
56
- #
57
- # A User object has_one of...
58
- #
59
- # * Member object
60
- # * Admin object
61
- class DevisePlusAdmin < Track
62
- gemfile do
63
- gem 'devise'
64
- end
32
+ track "user_profile" do
33
+ name "User Profile"
34
+ desc "Given a user class, adds a profile class to store personal information about the user."
65
35
 
66
- before_migrate do
67
- generate "devise:install"
68
- generate "devise", config.user_class
69
- end
36
+ before_migrate do
37
+ model "Profile", {
38
+ "first_name" => "string",
39
+ "last_name" => "string",
40
+ "favorite_color" => "string",
41
+ "user_id" => "integer"
42
+ }
43
+ end
44
+ end
70
45
 
71
- def invoke
72
- end
46
+ track "devise_plus_admin" do
47
+ gemfile do
48
+ gem 'devise'
73
49
  end
74
50
 
75
- # TODO
76
- # A User object has_one of...
77
- #
78
- # * Member object
79
- # * Moderator object
80
- # * Admin object
81
- class DeviseThreeTier < Track
82
- gemfile do
83
- gem 'devise'
84
- end
51
+ before_migrate do
52
+ generate "devise:install"
53
+ generate "devise", config.user_class
54
+ end
55
+ end
85
56
 
86
- before_migrate do
87
- generate "devise:install"
88
- generate "devise", config.user_class
89
- end
57
+ track "devise_three_tier" do
58
+ gemfile do
59
+ gem 'devise'
60
+ end
90
61
 
91
- def invoke
92
- end
62
+ before_migrate do
63
+ generate "devise:install"
64
+ generate "devise", config.user_class
93
65
  end
94
66
  end
@@ -1,7 +1,3 @@
1
- class FastTrack
2
-
3
- # TODO
4
- # Deploy an Errbit instance to Heroku, for error tracking
5
- class ErrbitHeroku
6
- end
1
+ track "errbit_heroku" do
2
+ desc "Deploy an Errbit instance to Heroku, for error tracking"
7
3
  end
data/lib/tracks/guard.rb CHANGED
@@ -1,24 +1,25 @@
1
- class FastTrack
2
- class Guard < Track
1
+ track "guard" do
2
+ gemfile do
3
+ gem 'guard'
3
4
  end
5
+ end
6
+
7
+ track "awesome_guard" do
8
+ requires "guard"
4
9
 
5
- class GuardAwesomeDefaults
6
- gemfile do
7
- gem 'guard'
8
- gem 'guard-rspec'
9
- gem 'guard-jasmine'
10
- gem 'guard-livereload'
11
- end
10
+ desc "Use Guard with RSpec, Jasmine & livereload"
12
11
 
13
- def template_directory
14
- "guard_awesome_defaults"
15
- end
12
+ gemfile do
13
+ gem 'guard-rspec'
14
+ gem 'guard-jasmine'
15
+ gem 'guard-livereload'
16
+ end
16
17
 
17
- def guard_file
18
- read_file("Guardfile")
19
- end
18
+ def template_directory
19
+ "guard_awesome_defaults"
20
+ end
20
21
 
21
- def invoke
22
- end
22
+ def guard_file
23
+ read_file("Guardfile")
23
24
  end
24
25
  end
@@ -0,0 +1,5 @@
1
+ track "heroku" do
2
+ desc "Deploy your app to heroku"
3
+
4
+ # TODO!
5
+ end
data/lib/tracks/jquery.rb CHANGED
@@ -1,19 +1,10 @@
1
- class FastTrack
2
- class Jquery < Track
3
- rubygem "jquery-rails"
4
- github_url "https://github.com/indirect/jquery-rails"
1
+ track "jquery" do
2
+ desc "Add jQuery to your Rails app"
5
3
 
6
- github_description "
7
- This gem provides:
4
+ rubygem "jquery-rails"
5
+ github_url "https://github.com/indirect/jquery-rails"
8
6
 
9
- jQuery 1.7.2
10
- jQuery UI 1.8.18 (javascript only)
11
- the jQuery UJS adapter
12
- assert_select_jquery to test jQuery responses in Ruby tests
13
- "
14
-
15
- gemfile do
16
- gem 'jquery-rails'
17
- end
7
+ gemfile do
8
+ gem 'jquery-rails'
18
9
  end
19
10
  end