routes 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/bin/routes +26 -10
  4. metadata +6 -6
data/Rakefile CHANGED
@@ -15,8 +15,8 @@ Jeweler::Tasks.new do |gem|
15
15
  gem.name = "routes"
16
16
  gem.homepage = "http://github.com/bcaccinolo/routes"
17
17
  gem.license = "MIT"
18
- gem.summary = "A routes command line to easily search through the rails routes"
19
- gem.description = "A routes command line to easily search through the rails routes"
18
+ gem.summary = "A routes command line to easily and fastly search through the rails routes"
19
+ gem.description = "A routes command line to easily search through the rails routes. Also fastly cause routes commands caches the routes results."
20
20
  gem.email = "benoit.caccinolo@gmail.com"
21
21
  gem.authors = ["Caccinolo Benoit"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/bin/routes CHANGED
@@ -1,3 +1,6 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require 'optparse'
1
4
 
2
5
  class File
3
6
  def File.same_contents(p1, p2)
@@ -19,22 +22,35 @@ class File
19
22
  end
20
23
 
21
24
 
22
- # is Dir .roads exist
23
- if Dir.glob(".roads").empty?
24
- Dir.mkdir(".roads")
25
+ options = {}
26
+ OptionParser.new do |opts|
27
+ opts.banner = "Usage: routes [options]"
28
+
29
+ opts.on("-i", "--init", "Initialize the routes cache") do |v|
30
+ options[:init] = 1
25
31
  end
32
+ end.parse!
26
33
 
27
- if File.same_contents("config/routes.rb", ".roads/routes.rb")
28
- # puts "files identical"
29
- else
30
- puts "Updating routes cache"
31
- system "cp config/routes.rb .roads/"
32
- system "rake routes > .roads/routes.txt"
34
+ #p options
35
+ #p ARGV
36
+
37
+
38
+ # is Dir .routess exist
39
+ if Dir.glob(".routes").empty?
40
+ Dir.mkdir(".routes")
33
41
  end
34
42
 
35
- cmd = "cat .roads/routes.txt"
43
+ if !File.same_contents("config/routes.rb", ".routes/routes.rb") || options.include?(:init)
44
+ puts "Updating routes cache"
45
+ if system "rake routes > .routes/routes.txt"
46
+ system "cp config/routes.rb .routes/"
47
+ end
48
+ end
49
+
50
+ cmd = "cat .routes/routes.txt"
36
51
  ARGV.each do|a|
37
52
  cmd << " | grep -i #{a}"
38
53
  end
39
54
 
40
55
  system cmd
56
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Caccinolo Benoit
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-08 00:00:00 +02:00
18
+ date: 2011-04-15 00:00:00 +02:00
19
19
  default_executable: routes
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -78,7 +78,7 @@ dependencies:
78
78
  prerelease: false
79
79
  type: :development
80
80
  requirement: *id004
81
- description: A routes command line to easily search through the rails routes
81
+ description: A routes command line to easily search through the rails routes. Also fastly cause routes commands caches the routes results.
82
82
  email: benoit.caccinolo@gmail.com
83
83
  executables:
84
84
  - routes
@@ -131,7 +131,7 @@ rubyforge_project:
131
131
  rubygems_version: 1.5.0
132
132
  signing_key:
133
133
  specification_version: 3
134
- summary: A routes command line to easily search through the rails routes
134
+ summary: A routes command line to easily and fastly search through the rails routes
135
135
  test_files:
136
136
  - test/helper.rb
137
137
  - test/test_routes.rb