primo 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -6
- data/bin/primo +2 -2
- data/lib/primo/version.rb +1 -1
- data/lib/primo.rb +5 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -6,9 +6,13 @@ Inspired by Steve Klabnik's article ["Rails has Two Default Stacks"](http://word
|
|
6
6
|
|
7
7
|
## Why is this useful?
|
8
8
|
|
9
|
-
Rails application templates are awesome, especially for hackers that often need to set up the same basic app. Sadly the ecosystem around them seems to be quite limited. Primo tries to solve this by adding a command line interface for defining your default template and share it with others.
|
9
|
+
Rails application templates are awesome, especially for hackers that often need to set up the same basic app, but also for companies that want to promote their best pratices. Sadly the ecosystem around them seems to be quite limited. Primo tries to solve this by adding a command line interface for defining your default template and share it with others.
|
10
10
|
|
11
|
-
At the moment Primo allows you to run a Rails install with a template based on PostgreSQL/HAML/Rspec
|
11
|
+
At the moment Primo allows you to run a Rails install with a template based on PostgreSQL/HAML/Rspec. It also allows you to specify your own default template in a .primo file.
|
12
|
+
|
13
|
+
## What is next?
|
14
|
+
|
15
|
+
I have been thinking about a "template server" much like rubygems.org to allow people to upload/share their templates and reference them by name. I would love to know if this an idea worth exploring or just silly. [Join the discussion here](https://github.com/cbetta/primo/issues/2)
|
12
16
|
|
13
17
|
## Usage
|
14
18
|
|
@@ -19,7 +23,11 @@ At the moment Primo allows you to run a Rails install with a template based on P
|
|
19
23
|
|
20
24
|
primo new app_name #instead of "rails new app_name"
|
21
25
|
|
22
|
-
This generates a PostgreSQL/HAML/Rspec Rails app using [this template](https://github.com/cbetta/primo/blob/master/templates/prime.rb).
|
26
|
+
This generates a PostgreSQL/HAML/Rspec Rails app using [this admittedly very basic template](https://github.com/cbetta/primo/blob/master/templates/prime.rb).
|
27
|
+
|
28
|
+
Specify a different build in template (currently only 2) as follows
|
29
|
+
|
30
|
+
primo new app_name -t template_name
|
23
31
|
|
24
32
|
### Specify default template
|
25
33
|
|
@@ -34,13 +42,15 @@ or edit `~/.primo`:
|
|
34
42
|
default="template_name"
|
35
43
|
default="/local/path/to/template.rb"
|
36
44
|
default="http://remote.path/to/template.rb"
|
45
|
+
|
46
|
+
## Todos
|
37
47
|
|
38
|
-
|
39
|
-
|
40
|
-
* Think about a "template server" much like rubygems.org to allow people to upload/share their templates and reference them by name.
|
48
|
+
* Add tests
|
49
|
+
* Look into template server idea
|
41
50
|
|
42
51
|
## Release notes
|
43
52
|
|
53
|
+
* **0.0.6** Allows for overriding of templates
|
44
54
|
* **0.0.5** Adds option to set custom default
|
45
55
|
* **0.0.4** Fixing template
|
46
56
|
* **0.0.3** Removed direct Rails dependency
|
data/bin/primo
CHANGED
@@ -12,9 +12,9 @@ flag [:t,:template], :default_value => Primo.current_template
|
|
12
12
|
desc 'Create a new Rails app'
|
13
13
|
long_desc "Create a new Rails app using your default template"
|
14
14
|
command :new do |c|
|
15
|
-
c.action do |
|
15
|
+
c.action do |global_options,_,args|
|
16
16
|
help_now!('Please specify name for your new Rails app') if args.length != 1
|
17
|
-
Primo.create args.first
|
17
|
+
Primo.create args.first, global_options[:template]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/lib/primo/version.rb
CHANGED
data/lib/primo.rb
CHANGED
@@ -4,8 +4,8 @@ class Primo
|
|
4
4
|
|
5
5
|
CONFIG_FILE = File.expand_path('~/.primo').freeze
|
6
6
|
|
7
|
-
def self.create name
|
8
|
-
system "rails new #{name} -m #{
|
7
|
+
def self.create name, template
|
8
|
+
system "rails new #{name} -m #{path_for(template)}"
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.default value
|
@@ -19,10 +19,9 @@ class Primo
|
|
19
19
|
ParseConfig.new(CONFIG_FILE)["default"]
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.
|
23
|
-
|
24
|
-
|
25
|
-
default
|
22
|
+
def self.path_for template
|
23
|
+
return File.expand_path("templates/#{template}.rb") unless template =~ /\.rb$/i
|
24
|
+
template
|
26
25
|
end
|
27
26
|
|
28
27
|
def self.ensure_config
|