harker 0.5.3

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.
Files changed (67) hide show
  1. data/History.txt +31 -0
  2. data/Manifest.txt +66 -0
  3. data/README.rdoc +101 -0
  4. data/Rakefile +20 -0
  5. data/bin/harker +19 -0
  6. data/lib/harker.rb +116 -0
  7. data/lib/harker/gemify.rb +44 -0
  8. data/lib/harker/rails_configuration.rb +36 -0
  9. data/lib/harker/server.rb +125 -0
  10. data/lib/harker/templates/bin.erb +5 -0
  11. data/lib/harker/templates/hoe.erb +9 -0
  12. data/lib/harker/templates/lib.erb +2 -0
  13. data/test/sample/Manifest.txt +53 -0
  14. data/test/sample/README.rdoc +46 -0
  15. data/test/sample/Rakefile +14 -0
  16. data/test/sample/app/controllers/application_controller.rb +10 -0
  17. data/test/sample/app/controllers/harks_controller.rb +6 -0
  18. data/test/sample/app/helpers/application_helper.rb +3 -0
  19. data/test/sample/app/helpers/harks_helper.rb +2 -0
  20. data/test/sample/app/models/hark.rb +2 -0
  21. data/test/sample/bin/sample_rails +5 -0
  22. data/test/sample/config/boot.rb +110 -0
  23. data/test/sample/config/database.yml +22 -0
  24. data/test/sample/config/environment.rb +41 -0
  25. data/test/sample/config/environments/development.rb +17 -0
  26. data/test/sample/config/environments/production.rb +28 -0
  27. data/test/sample/config/environments/test.rb +28 -0
  28. data/test/sample/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/sample/config/initializers/inflections.rb +10 -0
  30. data/test/sample/config/initializers/mime_types.rb +5 -0
  31. data/test/sample/config/initializers/new_rails_defaults.rb +19 -0
  32. data/test/sample/config/initializers/session_store.rb +15 -0
  33. data/test/sample/config/locales/en.yml +5 -0
  34. data/test/sample/config/routes.rb +45 -0
  35. data/test/sample/db/migrate/20090326050232_create_harks.rb +12 -0
  36. data/test/sample/lib/sample_rails.rb +2 -0
  37. data/test/sample/public/404.html +30 -0
  38. data/test/sample/public/422.html +30 -0
  39. data/test/sample/public/500.html +30 -0
  40. data/test/sample/public/favicon.ico +0 -0
  41. data/test/sample/public/images/rails.png +0 -0
  42. data/test/sample/public/index.html +275 -0
  43. data/test/sample/public/javascripts/application.js +2 -0
  44. data/test/sample/public/javascripts/controls.js +963 -0
  45. data/test/sample/public/javascripts/dragdrop.js +973 -0
  46. data/test/sample/public/javascripts/effects.js +1128 -0
  47. data/test/sample/public/javascripts/prototype.js +4320 -0
  48. data/test/sample/public/robots.txt +5 -0
  49. data/test/sample/script/about +4 -0
  50. data/test/sample/script/console +3 -0
  51. data/test/sample/script/dbconsole +3 -0
  52. data/test/sample/script/destroy +3 -0
  53. data/test/sample/script/generate +3 -0
  54. data/test/sample/script/performance/benchmarker +3 -0
  55. data/test/sample/script/performance/profiler +3 -0
  56. data/test/sample/script/plugin +3 -0
  57. data/test/sample/script/runner +3 -0
  58. data/test/sample/script/server +3 -0
  59. data/test/sample/test/fixtures/harks.yml +7 -0
  60. data/test/sample/test/functional/harks_controller_test.rb +8 -0
  61. data/test/sample/test/performance/browsing_test.rb +9 -0
  62. data/test/sample/test/test_helper.rb +38 -0
  63. data/test/sample/test/unit/hark_test.rb +8 -0
  64. data/test/sample/test/unit/helpers/harks_helper_test.rb +4 -0
  65. data/test/test_gemify.sh +18 -0
  66. data/test/test_harker.rb +81 -0
  67. metadata +163 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ # one:
4
+ # column: value
5
+ #
6
+ # two:
7
+ # column: value
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class HarksControllerTest < ActionController::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ # Profiling results for each test method are written to tmp/performance.
5
+ class BrowsingTest < ActionController::PerformanceTest
6
+ def test_homepage
7
+ get '/'
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ #
19
+ # The only drawback to using transactional fixtures is when you actually
20
+ # need to test transactions. Since your test is bracketed by a transaction,
21
+ # any transactions started in your code will be automatically rolled back.
22
+ self.use_transactional_fixtures = true
23
+
24
+ # Instantiated fixtures are slow, but give you @david where otherwise you
25
+ # would need people(:david). If you don't want to migrate your existing
26
+ # test cases which use the @david style and don't mind the speed hit (each
27
+ # instantiated fixtures translates to a database query per test method),
28
+ # then set this back to true.
29
+ self.use_instantiated_fixtures = false
30
+
31
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
+ #
33
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
+ # -- they do not yet inherit this setting
35
+ fixtures :all
36
+
37
+ # Add more helper methods to be used by all tests here...
38
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class HarkTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class HarksHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+
3
+ # The gemification step is tricky to test. =\
4
+
5
+ sudo gem uninstall -x dummy
6
+ rm -rf /tmp/dummy-instance
7
+ rm -rf /tmp/dummy
8
+
9
+ cd /tmp
10
+ rails dummy
11
+ cd /tmp/dummy
12
+ script/generate scaffold Dummy name:string favourite_dumb_thing:string
13
+ harker
14
+ rake install_gem
15
+ dummy init /tmp/dummy-instance
16
+ cd /tmp/dummy-instance
17
+ dummy migrate
18
+ dummy start
@@ -0,0 +1,81 @@
1
+ require "rubygems"
2
+ require "minitest/unit"
3
+ require 'fileutils'
4
+ require 'timeout'
5
+ require 'open-uri'
6
+
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib/")
8
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/sample/lib/")
9
+ require 'harker'
10
+
11
+ class TestHarker < MiniTest::Unit::TestCase
12
+ ROOT = "/tmp/harker-test-#{Process.pid}"
13
+ URL = 'http://localhost:3000/harks'
14
+
15
+ # Ensure nothing's currently running on that port
16
+ begin
17
+ open(URL).read and abort "Already a process running on our port."
18
+ rescue Errno::ECONNREFUSED # We want this to happen
19
+ end
20
+
21
+ def setup
22
+ unless File.exist?(ROOT)
23
+ Harker::GEM_ROOT.replace(File.dirname(__FILE__) + '/sample/')
24
+ harker_action('init')
25
+ harker_action('migrate')
26
+ end
27
+ end
28
+
29
+ at_exit { FileUtils.rm_rf ROOT }
30
+
31
+ def test_init
32
+ assert File.exist?(ROOT)
33
+ assert File.exist?(ROOT + '/database.yml')
34
+ end
35
+
36
+ def test_start
37
+ start_server_process
38
+ harks = YAML.load(open(URL).read)
39
+ assert File.exists?(ROOT + '/tmp/pids/server.pid'), "No pid found."
40
+ # Make sure actual DB access works.
41
+ assert_equal ['Joy!'], harks.map{ |h| h['tidings'] }
42
+ ensure
43
+ begin
44
+ harker_action('stop')
45
+ rescue SystemExit
46
+ end
47
+ end
48
+
49
+ def test_stop
50
+ start_server_process
51
+ assert File.exists?(ROOT + '/tmp/pids/server.pid'), "No pid found."
52
+ Harker.launch('sample_rails', ['stop', ROOT]); sleep 0.1
53
+ assert_raises(Errno::ECONNREFUSED) { open(URL).read }
54
+ end
55
+
56
+ def test_migrate
57
+ assert_equal(['id', 'tidings', 'updated_at', 'created_at'].sort,
58
+ Hark.columns.map{ |c| c.name }.sort)
59
+ end
60
+
61
+ private
62
+
63
+ def harker_action(action)
64
+ $stdout = StringIO.new
65
+ $stderr = StringIO.new
66
+ Harker.launch('sample_rails', [action, ROOT])
67
+ ensure
68
+ $stdout = STDOUT
69
+ $stderr = STDERR
70
+ end
71
+
72
+ def start_server_process
73
+ `cd #{File.dirname(__FILE__)}/.. ; ruby -I:lib:test/sample/lib test/sample/bin/sample_rails start #{ROOT} -d`
74
+ Timeout.timeout(5) do
75
+ loop { break if File.exist?(ROOT + '/tmp/pids/server.pid'); sleep 0.1 }
76
+ end
77
+ sleep 0.1 # Waiting for pid to exist isn't enough; it looks like.
78
+ end
79
+ end
80
+
81
+ MiniTest::Unit.autorun
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: harker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.3
5
+ platform: ruby
6
+ authors:
7
+ - Phil Hagelberg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-21 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: minitest
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: sqlite3-ruby
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.2.4
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: hoe
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.12.1
54
+ version:
55
+ description: Harker means Rails deployments via RubyGems--because a package manager is a terrible thing to waste.
56
+ email:
57
+ - technomancy@gmail.com
58
+ executables:
59
+ - harker
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - History.txt
64
+ - Manifest.txt
65
+ files:
66
+ - History.txt
67
+ - Manifest.txt
68
+ - README.rdoc
69
+ - Rakefile
70
+ - bin/harker
71
+ - lib/harker.rb
72
+ - lib/harker/gemify.rb
73
+ - lib/harker/rails_configuration.rb
74
+ - lib/harker/server.rb
75
+ - lib/harker/templates/bin.erb
76
+ - lib/harker/templates/hoe.erb
77
+ - lib/harker/templates/lib.erb
78
+ - test/sample/Manifest.txt
79
+ - test/sample/README.rdoc
80
+ - test/sample/Rakefile
81
+ - test/sample/app/controllers/application_controller.rb
82
+ - test/sample/app/controllers/harks_controller.rb
83
+ - test/sample/app/helpers/application_helper.rb
84
+ - test/sample/app/helpers/harks_helper.rb
85
+ - test/sample/app/models/hark.rb
86
+ - test/sample/bin/sample_rails
87
+ - test/sample/config/boot.rb
88
+ - test/sample/config/database.yml
89
+ - test/sample/config/environment.rb
90
+ - test/sample/config/environments/development.rb
91
+ - test/sample/config/environments/production.rb
92
+ - test/sample/config/environments/test.rb
93
+ - test/sample/config/initializers/backtrace_silencers.rb
94
+ - test/sample/config/initializers/inflections.rb
95
+ - test/sample/config/initializers/mime_types.rb
96
+ - test/sample/config/initializers/new_rails_defaults.rb
97
+ - test/sample/config/initializers/session_store.rb
98
+ - test/sample/config/locales/en.yml
99
+ - test/sample/config/routes.rb
100
+ - test/sample/db/migrate/20090326050232_create_harks.rb
101
+ - test/sample/lib/sample_rails.rb
102
+ - test/sample/public/404.html
103
+ - test/sample/public/422.html
104
+ - test/sample/public/500.html
105
+ - test/sample/public/favicon.ico
106
+ - test/sample/public/images/rails.png
107
+ - test/sample/public/index.html
108
+ - test/sample/public/javascripts/application.js
109
+ - test/sample/public/javascripts/controls.js
110
+ - test/sample/public/javascripts/dragdrop.js
111
+ - test/sample/public/javascripts/effects.js
112
+ - test/sample/public/javascripts/prototype.js
113
+ - test/sample/public/robots.txt
114
+ - test/sample/script/about
115
+ - test/sample/script/console
116
+ - test/sample/script/dbconsole
117
+ - test/sample/script/destroy
118
+ - test/sample/script/generate
119
+ - test/sample/script/performance/benchmarker
120
+ - test/sample/script/performance/profiler
121
+ - test/sample/script/plugin
122
+ - test/sample/script/runner
123
+ - test/sample/script/server
124
+ - test/sample/test/fixtures/harks.yml
125
+ - test/sample/test/functional/harks_controller_test.rb
126
+ - test/sample/test/performance/browsing_test.rb
127
+ - test/sample/test/test_helper.rb
128
+ - test/sample/test/unit/hark_test.rb
129
+ - test/sample/test/unit/helpers/harks_helper_test.rb
130
+ - test/test_gemify.sh
131
+ - test/test_harker.rb
132
+ has_rdoc: true
133
+ homepage: http://github.com/technomancy/harker
134
+ licenses: []
135
+
136
+ post_install_message:
137
+ rdoc_options:
138
+ - --main
139
+ - README.rdoc
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: "0"
147
+ version:
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: "0"
153
+ version:
154
+ requirements: []
155
+
156
+ rubyforge_project: seattlerb
157
+ rubygems_version: 1.3.1
158
+ signing_key:
159
+ specification_version: 3
160
+ summary: "Harker: Rubygems-based deployment for Rails apps."
161
+ test_files:
162
+ - test/sample/test/test_helper.rb
163
+ - test/test_harker.rb