Permalink
Browse files

Compile an sh build script

  • Loading branch information...
svenfuchs committed Dec 24, 2012
1 parent c321648 commit 2dd6b07e491f29050590b2b6bb307bd2c01e6ba7
Showing with 2,263 additions and 4,870 deletions.
  1. +2 −1 .travis.yml
  2. +0 −11 Gemfile
  3. +0 −30 features/support/env.rb
  4. +0 −310 features/support/step_definitions.rb
  5. +0 −78 features/switching_active_jdk.feature
  6. +0 −93 features/test_clojure.feature
  7. +0 −93 features/test_clojure_with_given_jdk_version.feature
  8. +0 −137 features/test_erlang.feature
  9. +0 −135 features/test_groovy.feature
  10. +0 −146 features/test_java.feature
  11. +0 −158 features/test_nodejs.feature
  12. +0 −112 features/test_php.feature
  13. +0 −122 features/test_ruby.feature
  14. +0 −156 features/test_ruby_with_given_jdk_version.feature
  15. +0 −117 features/test_scala.feature
  16. +0 −117 features/test_scala_with_given_jdk_version.feature
  17. +5 −0 lib/core_ext/object/false.rb
  18. +5 −0 lib/core_ext/string/indent.rb
  19. +5 −0 lib/core_ext/string/unindent.rb
  20. +32 −78 lib/travis/build.rb
  21. +0 −36 lib/travis/build/commit.rb
  22. +106 −0 lib/travis/build/config.rb
  23. +0 −24 lib/travis/build/connection.rb
  24. +0 −43 lib/travis/build/event.rb
  25. +0 −15 lib/travis/build/exceptions.rb
  26. +0 −76 lib/travis/build/factory.rb
  27. +0 −9 lib/travis/build/job.rb
  28. +0 −28 lib/travis/build/job/image.rb
  29. +0 −198 lib/travis/build/job/test.rb
  30. +0 −39 lib/travis/build/job/test/c.rb
  31. +0 −47 lib/travis/build/job/test/clojure.rb
  32. +0 −64 lib/travis/build/job/test/cpp.rb
  33. +0 −48 lib/travis/build/job/test/erlang.rb
  34. +0 −46 lib/travis/build/job/test/go.rb
  35. +0 −16 lib/travis/build/job/test/groovy.rb
  36. +0 −45 lib/travis/build/job/test/haskell.rb
  37. +0 −32 lib/travis/build/job/test/jdk_switcher.rb
  38. +0 −75 lib/travis/build/job/test/jvm_language.rb
  39. +0 −52 lib/travis/build/job/test/node_js.rb
  40. +0 −64 lib/travis/build/job/test/perl.rb
  41. +0 −50 lib/travis/build/job/test/php.rb
  42. +0 −15 lib/travis/build/job/test/pure_java.rb
  43. +0 −77 lib/travis/build/job/test/python.rb
  44. +0 −64 lib/travis/build/job/test/ruby.rb
  45. +0 −47 lib/travis/build/job/test/scala.rb
  46. +0 −48 lib/travis/build/remote.rb
  47. +0 −54 lib/travis/build/scm/git.rb
  48. +83 −0 lib/travis/build/script.rb
  49. +25 −0 lib/travis/build/script/c.rb
  50. +37 −0 lib/travis/build/script/clojure.rb
  51. +50 −0 lib/travis/build/script/cpp.rb
  52. +42 −0 lib/travis/build/script/erlang.rb
  53. +49 −0 lib/travis/build/script/git.rb
  54. +33 −0 lib/travis/build/script/go.rb
  55. +11 −0 lib/travis/build/script/groovy.rb
  56. +29 −0 lib/travis/build/script/haskell.rb
  57. +40 −0 lib/travis/build/script/helpers.rb
  58. +21 −0 lib/travis/build/script/jdk.rb
  59. +35 −0 lib/travis/build/script/jvm.rb
  60. +43 −0 lib/travis/build/script/node_js.rb
  61. +37 −0 lib/travis/build/script/perl.rb
  62. +36 −0 lib/travis/build/script/php.rb
  63. +12 −0 lib/travis/build/script/pure_java.rb
  64. +53 −0 lib/travis/build/script/python.rb
  65. +61 −0 lib/travis/build/script/ruby.rb
  66. +34 −0 lib/travis/build/script/scala.rb
  67. +34 −0 lib/travis/build/script/services.rb
  68. +64 −0 lib/travis/build/script/stages.rb
  69. +2 −0 lib/travis/build/script/templates/footer.sh
  70. +34 −0 lib/travis/build/script/templates/header.sh
  71. +21 −0 lib/travis/build/shell.rb
  72. +64 −0 lib/travis/build/shell/dsl.rb
  73. +49 −0 lib/travis/build/shell/filters.rb
  74. +98 −0 lib/travis/build/shell/node.rb
  75. +0 −8 lib/travis/build/version.rb
  76. +141 −0 play/build.sh
  77. +30 −0 play/compile.rb
  78. +12 −0 play/timeout.sh
  79. +0 −62 spec/build/event_spec.rb
  80. +0 −150 spec/build/factory_spec.rb
  81. +0 −48 spec/build/job/test/c_spec.rb
  82. +0 −83 spec/build/job/test/clojure_spec.rb
  83. +0 −60 spec/build/job/test/cpp_spec.rb
  84. +0 −69 spec/build/job/test/erlang_spec.rb
  85. +0 −42 spec/build/job/test/go_spec.rb
  86. +0 −61 spec/build/job/test/groovy_spec.rb
  87. +0 −23 spec/build/job/test/haskell_spec.rb
  88. +0 −94 spec/build/job/test/jvm_language_spec.rb
  89. +0 −55 spec/build/job/test/node_js_spec.rb
  90. +0 −53 spec/build/job/test/perl_spec.rb
  91. +0 −64 spec/build/job/test/php_spec.rb
  92. +0 −65 spec/build/job/test/python_spec.rb
  93. +0 −124 spec/build/job/test/ruby_spec.rb
  94. +0 −68 spec/build/job/test/scala_spec.rb
  95. +0 −270 spec/build/job/test_spec.rb
  96. +0 −31 spec/build/remote_spec.rb
  97. +0 −48 spec/build/scm/git_spec.rb
  98. +0 −79 spec/build_spec.rb
  99. +28 −0 spec/script/c_spec.rb
  100. +42 −0 spec/script/clojure_spec.rb
  101. +75 −0 spec/script/cpp_spec.rb
  102. +51 −0 spec/script/erlang_spec.rb
  103. +43 −0 spec/script/go_spec.rb
  104. +10 −0 spec/script/groovy_spec.rb
  105. +30 −0 spec/script/haskell_spec.rb
  106. +46 −0 spec/script/node_js_spec.rb
  107. +60 −0 spec/script/perl_spec.rb
  108. +25 −0 spec/script/php_spec.rb
  109. +10 −0 spec/script/pure_java.rb
  110. +65 −0 spec/script/python_spec.rb
  111. +54 −0 spec/script/ruby_spec.rb
  112. +32 −0 spec/script/scala_spec.rb
  113. +38 −0 spec/shared/jdk.rb
  114. +37 −0 spec/shared/jvm.rb
  115. +45 −0 spec/shared/script.rb
  116. +43 −17 spec/spec_helper.rb
  117. +37 −0 spec/support/header.sh
  118. +0 −3 spec/support/helpers.rb
  119. +52 −13 spec/support/matchers.rb
  120. +0 −64 spec/support/mocks.rb
  121. +5 −10 spec/support/payloads.rb
View
@@ -1,6 +1,7 @@
language: ruby
rvm:
+ - 1.9.3
- jruby-18mode
- jruby-19mode
- jruby-head
-script: "bundle exec rspec spec && bundle exec cucumber"
+script: "bundle exec rspec spec"
View
11 Gemfile
@@ -2,19 +2,8 @@ source :rubygems
gem 'travis-support', :git => 'git://github.com/travis-ci/travis-support.git'
-gem 'activesupport', '~> 3.1.2'
-gem 'hashr', '~> 0.0.17'
-gem 'multi_json', '~> 1.0.3'
-gem 'faraday', '~> 0.7.5'
-gem 'net-ssh-shell', '~> 0.2.0'
-gem 'rake', '~> 0.9.2.2'
-gem 'thor', '~> 0.14.6'
-
-gem 'jruby-openssl', '~> 0.7.4', :platforms => :jruby
-
group :test do
gem 'mocha', '~> 0.10.0'
gem 'rspec', '~> 2.7.0'
- gem 'cucumber', '~> 1.1.2'
end
View
@@ -1,30 +0,0 @@
-root = File.expand_path('../../..', __FILE__)
-
-$: << "#{root}/lib" << "#{root}/spec"
-
-require 'travis/build'
-require 'travis/support'
-
-require 'stringio'
-require 'mocha'
-require 'support/mocks'
-require 'support/payloads'
-
-World(Mocha::API)
-
-Before do
- mocha_setup
-
- Travis.logger = Logger.new(StringIO.new)
-
- $now = Time.now.utc
- Time.stubs(:now).returns($now)
-end
-
-After do
- begin
- mocha_verify
- ensure
- mocha_teardown
- end
-end
@@ -1,310 +0,0 @@
-require 'hashr'
-require 'active_support/core_ext/hash/keys'
-
-def decode(string)
- string.split(',').inject({}) do |result, pair|
- key, value = pair.split(':').map { |token| token.strip }
-
- value = case value
- when '[now]'
- Time.now.utc
- when 'true', 'false'
- eval(value)
- when /^\/.*\/$/
- eval(value)
- when /^\d*$/
- value.to_i
- else
- value
- end
-
- result.merge(key => value)
- end.symbolize_keys
-end
-
-Given /^the following test payload$/ do |table|
- hash = Hashr.new(table.rows_hash)
-
- $payload = Hashr.new({
- :repository => {
- :slug => hash.repository,
- :source_url => "git://github.com/#{hash.repository}.git"
- },
- :build => {
- :commit => hash.commit
- },
- :type => 'test'
- })
-
- $payload.config = decode(hash.config) if hash.config?
-end
-
-When /^it starts a job$/ do
- $vm = Mocks::Vm.new
- $shell = Mocks::Shell.new
- $observer = Mocks::Observer.new
- $sequence = sequence('build')
- $build = Travis::Build.create($vm, $shell, [$observer], $payload, {})
-
- step 'it opens the ssh session'
- step 'it cds into the builds dir'
-end
-
-Then /^it (successfully|fails to) clones? the repository to the build dir with git$/ do |result|
- step 'it silently disables interactive git auth'
- step "it #{result} clones the repository with git"
- step 'it silently removes the ssh key'
-end
-
-Then /^it (successfully|fails to) checks? out the commit with git to the repository directory$/ do |result|
- step 'it cds into the repository directory'
- step "it #{result} checks the commit out with git"
-end
-
-Then /^it finds a file (.*) (?:and|but) (successfully|fails to) installs? dependencies with (.*)$/ do |filename, result, tool|
- step "it finds the file #{filename}"
- if tool == 'bundle'
- step 'it evaluates the current working directory'
- step "it exports the line BUNDLE_GEMFILE=~/builds/travis-ci/travis-ci/#{filename}"
- end
- step "it #{result} installs dependencies with #{tool}"
-end
-
-
-Then /^it exports the given environment variables$/ do
- step "it exports the line TRAVIS_PULL_REQUEST=false"
- step "it exports the line TRAVIS_SECURE_ENV_VARS=false"
-
- if $payload.config.env?
- line = $payload.config.env
- step "it exports the line #{line}"
- end
-end
-
-Then /^it opens the ssh session$/ do
- $shell.expects(:connect).
- in_sequence($sequence)
-end
-
-Then /^it cds into the (.*)$/ do |dir|
- dirs = {
- 'builds dir' => '~/builds',
- 'repository directory' => $payload.repository.slug
- }
- dir = dirs[dir]
-
- $shell.expects(:chdir).
- with(dir).
- outputs("cd #{dir}").
- in_sequence($sequence)
-end
-
-Then /^it exports the line (.+)$/ do |line|
- $shell.expects(:export_line).
- with(line).
- outputs("export #{line}").
- in_sequence($sequence)
-end
-
-Then /^it silently disables interactive git auth$/ do
- $shell.expects(:export).
- with('GIT_ASKPASS', 'echo', :echo => false).
- in_sequence($sequence)
-end
-
-Then /^it (successfully|fails to) clones? the repository with git$/ do |result|
- $shell.expects(:execute).
- with("git clone --depth=100 --quiet git://github.com/#{$payload.repository.slug}.git #{$payload.repository.slug}").
- outputs('git clone').
- returns(result == 'successfully').
- in_sequence($sequence)
-end
-
-Then /^it silently removes the ssh key/ do
- $shell.expects(:execute).
- with('rm -f ~/.ssh/source_rsa', :echo => false).
- in_sequence($sequence)
-end
-
-Then /^it (successfully|fails to) checks? the commit out with git$/ do |result|
- checkout = $shell.expects(:execute).
- with("git checkout -qf #{$payload.build.commit}").
- outputs('git checkout')
-
- if result == 'successfully'
- checkout.
- returns(true).
- in_sequence($sequence)
-
- $shell.expects(:file_exists?).
- with('.gitmodules').
- returns(false)
- else
- checkout.
- raises(Travis::AssertionFailed).
- in_sequence($sequence)
- end
-end
-
-Then /^it (successfully|fails to) switch(?:es)? to the (.*) version: (.*)$/ do |result, language, version|
- cmds = {
- 'ruby' => "rvm use #{version}",
- 'erlang' => "source /home/vagrant/otp/#{version}/activate",
- 'nodejs' => "nvm use #{version}",
- 'php' => "phpenv global #{version}",
- 'jdk' => "jdk_switcher use #{version}"
- }
- cmd = cmds[language.gsub('.', '')]
-
- options = nil
- options = { :echo => true } if language == 'ruby'
-
- $shell.expects(:execute).
- with(cmd, options).
- outputs(cmd).
- returns(result == 'successfully').
- in_sequence($sequence)
-end
-
-Then /it announces active (?:lein|leiningen|Leiningen) version/ do
- cmd = 'lein version'
-
- $shell.expects(:execute).
- with(cmd).
- outputs(cmd).
- in_sequence($sequence)
-end
-
-Then /it announces active (?:php|PHP) version/ do
- cmd = 'php --version'
-
- $shell.expects(:execute).
- with(cmd).
- outputs(cmd).
- in_sequence($sequence)
-end
-
-Then /it announces active (?:jdk|JDK) version/ do
- $shell.expects(:execute).
- with("java -version").
- outputs("java -version").
- in_sequence($sequence)
-
- $shell.expects(:execute).
- with("javac -version").
- outputs("javac -version").
- in_sequence($sequence)
-end
-
-Then /it announces active (?:ruby|Ruby) version/ do
- $shell.expects(:execute).
- with("ruby --version").
- outputs("ruby --version").
- in_sequence($sequence)
-
- $shell.expects(:execute).
- with("gem --version").
- outputs("gem --version").
- in_sequence($sequence)
-end
-
-Then /it announces active (?:node|node.js|Node|Node.js) version/ do
- $shell.expects(:execute).
- with("node --version").
- outputs("node --version").
- returns(true).
- in_sequence($sequence)
-
- $shell.expects(:execute).
- with("npm --version").
- outputs("npm --version").
- returns(true).
- in_sequence($sequence)
-end
-
-Then /^it (finds|does not find) (?:the )?file (.*)$/ do |result, filenames|
- filenames = filenames.split(/, | or /).map { |filename| filename.strip }
- filenames.each do |filename|
- $shell.expects(:file_exists?).
- with(filename).
- at_least_once.
- returns(result == 'finds').
- in_sequence($sequence)
- end
-end
-
-Then /^it (finds|does not find) directory (.*)$/ do |result, dirname|
- $shell.expects(:directory_exists?).
- with(dirname).
- at_least_once.
- returns(result == 'finds').
- in_sequence($sequence)
-end
-
-Then /^there is no local rebar in the repository$/ do
- $build.stubs(:has_local_rebar?).returns(false)
- $shell.stubs(:file_exists?).
- with("rebar").
- returns(false)
-end
-
-Then /^it evaluates the current working directory$/ do
- $shell.expects(:cwd).
- returns("~/builds/#{$payload.repository.slug}").
- in_sequence($sequence)
-end
-
-Then /^it (successfully|fails to) installs? dependencies with (.*)$/ do |result, dependencies|
- cmds = {
- 'bundle' => 'bundle install',
- 'lein' => 'lein deps',
- 'maven' => 'mvn install --quiet -DskipTests=true',
- 'mvn' => 'mvn install --quiet -DskipTests=true',
- 'gradle' => 'gradle assemble',
- 'rebar' => 'rebar get-deps',
- 'npm' => 'npm install --dev',
- 'composer' => 'composer install --dev'
- }
- cmd = cmds[dependencies]
-
- $shell.expects(:execute).
- with(cmd, :stage => :install).
- outputs(cmd).
- returns(result == 'successfully').
- in_sequence($sequence)
-end
-
-Then /^it (successfully|fails to) runs? the (.*): (.*)$/ do |result, type, command|
- $shell.expects(:execute).
- with(command, :stage => type.to_sym).
- outputs(command).
- returns(result == 'successfully').
- in_sequence($sequence)
-end
-
-Then /^it closes the ssh session$/ do
- $shell.expects(:close).
- in_sequence($sequence)
-end
-
-Then /^it returns the result (.*)$/ do |result|
- $build.run[:result].should == result.to_i
-end
-
-Then /^it has captured the following events$/ do |table|
- expected = table.hashes.map { |hash| Hashr.new(hash) }
- actual = $observer.events
-
- expected.each_with_index do |expected, ix|
- actual[ix][0].should == expected.name
-
- decode(expected.data).each do |key, value|
- case value
- when Regexp
- actual[ix][1][key].should =~ value
- else
- actual[ix][1][key].should == value
- end
- end
- end
-end
Oops, something went wrong.

0 comments on commit 2dd6b07

Please sign in to comment.