rbiphonetest 0.3.0 → 0.4.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 +6 -0
- data/Manifest.txt +10 -7
- data/README.rdoc +1 -1
- data/Rakefile +23 -3
- data/app_generators/rbiphonetest/rbiphonetest_generator.rb +8 -5
- data/app_generators/rbiphonetest/templates/Classes/module.h.erb +1 -0
- data/app_generators/rbiphonetest/templates/Classes/module.m.erb +3 -0
- data/app_generators/rbiphonetest/templates/Rakefile +36 -21
- data/app_generators/rbiphonetest/templates/dot_autotest +1 -1
- data/bin/rbiphonetest +7 -5
- data/features/development.feature +13 -0
- data/features/models.feature +35 -0
- data/features/new_project.feature +30 -0
- data/features/step_definitions/cli_steps.rb +14 -0
- data/features/step_definitions/common_steps.rb +170 -0
- data/features/support/cli.rb +8 -0
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +19 -0
- data/lib/rbiphonetest.rb +1 -1
- data/lib/rbiphonetest/version.rb +1 -1
- data/rbiphonetest_generators/install_rspec/install_rspec_generator.rb +3 -2
- data/rbiphonetest_generators/install_rspec/templates/spec/spec_helper.rb +5 -1
- data/rbiphonetest_generators/install_test_unit/install_test_unit_generator.rb +3 -2
- data/rbiphonetest_generators/install_test_unit/templates/test/test_helper.rb +5 -1
- data/rbiphonetest_generators/model_rspec/templates/spec.rb +0 -3
- data/rbiphonetest_generators/model_test_unit/model_test_unit_generator.rb +3 -3
- data/rbiphonetest_generators/model_test_unit/templates/test.rb +0 -3
- data/test/test_generator_helper.rb +1 -1
- data/test/test_rbiphonetest_generator.rb +6 -2
- metadata +30 -39
- data/License.txt +0 -20
- data/config/hoe.rb +0 -70
- data/config/requirements.rb +0 -15
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/test_rbiphonetest.rb +0 -11
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.4.0 2009-03-17
|
2
|
+
|
3
|
+
* 2+ models now fixed! No more dependency issues between classes being tested: only one bundle created - all ObjC code being tested is compiled into one bundle
|
4
|
+
* Upgrade internals to use latest newgem (removed bunch of dev-only files)
|
5
|
+
* Behaviour of rbiphonetest covered by Cucumber scenarios
|
6
|
+
|
1
7
|
== 0.3.0 2008-07-05
|
2
8
|
|
3
9
|
* Support for test/unit AND rspec test frameworks (via install_test_unit and install_rspec generators)
|
data/Manifest.txt
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
History.txt
|
2
|
-
License.txt
|
3
2
|
Manifest.txt
|
4
3
|
PostInstall.txt
|
5
4
|
README.rdoc
|
6
5
|
Rakefile
|
7
6
|
app_generators/rbiphonetest/USAGE
|
8
7
|
app_generators/rbiphonetest/rbiphonetest_generator.rb
|
8
|
+
app_generators/rbiphonetest/templates/Classes/module.h.erb
|
9
|
+
app_generators/rbiphonetest/templates/Classes/module.m.erb
|
9
10
|
app_generators/rbiphonetest/templates/Rakefile
|
10
11
|
app_generators/rbiphonetest/templates/dot_autotest
|
11
12
|
bin/iphoneruby
|
12
13
|
bin/rbiphonetest
|
13
|
-
|
14
|
-
|
14
|
+
features/development.feature
|
15
|
+
features/models.feature
|
16
|
+
features/new_project.feature
|
17
|
+
features/step_definitions/cli_steps.rb
|
18
|
+
features/step_definitions/common_steps.rb
|
19
|
+
features/support/cli.rb
|
20
|
+
features/support/common.rb
|
21
|
+
features/support/env.rb
|
15
22
|
lib/rbiphonetest.rb
|
16
23
|
lib/rbiphonetest/version.rb
|
17
24
|
rbiphonetest_generators/install_rspec/USAGE
|
@@ -41,14 +48,10 @@ script/destroy
|
|
41
48
|
script/generate
|
42
49
|
script/txt2html
|
43
50
|
setup.rb
|
44
|
-
tasks/deployment.rake
|
45
|
-
tasks/environment.rake
|
46
|
-
tasks/website.rake
|
47
51
|
test/test_generator_helper.rb
|
48
52
|
test/test_helper.rb
|
49
53
|
test/test_install_rspec_generator.rb
|
50
54
|
test/test_install_test_unit_generator.rb
|
51
55
|
test/test_model_generator.rb
|
52
|
-
test/test_rbiphonetest.rb
|
53
56
|
test/test_rbiphonetest_generator.rb
|
54
57
|
test/test_story_generator.rb
|
data/README.rdoc
CHANGED
@@ -68,7 +68,7 @@ From source:
|
|
68
68
|
|
69
69
|
(The MIT License)
|
70
70
|
|
71
|
-
Copyright (c) 2008 Dr Nic Williams
|
71
|
+
Copyright (c) 2008-9 Dr Nic Williams
|
72
72
|
|
73
73
|
Permission is hereby granted, free of charge, to any person obtaining
|
74
74
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -1,4 +1,24 @@
|
|
1
|
-
require
|
2
|
-
require '
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
+
require File.dirname(__FILE__) + '/lib/rbiphonetest'
|
3
3
|
|
4
|
-
|
4
|
+
# Generate all the Rake tasks
|
5
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
+
$hoe = Hoe.new('rbiphonetest', RbIphoneTest::VERSION) do |p|
|
7
|
+
p.developer('Dr Nic Williams', 'drnicwilliams@gmail.com')
|
8
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
9
|
+
p.post_install_message = 'PostInstall.txt'
|
10
|
+
p.extra_deps = [
|
11
|
+
['newgem', ">= #{::Newgem::VERSION}"]
|
12
|
+
]
|
13
|
+
|
14
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
15
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
16
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
17
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
21
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
22
|
+
|
23
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
24
|
+
task :default => [:features]
|
@@ -6,14 +6,15 @@ class RbiphonetestGenerator < RubiGen::Base
|
|
6
6
|
default_options :author => nil,
|
7
7
|
:test_framework => 'test_unit'
|
8
8
|
|
9
|
-
attr_reader :name
|
9
|
+
attr_reader :name, :module_name
|
10
10
|
attr_reader :test_framework
|
11
11
|
|
12
12
|
def initialize(runtime_args, runtime_options = {})
|
13
13
|
super
|
14
14
|
usage if args.empty?
|
15
15
|
@destination_root = File.expand_path(args.shift)
|
16
|
-
@name
|
16
|
+
@name = base_name.gsub("-", "_")
|
17
|
+
@module_name = name.camelize
|
17
18
|
extract_options
|
18
19
|
end
|
19
20
|
|
@@ -24,8 +25,10 @@ class RbiphonetestGenerator < RubiGen::Base
|
|
24
25
|
BASEDIRS.each { |path| m.directory path }
|
25
26
|
|
26
27
|
# Create stubs
|
27
|
-
m.
|
28
|
-
m.file
|
28
|
+
m.template_copy_each ["Rakefile"]
|
29
|
+
m.file "dot_autotest", ".autotest"
|
30
|
+
m.template "Classes/module.m.erb", "Classes/#{module_name}.m"
|
31
|
+
m.template "Classes/module.h.erb", "Classes/#{module_name}.h"
|
29
32
|
|
30
33
|
# Selecting a test framework
|
31
34
|
case test_framework
|
@@ -75,4 +78,4 @@ EOS
|
|
75
78
|
Classes
|
76
79
|
tasks
|
77
80
|
)
|
78
|
-
end
|
81
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/* <%= module_name %> */
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "rake"
|
3
3
|
|
4
|
+
bundle_name = '<%= module_name %>'
|
5
|
+
src_paths = %w[Classes] # any included projects, add folders here
|
6
|
+
src_files = FileList['Classes/**/*.m'] # any included projects, add files here
|
7
|
+
req_frameworks = %w[Foundation] # use only frameworks available to both Cocoa + iPhone SDKs
|
8
|
+
req_libraries = %w[] # e.g. add sqlite3 for libsqlite3 to be used by linking step
|
9
|
+
|
4
10
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
5
11
|
|
6
12
|
namespace :objc do
|
@@ -10,31 +16,40 @@ end
|
|
10
16
|
|
11
17
|
task :compile => "objc:compile"
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
path =~ /Classes\/(.*)\.m/
|
19
|
-
model_name = $1
|
20
|
-
|
21
|
-
task :compile => model_name do
|
22
|
-
if Dir.glob("**/#{model_name}.bundle").length == 0
|
23
|
-
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
24
|
-
STDERR.puts "Bundle actually failed to build."
|
25
|
-
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
26
|
-
exit(1)
|
27
|
-
end
|
28
|
-
end
|
19
|
+
# Converts ('-I', ['foo', 'bar'])
|
20
|
+
# Into: -Ifoo -Ibar
|
21
|
+
def make_options(flag, items)
|
22
|
+
items.map { |item| "#{flag}#{item}" }.join(" ")
|
23
|
+
end
|
29
24
|
|
30
|
-
|
25
|
+
src_files.each do |file|
|
26
|
+
FileUtils.mkdir_p "build"
|
27
|
+
base = file.gsub(/\.m$/,'')
|
28
|
+
dot_o = "build/#{File.basename base}.o"
|
29
|
+
file dot_o => ["#{base}.m", "#{base}.h"] do
|
30
|
+
sh "gcc -c #{base}.m -o #{dot_o} #{make_options '-I', src_paths}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
dot_o_files = src_files.map { |file| "build/" + File.basename(file).gsub(/\.m$/,'') + ".o" }
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
namespace :objc do
|
37
|
+
task :compile => "build/bundles/#{bundle_name}.bundle" do
|
38
|
+
if Dir.glob("**/#{bundle_name}.bundle").length == 0
|
39
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
40
|
+
STDERR.puts "Bundle actually failed to build."
|
41
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
42
|
+
exit(1)
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
46
|
+
file "build/bundles/#{bundle_name}.bundle" => dot_o_files do |t|
|
47
|
+
FileUtils.mkdir_p "build/bundles"
|
48
|
+
FileUtils.rm Dir["build/bundles/#{bundle_name}.bundle"]
|
49
|
+
sh "gcc -o build/bundles/#{bundle_name}.bundle #{dot_o_files.join(" ")} -bundle " +
|
50
|
+
"#{make_options '-framework ', req_frameworks} " +
|
51
|
+
"#{make_options '-l', req_libraries} " +
|
52
|
+
"#{make_options '-I', src_paths}"
|
53
|
+
end
|
39
54
|
end
|
40
55
|
|
data/bin/rbiphonetest
CHANGED
@@ -5,14 +5,16 @@ require 'rubigen'
|
|
5
5
|
|
6
6
|
if %w(-v --version).include? ARGV.first
|
7
7
|
require 'rbiphonetest/version'
|
8
|
-
puts "#{File.basename($0)} #{
|
8
|
+
puts "#{File.basename($0)} #{RbIphoneTest::VERSION::STRING}"
|
9
9
|
exit(0)
|
10
10
|
end
|
11
11
|
|
12
12
|
require 'rubigen/scripts/generate'
|
13
13
|
RubiGen::Base.reset_sources
|
14
|
-
|
15
|
-
RubiGen::Base.
|
16
|
-
|
17
|
-
RubiGen::
|
14
|
+
RubiGen::Base.use_application_sources! :rubygems
|
15
|
+
RubiGen::Base.prepend_sources(*[
|
16
|
+
RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "app_generators")),
|
17
|
+
RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "rbiphonetest_generators"))
|
18
|
+
])
|
19
|
+
|
18
20
|
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'rbiphonetest')
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Development processes of newgem itself (rake tasks)
|
2
|
+
|
3
|
+
As a Newgem maintainer or contributor
|
4
|
+
I want rake tasks to maintain and release the gem
|
5
|
+
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
6
|
+
|
7
|
+
Scenario: Generate RubyGem
|
8
|
+
Given this project is active project folder
|
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/
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Generate, compile and test Objective-C classes with Ruby tests
|
2
|
+
In order to reduce the cost of development and maintenance of Objective-C projects
|
3
|
+
As an Objective-C developer
|
4
|
+
I want a generator for new Objective-C models/classes that are covered by Ruby tests
|
5
|
+
|
6
|
+
Scenario: Generate a single model and its default tests should pass
|
7
|
+
Given an existing rbiphonetest scaffold using options '' [called 'my_project']
|
8
|
+
When I invoke 'model' generator with arguments 'Person'
|
9
|
+
Then file 'Classes/Person.m' is created
|
10
|
+
And file 'Classes/Person.h' is created
|
11
|
+
And file 'test/test_person.rb' is created
|
12
|
+
When I invoke task 'rake test'
|
13
|
+
Then all 1 tests pass
|
14
|
+
|
15
|
+
Scenario: Generate a single model and its default tests should pass, for rspec project
|
16
|
+
Given an existing rbiphonetest scaffold using options '--test-with=rspec' [called 'my_project']
|
17
|
+
When I invoke 'model' generator with arguments 'Person'
|
18
|
+
Then file 'Classes/Person.m' is created
|
19
|
+
And file 'Classes/Person.h' is created
|
20
|
+
And file 'spec/person_spec.rb' is created
|
21
|
+
When I invoke task 'rake spec'
|
22
|
+
Then all 1 examples pass
|
23
|
+
|
24
|
+
Scenario: Generate multiple models and its tests should pass
|
25
|
+
Given an existing rbiphonetest scaffold using options '' [called 'my_project']
|
26
|
+
When I invoke 'model' generator with arguments 'Person'
|
27
|
+
When I invoke 'model' generator with arguments 'Company'
|
28
|
+
Then file 'Classes/Person.m' is created
|
29
|
+
And file 'Classes/Person.h' is created
|
30
|
+
And file 'test/test_person.rb' is created
|
31
|
+
Then file 'Classes/Company.m' is created
|
32
|
+
And file 'Classes/Company.h' is created
|
33
|
+
And file 'test/test_company.rb' is created
|
34
|
+
When I invoke task 'rake test'
|
35
|
+
Then all 2 tests pass
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Created a new Objective-C project that can be tested by Ruby tests
|
2
|
+
In order to reduce the cost of development and maintenance of Objective-C projects
|
3
|
+
As an Objective-C developer
|
4
|
+
I want a generator for new Objective-C libraries that are covered by Ruby tests
|
5
|
+
|
6
|
+
Scenario: Generate new project (defaults test/unit)
|
7
|
+
Given a safe folder
|
8
|
+
When I execute rbiphonetest for project 'my_project' with options ''
|
9
|
+
Then file 'Rakefile' is created
|
10
|
+
And file 'Classes/MyProject.h' is created
|
11
|
+
And file 'Classes/MyProject.m' is created
|
12
|
+
And file 'Classes/MyProject.m' contents does match /void Init_MyProject\(\) \{ \}/
|
13
|
+
And file 'Classes/MyProject.m' contents does match /#import "MyProject.h"/
|
14
|
+
And Rakefile can display tasks successfully
|
15
|
+
And file 'test/test_helper.rb' is created
|
16
|
+
|
17
|
+
Scenario: Generate new test/unit project
|
18
|
+
Given a safe folder
|
19
|
+
When I execute rbiphonetest for project 'my_project' with options '--test-with=test_unit'
|
20
|
+
Then file 'Rakefile' is created
|
21
|
+
And Rakefile can display tasks successfully
|
22
|
+
And file 'test/test_helper.rb' is created
|
23
|
+
|
24
|
+
Scenario: Generate new rspec project
|
25
|
+
Given a safe folder
|
26
|
+
When I execute rbiphonetest for project 'my_project' with options '--test-with=rspec'
|
27
|
+
Then file 'Rakefile' is created
|
28
|
+
And Rakefile can display tasks successfully
|
29
|
+
And file 'spec/spec_helper.rb' is created
|
30
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
When /^I execute rbiphonetest for project '(.*)' with options '(.*)'/ do |project_name, arguments|
|
2
|
+
setup_active_project_folder project_name
|
3
|
+
in_tmp_folder do
|
4
|
+
@stdout = File.expand_path("newgem.out")
|
5
|
+
system "ruby #{rbiphonetest_cmd} #{arguments} #{project_name} > #{@stdout}"
|
6
|
+
force_local_lib_override
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
Given /^an existing rbiphonetest scaffold using options '(.*)' \[called '(.*)'\]/ do |arguments, project_name|
|
11
|
+
Given "a safe folder"
|
12
|
+
Given "I execute rbiphonetest for project '#{project_name}' with options '#{arguments}'"
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,170 @@
|
|
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 "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 is deleted/ do |folder|
|
19
|
+
in_project_folder { FileUtils.rm_rf folder }
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I invoke '(.*)' generator with arguments '(.*)'$/ do |generator, arguments|
|
23
|
+
@stdout = StringIO.new
|
24
|
+
FileUtils.chdir(@active_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
|
+
FileUtils.chdir(@active_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 /^output same as contents of '(.*)'$/ do |file|
|
103
|
+
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
104
|
+
actual_output = File.read(@stdout)
|
105
|
+
actual_output.should == expected_output
|
106
|
+
end
|
107
|
+
|
108
|
+
Then /^(does|does not) invoke generator '(.*)'$/ do |does_invoke, generator|
|
109
|
+
actual_output = File.read(@stdout)
|
110
|
+
does_invoke == "does" ?
|
111
|
+
actual_output.should(match(/dependency\s+#{generator}/)) :
|
112
|
+
actual_output.should_not(match(/dependency\s+#{generator}/))
|
113
|
+
end
|
114
|
+
|
115
|
+
Then /help options '(.*)' and '(.*)' are displayed/ do |opt1, opt2|
|
116
|
+
actual_output = File.read(@stdout)
|
117
|
+
actual_output.should match(/#{opt1}/)
|
118
|
+
actual_output.should match(/#{opt2}/)
|
119
|
+
end
|
120
|
+
|
121
|
+
Then /^output (does|does not) match \/(.*)\// do |does, regex|
|
122
|
+
actual_output = File.read(@stdout)
|
123
|
+
(does == 'does') ?
|
124
|
+
actual_output.should(match(/#{regex}/)) :
|
125
|
+
actual_output.should_not(match(/#{regex}/))
|
126
|
+
end
|
127
|
+
|
128
|
+
Then /^all (\d+) tests pass/ do |expected_test_count|
|
129
|
+
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
130
|
+
actual_output = File.read(@stdout)
|
131
|
+
actual_output.should match(expected)
|
132
|
+
end
|
133
|
+
|
134
|
+
Then /^all (\d+) examples pass/ do |expected_test_count|
|
135
|
+
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
136
|
+
actual_output = File.read(@stdout)
|
137
|
+
actual_output.should match(expected)
|
138
|
+
end
|
139
|
+
|
140
|
+
Then /^yaml file '(.*)' contains (\{.*\})/ do |file, yaml|
|
141
|
+
in_project_folder do
|
142
|
+
yaml = eval yaml
|
143
|
+
YAML.load(File.read(file)).should == yaml
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^Rakefile can display tasks successfully/ do
|
148
|
+
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
149
|
+
FileUtils.chdir(@active_project_folder) do
|
150
|
+
system "rake -T > #{@stdout} 2> #{@stdout}"
|
151
|
+
end
|
152
|
+
actual_output = File.read(@stdout)
|
153
|
+
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
154
|
+
end
|
155
|
+
|
156
|
+
Then /^task 'rake (.*)' is executed successfully/ do |task|
|
157
|
+
@stdout.should_not be_nil
|
158
|
+
actual_output = File.read(@stdout)
|
159
|
+
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
160
|
+
actual_output.should_not match(/Error/i)
|
161
|
+
end
|
162
|
+
|
163
|
+
Then /^gem spec key '(.*)' contains \/(.*)\// do |key, regex|
|
164
|
+
in_project_folder do
|
165
|
+
gem_file = Dir["pkg/*.gem"].first
|
166
|
+
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
167
|
+
spec_value = gem_spec.send(key.to_sym)
|
168
|
+
spec_value.to_s.should match(/#{regex}/)
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CommonHelpers
|
2
|
+
def in_tmp_folder(&block)
|
3
|
+
FileUtils.chdir(@tmp_root, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def in_project_folder(&block)
|
7
|
+
project_folder = @active_project_folder || @tmp_root
|
8
|
+
FileUtils.chdir(project_folder, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def in_home_folder(&block)
|
12
|
+
FileUtils.chdir(@home_path, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def force_local_lib_override(project_name = @project_name)
|
16
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
+
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
+
f << rakefile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_active_project_folder project_name
|
24
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
+
@project_name = project_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World { |world| world.extend CommonHelpers }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/rbiphonetest"
|
2
|
+
|
3
|
+
gem 'cucumber'
|
4
|
+
require 'cucumber'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'rubigen'
|
10
|
+
rescue LoadError
|
11
|
+
require 'rubygems'
|
12
|
+
require 'rubigen'
|
13
|
+
end
|
14
|
+
require 'rubigen/helpers/generator_test_helper'
|
15
|
+
include RubiGen::GeneratorTestHelper
|
16
|
+
|
17
|
+
SOURCES = Dir[File.dirname(__FILE__) + "/../../*_generators"].map do |f|
|
18
|
+
RubiGen::PathSource.new(:test, File.expand_path(f))
|
19
|
+
end
|
data/lib/rbiphonetest.rb
CHANGED
data/lib/rbiphonetest/version.rb
CHANGED
@@ -2,12 +2,13 @@ class InstallRspecGenerator < RubiGen::Base
|
|
2
2
|
|
3
3
|
default_options :author => nil
|
4
4
|
|
5
|
-
attr_reader :name
|
5
|
+
attr_reader :name, :module_name
|
6
6
|
|
7
7
|
def initialize(runtime_args, runtime_options = {})
|
8
8
|
super
|
9
9
|
usage if args.empty?
|
10
10
|
@name = args.shift
|
11
|
+
@module_name = File.basename(destination_root).gsub("-", "_").camelize
|
11
12
|
extract_options
|
12
13
|
end
|
13
14
|
|
@@ -17,7 +18,7 @@ class InstallRspecGenerator < RubiGen::Base
|
|
17
18
|
m.directory 'spec'
|
18
19
|
m.directory 'tasks'
|
19
20
|
|
20
|
-
m.
|
21
|
+
m.template_copy_each ["spec/spec_helper.rb"]
|
21
22
|
m.file_copy_each ["tasks/rspec.rake"]
|
22
23
|
end
|
23
24
|
end
|
@@ -2,12 +2,13 @@ class InstallTestUnitGenerator < RubiGen::Base
|
|
2
2
|
|
3
3
|
default_options :author => nil
|
4
4
|
|
5
|
-
attr_reader :name
|
5
|
+
attr_reader :name, :module_name
|
6
6
|
|
7
7
|
def initialize(runtime_args, runtime_options = {})
|
8
8
|
super
|
9
9
|
usage if args.empty?
|
10
10
|
@name = args.shift
|
11
|
+
@module_name = File.basename(destination_root).gsub("-", "_").camelize
|
11
12
|
extract_options
|
12
13
|
end
|
13
14
|
|
@@ -17,7 +18,7 @@ class InstallTestUnitGenerator < RubiGen::Base
|
|
17
18
|
m.directory 'test'
|
18
19
|
m.directory 'tasks'
|
19
20
|
|
20
|
-
m.
|
21
|
+
m.template_copy_each ["test/test_helper.rb"]
|
21
22
|
m.file_copy_each ["tasks/test_unit.rake"]
|
22
23
|
|
23
24
|
end
|
@@ -1,4 +1,8 @@
|
|
1
1
|
require "test/unit"
|
2
2
|
require "osx/cocoa"
|
3
3
|
|
4
|
-
$:.unshift File.dirname(__FILE__) + "/../build/bundles"
|
4
|
+
$:.unshift File.dirname(__FILE__) + "/../build/bundles"
|
5
|
+
|
6
|
+
bundle_name = '<%= module_name %>'
|
7
|
+
require "#{bundle_name}.bundle"
|
8
|
+
OSX::ns_import bundle_name.to_sym
|
@@ -7,8 +7,8 @@ class ModelTestUnitGenerator < RubiGen::Base
|
|
7
7
|
def initialize(runtime_args, runtime_options = {})
|
8
8
|
super
|
9
9
|
usage if args.empty?
|
10
|
-
@name
|
11
|
-
@class_name
|
10
|
+
@name = args.shift.underscore
|
11
|
+
@class_name = @name.camelcase
|
12
12
|
extract_options
|
13
13
|
end
|
14
14
|
|
@@ -48,4 +48,4 @@ EOS
|
|
48
48
|
# raw instance variable value.
|
49
49
|
# @author = options[:author]
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -7,7 +7,7 @@ require 'fileutils'
|
|
7
7
|
|
8
8
|
# Must set before requiring generator libs.
|
9
9
|
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
10
|
-
PROJECT_NAME = "
|
10
|
+
PROJECT_NAME = "my_project" unless defined?(PROJECT_NAME)
|
11
11
|
app_root = File.join(TMP_ROOT, PROJECT_NAME)
|
12
12
|
if defined?(APP_ROOT)
|
13
13
|
APP_ROOT.replace(app_root)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestRbIphoneTestGenerator < Test::Unit::TestCase
|
4
4
|
include RubiGen::GeneratorTestHelper
|
5
5
|
|
6
6
|
def setup
|
@@ -32,6 +32,8 @@ class TestIphonerubyGenerator < Test::Unit::TestCase
|
|
32
32
|
assert_directory_exists "tasks"
|
33
33
|
assert_generated_file ".autotest"
|
34
34
|
assert_generated_file "Rakefile"
|
35
|
+
assert_generated_file "Classes/MyProject.h"
|
36
|
+
assert_generated_file "Classes/MyProject.m"
|
35
37
|
assert_generated_file "test/test_helper.rb"
|
36
38
|
assert_generated_file "script/generate"
|
37
39
|
end
|
@@ -39,10 +41,12 @@ class TestIphonerubyGenerator < Test::Unit::TestCase
|
|
39
41
|
def test_generator_with_rspec
|
40
42
|
run_generator('rbiphonetest', [APP_ROOT], sources, {:test_framework => 'rspec'})
|
41
43
|
assert_directory_exists "Classes"
|
42
|
-
assert_directory_exists "
|
44
|
+
assert_directory_exists "spec"
|
43
45
|
assert_directory_exists "tasks"
|
44
46
|
assert_generated_file ".autotest"
|
45
47
|
assert_generated_file "Rakefile"
|
48
|
+
assert_generated_file "Classes/MyProject.h"
|
49
|
+
assert_generated_file "Classes/MyProject.m"
|
46
50
|
assert_generated_file "spec/spec_helper.rb"
|
47
51
|
assert_generated_file "script/generate"
|
48
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbiphonetest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,9 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-03-17 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: newgem
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.3.0
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: hoe
|
17
27
|
type: :development
|
@@ -20,9 +30,9 @@ dependencies:
|
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
33
|
+
version: 1.8.0
|
24
34
|
version:
|
25
|
-
description: Want to write iPhone unit tests? Want to write them in Ruby?
|
35
|
+
description: "Want to write iPhone apps with unit tests? Want to write them in Ruby? * Blog introduction: http://drnicwilliams.com/2008/07/04/unit-testing-iphone-apps-with-ruby-rbiphonetest/ * Video introduction: http://www.vimeo.com/1262916 * Google Group: http://groups.google.com/group/rbiphonetest * Bugs/Features: http://drnic.lighthouseapp.com/projects/13763-rbiphonetest"
|
26
36
|
email:
|
27
37
|
- drnicwilliams@gmail.com
|
28
38
|
executables:
|
@@ -32,24 +42,31 @@ extensions: []
|
|
32
42
|
|
33
43
|
extra_rdoc_files:
|
34
44
|
- History.txt
|
35
|
-
- License.txt
|
36
45
|
- Manifest.txt
|
37
46
|
- PostInstall.txt
|
47
|
+
- README.rdoc
|
38
48
|
files:
|
39
49
|
- History.txt
|
40
|
-
- License.txt
|
41
50
|
- Manifest.txt
|
42
51
|
- PostInstall.txt
|
43
52
|
- README.rdoc
|
44
53
|
- Rakefile
|
45
54
|
- app_generators/rbiphonetest/USAGE
|
46
55
|
- app_generators/rbiphonetest/rbiphonetest_generator.rb
|
56
|
+
- app_generators/rbiphonetest/templates/Classes/module.h.erb
|
57
|
+
- app_generators/rbiphonetest/templates/Classes/module.m.erb
|
47
58
|
- app_generators/rbiphonetest/templates/Rakefile
|
48
59
|
- app_generators/rbiphonetest/templates/dot_autotest
|
49
60
|
- bin/iphoneruby
|
50
61
|
- bin/rbiphonetest
|
51
|
-
-
|
52
|
-
-
|
62
|
+
- features/development.feature
|
63
|
+
- features/models.feature
|
64
|
+
- features/new_project.feature
|
65
|
+
- features/step_definitions/cli_steps.rb
|
66
|
+
- features/step_definitions/common_steps.rb
|
67
|
+
- features/support/cli.rb
|
68
|
+
- features/support/common.rb
|
69
|
+
- features/support/env.rb
|
53
70
|
- lib/rbiphonetest.rb
|
54
71
|
- lib/rbiphonetest/version.rb
|
55
72
|
- rbiphonetest_generators/install_rspec/USAGE
|
@@ -79,44 +96,19 @@ files:
|
|
79
96
|
- script/generate
|
80
97
|
- script/txt2html
|
81
98
|
- setup.rb
|
82
|
-
- tasks/deployment.rake
|
83
|
-
- tasks/environment.rake
|
84
|
-
- tasks/website.rake
|
85
99
|
- test/test_generator_helper.rb
|
86
100
|
- test/test_helper.rb
|
87
101
|
- test/test_install_rspec_generator.rb
|
88
102
|
- test/test_install_test_unit_generator.rb
|
89
103
|
- test/test_model_generator.rb
|
90
|
-
- test/test_rbiphonetest.rb
|
91
104
|
- test/test_rbiphonetest_generator.rb
|
92
105
|
- test/test_story_generator.rb
|
93
106
|
has_rdoc: true
|
94
|
-
homepage: http://
|
95
|
-
post_install_message:
|
96
|
-
|
97
|
-
You can add Ruby-based unit tests to any iPhone/Xcode project by changing to the
|
98
|
-
project's folder in the terminal/console and running:
|
99
|
-
|
100
|
-
rbiphonetest .
|
101
|
-
|
102
|
-
This adds the test framework, a Rakefile, and an `autotest` config file.
|
103
|
-
|
104
|
-
You can now create testable Objective-C models/classes using the generator:
|
105
|
-
|
106
|
-
$ script/generate model WidgetMaker
|
107
|
-
create Classes/WidgetMaker.h
|
108
|
-
create Classes/WidgetMaker.m
|
109
|
-
create test/test_widget_maker.rb
|
110
|
-
|
111
|
-
To run tests you have several options:
|
112
|
-
|
113
|
-
1. `rake` or `rake test`
|
114
|
-
1. `autotest` (after installing the ZenTest gem)
|
115
|
-
|
116
|
-
Enjoy iPhone development with Ruby!
|
107
|
+
homepage: http://rbiphonetest.rubyforge.org
|
108
|
+
post_install_message: PostInstall.txt
|
117
109
|
rdoc_options:
|
118
110
|
- --main
|
119
|
-
- README.
|
111
|
+
- README.rdoc
|
120
112
|
require_paths:
|
121
113
|
- lib
|
122
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -134,16 +126,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
126
|
requirements: []
|
135
127
|
|
136
128
|
rubyforge_project: rbiphonetest
|
137
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.3.1
|
138
130
|
signing_key:
|
139
131
|
specification_version: 2
|
140
|
-
summary: Want to write iPhone unit tests? Want to write them in Ruby?
|
132
|
+
summary: "Want to write iPhone apps with unit tests? Want to write them in Ruby? * Blog introduction: http://drnicwilliams.com/2008/07/04/unit-testing-iphone-apps-with-ruby-rbiphonetest/ * Video introduction: http://www.vimeo.com/1262916 * Google Group: http://groups.google.com/group/rbiphonetest * Bugs/Features: http://drnic.lighthouseapp.com/projects/13763-rbiphonetest"
|
141
133
|
test_files:
|
142
134
|
- test/test_generator_helper.rb
|
143
135
|
- test/test_helper.rb
|
144
136
|
- test/test_install_rspec_generator.rb
|
145
137
|
- test/test_install_test_unit_generator.rb
|
146
138
|
- test/test_model_generator.rb
|
147
|
-
- test/test_rbiphonetest.rb
|
148
139
|
- test/test_rbiphonetest_generator.rb
|
149
140
|
- test/test_story_generator.rb
|
data/License.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008 Dr Nic Williams
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/config/hoe.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'rbiphonetest/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Dr Nic Williams'
|
4
|
-
EMAIL = "drnicwilliams@gmail.com"
|
5
|
-
DESCRIPTION = "Want to write iPhone unit tests? Want to write them in Ruby?"
|
6
|
-
GEM_NAME = 'rbiphonetest' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'rbiphonetest' # The unix name for your project
|
8
|
-
HOMEPATH = "http://github.com/drnic/rbiphonetest"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
['rubigen', '>= 1.3.2']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
VERS = RbIphoneTest::VERSION::STRING
|
35
|
-
RDOC_OPTS = ['--quiet', '--title', 'rbiphonetest documentation',
|
36
|
-
"--opname", "index.html",
|
37
|
-
"--line-numbers",
|
38
|
-
"--main", "README",
|
39
|
-
"--inline-source"]
|
40
|
-
|
41
|
-
class Hoe
|
42
|
-
def extra_deps
|
43
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
-
@extra_deps
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Generate all the Rake tasks
|
49
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
-
p.developer(AUTHOR, EMAIL)
|
52
|
-
p.description = DESCRIPTION
|
53
|
-
p.summary = DESCRIPTION
|
54
|
-
p.url = HOMEPATH
|
55
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
|
-
p.test_globs = ["test/**/test_*.rb"]
|
57
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
-
|
59
|
-
# == Optional
|
60
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
62
|
-
|
63
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
|
-
end
|
65
|
-
|
66
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
67
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
68
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
69
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
70
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
data/tasks/environment.rake
DELETED
data/tasks/website.rake
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
desc 'Generate website files'
|
2
|
-
task :website_generate => :ruby_env do
|
3
|
-
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
-
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Upload website files to rubyforge'
|
9
|
-
task :website_upload do
|
10
|
-
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
-
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
-
local_dir = 'website'
|
13
|
-
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate and upload website files'
|
17
|
-
task :website => [:website_generate, :website_upload, :publish_docs]
|