fast_track 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -17
- data/lib/fast_track/version.rb +1 -1
- data/lib/fast_track.rb +99 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -1,29 +1,66 @@
|
|
1
|
-
#
|
1
|
+
# fast_track
|
2
2
|
|
3
|
-
|
3
|
+
Create Rails apps quickly.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Status:
|
6
6
|
|
7
|
-
|
7
|
+
Currently very alpha. Check out what's possible here:
|
8
8
|
|
9
|
-
|
9
|
+
```bash
|
10
|
+
git clone git@github.com:EncomLabs/fast_track.git
|
11
|
+
cd fast_track
|
12
|
+
```
|
10
13
|
|
11
|
-
|
14
|
+
The executable `bin/track` is where all the magic happens for the moment.
|
12
15
|
|
13
|
-
|
16
|
+
## Examples:
|
14
17
|
|
15
|
-
|
18
|
+
### Create an app with Devise + Cancan + Rolify
|
16
19
|
|
17
|
-
|
20
|
+
```bash
|
21
|
+
./bin/track --app whatever --tracks devise,cancan,rolify
|
22
|
+
```
|
18
23
|
|
19
|
-
|
24
|
+
### Same as above, but add Devise views
|
20
25
|
|
21
|
-
|
26
|
+
```bash
|
27
|
+
./bin/track --app whatever --tracks devise_with_views,cancan,rolify
|
28
|
+
```
|
22
29
|
|
23
|
-
|
30
|
+
### Same as above, but with Twitter Bootstrap
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
```bash
|
33
|
+
./bin/track --app whatever --tracks twitter_bootstrap,devise_with_view,cancan,rolify
|
34
|
+
```
|
35
|
+
|
36
|
+
## Why not use rails wizard / appscrolls / Rails app composer / some other Rails app builder ?
|
37
|
+
|
38
|
+
In all the projects I've seen, most functionality is implemented in procedural scripts. They are not objects.
|
39
|
+
In `fast_track`, all objects inherit from `Track`. Procedural is fine for quick scripts, but not for robust tools.
|
40
|
+
|
41
|
+
## Roadmap
|
42
|
+
|
43
|
+
The roadmap includes
|
44
|
+
|
45
|
+
* The ability to handle advanced configurations.
|
46
|
+
* For other tracks to inherit from one another (e.g. the `DeviseOmniauth` track would inherit from the `Devise` track).
|
47
|
+
* Heroku support
|
48
|
+
* Git & Github support
|
49
|
+
* Errbit support
|
50
|
+
* Uploader support (CarrierWave, Paperclip, etc)
|
51
|
+
* Tons of ready-to-use templates with no dependencies
|
52
|
+
* Fix `Slop` to use delimit Arrays with spaces, or use a different option parser. Not a fan of the commas as shown above.
|
53
|
+
|
54
|
+
## Contributing to fast_track
|
55
|
+
|
56
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
57
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
58
|
+
* Fork the project.
|
59
|
+
* Start a feature/bugfix branch.
|
60
|
+
* Commit and push until you are happy with your contribution.
|
61
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
62
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
63
|
+
|
64
|
+
## Copyright
|
65
|
+
|
66
|
+
Copyright (c) 2013 EncomLabs. See LICENSE.txt for further details.
|
data/lib/fast_track/version.rb
CHANGED
data/lib/fast_track.rb
CHANGED
@@ -1,5 +1,102 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
|
2
2
|
|
3
|
-
|
3
|
+
require 'open-uri'
|
4
|
+
require 'slop'
|
4
5
|
|
6
|
+
require 'pry'
|
7
|
+
|
8
|
+
require 'rails/generators'
|
9
|
+
require 'rails/generators/rails/app/app_generator'
|
10
|
+
|
11
|
+
require 'fast_track/config'
|
12
|
+
|
13
|
+
require 'fast_track/track_methods'
|
14
|
+
require 'fast_track/track'
|
15
|
+
|
16
|
+
require 'fast_track/generator'
|
17
|
+
|
18
|
+
require 'fast_track/cancan'
|
19
|
+
require 'fast_track/rolify'
|
20
|
+
require 'fast_track/devise'
|
21
|
+
|
22
|
+
require 'fast_track/awesome_defaults'
|
23
|
+
require 'fast_track/twitter_bootstrap'
|
24
|
+
|
25
|
+
class FastTrack
|
26
|
+
class TrackNotFound < Exception
|
27
|
+
def initialize(track_name)
|
28
|
+
super("Could not find track #{track_name}! Please double-check the provided params.")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
FastTrack.validate_options!
|
34
|
+
end
|
35
|
+
|
36
|
+
def app
|
37
|
+
@app ||= Generator.new([FastTrack.app_name])
|
38
|
+
end
|
39
|
+
|
40
|
+
def start
|
41
|
+
app.invoke
|
42
|
+
end
|
43
|
+
|
44
|
+
class << self
|
45
|
+
def options
|
46
|
+
@opts
|
47
|
+
end
|
48
|
+
|
49
|
+
def app_name
|
50
|
+
options[:app]
|
51
|
+
end
|
52
|
+
|
53
|
+
def make_tracks
|
54
|
+
options[:tracks].map do |track|
|
55
|
+
klass = FastTrack.const_get(track.camelize)
|
56
|
+
if klass <= Track
|
57
|
+
klass
|
58
|
+
else
|
59
|
+
raise TrackNotFound.new(klass.name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def tracks
|
65
|
+
@tracks ||= make_tracks
|
66
|
+
end
|
67
|
+
|
68
|
+
def validate_options!
|
69
|
+
@opts ||= Slop.parse(ARGV || [], strict: true, arguments: true, help: true) do
|
70
|
+
banner 'Usage: track --A [app] --T [tracks]'
|
71
|
+
|
72
|
+
on 'A', 'app=', 'The application name'
|
73
|
+
on 'T', 'tracks=', 'The tracks to run', as: Array
|
74
|
+
end
|
75
|
+
|
76
|
+
# TODO: Is there a Ruby gem that has the same functionality as ActiveModel::Validations
|
77
|
+
# but doesn't require ActiveRecord?
|
78
|
+
#
|
79
|
+
# Because we should use that here..
|
80
|
+
|
81
|
+
if @opts[:app].blank?
|
82
|
+
raise "--app can't be blank!"
|
83
|
+
end
|
84
|
+
|
85
|
+
if @opts[:tracks].blank?
|
86
|
+
raise "--tracks can't be blank!"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def config
|
91
|
+
@config ||= FastTrack::Config.new
|
92
|
+
end
|
93
|
+
|
94
|
+
def root
|
95
|
+
File.expand_path '../..', __FILE__
|
96
|
+
end
|
97
|
+
|
98
|
+
def template_root
|
99
|
+
File.join(File.expand_path(root), "lib", "templates")
|
100
|
+
end
|
101
|
+
end
|
5
102
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_track
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
segments:
|
134
134
|
- 0
|
135
|
-
hash:
|
135
|
+
hash: 2775876779889266513
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
none: false
|
138
138
|
requirements:
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
hash:
|
144
|
+
hash: 2775876779889266513
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
147
|
rubygems_version: 1.8.25
|