fwtoolkit 0.9.3 → 1.0.1
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.
- checksums.yaml +8 -8
- data/bin/fwt +2 -112
- data/features/cocoapods/setup.feature +60 -0
- data/features/frank/model.feature +20 -0
- data/features/frank/setup.feature +28 -0
- data/features/git/create.feature +29 -0
- data/features/project/create.feature +25 -0
- data/features/step_definitions/aruba_steps.rb +11 -0
- data/features/step_definitions/git_steps.rb +30 -0
- data/features/step_definitions/project_steps.rb +50 -0
- data/features/step_definitions/rvm_steps.rb +11 -0
- data/features/step_definitions/system_steps.rb +8 -0
- data/features/support/env.rb +23 -0
- data/features/support/lib_test/aruba_fwt.rb +30 -0
- data/features/support/lib_test/aruba_mod.rb +28 -0
- data/features/support/lib_test/fake_gem.rb +47 -0
- data/features/xcode/create.feature +42 -0
- data/lib/fwtoolkit/cli/bootstrap.rb +75 -0
- data/lib/fwtoolkit/cli/ci.rb +52 -0
- data/lib/fwtoolkit/cli/cocoapods.rb +73 -0
- data/lib/fwtoolkit/cli/ext/thor.rb +35 -0
- data/lib/fwtoolkit/cli/frank.rb +113 -0
- data/lib/fwtoolkit/cli/fw_actions/template_dir.rb +59 -0
- data/lib/fwtoolkit/cli/fw_actions.rb +2 -0
- data/lib/fwtoolkit/cli/git.rb +42 -0
- data/lib/fwtoolkit/cli/ota.rb +109 -0
- data/lib/fwtoolkit/cli/ota_client/hockeyapp_client.rb +70 -0
- data/lib/fwtoolkit/cli/project.rb +83 -0
- data/lib/fwtoolkit/cli/thorutils.rb +14 -0
- data/lib/fwtoolkit/cli/xcode.rb +105 -0
- data/lib/fwtoolkit/cli.rb +27 -36
- data/lib/fwtoolkit/config/config.sample +8 -0
- data/lib/fwtoolkit/config.rb +41 -0
- data/lib/fwtoolkit/configfile.rb +36 -0
- data/lib/fwtoolkit/executable/executable.rb +45 -0
- data/lib/fwtoolkit/executable.rb +1 -0
- data/lib/fwtoolkit/ext/gem.rb +9 -0
- data/lib/fwtoolkit/ext/hash_yaml.rb +17 -0
- data/lib/fwtoolkit/git_client/git_client.rb +225 -0
- data/lib/fwtoolkit/git_client.rb +1 -0
- data/lib/fwtoolkit/projectfile.rb +50 -0
- data/lib/fwtoolkit/rake/ext/rake.rb +7 -0
- data/lib/fwtoolkit/rake/tasks/ci.rb +25 -0
- data/lib/fwtoolkit/rake/tasks/config.rb +13 -0
- data/lib/fwtoolkit/rake/tasks/ota.rb +31 -0
- data/lib/fwtoolkit/rake/tasks/project.rb +28 -0
- data/lib/fwtoolkit/rake/tasks/test.rb +59 -0
- data/lib/fwtoolkit/rake/tasks/xcode.rb +69 -0
- data/lib/fwtoolkit/rake/tasks.rb +20 -0
- data/lib/fwtoolkit/version.rb +1 -1
- data/lib/fwtoolkit.rb +4 -7
- data/spec/git_client_spec.rb +316 -0
- data/spec/project_config_spec.rb +40 -0
- data/spec/rake/project.rb +28 -0
- data/spec/rake/test.rb +85 -0
- data/spec/rake/xcode.rb +66 -0
- data/spec/support/aruba-doubles-rspec.rb +21 -0
- data/spec/support/ctx_rake.rb +23 -0
- data/spec/support/double_helper.rb +13 -0
- data/spec/support/project_generator.rb +45 -0
- data/templates/default_project/frank/%project_name%/%target_name%/%class_prefix%AppDelegate+Frank.h.tt +15 -0
- data/templates/{cucumber/AppDelegate+Frank.m.erb → default_project/frank/%project_name%/%target_name%/%class_prefix%AppDelegate+Frank.m.tt} +25 -21
- data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/example.feature +0 -0
- data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/step_definitions/launch_steps.rb +0 -0
- data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/support/env.rb +0 -0
- data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/support/mimic.rb +0 -0
- data/templates/default_project/frank/~template_config.rb +11 -0
- data/templates/default_project/frank_seed_core_data/%project_name%/Frank/features/support/models/%class_name%.rb.tt +30 -0
- data/templates/default_project/frank_seed_support/%project_name%/Frank/features/support/models/factories.rb.tt +10 -0
- data/templates/{cucumber → default_project/frank_seed_support/%project_name%/Frank}/features/support/views/my_objects_json.erb +0 -0
- data/templates/{cucumber → default_project/frank_seed_support/%project_name%/Frank}/features/support/views/my_objects_xml.erb +0 -0
- data/templates/{fwt/gitignore.erb → default_project/git/.gitignore} +0 -0
- data/templates/{fwt/rvmrc.erb → default_project/rvm/.rvmrc.tt} +2 -2
- data/templates/default_project/rvm/Gemfile +4 -0
- data/templates/default_project/xcode/%project_name%/%project_name%.xcodeproj/project.pbxproj.tt +583 -0
- data/templates/default_project/xcode/%project_name%/%project_name%.xcodeproj/project.xcworkspace/contents.xcworkspacedata.tt +7 -0
- data/templates/default_project/xcode/%project_name%/%project_name%.xcodeproj/xcshareddata/xcschemes/%project_name%-Release.xcscheme.tt +105 -0
- data/templates/default_project/xcode/%project_name%/%project_name%.xcodeproj/xcshareddata/xcschemes/%project_name%-Testing.xcscheme.tt +105 -0
- data/templates/default_project/xcode/%project_name%/%project_name%.xcodeproj/xcshareddata/xcschemes/%project_name%.xcscheme.tt +105 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.h.tt +15 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.m.tt +49 -0
- data/templates/{fwt/default_project/Info.plist.erb → default_project/xcode/%project_name%/%target_name%/Supporting Files/%project_name%-Info.plist} +0 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/%project_name%-Prefix.pch.tt +14 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/Settings.bundle/Root.plist +53 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/Settings.bundle/en.lproj/Root.strings +0 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/en.lproj/InfoPlist.strings +2 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/fw-shared.xcconfig +49 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/info.plist.h.tt +8 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/main.m.tt +18 -0
- data/templates/default_project/xcode/%project_name%/%target_name%/Supporting Files/version.sh +159 -0
- data/templates/default_project/xcode/%project_name%/%tests_target_name%/%project_name%Tests.h.tt +13 -0
- data/templates/default_project/xcode/%project_name%/%tests_target_name%/%project_name%Tests.m.tt +32 -0
- data/templates/default_project/xcode/%project_name%/%tests_target_name%/Supporting Files/%tests_target_name%-Info.plist +22 -0
- data/templates/default_project/xcode/%project_name%/%tests_target_name%/Supporting Files/en.lproj/InfoPlist.strings +2 -0
- data/templates/default_project/xcode/%project_name%/Default.png +0 -0
- data/templates/default_project/xcode/%project_name%/Resources/Default-568h@2x.png +0 -0
- data/templates/default_project/xcode/%project_name%/Resources/Default.png +0 -0
- data/templates/default_project/xcode/%project_name%/Resources/Default@2x.png +0 -0
- data/templates/default_project/xcode/%project_name%.xcworkspace/contents.xcworkspacedata.tt +7 -0
- data/templates/default_project/xcode/FWProjectfile.tt +14 -0
- data/templates/default_project/xcode/Podfile.tt +4 -0
- data/templates/default_project/xcode/Rakefile.tt +14 -0
- data/templates/default_project/xcode/cruise_config.rb +3 -0
- data/templates/default_project/xcode/~template_config.rb +5 -0
- metadata +187 -141
- data/lib/fwtoolkit/tasks/build.rb +0 -121
- data/lib/fwtoolkit/tasks/ci.rb +0 -30
- data/lib/fwtoolkit/tasks/cocoapods.rb +0 -32
- data/lib/fwtoolkit/tasks/frank.rb +0 -119
- data/lib/fwtoolkit/tasks/helper.rb +0 -16
- data/lib/fwtoolkit/tasks/services.rb +0 -41
- data/lib/fwtoolkit/tasks.rb +0 -24
- data/lib/fwtoolkit/test/frank_model.rb +0 -120
- data/lib/fwtoolkit/test/misc_steps.rb +0 -9
- data/lib/fwtoolkit/test/model_helper.rb +0 -94
- data/lib/fwtoolkit/test/network_steps.rb +0 -60
- data/lib/fwtoolkit/test/pickle_steps.rb +0 -101
- data/lib/fwtoolkit/test/timeout_helper.rb +0 -21
- data/lib/fwtoolkit/test/ui_helper.rb +0 -19
- data/lib/fwtoolkit/test/ui_steps.rb +0 -17
- data/templates/cucumber/AppDelegate+Frank.h.erb +0 -15
- data/templates/fwt/Gemfile.erb +0 -3
- data/templates/fwt/Podfile.erb +0 -4
- data/templates/fwt/Rakefile.erb +0 -24
- data/templates/fwt/default_project/AppDelegate.h.erb +0 -12
- data/templates/fwt/default_project/AppDelegate.m.erb +0 -20
- data/templates/fwt/default_project/Prefix.pch.erb +0 -6
- data/templates/fwt/default_project/main.m.erb +0 -15
- data/templates/models/factories.rb.erb +0 -10
- data/templates/models/model.rb.erb +0 -30
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'fwtoolkit/rake/tasks/project'
|
|
2
|
+
require 'support/ctx_rake'
|
|
3
|
+
require 'rake'
|
|
4
|
+
|
|
5
|
+
require 'support/aruba-doubles-rspec'
|
|
6
|
+
require 'support/double_helper'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
describe 'test' do
|
|
10
|
+
let!(:cmd_double) { ArubaDoublesSupport.new }
|
|
11
|
+
|
|
12
|
+
before :each do
|
|
13
|
+
cmd_double.setup
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
after :each do
|
|
17
|
+
cmd_double.teardown
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe 'project:update' do
|
|
21
|
+
include_context 'rake'
|
|
22
|
+
|
|
23
|
+
it 'runs the project update task on fwt' do
|
|
24
|
+
FWToolkit::Rake::ProjectTask.new
|
|
25
|
+
invoke_and_expect_cmd "fwt proj update"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/spec/rake/test.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require 'fwtoolkit/rake/tasks/test'
|
|
2
|
+
require 'support/ctx_rake'
|
|
3
|
+
require 'support/project_generator'
|
|
4
|
+
require 'rake'
|
|
5
|
+
|
|
6
|
+
require 'support/aruba-doubles-rspec'
|
|
7
|
+
|
|
8
|
+
require 'support/double_helper'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
describe 'test' do
|
|
12
|
+
|
|
13
|
+
let!(:project) { ProjectGenerator.new }
|
|
14
|
+
let(:config) { project.config }
|
|
15
|
+
let!(:cmd_double) { ArubaDoublesSupport.new }
|
|
16
|
+
|
|
17
|
+
before :each do
|
|
18
|
+
project.create_test_project(ProjectGenerator::PRJFILE_COMPLETE_CONFIG)
|
|
19
|
+
Dir.chdir(project.project_folder)
|
|
20
|
+
|
|
21
|
+
# cucumber/rake relies on the presence of bundler
|
|
22
|
+
Gem::Specification.stub(:find_all_by_name).with('bundler').and_return(['bundler'])
|
|
23
|
+
|
|
24
|
+
cmd_double.setup
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
after :each do
|
|
28
|
+
cmd_double.teardown
|
|
29
|
+
#@project_generator.delete_project
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
describe 'test:frank' do
|
|
35
|
+
include_context 'rake'
|
|
36
|
+
|
|
37
|
+
it 'runs the cucumber task' do
|
|
38
|
+
FWToolkit::Rake::TestTask.new
|
|
39
|
+
invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'sets the right env vars for the Frank environment' do
|
|
43
|
+
FWToolkit::Rake::TestTask.new
|
|
44
|
+
cmd_double.double_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip"
|
|
45
|
+
subject.invoke
|
|
46
|
+
ENV['USE_SIM_LAUNCHER_SERVER'].should be_nil
|
|
47
|
+
ENV['APP_BUNDLE_PATH'].should eq File.join(Dir.pwd, config[:frankified_app])
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe 'test:build' do
|
|
52
|
+
include_context 'rake'
|
|
53
|
+
|
|
54
|
+
it 'builds the frankified app' do
|
|
55
|
+
FWToolkit::Rake::TestTask.new
|
|
56
|
+
invoke_and_expect_cmd "frank build --workspace #{config[:xcode_workspace]} --scheme #{config[:xcode_scheme]}"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe 'test:ci:frank' do
|
|
61
|
+
include_context 'rake'
|
|
62
|
+
|
|
63
|
+
it 'runs the cucumber task (CI)' do
|
|
64
|
+
FWToolkit::Rake::TestTask.new
|
|
65
|
+
invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/tmp/frank_results.html' --format rerun --out '/tmp/frank_rerun.txt'"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'runs the cucumber task when a custom build_artifact env is specified (CI)' do
|
|
69
|
+
FWToolkit::Rake::TestTask.new
|
|
70
|
+
ENV['CC_BUILD_ARTIFACTS'] = '/myDir'
|
|
71
|
+
invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/myDir/frank_results.html' --format rerun --out '/myDir/frank_rerun.txt'"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'sets the right env vars for the Frank environment (CI)' do
|
|
75
|
+
FWToolkit::Rake::TestTask.new
|
|
76
|
+
cmd_double.double_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/tmp/frank_results.html' --format rerun --out '/tmp/frank_rerun.txt'"
|
|
77
|
+
|
|
78
|
+
subject.invoke
|
|
79
|
+
ENV['USE_SIM_LAUNCHER_SERVER'].should eq 'yes'
|
|
80
|
+
ENV['APP_BUNDLE_PATH'].should eq File.join(Dir.pwd, config[:frankified_app])
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
data/spec/rake/xcode.rb
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'fwtoolkit/rake/tasks/xcode'
|
|
2
|
+
require 'support/project_generator'
|
|
3
|
+
|
|
4
|
+
describe 'rake build' do
|
|
5
|
+
|
|
6
|
+
before(:all) do
|
|
7
|
+
@xcode_workspace = ProjectGenerator::PRJFILE_COMPLETE_CONFIG[:xcode_workspace]
|
|
8
|
+
@xcode_scheme = ProjectGenerator::PRJFILE_COMPLETE_CONFIG[:xcode_scheme]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
@project_generator = ProjectGenerator.new
|
|
13
|
+
@project_generator.create_test_project ProjectGenerator::PRJFILE_COMPLETE_CONFIG
|
|
14
|
+
@project_folder = @project_generator.project_folder
|
|
15
|
+
Dir.chdir @project_folder
|
|
16
|
+
|
|
17
|
+
@task_mock = double('xcodetask')
|
|
18
|
+
XcodeBuild::Tasks::BuildTask.stub(:new).and_yield(@task_mock)
|
|
19
|
+
|
|
20
|
+
# mock configuration common to every test
|
|
21
|
+
@task_mock.should_receive(:invoke_from_within=).with('.').at_least(:once)
|
|
22
|
+
@task_mock.should_receive(:workspace=).with(@xcode_workspace).at_least(:once)
|
|
23
|
+
@task_mock.should_receive(:scheme=).with(@xcode_scheme).at_least(:once)
|
|
24
|
+
@task_mock.should_receive(:formatter=).at_least(:once)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
after(:each) do
|
|
28
|
+
@project_generator.delete_project
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should configure the debug task' do
|
|
32
|
+
@task_mock.should_receive(:configuration=).with('Debug').at_least(:once)
|
|
33
|
+
@task_mock.should_receive(:configuration=).with(any_args()).any_number_of_times
|
|
34
|
+
@task_mock.should_receive(:sdk=).with('iphonesimulator').at_least(:once)
|
|
35
|
+
@task_mock.should_receive(:sdk=).with(any_args()).any_number_of_times
|
|
36
|
+
|
|
37
|
+
FWToolkit::Rake::XcodeTask.new
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'should configure the testing task' do
|
|
41
|
+
@task_mock.should_receive(:configuration=).with('Debug').at_least(:once)
|
|
42
|
+
@task_mock.should_receive(:configuration=).with(any_args()).any_number_of_times
|
|
43
|
+
@task_mock.should_receive(:sdk=).with('iphoneos').at_least(:once)
|
|
44
|
+
@task_mock.should_receive(:sdk=).with(any_args()).any_number_of_times
|
|
45
|
+
|
|
46
|
+
FWToolkit::Rake::XcodeTask.new
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'should configure the release task' do
|
|
50
|
+
@task_mock.should_receive(:configuration=).with('Release').at_least(:once)
|
|
51
|
+
@task_mock.should_receive(:configuration=).with(any_args()).any_number_of_times
|
|
52
|
+
@task_mock.should_receive(:sdk=).with('iphoneos').at_least(:once)
|
|
53
|
+
@task_mock.should_receive(:sdk=).with(any_args()).any_number_of_times
|
|
54
|
+
|
|
55
|
+
FWToolkit::Rake::XcodeTask.new
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'should configure the ci-test task' do
|
|
59
|
+
@task_mock.should_receive(:configuration=).with('Debug').at_least(:once)
|
|
60
|
+
@task_mock.should_receive(:configuration=).with(any_args()).any_number_of_times
|
|
61
|
+
@task_mock.should_receive(:sdk=).with('iphonesimulator').at_least(:once)
|
|
62
|
+
@task_mock.should_receive(:sdk=).with(any_args()).any_number_of_times
|
|
63
|
+
|
|
64
|
+
FWToolkit::Rake::XcodeTask.new
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'aruba-doubles'
|
|
2
|
+
require 'rspec'
|
|
3
|
+
|
|
4
|
+
class ArubaDoublesSupport
|
|
5
|
+
include ArubaDoubles
|
|
6
|
+
include RSpec::Core::DSL
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
ArubaDoubles::Double.setup
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def teardown
|
|
13
|
+
ArubaDoubles::Double.teardown
|
|
14
|
+
history.clear
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def has_run?(cmd)
|
|
18
|
+
history.include? cmd.shellsplit
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "rake"
|
|
2
|
+
|
|
3
|
+
shared_context "rake" do
|
|
4
|
+
let(:rake) { Rake::Application.new }
|
|
5
|
+
let(:task_name) { self.class.parent_groups.first.description }
|
|
6
|
+
let(:task_path) { "#{task_name.split(":").first}" }
|
|
7
|
+
subject { rake[task_name] }
|
|
8
|
+
|
|
9
|
+
def loaded_files_excluding_current_rake_file
|
|
10
|
+
$".reject {|file| file == File.join(File.dirname(__FILE__), "../rake/tasks", :task_path) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
before do
|
|
14
|
+
# rake.rake_require "../rake/test", [ File.dirname(__FILE__) ], loaded_files_excluding_current_rake_file
|
|
15
|
+
# rake.load_tasks
|
|
16
|
+
Rake.application = rake
|
|
17
|
+
# load "fwtoolkit/rake/tasks/#{task_path}.rb"
|
|
18
|
+
|
|
19
|
+
# Object::const_get(:FWToolkit).const_get(:Rake).const_get("#{task_path.capitalize}Task".to_sym).new
|
|
20
|
+
# rake.rake_require("../rake/tasks/#{task_path}", [File.dirname(__FILE__)], loaded_files_excluding_current_rake_file)
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'support/aruba-doubles-rspec'
|
|
2
|
+
|
|
3
|
+
RSpec.configure do |c|
|
|
4
|
+
module Helper
|
|
5
|
+
def invoke_and_expect_cmd(cmd_line)
|
|
6
|
+
cmd_double.double_cmd cmd_line
|
|
7
|
+
subject.invoke
|
|
8
|
+
expect(cmd_double.has_run? cmd_line).to be_true, cmd_double.history.to_pretty
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
c.include Helper
|
|
13
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'tmpdir'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
class ProjectGenerator
|
|
6
|
+
PRJFILE_MINIMAL_CONFIG = {
|
|
7
|
+
:project_name => "MyProject",
|
|
8
|
+
:class_prefix => "XYZ"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
PRJFILE_STANDARD_CONFIG = {
|
|
12
|
+
:binary_name => "myproject",
|
|
13
|
+
:target_name => "MyProjectTg",
|
|
14
|
+
:tests_target_name => "MyProjectTgTests"
|
|
15
|
+
}.merge(PRJFILE_MINIMAL_CONFIG)
|
|
16
|
+
|
|
17
|
+
PRJFILE_COMPLETE_CONFIG = {
|
|
18
|
+
:xcode_workspace => "MyProject.xcworkspace",
|
|
19
|
+
:xcode_project => "MyProject/MyProject.xcodeproj",
|
|
20
|
+
:xcode_scheme => "MyProject",
|
|
21
|
+
:source_root => "MyProject/MyProjectTg",
|
|
22
|
+
:tests_source_root => "MyProject/MyProjectTgTests",
|
|
23
|
+
:frank_root => "MyProject/MyProjectTg/Frank",
|
|
24
|
+
:frankified_app => "MyProject/MyProjectTg/Frank/frankified_build/Frankified.app"
|
|
25
|
+
}.merge(PRJFILE_STANDARD_CONFIG)
|
|
26
|
+
|
|
27
|
+
attr_accessor :config
|
|
28
|
+
|
|
29
|
+
def project_folder
|
|
30
|
+
@project_folder ||= Dir.mktmpdir
|
|
31
|
+
raise "Can't create temp folder" unless @project_folder
|
|
32
|
+
@project_folder
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def create_test_project(project_file_config)
|
|
36
|
+
@config = project_file_config
|
|
37
|
+
File.open(File.join(project_folder, 'FWProjectfile'), 'w') {|f| f.write project_file_config.to_yaml }
|
|
38
|
+
File.open(File.join(project_folder, 'Gemfile'), 'w') { |f| f.write 'gem "Bundler"'}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def delete_project
|
|
42
|
+
FileUtils.rm_rf @project_folder if File.exists? @project_folder
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// <%= config[:class_prefix] %>AppDelegate+Frank.h
|
|
3
|
+
// <%= config[:project_name] %>
|
|
4
|
+
//
|
|
5
|
+
// Created by <%= config[:project_creator] %> on 06/02/2013.
|
|
6
|
+
// Copyright (c) 2013 <%= config[:organization_name] %>. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "<%= config[:class_prefix] %>AppDelegate.h"
|
|
10
|
+
|
|
11
|
+
@interface <%= config[:class_prefix] %>AppDelegate (Frank)
|
|
12
|
+
|
|
13
|
+
- (void) seedCoreData:(NSString *)json;
|
|
14
|
+
|
|
15
|
+
@end
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
//
|
|
2
|
-
// <%=
|
|
3
|
-
//
|
|
2
|
+
// <%= config[:class_prefix] %>AppDelegate+Frank.h
|
|
3
|
+
// <%= config[:project_name] %>
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
6
|
-
// Copyright (c)
|
|
5
|
+
// Created by <%= config[:project_creator] %> on 06/02/2013.
|
|
6
|
+
// Copyright (c) 2013 <%= config[:organization_name] %>. All rights reserved.
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
#import "<%=
|
|
9
|
+
#import "<%= config[:class_prefix] %>AppDelegate+Frank.h"
|
|
10
10
|
#import <CoreData/CoreData.h>
|
|
11
11
|
#import <JSONKit/JSONKit.h>
|
|
12
12
|
#import <RestKit/RestKit.h>
|
|
13
13
|
|
|
14
|
-
@implementation <%=
|
|
14
|
+
@implementation <%= config[:class_prefix] %>AppDelegate (Frank)
|
|
15
15
|
|
|
16
16
|
- (void) seedCoreData:(NSString *)json
|
|
17
|
-
{
|
|
17
|
+
{
|
|
18
18
|
NSDictionary *objectsDictionary = [json objectFromJSONString];
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
NSManagedObjectContext *managedObjectContext = [RKObjectManager sharedManager].objectStore.managedObjectContextForCurrentThread;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
for (NSString *objectKey in objectsDictionary)
|
|
23
|
-
{
|
|
23
|
+
{
|
|
24
24
|
[self createObjectWithEntityName:objectKey configuredWithDictionary:[objectsDictionary objectForKey:objectKey] inManagedObjectContext:managedObjectContext];
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
- (NSManagedObject *)createObjectWithEntityName:(NSString *)entityName configuredWithDictionary:(NSDictionary *)dictionary inManagedObjectContext:(NSManagedObjectContext *)context
|
|
34
34
|
{
|
|
35
35
|
NSManagedObject *object = [NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context];
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
NSEntityDescription *objectEntityDescription = [object entity];
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
NSDictionary *attributes = [objectEntityDescription attributesByName];
|
|
40
40
|
NSDictionary *relationships = [objectEntityDescription relationshipsByName];
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
for (NSString *key in [dictionary allKeys])
|
|
43
43
|
{
|
|
44
44
|
if ([[attributes allKeys] containsObject:key])
|
|
@@ -52,25 +52,29 @@
|
|
|
52
52
|
else if ([[relationships allKeys] containsObject:key])
|
|
53
53
|
{
|
|
54
54
|
NSRelationshipDescription *relationshipDescription = [relationships objectForKey:key];
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
NSString *destinationEntityName = [[relationshipDescription destinationEntity] name];
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
if ([relationshipDescription isToMany])
|
|
59
59
|
{
|
|
60
60
|
NSMutableSet *relationshipSet = [NSMutableSet set];
|
|
61
61
|
for (NSDictionary *toManyRelationshipObject in [dictionary objectForKey:key])
|
|
62
62
|
{
|
|
63
|
-
NSManagedObject *destinationObject = [self createObjectWithEntityName:destinationEntityName
|
|
64
|
-
|
|
63
|
+
NSManagedObject *destinationObject = [self createObjectWithEntityName:destinationEntityName
|
|
64
|
+
configuredWithDictionary:toManyRelationshipObject
|
|
65
|
+
inManagedObjectContext:context];
|
|
66
|
+
|
|
65
67
|
[relationshipSet addObject:destinationObject];
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
|
|
68
70
|
[object setValue:relationshipSet forKey:key];
|
|
69
71
|
}
|
|
70
72
|
else
|
|
71
73
|
{
|
|
72
|
-
NSManagedObject *destinationObject = [self createObjectWithEntityName:destinationEntityName
|
|
73
|
-
|
|
74
|
+
NSManagedObject *destinationObject = [self createObjectWithEntityName:destinationEntityName
|
|
75
|
+
configuredWithDictionary:[dictionary objectForKey:key]
|
|
76
|
+
inManagedObjectContext:context];
|
|
77
|
+
|
|
74
78
|
[object setValue:destinationObject forKey:key];
|
|
75
79
|
}
|
|
76
80
|
}
|
|
@@ -79,4 +83,4 @@
|
|
|
79
83
|
return object;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
@end
|
|
86
|
+
@end
|
data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/example.feature
RENAMED
|
File without changes
|
|
File without changes
|
data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/support/env.rb
RENAMED
|
File without changes
|
data/templates/{cucumber → default_project/frank/%project_name%/Frank}/features/support/mimic.rb
RENAMED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'xcodeproj'
|
|
2
|
+
|
|
3
|
+
project_config do |destination_root, config|
|
|
4
|
+
source_files_folder = File.join destination_root, config[:project_name], config[:target_name]
|
|
5
|
+
project_file = File.join destination_root, config[:project_name], "#{config[:project_name]}.xcodeproj"
|
|
6
|
+
project = Xcodeproj::Project.new(project_file)
|
|
7
|
+
project.new_file File.join(source_files_folder, "#{config[:class_prefix]}AppDelegate+Frank.h"), config[:project_name]
|
|
8
|
+
m = project.new_file File.join(source_files_folder, "#{config[:class_prefix]}AppDelegate+Frank.m"), config[:project_name]
|
|
9
|
+
project.targets.select{|t| t.name.eql? config[:target_name]}[0].add_file_references [m]
|
|
10
|
+
project.save_as project_file
|
|
11
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Generated code
|
|
2
|
+
class <%= config[:class_name] %> < FWToolkit::Test::FrankModel
|
|
3
|
+
# attributes
|
|
4
|
+
attr_accessor <%= config[:model].attributes.map{|p| ":#{p.name.ruby_format}"}.join(', ') %>
|
|
5
|
+
# relationships
|
|
6
|
+
attr_reader <%= config[:model].relationships.select{|r| r.inverse != nil}.map{|r| ":#{r.name.ruby_format}"}.join(', ') %>
|
|
7
|
+
|
|
8
|
+
# inverse relationship setters
|
|
9
|
+
<% config[:model].relationships.select{|r| not r.to_many? and r.inverse}.each do |r| %><% name = r.name.ruby_format %>
|
|
10
|
+
def <%= name %>=(_<%= name %>)
|
|
11
|
+
@<%= name %> = _<%= name %>
|
|
12
|
+
unless @<%= name %>.<%= r.inverse.ruby_format %>
|
|
13
|
+
@<%= name %>.<%= r.inverse.ruby_format %> = []
|
|
14
|
+
end
|
|
15
|
+
@<%= name %>.<%= r.inverse.ruby_format %> << self
|
|
16
|
+
end
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
# lazy initialisation of to_many relationships
|
|
20
|
+
<% config[:model].relationships.select{|r| r.to_many? and r.inverse}.each do |r| %><% name = r.name.ruby_format %>
|
|
21
|
+
def <%= name %>
|
|
22
|
+
@<%= name %> ||= []
|
|
23
|
+
end
|
|
24
|
+
<% end %>
|
|
25
|
+
|
|
26
|
+
def as_json(options={})
|
|
27
|
+
<% attributes_and_properties = config[:model].attributes + config[:model].relationships.select{|r| r.to_many? and r.inverse} %>
|
|
28
|
+
{'<%= config[:model].name %>' => {<%= attributes_and_properties.map {|p| ":#{p.name} => self.#{p.name.ruby_format}"}.join(', ') %>}}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
|
7
7
|
# Only full ruby name is supported here, for short names use:
|
|
8
8
|
# echo "rvm use 1.9.3" > .rvmrc
|
|
9
|
-
environment_id="ruby
|
|
9
|
+
environment_id="ruby-<%= @ruby_version %>@<%= @app_name %>"
|
|
10
10
|
|
|
11
11
|
# First we attempt to load the desired environment directly from the environment
|
|
12
12
|
# file. This is very fast and efficient compared to running through the entire
|
|
@@ -35,7 +35,7 @@ fi
|
|
|
35
35
|
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
|
36
36
|
# gem install bundler
|
|
37
37
|
#fi
|
|
38
|
-
#if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
|
38
|
+
#if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
|
39
39
|
#then
|
|
40
40
|
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
|
41
41
|
#fi
|