captify 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +11 -3
  2. data/VERSION +1 -1
  3. data/bin/captify +31 -5
  4. data/captify.gemspec +1 -1
  5. metadata +2 -2
@@ -9,7 +9,7 @@ For bundler, add this to your Gemfile:
9
9
 
10
10
  == Usage
11
11
  cd my_project
12
- captify . # use default template: rails-basic
12
+ bundle exec captify . # use default template: rails-basic
13
13
 
14
14
  It will:
15
15
 
@@ -19,9 +19,17 @@ It will:
19
19
  To use a different template:
20
20
 
21
21
  cd my_project
22
- T=sinatra-basic captify .
22
+ bundle exec captify -t sinatra-basic .
23
23
 
24
- == Contributing to capy
24
+ === How to load template without bundler?
25
+ cd my_project
26
+ captify -r capistrano-templates -t rails-basic .
27
+
28
+ === See also
29
+ captify -h
30
+
31
+
32
+ == Contributing to captify
25
33
 
26
34
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
27
35
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,22 +1,48 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'captify/template'
4
+ require 'optparse'
5
+
6
+ opts = OptionParser.new do |opts|
7
+ opts.banner = "Usage: captify [options] directory"
8
+
9
+ opts.separator ""
10
+ opts.separator "Options:"
11
+
12
+ opts.on("-t", "--template TEMPLATE_NAME",
13
+ "Specify the template to be used") do |template|
14
+ template_name = template
15
+ end
16
+
17
+ opts.on("-r", "--require LIBRARY",
18
+ "Add LIBRARY that contains templates into load path") do |lib|
19
+ require lib
20
+ end
21
+
22
+ opts.on_tail("-h", "--help", "Show this message") do
23
+ puts opts
24
+ exit
25
+ end
26
+ end
27
+
28
+ opts.parse!(ARGV)
29
+
4
30
 
5
31
  Captify::Template.load_all
6
32
 
7
33
  if ARGV.empty?
8
- abort "Please specify the directory to captify, e.g. `#{File.basename($0)} .'"
34
+ abort "Please specify the directory to captify, e.g. `#{File.basename($0)} .'\n\n#{opts}"
9
35
  elsif !File.exists?(ARGV.first)
10
- abort "`#{ARGV.first}' does not exist."
36
+ abort "`#{ARGV.first}' does not exist.\n\n#{opts}"
11
37
  elsif !File.directory?(ARGV.first)
12
- abort "`#{ARGV.first}' is not a directory."
38
+ abort "`#{ARGV.first}' is not a directory.\n\n#{opts}"
13
39
  elsif ARGV.length > 1
14
- abort "Too many arguments; please specify only the directory to capify."
40
+ abort "Too many arguments; please specify only the directory to captify.\n\n#{opts}"
15
41
  end
16
42
 
17
43
  base_dir = ARGV.first
18
44
 
19
- template_name = ENV['T'] || 'rails-basic'
45
+ template_name = 'rails-basic' unless template_name
20
46
  file_paths = Captify::Template.template_files(template_name)
21
47
 
22
48
  puts `capify #{base_dir}`
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "captify"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Huiming Teo"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: captify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: 2119559040684084433
112
+ hash: -100599646786744606
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements: