-
Notifications
You must be signed in to change notification settings - Fork 92
/
Rakefile
97 lines (84 loc) · 4.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
RUBYDOCTEST = ENV['RUBYDOCTEST'] || "#{RUBY} `which rubydoctest`"
GEMS_ROOT = File.expand_path('../')
desc "Run tests and doctests for all components."
task :test do |t|
puts 'You probably want to set the HOBODEV variable before running rake test_all' if ENV['HOBODEV'].nil?
system("cd dryml ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo_fields ; #{RUBY} -S bundle exec rake test:doctest < test_responses.txt") &&
system("cd hobo_fields ; #{RUBY} -S bundle exec rake test:unit") &&
system("cd hobo_support ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test:irt") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test")
exit($?.exitstatus)
end
desc "Run tests and doctests for all components."
task :test_jruby do |t|
puts 'You probably want to set the HOBODEV variable before running rake test_all' if ENV['HOBODEV'].nil?
system("cd dryml ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo_fields ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo_fields ; #{RUBY} -S bundle exec rake test:unit") &&
system("cd hobo_support ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test:doctest") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test:irt") &&
system("cd hobo ; #{RUBY} -S bundle exec rake test")
exit($?.exitstatus)
end
desc "Run the integration tests"
task :test_integration do |t|
system("cd integration_tests/agility; #{RUBY} -S rake test:integration")
exit($?.exitstatus)
end
desc "Build and push or install all the hobo-gems"
task :gems, :action, :force do |t, args|
unless args.action.match(/^push|install|build$/)
puts "Unknown '#{args.action}' action: it must be either 'push' or 'install' or 'build'."
exit(1)
end
if ! args.force && ! `git status -s`.empty?
puts <<-EOS.gsub(/^ {6}/, '')
Rake task aborted: the working tree is dirty!
If you know what you are doing you can use \`rake gems[#{args.action},force]\`"
EOS
exit(1)
end
%w[hobo_support hobo_fields dryml hobo hobo_rapid hobo_jquery hobo_jquery_ui hobo_clean hobo_clean_admin hobo_clean_sidemenu].each do |name|
chdir(File.expand_path("../#{name}", __FILE__)) do
orig_version = version = File.read('VERSION').strip
begin
# add the commit ID to the version, since it might not be the real gem version that will be published
if args.action == 'install'
commit_id = `git log -1 --format="%h" HEAD`.strip
version = "#{orig_version}.#{commit_id}"
File.open('VERSION', 'w') do |f|
f.puts version
end
end
gem_name = "#{name}-#{version}.gem"
sh %(gem build #{name}.gemspec)
sh %(gem #{args.action} #{gem_name} #{args.action == 'install' ? '--local' : ''}) unless args.action=='build'
ensure
remove_entry_secure gem_name, true unless args.action=='build'
if args.action == 'install'
File.open('VERSION', 'w') do |f|
f.puts orig_version
end
end
end
end
end
if args.action == 'install'
puts <<-EOS.gsub(/^ {6}/, '')
*******************************************************************************
* NOTICE *
*******************************************************************************
* The version id of locally installed hobo gems is comparable to a --pre *
* version: i.e. it is alphabetically ordered (not numerically ordered), *
* besides it includes the sah1 commit id which is not aphabetically ordered, *
* so be sure your application picks the version you really intend to use by *
* setting it explicitly in the Gemfile. *
*******************************************************************************
EOS
end
end