switch_file 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,22 +2,22 @@
2
2
  {
3
3
  :name => 'model_spec',
4
4
  :shortcut => :ms,
5
- :path_generator => lambda {|class_name| "spec/models/#{class_name}_spec.rb"},
5
+ :path_generator => lambda {|class_name| "spec/models/#{class_name.singularize}_spec.rb"},
6
6
  :path_regex => %r{spec/models/(.*)_spec.rb},
7
7
  :command => 'geany'
8
8
  },
9
9
  {
10
10
  :name => 'controller_spec',
11
11
  :shortcut => :cs,
12
- :path_generator => lambda {|class_name| "spec/controllers/#{class_name}_spec.rb"},
13
- :path_regex => %r{spec/controllers/(.*)_spec.rb},
12
+ :path_generator => lambda {|class_name| "spec/controllers/#{class_name.pluralize}_controller_spec.rb"},
13
+ :path_regex => %r{spec/controllers/(.*)_controller_spec.rb},
14
14
  :command => 'geany'
15
15
  },
16
16
  {
17
17
  :name => 'helper_spec',
18
18
  :shortcut => :hs,
19
- :path_generator => lambda {|class_name| "spec/helpers/#{class_name}_spec.rb"},
20
- :path_regex => %r{spec/helpers/(.*)_spec.rb},
19
+ :path_generator => lambda {|class_name| "spec/helpers/#{class_name.pluralize}_helper_spec.rb"},
20
+ :path_regex => %r{spec/helpers/(.*)_helper_spec.rb},
21
21
  :command => 'geany'
22
22
  },
23
23
  {
@@ -30,22 +30,22 @@
30
30
  {
31
31
  :name => 'model',
32
32
  :shortcut => :m,
33
- :path_generator => lambda {|class_name| "app/models/#{class_name}.rb"},
33
+ :path_generator => lambda {|class_name| "app/models/#{class_name.singularize}.rb"},
34
34
  :path_regex => %r{app/models/(.*).rb},
35
35
  :command => 'geany'
36
36
  },
37
37
  {
38
38
  :name => 'controller',
39
39
  :shortcut => :c,
40
- :path_generator => lambda {|class_name| "app/controllers/#{class_name}.rb"},
41
- :path_regex => %r{app/controllers/(.*).rb},
40
+ :path_generator => lambda {|class_name| "app/controllers/#{class_name.pluralize}_controller.rb"},
41
+ :path_regex => %r{app/controllers/(.*)_controller.rb},
42
42
  :command => 'geany'
43
43
  },
44
44
  {
45
45
  :name => 'helper',
46
46
  :shortcut => :h,
47
- :path_generator => lambda {|class_name| "app/helpers/#{class_name}.rb"},
48
- :path_regex => %r{app/helpers/(.*).rb},
47
+ :path_generator => lambda {|class_name| "app/helpers/#{class_name.pluralize}_helper.rb"},
48
+ :path_regex => %r{app/helpers/(.*)_helper.rb},
49
49
  :command => 'geany'
50
50
  },
51
51
  {
@@ -20,21 +20,21 @@ module SwitchFile
20
20
 
21
21
  begin
22
22
  shortcut = options['shortcut'] || ask(source.prompt_message)
23
+
23
24
  unless shortcut.strip.empty?
24
- begin
25
- target_command = source.project.file_type_with_shortcut!(shortcut).generate_open_command(source)
26
- `#{target_command}`
27
- rescue SwitchFile::Exception => exception
28
- if SwitchFile.production?
29
- say exception.message
30
- retry
31
- end
32
- end
25
+ target_command = source.project.file_type_with_shortcut!(shortcut).generate_open_command(source)
26
+ `#{target_command}`
33
27
  end
34
28
 
35
- rescue SwitchFile::Exception => exception
36
- say exception.message if SwitchFile.production?
29
+ rescue Project::NoMatchingFileTypeForShortcut => exception
30
+ if SwitchFile.production?
31
+ say exception.message
32
+ retry
33
+ end
37
34
  end
35
+
36
+ rescue SwitchFile::Exception => exception
37
+ say exception.message if SwitchFile.production?
38
38
  end
39
39
 
40
40
  def help
@@ -1,3 +1,3 @@
1
1
  module SwitchFile
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,123 +1,158 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: switch_file
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - George Mendoza
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-24 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-05-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: active_support
16
- requirement: &77491890 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
22
32
  type: :runtime
23
- prerelease: false
24
- version_requirements: *77491890
25
- - !ruby/object:Gem::Dependency
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
26
35
  name: pow
27
- requirement: &77491400 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
28
38
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
33
46
  type: :runtime
34
- prerelease: false
35
- version_requirements: *77491400
36
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
37
49
  name: thor
38
- requirement: &77490900 !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
39
52
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
44
60
  type: :runtime
45
- prerelease: false
46
- version_requirements: *77490900
47
- - !ruby/object:Gem::Dependency
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
48
63
  name: valuable
49
- requirement: &77490360 !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
55
74
  type: :runtime
56
- prerelease: false
57
- version_requirements: *77490360
58
- - !ruby/object:Gem::Dependency
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
59
77
  name: coderay
60
- requirement: &77489780 !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
61
80
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
66
88
  type: :development
67
- prerelease: false
68
- version_requirements: *77489780
69
- - !ruby/object:Gem::Dependency
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
70
91
  name: guard
71
- requirement: &77489310 !ruby/object:Gem::Requirement
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
72
94
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
77
102
  type: :development
78
- prerelease: false
79
- version_requirements: *77489310
80
- - !ruby/object:Gem::Dependency
103
+ version_requirements: *id006
104
+ - !ruby/object:Gem::Dependency
81
105
  name: guard-rspec
82
- requirement: &77488450 !ruby/object:Gem::Requirement
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
83
108
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
88
116
  type: :development
89
- prerelease: false
90
- version_requirements: *77488450
91
- - !ruby/object:Gem::Dependency
117
+ version_requirements: *id007
118
+ - !ruby/object:Gem::Dependency
92
119
  name: pry
93
- requirement: &77487630 !ruby/object:Gem::Requirement
120
+ prerelease: false
121
+ requirement: &id008 !ruby/object:Gem::Requirement
94
122
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
99
130
  type: :development
100
- prerelease: false
101
- version_requirements: *77487630
102
- - !ruby/object:Gem::Dependency
131
+ version_requirements: *id008
132
+ - !ruby/object:Gem::Dependency
103
133
  name: rspec
104
- requirement: &77487370 !ruby/object:Gem::Requirement
134
+ prerelease: false
135
+ requirement: &id009 !ruby/object:Gem::Requirement
105
136
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
143
+ version: "0"
110
144
  type: :development
111
- prerelease: false
112
- version_requirements: *77487370
145
+ version_requirements: *id009
113
146
  description: A configurable utility for jumping across files
114
- email:
147
+ email:
115
148
  - gsmendoza@gmail.com
116
- executables:
149
+ executables:
117
150
  - switch_file
118
151
  extensions: []
152
+
119
153
  extra_rdoc_files: []
120
- files:
154
+
155
+ files:
121
156
  - .gitignore
122
157
  - CHANGELOG.markdown
123
158
  - Gemfile
@@ -146,26 +181,36 @@ files:
146
181
  - switch_file.gemspec
147
182
  homepage: https://github.com/gsmendoza/switch_file
148
183
  licenses: []
184
+
149
185
  post_install_message:
150
186
  rdoc_options: []
151
- require_paths:
187
+
188
+ require_paths:
152
189
  - lib
153
- required_ruby_version: !ruby/object:Gem::Requirement
190
+ required_ruby_version: !ruby/object:Gem::Requirement
154
191
  none: false
155
- requirements:
156
- - - ! '>='
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
- required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ hash: 3
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
200
  none: false
161
- requirements:
162
- - - ! '>='
163
- - !ruby/object:Gem::Version
164
- version: '0'
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ hash: 3
205
+ segments:
206
+ - 0
207
+ version: "0"
165
208
  requirements: []
209
+
166
210
  rubyforge_project: switch_file
167
- rubygems_version: 1.8.6
211
+ rubygems_version: 1.8.10
168
212
  signing_key:
169
213
  specification_version: 3
170
214
  summary: A configurable utility for jumping across files
171
215
  test_files: []
216
+