choctop 0.9.6 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +10 -0
- data/Manifest.txt +16 -7
- data/README.rdoc +7 -3
- data/app_generators/install_choctop/templates/Rakefile.erb +2 -3
- data/features/development.feature +5 -5
- data/features/dmg.feature +34 -28
- data/features/fixtures/SampleApp/README.txt +1 -0
- data/features/fixtures/SampleApp/build/Release/README.txt +1 -0
- data/features/fixtures/SampleApp/build/Release/dmg/README.txt +1 -0
- data/features/initial_generator.feature +10 -10
- data/features/rake_tasks.feature +15 -15
- data/features/sparkle_feed.feature +25 -25
- data/features/step_definitions/common_steps.rb +177 -0
- data/features/{steps → step_definitions}/dmg_steps.rb +12 -4
- data/features/{steps → step_definitions}/file_attribute_steps.rb +2 -2
- data/features/{steps/generator.rb → step_definitions/generator_steps.rb} +2 -2
- data/features/{steps/remote.rb → step_definitions/remote_steps.rb} +2 -2
- data/features/{steps → step_definitions}/xcode_steps.rb +1 -1
- data/features/support/common.rb +44 -0
- data/features/{steps → support}/env.rb +0 -0
- data/features/support/matchers.rb +11 -0
- data/lib/choctop.rb +66 -28
- data/lib/choctop/appcast.rb +1 -1
- data/lib/choctop/dmg.rb +22 -3
- data/spec/choctop_spec.rb +85 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +5 -0
- data/tasks/rspec.rake +21 -0
- metadata +44 -13
- data/features/steps/common.rb +0 -248
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 0.10.0 2009-06-11
|
2
|
+
|
3
|
+
* Extra files supported: +add_file 'project/path/to/file_or_folder_or_bundle', :position => [x, y]+
|
4
|
+
|
5
|
+
== 0.9.7 2009-05-17
|
6
|
+
|
7
|
+
* New config option: s.build_type = ENV['BUILD_TYPE'] || 'Release' [kdbdallas]
|
8
|
+
* permit SUFeedURL to not be specified (cleanly exit from deploy rake tasks)
|
9
|
+
* removed unused 'appcast' rake task
|
10
|
+
|
1
11
|
== 0.9.6 2009-02-10
|
2
12
|
|
3
13
|
* Custom Applications Icons!!!
|
data/Manifest.txt
CHANGED
@@ -38,27 +38,36 @@ features/fixtures/App With Whitespace/main.m
|
|
38
38
|
features/fixtures/SampleApp/English.lproj/InfoPlist.strings
|
39
39
|
features/fixtures/SampleApp/English.lproj/MainMenu.xib
|
40
40
|
features/fixtures/SampleApp/Info.plist
|
41
|
+
features/fixtures/SampleApp/README.txt
|
41
42
|
features/fixtures/SampleApp/SampleApp.xcodeproj/TemplateIcon.icns
|
42
43
|
features/fixtures/SampleApp/SampleApp.xcodeproj/project.pbxproj
|
43
44
|
features/fixtures/SampleApp/SampleApp_Prefix.pch
|
45
|
+
features/fixtures/SampleApp/build/Release/README.txt
|
46
|
+
features/fixtures/SampleApp/build/Release/dmg/README.txt
|
44
47
|
features/fixtures/SampleApp/main.m
|
45
48
|
features/fixtures/custom_assets/appicon.icns
|
46
49
|
features/initial_generator.feature
|
47
50
|
features/rake_tasks.feature
|
48
51
|
features/sparkle_feed.feature
|
49
|
-
features/
|
50
|
-
features/
|
51
|
-
features/
|
52
|
-
features/
|
53
|
-
features/
|
54
|
-
features/
|
55
|
-
features/
|
52
|
+
features/step_definitions/common_steps.rb
|
53
|
+
features/step_definitions/dmg_steps.rb
|
54
|
+
features/step_definitions/file_attribute_steps.rb
|
55
|
+
features/step_definitions/generator_steps.rb
|
56
|
+
features/step_definitions/remote_steps.rb
|
57
|
+
features/step_definitions/xcode_steps.rb
|
58
|
+
features/support/common.rb
|
59
|
+
features/support/env.rb
|
60
|
+
features/support/matchers.rb
|
56
61
|
lib/choctop.rb
|
57
62
|
lib/choctop/appcast.rb
|
58
63
|
lib/choctop/dmg.rb
|
59
64
|
script/console
|
60
65
|
script/destroy
|
61
66
|
script/generate
|
67
|
+
spec/choctop_spec.rb
|
68
|
+
spec/spec.opts
|
69
|
+
spec/spec_helper.rb
|
70
|
+
tasks/rspec.rake
|
62
71
|
website/_layouts/default.html
|
63
72
|
website/_layouts/post.html
|
64
73
|
website/_posts/2009-02-02-first-post.markdown
|
data/README.rdoc
CHANGED
@@ -52,17 +52,21 @@ to the end:
|
|
52
52
|
require "choctop"
|
53
53
|
|
54
54
|
ChocTop.new do |s|
|
55
|
-
s.host = 'project.com'
|
56
55
|
s.remote_dir = '/path/to/upload/root/of/app'
|
57
56
|
|
58
57
|
# Optional, showing defaults
|
59
|
-
s.
|
58
|
+
s.host = host from Info.plist['SUFeedURL']
|
59
|
+
s.base_url = "http://#{s.host}"
|
60
60
|
s.release_notes = "release_notes.html"
|
61
61
|
|
62
62
|
# Custom DMG
|
63
63
|
s.background_file = "background.jpg"
|
64
64
|
s.app_icon_position = [100, 90]
|
65
65
|
s.applications_icon_position = [400, 90]
|
66
|
+
s.applications_icon = "applications.icns"
|
67
|
+
|
68
|
+
# Extra files
|
69
|
+
s.add_file 'path/to/README.txt', :position => [250, 90]
|
66
70
|
|
67
71
|
# Custom DMG options
|
68
72
|
s.volume_icon = "dmg.icns"
|
@@ -131,4 +135,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
131
135
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
132
136
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
133
137
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
134
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
138
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -4,9 +4,8 @@ require "rake"
|
|
4
4
|
require "choctop"
|
5
5
|
|
6
6
|
ChocTop.new do |s|
|
7
|
-
# Remote upload target
|
8
|
-
s.host = '<%= urlname %>.com'
|
9
|
-
# s.base_url = "http://#{s.host}"
|
7
|
+
# Remote upload target (set host if not same as Info.plist['SUFeedURL'])
|
8
|
+
# s.host = '<%= urlname %>.com'
|
10
9
|
s.remote_dir = '/path/to/upload/root/of/app'
|
11
10
|
|
12
11
|
# Custom DMG
|
@@ -6,8 +6,8 @@ Feature: Development processes of newgem itself (rake tasks)
|
|
6
6
|
|
7
7
|
Scenario: Generate RubyGem
|
8
8
|
Given this project is active project folder
|
9
|
-
And
|
10
|
-
When task
|
11
|
-
Then folder
|
12
|
-
And file with name matching
|
13
|
-
And gem spec key
|
9
|
+
And "pkg" folder is deleted
|
10
|
+
When I invoke task "rake gem"
|
11
|
+
Then folder "pkg" is created
|
12
|
+
And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
|
13
|
+
And gem spec key "rdoc_options" contains /--mainREADME.rdoc/
|
data/features/dmg.feature
CHANGED
@@ -4,36 +4,42 @@ Feature: Can build a customised DMG image from application build
|
|
4
4
|
I want a rake task to generate a DMG based on custom settings
|
5
5
|
|
6
6
|
Scenario: Build a DMG with default custom DMG config
|
7
|
-
Given a Cocoa app with choctop installed called
|
8
|
-
When task
|
9
|
-
Then file
|
10
|
-
When dmg
|
11
|
-
Then folder
|
12
|
-
And file
|
13
|
-
And file
|
14
|
-
And file
|
15
|
-
And file
|
7
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
8
|
+
When I invoke task "rake dmg"
|
9
|
+
Then file "appcast/build/SampleApp-0.1.0.dmg" is created
|
10
|
+
When dmg "appcast/build/SampleApp-0.1.0.dmg" is mounted as "SampleApp"
|
11
|
+
Then folder "SampleApp.app" in mounted volume is created
|
12
|
+
And file "Applications" in mounted volume is created
|
13
|
+
And file ".background/background.jpg" in mounted volume is created
|
14
|
+
And file ".background/background.jpg" in mounted volume is invisible
|
15
|
+
And file ".VolumeIcon.icns" in mounted volume is created
|
16
16
|
|
17
17
|
Scenario: Build a DMG with a whitespace name
|
18
|
-
Given a Cocoa app with choctop installed called
|
19
|
-
When task
|
20
|
-
Then file
|
21
|
-
When dmg
|
22
|
-
Then folder
|
23
|
-
And file
|
24
|
-
And file
|
25
|
-
And file
|
26
|
-
And file
|
18
|
+
Given a Cocoa app with choctop installed called "App With Whitespace"
|
19
|
+
When I invoke task "rake dmg"
|
20
|
+
Then file "appcast/build/App With Whitespace-1.0.dmg" is created
|
21
|
+
When dmg "appcast/build/App With Whitespace-1.0.dmg" is mounted as "App With Whitespace"
|
22
|
+
Then folder "App With Whitespace.app" in mounted volume is created
|
23
|
+
And file "Applications" in mounted volume is created
|
24
|
+
And file ".background/background.jpg" in mounted volume is created
|
25
|
+
And file ".background/background.jpg" in mounted volume is invisible
|
26
|
+
And file ".VolumeIcon.icns" in mounted volume is created
|
27
27
|
|
28
28
|
Scenario: Build a DMG with custom Applications symlink icon
|
29
|
-
Given a Cocoa app with choctop installed called
|
29
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
30
30
|
And is configured for custom Applications icon
|
31
|
-
When task
|
32
|
-
And dmg
|
33
|
-
Then file
|
34
|
-
And file
|
35
|
-
And file
|
36
|
-
And file
|
37
|
-
And file
|
38
|
-
|
39
|
-
|
31
|
+
When I invoke task "rake dmg"
|
32
|
+
And dmg "appcast/build/SampleApp-0.1.0.dmg" is mounted as "SampleApp"
|
33
|
+
Then file "Applications" in mounted volume is created
|
34
|
+
And file "Applications" in mounted volume has GetFileInfo type ""fdrp""
|
35
|
+
And file "Applications" in mounted volume has GetFileInfo alias "1"
|
36
|
+
And file "Applications" in mounted volume has GetFileInfo custom icon "1"
|
37
|
+
And file "Applications" in mounted volume is aliased to "/Applications"
|
38
|
+
|
39
|
+
Scenario: Build a DMG with extra included file such as README in the project folder
|
40
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
41
|
+
And is configured for an asset file "README.txt" to be included in dmg
|
42
|
+
When I invoke task "rake dmg"
|
43
|
+
And dmg "appcast/build/SampleApp-0.1.0.dmg" is mounted as "SampleApp"
|
44
|
+
And file "README.txt" in mounted volume is created
|
45
|
+
And file "SampleApp.app.dSYM" in mounted volume is not created
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the README for the SampleApp
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the README for the SampleApp
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the README for the SampleApp
|
@@ -5,20 +5,20 @@ Feature: Setup a Cocoa app with choctop
|
|
5
5
|
|
6
6
|
Scenario: Install choctop into an app that has no existing Rakefile
|
7
7
|
Given a Cocoa app that does not have an existing Rakefile
|
8
|
-
When I run local executable
|
8
|
+
When I run local executable "install_choctop" with arguments "."
|
9
9
|
And Rakefile wired to use development code instead of installed RubyGem
|
10
|
-
Then file
|
11
|
-
And
|
12
|
-
And
|
10
|
+
Then file "Rakefile" is created
|
11
|
+
And I should see /rake build/
|
12
|
+
And I should see /rake upload/
|
13
13
|
|
14
|
-
Scenario: Run
|
14
|
+
Scenario: Run "install_choctop" without arguments shows an error
|
15
15
|
Given a Cocoa app that does not have an existing Rakefile
|
16
|
-
When I run local executable
|
17
|
-
Then
|
16
|
+
When I run local executable "install_choctop" with arguments ""
|
17
|
+
Then I should see /USAGE: install_choctop path/to/CocoaApp/
|
18
18
|
|
19
19
|
Scenario: Install choctop and generate a release_notes file
|
20
20
|
Given a Cocoa app that does not have an existing Rakefile
|
21
|
-
When I run local executable
|
22
|
-
Then file
|
23
|
-
And
|
21
|
+
When I run local executable "install_choctop" with arguments "."
|
22
|
+
Then file "release_notes.txt" is created
|
23
|
+
And file "release_notes.txt" contents does match /Initial release/
|
24
24
|
|
data/features/rake_tasks.feature
CHANGED
@@ -4,27 +4,27 @@ Feature: Rake tasks are available to build and deploy Cocoa apps with Sparkle
|
|
4
4
|
I want rake tasks to build and deploy my Cocoa app
|
5
5
|
|
6
6
|
Scenario: rake task to build Release of app
|
7
|
-
Given a Cocoa app with choctop installed called
|
8
|
-
When task
|
9
|
-
Then folder
|
7
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
8
|
+
When I invoke task "rake build"
|
9
|
+
Then folder "build/Release/SampleApp.app" is created
|
10
10
|
|
11
11
|
Scenario: rake task to create dmg file of build
|
12
|
-
Given a Cocoa app with choctop installed called
|
13
|
-
When task
|
14
|
-
Then file
|
12
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
13
|
+
When I invoke task "rake dmg"
|
14
|
+
Then file "appcast/build/SampleApp-0.1.0.dmg" is created
|
15
15
|
|
16
16
|
Scenario: rake task to upload the appcast file to the server
|
17
|
-
Given a Cocoa app with choctop installed called
|
18
|
-
And task
|
17
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
18
|
+
And I invoke task "rake dmg feed"
|
19
19
|
And ChocTop config is configured for local rsync
|
20
|
-
When task
|
21
|
-
Then remote file
|
22
|
-
Then remote file
|
23
|
-
Then remote file
|
20
|
+
When I invoke task "rake upload"
|
21
|
+
Then remote file "my_feed.xml" is created
|
22
|
+
Then remote file "SampleApp-0.1.0.dmg" is created
|
23
|
+
Then remote file "index.php" is created
|
24
24
|
|
25
25
|
Scenario: change the version number in the Info.plist
|
26
|
-
Given a Cocoa app with choctop installed called
|
27
|
-
When task
|
28
|
-
Then current xcode project version is
|
26
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
27
|
+
When I invoke task "rake version:set VERSION="1.2.3""
|
28
|
+
Then current xcode project version is "1.2.3"
|
29
29
|
|
30
30
|
|
@@ -4,35 +4,35 @@ Feature: Generate an XML file for Sparkle to use for updates
|
|
4
4
|
I want to generate an XML file for the Sparkle framework
|
5
5
|
|
6
6
|
Scenario: rake task to create/update the appcast file
|
7
|
-
Given a Cocoa app with choctop installed called
|
7
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
8
8
|
And ChocTop config is configured for remote Sparkle
|
9
|
-
When task
|
10
|
-
Then file
|
11
|
-
And
|
12
|
-
And
|
13
|
-
And
|
14
|
-
And
|
15
|
-
And
|
16
|
-
And
|
17
|
-
And
|
18
|
-
And file
|
19
|
-
And
|
20
|
-
And
|
21
|
-
And file
|
22
|
-
And
|
23
|
-
And
|
24
|
-
And
|
25
|
-
And
|
9
|
+
When I invoke task "rake dmg feed"
|
10
|
+
Then file "appcast/build/my_feed.xml" is created
|
11
|
+
And file "appcast/build/my_feed.xml" contents does match /<channel>/
|
12
|
+
And file "appcast/build/my_feed.xml" contents does match /</channel>/
|
13
|
+
And file "appcast/build/my_feed.xml" contents does match /<pubDate>/
|
14
|
+
And file "appcast/build/my_feed.xml" contents does match /<item>/
|
15
|
+
And file "appcast/build/my_feed.xml" contents does match /<title>SampleApp 0.1.0</title>/
|
16
|
+
And file "appcast/build/my_feed.xml" contents does match /href="http://mocra.com/sample_app/my_feed.xml"/
|
17
|
+
And file "appcast/build/my_feed.xml" contents does match /<sparkle:releaseNotesLink>http://mocra.com/sample_app/release_notes.html</sparkle:releaseNotesLink>/
|
18
|
+
And file "appcast/build/index.php" is created
|
19
|
+
And file "appcast/build/index.php" contents does match /Location/
|
20
|
+
And file "appcast/build/index.php" contents does match /SampleApp-0.1.0.dmg/
|
21
|
+
And file "appcast/build/release_notes.html" is created
|
22
|
+
And file "appcast/build/release_notes.html" contents does match /0.1.0/
|
23
|
+
And file "appcast/build/release_notes.html" contents does match /<h2>Initial release</h2>/
|
24
|
+
And file "appcast/build/release_notes.html" contents does match /<p>Yay! First release.</p>/
|
25
|
+
And file "appcast/build/release_notes.html" contents does match /<html>/
|
26
26
|
|
27
27
|
Scenario: generate default release notes if no release_notes.txt
|
28
|
-
Given a Cocoa app with choctop installed called
|
28
|
+
Given a Cocoa app with choctop installed called "SampleApp"
|
29
29
|
And ChocTop config is configured for remote Sparkle
|
30
|
-
And
|
31
|
-
When task
|
32
|
-
Then file
|
33
|
-
And
|
34
|
-
And
|
35
|
-
And
|
30
|
+
And "release_notes.txt" file is deleted
|
31
|
+
When I invoke task "rake dmg feed"
|
32
|
+
Then file "appcast/build/release_notes.html" is created
|
33
|
+
And file "appcast/build/release_notes.html" contents does match /0.1.0/
|
34
|
+
And file "appcast/build/release_notes.html" contents does match /<h2>Initial release</h2>/
|
35
|
+
And file "appcast/build/release_notes.html" contents does match /<html>/
|
36
36
|
|
37
37
|
|
38
38
|
|
@@ -0,0 +1,177 @@
|
|
1
|
+
Given /^a safe folder/ do
|
2
|
+
FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
3
|
+
FileUtils.mkdir_p @tmp_root
|
4
|
+
FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
|
5
|
+
@lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
6
|
+
Given %Q{env variable $HOME set to "#{@home_path}"}
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^this project is active project folder/ do
|
10
|
+
Given "a safe folder"
|
11
|
+
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
|
15
|
+
ENV[env_var] = value
|
16
|
+
end
|
17
|
+
|
18
|
+
Given /"(.*)" (folder|file) is deleted/ do |type, file|
|
19
|
+
in_project_folder { FileUtils.rm_rf file }
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
23
|
+
@stdout = StringIO.new
|
24
|
+
in_project_folder do
|
25
|
+
if Object.const_defined?("APP_ROOT")
|
26
|
+
APP_ROOT.replace(FileUtils.pwd)
|
27
|
+
else
|
28
|
+
APP_ROOT = FileUtils.pwd
|
29
|
+
end
|
30
|
+
run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
|
31
|
+
end
|
32
|
+
File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
|
33
|
+
@stdout.rewind
|
34
|
+
f << @stdout.read
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
39
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
40
|
+
in_project_folder do
|
41
|
+
system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
46
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
47
|
+
in_project_folder do
|
48
|
+
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
53
|
+
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
54
|
+
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
55
|
+
in_project_folder do
|
56
|
+
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
When /^I invoke task "rake (.*)"/ do |task|
|
61
|
+
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
62
|
+
in_project_folder do
|
63
|
+
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
68
|
+
in_project_folder do
|
69
|
+
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
74
|
+
in_project_folder do
|
75
|
+
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
Then /^file with name matching "(.*)" is created/ do |pattern|
|
80
|
+
in_project_folder do
|
81
|
+
Dir[pattern].should_not be_empty
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
86
|
+
in_project_folder do
|
87
|
+
actual_output = File.read(file)
|
88
|
+
(does == 'does') ?
|
89
|
+
actual_output.should(match(/#{regex}/)) :
|
90
|
+
actual_output.should_not(match(/#{regex}/))
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
95
|
+
File.exists?(gem_file).should be_true
|
96
|
+
File.exists?(project_file).should be_true
|
97
|
+
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
98
|
+
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
99
|
+
project_file_contents.should == gem_file_contents
|
100
|
+
end
|
101
|
+
|
102
|
+
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
103
|
+
actual_output = File.read(@stdout)
|
104
|
+
does_invoke == "does" ?
|
105
|
+
actual_output.should(match(/dependency\s+#{generator}/)) :
|
106
|
+
actual_output.should_not(match(/dependency\s+#{generator}/))
|
107
|
+
end
|
108
|
+
|
109
|
+
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
110
|
+
actual_output = File.read(@stdout)
|
111
|
+
actual_output.should match(/#{opt1}/)
|
112
|
+
actual_output.should match(/#{opt2}/)
|
113
|
+
end
|
114
|
+
|
115
|
+
Then /^I should see$/ do |text|
|
116
|
+
actual_output = File.read(@stdout)
|
117
|
+
actual_output.should contain(text)
|
118
|
+
end
|
119
|
+
|
120
|
+
Then %r{^I should see /(.*)/$} do |text|
|
121
|
+
actual_output = File.read(@stdout)
|
122
|
+
actual_output.should contain(text)
|
123
|
+
end
|
124
|
+
|
125
|
+
Then /^I should not see$/ do |text|
|
126
|
+
actual_output = File.read(@stdout)
|
127
|
+
actual_output.should_not contain(text)
|
128
|
+
end
|
129
|
+
|
130
|
+
Then /^I should see exactly$/ do |text|
|
131
|
+
actual_output = File.read(@stdout)
|
132
|
+
actual_output.should == text
|
133
|
+
end
|
134
|
+
|
135
|
+
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
136
|
+
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
137
|
+
actual_output = File.read(@stdout)
|
138
|
+
actual_output.should match(expected)
|
139
|
+
end
|
140
|
+
|
141
|
+
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
142
|
+
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
143
|
+
actual_output = File.read(@stdout)
|
144
|
+
actual_output.should match(expected)
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
148
|
+
in_project_folder do
|
149
|
+
yaml = eval yaml
|
150
|
+
YAML.load(File.read(file)).should == yaml
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
Then /^Rakefile can display tasks successfully/ do
|
155
|
+
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
156
|
+
in_project_folder do
|
157
|
+
system "rake -T > #{@stdout} 2> #{@stdout}"
|
158
|
+
end
|
159
|
+
actual_output = File.read(@stdout)
|
160
|
+
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
161
|
+
end
|
162
|
+
|
163
|
+
Then /^task "rake (.*)" is executed successfully/ do |task|
|
164
|
+
@stdout.should_not be_nil
|
165
|
+
actual_output = File.read(@stdout)
|
166
|
+
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
167
|
+
actual_output.should_not match(/Error/i)
|
168
|
+
end
|
169
|
+
|
170
|
+
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
171
|
+
in_project_folder do
|
172
|
+
gem_file = Dir["pkg/*.gem"].first
|
173
|
+
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
174
|
+
spec_value = gem_spec.send(key.to_sym)
|
175
|
+
spec_value.to_s.should match(/#{regex}/)
|
176
|
+
end
|
177
|
+
end
|