rails3_assist 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rails3_assist/file/special.rb +5 -0
- data/rails3_assist.gemspec +1 -1
- data/spec/fixtures/Gemfile +5 -29
- data/spec/rails3_assist/file/special_spec.rb +23 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -31,6 +31,11 @@ module Rails3::Assist::File
|
|
31
31
|
def has_gem_version? name, version = nil
|
32
32
|
File.new(gem_file).read =~ /gem\s+('|")#{name}\1,\s*('|")#{version}\2/
|
33
33
|
end
|
34
|
+
|
35
|
+
def clean_gemfile
|
36
|
+
clean_gemfile_content = read_gem_file.gsub(/('|")\s*gem/m, "\\1\ngem")
|
37
|
+
File.open(gem_file, 'w') {|f| f.write(clean_gemfile_content) }
|
38
|
+
end
|
34
39
|
|
35
40
|
# read_application_file
|
36
41
|
# append_to_application_file
|
data/rails3_assist.gemspec
CHANGED
data/spec/fixtures/Gemfile
CHANGED
@@ -1,30 +1,6 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
gem 'sqlite3-ruby', :require => 'sqlite3'
|
9
|
-
|
10
|
-
# Use unicorn as the web server
|
11
|
-
# gem 'unicorn'
|
12
|
-
|
13
|
-
# Deploy with Capistrano
|
14
|
-
# gem 'capistrano'
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'ruby-debug'
|
18
|
-
|
19
|
-
# Bundle the extra gems:
|
20
|
-
# gem 'bj'
|
21
|
-
# gem 'nokogiri'
|
22
|
-
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
23
|
-
# gem 'aws-s3', :require => 'aws/s3'
|
24
|
-
|
25
|
-
# Bundle gems for the local environment. Make sure to
|
26
|
-
# put test-only gems in this group so their generators
|
27
|
-
# and rake tasks are available in development mode:
|
28
|
-
# group :development, :test do
|
29
|
-
# gem 'webrat'
|
30
|
-
# end
|
2
|
+
gem 'rails', '3.0.3'
|
3
|
+
gem 'cream'
|
4
|
+
gem 'devise'
|
5
|
+
gem "mm-devise"
|
6
|
+
gem "roles_mongo_mapper"
|
@@ -79,9 +79,30 @@ describe Rails3::Assist::File::Special do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
describe '#clean_gemfile' do
|
83
|
+
it 'should be true that it has cleaned the Gemfile ensuring newlines between each gem' do
|
84
|
+
old_gem_file_content = AppDir.new.read_gem_file
|
85
|
+
|
86
|
+
CLASS.append_to_gem_file do
|
87
|
+
"gem 'hello'gem 'hi'gem 'blip'"
|
88
|
+
end
|
89
|
+
|
90
|
+
AppDir.new.clean_gemfile
|
91
|
+
|
92
|
+
expected = "gem 'hello'\ngem 'hi'"
|
93
|
+
|
94
|
+
AppDir.new.read_gem_file.should match /#{Regexp.escape(expected)}/
|
95
|
+
|
96
|
+
File.overwrite CLASS.gem_file do
|
97
|
+
old_gem_file_content
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
82
102
|
describe '#has_gem_version?' do
|
83
|
-
it 'should be true that it has the rails gem 3.0.
|
84
|
-
AppDir.new.
|
103
|
+
it 'should be true that it has the rails gem 3.0.3' do
|
104
|
+
# puts AppDir.new.read_gem_file
|
105
|
+
AppDir.new.has_gem_version?(:rails, '3.0.3').should be_true
|
85
106
|
end
|
86
107
|
|
87
108
|
it 'should be false that it has the rails gem 3.0.1' do
|