Commit ff63023 1 parent 96aff70 commit ff63023 Copy full SHA for ff63023
File tree 5 files changed +36
-7
lines changed
lib/cocoapods-core/specification
5 files changed +36
-7
lines changed Original file line number Diff line number Diff line change 1
1
# CocoaPods Core Changelog
2
2
3
+ ## Master
4
+
5
+ ##### Enhancements
6
+
7
+ * The specification now strips the indentation of the ` prefix_header ` and
8
+ ` prepare_command ` to aide their declaration as a here document (similarly to
9
+ what it already does with the description).
10
+ [ Fabio Pelosin] [ irrationalfab ]
11
+ [ #51 ] ( https://github.com/CocoaPods/Core/issues/51 )
12
+
3
13
## 0.31.0
4
14
5
15
##### Enhancements
18
28
## 0.30.0
19
29
20
30
Introduction of the Changelog.
31
+
32
+ [ irrationalfab ] : https://github.com/irrationalfab
33
+
Original file line number Diff line number Diff line change @@ -347,7 +347,10 @@ def prepare_hook_name(attr)
347
347
# @return [String] the prefix header.
348
348
#
349
349
def _prepare_prefix_header_contents ( value )
350
- value . is_a? ( Array ) ? value * "\n " : value
350
+ if value
351
+ value = value . join ( "\n " ) if value . is_a? ( Array )
352
+ value . strip_heredoc . chomp
353
+ end
351
354
end
352
355
353
356
# Ensures that the file patterns of the resource bundles are contained in
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ def summary
121
121
#
122
122
def description
123
123
description = attributes_hash [ "description" ]
124
- description . strip_heredoc if description
124
+ description . strip_heredoc . chomp if description
125
125
end
126
126
127
127
# @return [Array<String>] The list of the URL for the screenshots of
@@ -143,7 +143,8 @@ def documentation_url
143
143
# @return [String, Nil] The prepare command of the Pod if specified.
144
144
#
145
145
def prepare_command
146
- attributes_hash [ "prepare_command" ]
146
+ command = attributes_hash [ "prepare_command" ]
147
+ command . strip_heredoc . chomp if command
147
148
end
148
149
149
150
#---------------------------------------------------------------------#
Original file line number Diff line number Diff line change @@ -179,7 +179,16 @@ module Pod
179
179
end
180
180
181
181
it "allows to specify the contents of the prefix header as an array" do
182
- @spec . prefix_header_contents = '#import <UIKit/UIKit.h>' , '#import <Foundation/Foundation.h>'
182
+ @spec . prefix_header_contents = [ '#import <UIKit/UIKit.h>' , '#import <Foundation/Foundation.h>' ]
183
+ @consumer . prefix_header_contents . should == "#import <UIKit/UIKit.h>\n #import <Foundation/Foundation.h>"
184
+ end
185
+
186
+ it "strips the indentation of the prefix headers" do
187
+ headers = <<-DESC
188
+ #import <UIKit/UIKit.h>
189
+ #import <Foundation/Foundation.h>
190
+ DESC
191
+ @spec . prefix_header_contents = headers
183
192
@consumer . prefix_header_contents . should == "#import <UIKit/UIKit.h>\n #import <Foundation/Foundation.h>"
184
193
end
185
194
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ module Pod
114
114
Line2
115
115
DESC
116
116
@spec . description = desc
117
- @spec . description . should == "Line1\n Line2\n "
117
+ @spec . description . should == "Line1\n Line2"
118
118
end
119
119
120
120
it "returns the screenshots" do
@@ -127,8 +127,11 @@ module Pod
127
127
@spec . screenshots . should == [ 'www.example.com/img1.png' ]
128
128
end
129
129
130
- it "returns the prepare_command" do
131
- @spec . prepare_command = 'ruby prepare_script.rb'
130
+ it "returns the prepare command stripping the indentation" do
131
+ command = <<-DESC
132
+ ruby prepare_script.rb
133
+ DESC
134
+ @spec . prepare_command = command
132
135
@spec . prepare_command . should == 'ruby prepare_script.rb'
133
136
end
134
137
You can’t perform that action at this time.
0 commit comments