rails_assist 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,12 +2,18 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "require_all", "~> 1.2.0"
4
4
  gem "sugar-high", ">= 0.6.0"
5
- gem "file_mutate", ">= 0.1.1"
5
+ gem "file_mutate", "~> 0.1.3"
6
6
  gem "activesupport", ">= 3.0.1"
7
7
 
8
+ group :test do
9
+ gem 'rails-app-spec', '>= 0.5.0'
10
+ gem 'generator-spec', '>= 0.7.8'
11
+ gem 'mocha', '>= 0.9.8'
12
+ end
13
+
8
14
  group :development do
9
15
  gem "rspec", ">= 2.4"
10
16
  gem "bundler", ">= 1.0.1"
11
17
  gem "jeweler", ">= 1.6.4"
12
- gem "rcov", ">= 0"
18
+ gem "rcov", ">= 0"
13
19
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/lib/rails_assist.rb CHANGED
@@ -9,6 +9,10 @@ require 'sugar-high/file'
9
9
  require 'sugar-high/regexp'
10
10
  require 'sugar-high/array'
11
11
 
12
+ require 'file_mutate'
13
+
14
+ File.file_mutate :all
15
+
12
16
  require 'rails_assist/namespaces'
13
17
 
14
18
  module RailsAssist
@@ -1,5 +1,4 @@
1
1
  require 'sugar-high/file'
2
- require 'sugar-high/file_mutate'
3
2
 
4
3
  module RailsAssist::File
5
4
  module Application
@@ -12,4 +11,4 @@ module RailsAssist::File
12
11
  include Methods
13
12
  extend Methods
14
13
  end
15
- end
14
+ end
@@ -5,13 +5,13 @@ require 'sugar-high/regexp'
5
5
  require_all File.dirname(__FILE__) + '/file'
6
6
 
7
7
  module RailsAssist
8
- module Files
8
+ module Files
9
9
  # we depend on the Directories module doing some of the hard work!
10
10
  module Methods
11
11
  RYBY_FILES = '**/*.rb'
12
-
12
+
13
13
  def rails_app_filepaths type = :app, options = {}
14
- type = (type =~ /ss/) ? type : type.to_s.singularize
14
+ type = (type =~ /ss/) ? type : type.to_s.singularize
15
15
  dir = RailsAssist::Directory.send "#{type}_dirpath"
16
16
  expr = options[:expr]
17
17
  file_pattern = options[:pattern] || RYBY_FILES
@@ -22,35 +22,35 @@ module RailsAssist
22
22
  def rails_app_files type = :app, options = {}
23
23
  rails_app_filepaths(type, options).to_files
24
24
  end
25
-
25
+
26
26
  def all_filepaths expr=nil
27
27
  pattern = "#{RailsAssist::Directory::Root.root_dirpath}/**/*.*"
28
28
  FileList[pattern].to_a.grep_it expr
29
- end
29
+ end
30
30
 
31
31
  def all_files expr=nil
32
32
  all_filepaths(expr).to_files
33
- end
33
+ end
34
34
 
35
35
  def app_filepaths expr=nil
36
36
  rails_app_files(:app).grep_it expr
37
- end
37
+ end
38
38
 
39
39
  def app_files expr=nil
40
40
  app_filepaths(expr).to_files
41
- end
41
+ end
42
42
 
43
43
  # files_from :model, :controller, :matching => /user/
44
44
  def filepaths_from *types, &block
45
45
  expr = last_option(types)[:matching]
46
46
  the_files = types.inject([]) do |files, type|
47
- method = :"#{type}_files"
47
+ method = :"#{type}_files"
48
48
  files_found = send(method, expr) if respond_to?(method)
49
49
  files_found = RailsAssist::Artifact::Files.send(method, expr) if RailsAssist::Artifact::Files.respond_to?(method)
50
50
  files + files_found
51
51
  end.compact
52
52
  yield the_files if block
53
- the_files
53
+ the_files
54
54
  end
55
55
 
56
56
  def files_from *types, &block
@@ -113,41 +113,41 @@ module RailsAssist
113
113
  end
114
114
  }
115
115
  end
116
-
117
- # RailsAssist::Artifact.app_artifacts.each do |name|
118
- # plural_name = name.to_s.pluralize
119
- # class_eval %{
120
- # def #{name}_files? *names
121
- # names.to_strings.each do |name|
122
- # return false if !#{name}_file?(name)
123
- # end
124
- # true
125
- # end
126
- #
127
- # def #{name}_file? name
128
- # ::File.file? #{name}_file(name)
129
- # end
130
- # alias_method :has_#{name}_file?, :#{name}_file?
131
- #
132
- # def remove_all_#{plural_name}
133
- # RailsAssist::Artifact::Files.#{name}_files.each{|f| ::File.delete_file! f}
134
- # end
135
- # alias_method :delete_all_#{plural_name}, :remove_all_#{plural_name}
136
- #
137
- # def remove_#{plural_name} *names
138
- # return remove_all_#{plural_name} if names.empty?
139
- # names.to_strings.each do |name|
140
- # ::File.delete #{name}_file(name)
141
- # end
142
- # end
143
- # alias_method :delete_#{plural_name}, :remove_#{plural_name}
144
- # alias_method :remove_#{name}, :remove_#{plural_name}
145
- # alias_method :delete_#{name}, :remove_#{plural_name}
146
- # }
147
- # end
148
- end
149
-
116
+
117
+ RailsAssist::Artifact.app_artifacts.each do |name|
118
+ plural_name = name.to_s.pluralize
119
+ class_eval %{
120
+ def #{name}_files? *names
121
+ names.to_strings.each do |name|
122
+ return false if !#{name}_file?(name)
123
+ end
124
+ true
125
+ end
126
+
127
+ def #{name}_file? name
128
+ ::File.file? #{name}_file(name)
129
+ end
130
+ alias_method :has_#{name}_file?, :#{name}_file?
131
+
132
+ def remove_all_#{plural_name}
133
+ RailsAssist::Artifact::Files.#{name}_files.each{|f| ::File.delete_file! f}
134
+ end
135
+ alias_method :delete_all_#{plural_name}, :remove_all_#{plural_name}
136
+
137
+ def remove_#{plural_name} *names
138
+ return remove_all_#{plural_name} if names.empty?
139
+ names.to_strings.each do |name|
140
+ ::File.delete #{name}_file(name)
141
+ end
142
+ end
143
+ alias_method :delete_#{plural_name}, :remove_#{plural_name}
144
+ alias_method :remove_#{name}, :remove_#{plural_name}
145
+ alias_method :delete_#{name}, :remove_#{plural_name}
146
+ }
147
+ end
148
+ end
149
+
150
150
  include Methods
151
151
  extend Methods
152
- end # Files
153
- end # App
152
+ end # Files
153
+ end # App
data/rails_assist.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_assist}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
@@ -143,7 +143,7 @@ Gem::Specification.new do |s|
143
143
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
144
144
  s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
145
145
  s.add_runtime_dependency(%q<sugar-high>, [">= 0.6.0"])
146
- s.add_runtime_dependency(%q<file_mutate>, [">= 0.1.1"])
146
+ s.add_runtime_dependency(%q<file_mutate>, ["~> 0.1.3"])
147
147
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.1"])
148
148
  s.add_development_dependency(%q<rspec>, [">= 2.4"])
149
149
  s.add_development_dependency(%q<bundler>, [">= 1.0.1"])
@@ -152,7 +152,7 @@ Gem::Specification.new do |s|
152
152
  else
153
153
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
154
154
  s.add_dependency(%q<sugar-high>, [">= 0.6.0"])
155
- s.add_dependency(%q<file_mutate>, [">= 0.1.1"])
155
+ s.add_dependency(%q<file_mutate>, ["~> 0.1.3"])
156
156
  s.add_dependency(%q<activesupport>, [">= 3.0.1"])
157
157
  s.add_dependency(%q<rspec>, [">= 2.4"])
158
158
  s.add_dependency(%q<bundler>, [">= 1.0.1"])
@@ -162,7 +162,7 @@ Gem::Specification.new do |s|
162
162
  else
163
163
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
164
164
  s.add_dependency(%q<sugar-high>, [">= 0.6.0"])
165
- s.add_dependency(%q<file_mutate>, [">= 0.1.1"])
165
+ s.add_dependency(%q<file_mutate>, ["~> 0.1.3"])
166
166
  s.add_dependency(%q<activesupport>, [">= 3.0.1"])
167
167
  s.add_dependency(%q<rspec>, [">= 2.4"])
168
168
  s.add_dependency(%q<bundler>, [">= 1.0.1"])
data/spec/spec_helper.rb CHANGED
@@ -1,23 +1,17 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
1
  require 'rails_assist'
4
2
  require 'rails_assist/rspec'
5
3
  require 'rails-app-spec'
6
4
  require 'tmpdir'
7
5
 
8
- # Requires supporting files with custom matchers and macros, etc,
9
- # in ./support/ and its subdirectories.
10
- # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
-
12
6
  require 'generator-spec'
13
-
7
+
14
8
  RSpec::Generator.configure do |config|
15
9
  config.debug = false
16
10
  config.remove_temp_dir = false # true
17
- config.default_rails_root(__FILE__)
11
+ config.default_rails_root(__FILE__)
18
12
  config.lib = File.dirname(__FILE__) + '/../lib'
19
- config.logger = :stdout
20
- end
13
+ config.logger = :stdout
14
+ end
21
15
 
22
16
  require 'fixtures'
23
17
 
@@ -26,14 +20,14 @@ def project_dir
26
20
  end
27
21
 
28
22
  def temp_dir name
29
- File.join(project_dir, name)
23
+ File.join(project_dir, name)
30
24
  end
31
25
 
32
- def make_temp_dir name
26
+ def make_temp_dir name
33
27
  FileUtils.mkdir_p temp_dir(name)
34
28
  end
35
29
 
36
- def remove_temp_dir name
30
+ def remove_temp_dir name
37
31
  FileUtils.rm_rf temp_dir(name)
38
32
  end
39
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_assist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
16
- requirement: &2155428960 !ruby/object:Gem::Requirement
16
+ requirement: &2153997600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2155428960
24
+ version_requirements: *2153997600
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sugar-high
27
- requirement: &2155428480 !ruby/object:Gem::Requirement
27
+ requirement: &2153997000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2155428480
35
+ version_requirements: *2153997000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: file_mutate
38
- requirement: &2155427940 !ruby/object:Gem::Requirement
38
+ requirement: &2153996400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ! '>='
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.1.1
43
+ version: 0.1.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2155427940
46
+ version_requirements: *2153996400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &2155427460 !ruby/object:Gem::Requirement
49
+ requirement: &2153995820 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.0.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2155427460
57
+ version_requirements: *2153995820
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &2155426980 !ruby/object:Gem::Requirement
60
+ requirement: &2153995240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '2.4'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2155426980
68
+ version_requirements: *2153995240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &2155426500 !ruby/object:Gem::Requirement
71
+ requirement: &2153994660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.1
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2155426500
79
+ version_requirements: *2153994660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &2155425980 !ruby/object:Gem::Requirement
82
+ requirement: &2153994080 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.6.4
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2155425980
90
+ version_requirements: *2153994080
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rcov
93
- requirement: &2155425460 !ruby/object:Gem::Requirement
93
+ requirement: &2153993500 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2155425460
101
+ version_requirements: *2153993500
102
102
  description: Basic file operation helpers for working with Rails 3 artifacts
103
103
  email: kmandrup@gmail.com
104
104
  executables: []
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  segments:
237
237
  - 0
238
- hash: -669326387602020046
238
+ hash: -4063057361183552736
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements: