osheet 0.4.0 → 0.5.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/Gemfile.lock +24 -4
- data/examples/basic_with_templates.rb +1 -1
- data/examples/formats.rb +1 -1
- data/examples/styles.rb +1 -1
- data/examples/trivial.rb +1 -1
- data/lib/osheet/associations.rb +5 -9
- data/lib/osheet/cell.rb +24 -20
- data/lib/osheet/column.rb +19 -15
- data/lib/osheet/instance.rb +32 -0
- data/lib/osheet/railtie.rb +9 -0
- data/lib/osheet/row.rb +19 -15
- data/lib/osheet/style.rb +13 -8
- data/lib/osheet/styled_element.rb +1 -1
- data/lib/osheet/template.rb +13 -4
- data/lib/osheet/template_handler/rails.rb +44 -0
- data/lib/osheet/template_handler/tilt.rb +42 -0
- data/lib/osheet/template_handler.rb +2 -0
- data/lib/osheet/version.rb +1 -1
- data/lib/osheet/workbook.rb +22 -11
- data/lib/osheet/workbook_element.rb +10 -14
- data/lib/osheet/worksheet.rb +10 -6
- data/lib/osheet/worksheet_element.rb +3 -4
- data/lib/osheet/xmlss_writer/base.rb +5 -5
- data/lib/osheet.rb +16 -1
- data/osheet.gemspec +6 -1
- data/test/app_helper.rb +66 -0
- data/test/cell_test.rb +30 -14
- data/test/column_test.rb +24 -8
- data/test/helper.rb +4 -3
- data/test/mixin_test.rb +1 -2
- data/test/mixins.rb +1 -1
- data/test/osheet_test.rb +4 -2
- data/test/rails/three/.gitignore +4 -0
- data/test/rails/three/Gemfile +5 -0
- data/test/rails/three/Gemfile.lock +88 -0
- data/test/rails/three/app/controllers/application_controller.rb +3 -0
- data/test/rails/three/app/controllers/things_controller.rb +10 -0
- data/test/rails/three/app/helpers/application_helper.rb +2 -0
- data/test/rails/three/app/views/layouts/application.html.erb +14 -0
- data/test/rails/three/app/views/things/index.xls.osheet +15 -0
- data/test/rails/three/config/application.rb +42 -0
- data/test/rails/three/config/boot.rb +13 -0
- data/test/rails/three/config/database.yml +22 -0
- data/test/rails/three/config/environment.rb +5 -0
- data/test/rails/three/config/environments/development.rb +26 -0
- data/test/rails/three/config/environments/production.rb +49 -0
- data/test/rails/three/config/environments/test.rb +35 -0
- data/test/rails/three/config/initializers/app.rb +0 -0
- data/test/rails/three/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails/three/config/initializers/inflections.rb +10 -0
- data/test/rails/three/config/initializers/mime_types.rb +5 -0
- data/test/rails/three/config/initializers/secret_token.rb +7 -0
- data/test/rails/three/config/initializers/session_store.rb +8 -0
- data/test/rails/three/config/locales/en.yml +5 -0
- data/test/rails/three/config/routes.rb +3 -0
- data/test/rails/three/config.ru +4 -0
- data/test/rails/three/db/seeds.rb +7 -0
- data/test/rails/three/doc/README_FOR_APP +2 -0
- data/test/rails/three/lib/tasks/.gitkeep +0 -0
- data/test/rails/three/script/rails +6 -0
- data/test/rails/two/.bundle/config +2 -0
- data/test/rails/two/Booting +0 -0
- data/test/rails/two/Gemfile +5 -0
- data/test/rails/two/Gemfile.lock +45 -0
- data/test/rails/two/Rails +0 -0
- data/test/rails/two/app/controllers/application_controller.rb +20 -0
- data/test/rails/two/app/controllers/things_controller.rb +10 -0
- data/test/rails/two/app/helpers/application_helper.rb +3 -0
- data/test/rails/two/app/views/things/index.xls.osheet +15 -0
- data/test/rails/two/config/boot.rb +128 -0
- data/test/rails/two/config/database.yml +22 -0
- data/test/rails/two/config/environment.rb +41 -0
- data/test/rails/two/config/environments/development.rb +17 -0
- data/test/rails/two/config/environments/production.rb +28 -0
- data/test/rails/two/config/environments/test.rb +28 -0
- data/test/rails/two/config/initializers/app.rb +2 -0
- data/test/rails/two/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails/two/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails/two/config/initializers/inflections.rb +10 -0
- data/test/rails/two/config/initializers/mime_types.rb +5 -0
- data/test/rails/two/config/initializers/new_rails_defaults.rb +21 -0
- data/test/rails/two/config/initializers/session_store.rb +15 -0
- data/test/rails/two/config/locales/en.yml +5 -0
- data/test/rails/two/config/routes.rb +3 -0
- data/test/rails/two/db/development.sqlite3 +0 -0
- data/test/rails/two/db/seeds.rb +7 -0
- data/test/rails/two/script/about +4 -0
- data/test/rails/two/script/console +3 -0
- data/test/rails/two/script/dbconsole +3 -0
- data/test/rails/two/script/destroy +3 -0
- data/test/rails/two/script/generate +3 -0
- data/test/rails/two/script/performance/benchmarker +3 -0
- data/test/rails/two/script/performance/profiler +3 -0
- data/test/rails/two/script/plugin +3 -0
- data/test/rails/two/script/runner +3 -0
- data/test/rails/two/script/server +3 -0
- data/test/rails/two/tmp/pids/server.pid +1 -0
- data/test/rails_test.rb +38 -0
- data/test/row_test.rb +24 -8
- data/test/sinatra/app.rb +16 -0
- data/test/sinatra/views/index.osheet +13 -0
- data/test/sinatra_test.rb +19 -0
- data/test/style_test.rb +19 -3
- data/test/template_test.rb +19 -0
- data/test/workbook_test.rb +18 -3
- data/test/worksheet_test.rb +18 -2
- metadata +232 -11
|
@@ -30,21 +30,21 @@ module Osheet::XmlssWriter
|
|
|
30
30
|
# # puts "names: #{names.inspect}"
|
|
31
31
|
# # puts "name value: #{name_value}"
|
|
32
32
|
# # name_value
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
@ostyles = oworkbook.styles
|
|
35
35
|
@workbook = ::Xmlss::Workbook.new({
|
|
36
36
|
:worksheets => worksheets(oworkbook.worksheets)
|
|
37
37
|
})
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def to_data
|
|
40
|
+
def to_data(*options)
|
|
41
41
|
@workbook.styles = @styles
|
|
42
|
-
@workbook.to_xml
|
|
42
|
+
@workbook.to_xml(*options)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def to_file(path)
|
|
45
|
+
def to_file(path, *options)
|
|
46
46
|
FileUtils.mkdir_p(File.dirname(path))
|
|
47
|
-
File.open(path, 'w') {|f| f.write self.to_data}
|
|
47
|
+
File.open(path, 'w') {|f| f.write self.to_data(*options)}
|
|
48
48
|
File.exists?(path) ? path : false
|
|
49
49
|
end
|
|
50
50
|
|
data/lib/osheet.rb
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
module Osheet
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
MIME_TYPE = "application/vnd.ms-excel"
|
|
4
4
|
|
|
5
|
+
class << self
|
|
6
|
+
# used to register an appropriate template handler
|
|
7
|
+
# and register a mime type if necessary
|
|
8
|
+
def register
|
|
9
|
+
::Mime::Type.register MIME_TYPE, :xls if defined? ::Mime::Type
|
|
10
|
+
require 'osheet/template_handler'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
5
14
|
end
|
|
6
15
|
|
|
7
16
|
require 'osheet/associations'
|
|
@@ -9,5 +18,11 @@ require 'osheet/workbook_element'
|
|
|
9
18
|
require 'osheet/worksheet_element'
|
|
10
19
|
require 'osheet/styled_element'
|
|
11
20
|
require 'osheet/meta_element'
|
|
21
|
+
require 'osheet/instance'
|
|
22
|
+
require 'osheet/mixin'
|
|
23
|
+
|
|
24
|
+
if defined? Rails::Railtie
|
|
25
|
+
require 'osheet/railtie'
|
|
26
|
+
end
|
|
12
27
|
|
|
13
28
|
require 'osheet/workbook'
|
data/osheet.gemspec
CHANGED
|
@@ -19,8 +19,13 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
|
|
20
20
|
s.add_development_dependency("bundler", ["~> 1.0"])
|
|
21
21
|
s.add_development_dependency("test-belt", ["= 0.2.1"]) # locked to a specific version for test stability
|
|
22
|
+
s.add_development_dependency("sinatra", [">= 0.9.4"])
|
|
23
|
+
s.add_development_dependency("rack-test", [">= 0.5.3"])
|
|
24
|
+
s.add_development_dependency("webrat", [">= 0.6.0"])
|
|
25
|
+
s.add_development_dependency("open4")
|
|
26
|
+
s.add_development_dependency("rest-client")
|
|
22
27
|
|
|
23
28
|
s.add_dependency("enumeration", ["~>1.1.0"])
|
|
24
|
-
s.add_dependency("xmlss", "~>0.
|
|
29
|
+
s.add_dependency("xmlss", "~>0.2.0")
|
|
25
30
|
|
|
26
31
|
end
|
data/test/app_helper.rb
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'rack/test'
|
|
2
|
+
require 'webrat'
|
|
3
|
+
|
|
4
|
+
class Test::Unit::TestCase
|
|
5
|
+
include Rack::Test::Methods
|
|
6
|
+
include Webrat::Methods
|
|
7
|
+
include Webrat::Matchers
|
|
8
|
+
|
|
9
|
+
Webrat.configure do |config|
|
|
10
|
+
config.mode = :rack
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def assert_osheet_response(app, response)
|
|
14
|
+
assert_equal 200, response.status, "status is not '#{Rack::Utils::HTTP_STATUS_CODES[200]}'"
|
|
15
|
+
assert response.headers["Content-Type"].include?(Osheet::MIME_TYPE), "content type is not '#{Osheet::MIME_TYPE}'"
|
|
16
|
+
assert_osheet_data(app, response.body)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def assert_osheet_data(app, body)
|
|
20
|
+
correct_body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workbook xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"><Styles/><Worksheet ss:Name=\"from #{app}\"><Table><Row><Cell><Data ss:Type=\"Number\">1</Data></Cell><Cell><Data ss:Type=\"Number\">2</Data></Cell></Row></Table></Worksheet></Workbook>"
|
|
21
|
+
assert_equal correct_body, body.strip, "incorrect osheet data"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module Osheet
|
|
27
|
+
module RailsTestHelpers
|
|
28
|
+
|
|
29
|
+
module StartStop
|
|
30
|
+
def test_rails_app(version, action, host, port)
|
|
31
|
+
case action
|
|
32
|
+
when :start
|
|
33
|
+
puts
|
|
34
|
+
# puts "starting Rails #{version} app on port #{port}..."
|
|
35
|
+
@test_app_pid = Open4.popen4(case version
|
|
36
|
+
when :two
|
|
37
|
+
"ruby test/rails/two/script/server -p #{port}"
|
|
38
|
+
when :three
|
|
39
|
+
pwd = `pwd`.strip
|
|
40
|
+
cmd = "test/rails/three/script/rails server --pid=#{pwd}/test/rails/three/tmp/pids/test_server.pid --config=#{pwd}/test/rails/three/config.ru -p 3003"
|
|
41
|
+
cmd
|
|
42
|
+
end)[0]
|
|
43
|
+
puts "\nwaiting for rails #{version} app to start (#{@test_app_pid})"
|
|
44
|
+
sleep 3
|
|
45
|
+
while !(g = Open4.popen4("</dev/tcp/#{host}/#{port}")[3].gets).nil?
|
|
46
|
+
puts "waiting for rails #{version} app to start (#{@test_app_pid}): #{g.inspect}"
|
|
47
|
+
sleep 0.1
|
|
48
|
+
end
|
|
49
|
+
when :stop
|
|
50
|
+
puts
|
|
51
|
+
# puts "\nstopping Rails #{version} app on port #{port}..."
|
|
52
|
+
Process.kill(9, @test_app_pid)
|
|
53
|
+
while Open4.popen4("</dev/tcp/#{host}/#{port}")[3].gets.nil?
|
|
54
|
+
puts "\nwaiting for rails #{version} app to stop (#{@test_app_pid})"
|
|
55
|
+
sleep 0.5
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.included(receiver)
|
|
62
|
+
receiver.send :extend, StartStop
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
end
|
data/test/cell_test.rb
CHANGED
|
@@ -14,11 +14,11 @@ module Osheet
|
|
|
14
14
|
should_have_instance_methods :data, :format, :colspan, :rowspan, :href
|
|
15
15
|
|
|
16
16
|
should "set it's defaults" do
|
|
17
|
-
assert_equal nil, subject.send(:
|
|
18
|
-
assert_kind_of Format::General, subject.send(:
|
|
19
|
-
assert_equal 1, subject.send(:
|
|
20
|
-
assert_equal 1, subject.send(:
|
|
21
|
-
assert_equal nil, subject.send(:
|
|
17
|
+
assert_equal nil, subject.send(:get_ivar, "data")
|
|
18
|
+
assert_kind_of Format::General, subject.send(:get_ivar, "format")
|
|
19
|
+
assert_equal 1, subject.send(:get_ivar, "colspan")
|
|
20
|
+
assert_equal 1, subject.send(:get_ivar, "rowspan")
|
|
21
|
+
assert_equal nil, subject.send(:get_ivar, "href")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context "that has attributes" do
|
|
@@ -34,11 +34,11 @@ module Osheet
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
should "should set them correctly" do
|
|
37
|
-
assert_equal "Poo", subject.send(:
|
|
38
|
-
assert_kind_of Format::Number, subject.send(:
|
|
39
|
-
assert_equal 4, subject.send(:
|
|
40
|
-
assert_equal 2, subject.send(:
|
|
41
|
-
assert_equal "http://www.google.com", subject.send(:
|
|
37
|
+
assert_equal "Poo", subject.send(:get_ivar, "data")
|
|
38
|
+
assert_kind_of Format::Number, subject.send(:get_ivar, "format")
|
|
39
|
+
assert_equal 4, subject.send(:get_ivar, "colspan")
|
|
40
|
+
assert_equal 2, subject.send(:get_ivar, "rowspan")
|
|
41
|
+
assert_equal "http://www.google.com", subject.send(:get_ivar, "href")
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
should "know it's attribute(s)" do
|
|
@@ -57,27 +57,43 @@ module Osheet
|
|
|
57
57
|
should "type cast data strings/symbols" do
|
|
58
58
|
['a string', :symbol].each do |thing|
|
|
59
59
|
cell = Cell.new{data thing}
|
|
60
|
-
assert_kind_of ::String, cell.send(:
|
|
60
|
+
assert_kind_of ::String, cell.send(:get_ivar, "data")
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
should "type cast data dates" do
|
|
64
64
|
cell = Cell.new{data Date.today}
|
|
65
|
-
assert_kind_of ::Date, cell.send(:
|
|
65
|
+
assert_kind_of ::Date, cell.send(:get_ivar, "data")
|
|
66
66
|
end
|
|
67
67
|
should "type cast data numerics" do
|
|
68
68
|
[1, 1.0].each do |thing|
|
|
69
69
|
cell = Cell.new{data thing}
|
|
70
|
-
assert_kind_of ::Numeric, cell.send(:
|
|
70
|
+
assert_kind_of ::Numeric, cell.send(:get_ivar, "data")
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
should "type cast all other data to string" do
|
|
74
74
|
[Osheet, [:a, 'Aye'], {:a => 'Aye'}].each do |thing|
|
|
75
75
|
cell = Cell.new{data thing}
|
|
76
|
-
assert_kind_of ::String, cell.send(:
|
|
76
|
+
assert_kind_of ::String, cell.send(:get_ivar, "data")
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
end
|
|
83
|
+
|
|
84
|
+
class CellBindingTest < Test::Unit::TestCase
|
|
85
|
+
context "a cell defined w/ a block" do
|
|
86
|
+
should "access instance vars from that block's binding" do
|
|
87
|
+
@test = 'test'
|
|
88
|
+
@cell = Cell.new { data @test}
|
|
89
|
+
|
|
90
|
+
assert !@cell.send(:instance_variable_get, "@test").nil?
|
|
91
|
+
assert_equal @test, @cell.send(:instance_variable_get, "@test")
|
|
92
|
+
assert_equal @test.object_id, @cell.send(:instance_variable_get, "@test").object_id
|
|
93
|
+
assert_equal @test, @cell.attributes[:data]
|
|
94
|
+
assert_equal @test.object_id, @cell.attributes[:data].object_id
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
83
99
|
end
|
data/test/column_test.rb
CHANGED
|
@@ -17,10 +17,10 @@ module Osheet
|
|
|
17
17
|
should_have_instance_method :meta
|
|
18
18
|
|
|
19
19
|
should "set it's defaults" do
|
|
20
|
-
assert_equal nil, subject.send(:
|
|
21
|
-
assert_equal false, subject.send(:
|
|
20
|
+
assert_equal nil, subject.send(:get_ivar, "width")
|
|
21
|
+
assert_equal false, subject.send(:get_ivar, "autofit")
|
|
22
22
|
assert !subject.autofit?
|
|
23
|
-
assert_equal false, subject.send(:
|
|
23
|
+
assert_equal false, subject.send(:get_ivar, "hidden")
|
|
24
24
|
assert !subject.hidden?
|
|
25
25
|
|
|
26
26
|
assert_equal nil, subject.meta
|
|
@@ -40,10 +40,10 @@ module Osheet
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
should "should set them correctly" do
|
|
43
|
-
assert_equal 100, subject.send(:
|
|
44
|
-
assert_equal true, subject.send(:
|
|
43
|
+
assert_equal 100, subject.send(:get_ivar, "width")
|
|
44
|
+
assert_equal true, subject.send(:get_ivar, "autofit")
|
|
45
45
|
assert subject.autofit?
|
|
46
|
-
assert_equal true, subject.send(:
|
|
46
|
+
assert_equal true, subject.send(:get_ivar, "hidden")
|
|
47
47
|
assert subject.hidden?
|
|
48
48
|
assert_equal({}, subject.meta)
|
|
49
49
|
end
|
|
@@ -71,11 +71,27 @@ module Osheet
|
|
|
71
71
|
|
|
72
72
|
should "cast autofit and hidden to bool" do
|
|
73
73
|
col = Column.new { autofit :true; hidden 'false'}
|
|
74
|
-
assert_kind_of ::TrueClass, col.send(:
|
|
75
|
-
assert_kind_of ::TrueClass, col.send(:
|
|
74
|
+
assert_kind_of ::TrueClass, col.send(:get_ivar, "autofit")
|
|
75
|
+
assert_kind_of ::TrueClass, col.send(:get_ivar, "hidden")
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
end
|
|
81
|
+
|
|
82
|
+
class ColumnBindingTest < Test::Unit::TestCase
|
|
83
|
+
context "a column defined w/ a block" do
|
|
84
|
+
should "access instance vars from that block's binding" do
|
|
85
|
+
@test = 50
|
|
86
|
+
@col = Column.new { width @test }
|
|
87
|
+
|
|
88
|
+
assert !@col.send(:instance_variable_get, "@test").nil?
|
|
89
|
+
assert_equal @test, @col.send(:instance_variable_get, "@test")
|
|
90
|
+
assert_equal @test.object_id, @col.send(:instance_variable_get, "@test").object_id
|
|
91
|
+
assert_equal @test, @col.attributes[:width]
|
|
92
|
+
assert_equal @test.object_id, @col.attributes[:width].object_id
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
81
97
|
end
|
data/test/helper.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'test/env'
|
|
|
5
5
|
class Test::Unit::TestCase
|
|
6
6
|
class << self
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
def should_be_a_workbook_element(klass)
|
|
9
10
|
should_have_instance_methods :workbook, :styles, :templates
|
|
10
11
|
context "given a workbook with templates and styles" do
|
|
@@ -55,13 +56,13 @@ class Test::Unit::TestCase
|
|
|
55
56
|
context "by default" do
|
|
56
57
|
before { @default = klass.new }
|
|
57
58
|
should "default an empty style class" do
|
|
58
|
-
assert_equal nil, @default.send(:
|
|
59
|
+
assert_equal nil, @default.send(:get_ivar, "style_class")
|
|
59
60
|
end
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
should "default an empty style class" do
|
|
63
64
|
styled = klass.new{ style_class "awesome thing" }
|
|
64
|
-
assert_equal "awesome thing", styled.send(:
|
|
65
|
+
assert_equal "awesome thing", styled.send(:get_ivar, "style_class")
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
should "verify the style class string" do
|
|
@@ -88,7 +89,7 @@ class Test::Unit::TestCase
|
|
|
88
89
|
self.send(singular) {}
|
|
89
90
|
end
|
|
90
91
|
|
|
91
|
-
items = thing.send(:
|
|
92
|
+
items = thing.send(:get_ivar, collection)
|
|
92
93
|
assert_equal items, thing.send(collection)
|
|
93
94
|
assert !items.empty?
|
|
94
95
|
assert_equal 1, items.size
|
data/test/mixin_test.rb
CHANGED
data/test/mixins.rb
CHANGED
data/test/osheet_test.rb
CHANGED
|
@@ -3,10 +3,12 @@ require "test/helper"
|
|
|
3
3
|
class OsheetTest < Test::Unit::TestCase
|
|
4
4
|
|
|
5
5
|
context "Osheet" do
|
|
6
|
+
subject {::Osheet}
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
should_have_instance_method :register
|
|
9
|
+
|
|
10
|
+
should "use provide a default mime type" do
|
|
8
11
|
assert_equal "application/vnd.ms-excel", Osheet::MIME_TYPE
|
|
9
|
-
assert_equal "Excel", Osheet::SPREADSHEET_TYPE
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../../..
|
|
3
|
+
specs:
|
|
4
|
+
osheet (0.4.0)
|
|
5
|
+
enumeration (~> 1.1.0)
|
|
6
|
+
xmlss (~> 0.2.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: http://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
abstract (1.0.0)
|
|
12
|
+
actionmailer (3.0.3)
|
|
13
|
+
actionpack (= 3.0.3)
|
|
14
|
+
mail (~> 2.2.9)
|
|
15
|
+
actionpack (3.0.3)
|
|
16
|
+
activemodel (= 3.0.3)
|
|
17
|
+
activesupport (= 3.0.3)
|
|
18
|
+
builder (~> 2.1.2)
|
|
19
|
+
erubis (~> 2.6.6)
|
|
20
|
+
i18n (~> 0.4)
|
|
21
|
+
rack (~> 1.2.1)
|
|
22
|
+
rack-mount (~> 0.6.13)
|
|
23
|
+
rack-test (~> 0.5.6)
|
|
24
|
+
tzinfo (~> 0.3.23)
|
|
25
|
+
activemodel (3.0.3)
|
|
26
|
+
activesupport (= 3.0.3)
|
|
27
|
+
builder (~> 2.1.2)
|
|
28
|
+
i18n (~> 0.4)
|
|
29
|
+
activerecord (3.0.3)
|
|
30
|
+
activemodel (= 3.0.3)
|
|
31
|
+
activesupport (= 3.0.3)
|
|
32
|
+
arel (~> 2.0.2)
|
|
33
|
+
tzinfo (~> 0.3.23)
|
|
34
|
+
activeresource (3.0.3)
|
|
35
|
+
activemodel (= 3.0.3)
|
|
36
|
+
activesupport (= 3.0.3)
|
|
37
|
+
activesupport (3.0.3)
|
|
38
|
+
arel (2.0.7)
|
|
39
|
+
builder (2.1.2)
|
|
40
|
+
enumeration (1.1.0)
|
|
41
|
+
erubis (2.6.6)
|
|
42
|
+
abstract (>= 1.0.0)
|
|
43
|
+
i18n (0.5.0)
|
|
44
|
+
mail (2.2.15)
|
|
45
|
+
activesupport (>= 2.3.6)
|
|
46
|
+
i18n (>= 0.4.0)
|
|
47
|
+
mime-types (~> 1.16)
|
|
48
|
+
treetop (~> 1.4.8)
|
|
49
|
+
mime-types (1.16)
|
|
50
|
+
nokogiri (1.4.4)
|
|
51
|
+
polyglot (0.3.1)
|
|
52
|
+
rack (1.2.2)
|
|
53
|
+
rack-mount (0.6.14)
|
|
54
|
+
rack (>= 1.0.0)
|
|
55
|
+
rack-test (0.5.7)
|
|
56
|
+
rack (>= 1.0)
|
|
57
|
+
rails (3.0.3)
|
|
58
|
+
actionmailer (= 3.0.3)
|
|
59
|
+
actionpack (= 3.0.3)
|
|
60
|
+
activerecord (= 3.0.3)
|
|
61
|
+
activeresource (= 3.0.3)
|
|
62
|
+
activesupport (= 3.0.3)
|
|
63
|
+
bundler (~> 1.0)
|
|
64
|
+
railties (= 3.0.3)
|
|
65
|
+
railties (3.0.3)
|
|
66
|
+
actionpack (= 3.0.3)
|
|
67
|
+
activesupport (= 3.0.3)
|
|
68
|
+
rake (>= 0.8.7)
|
|
69
|
+
thor (~> 0.14.4)
|
|
70
|
+
rake (0.8.7)
|
|
71
|
+
sqlite3 (1.3.3)
|
|
72
|
+
sqlite3-ruby (1.3.3)
|
|
73
|
+
sqlite3 (>= 1.3.3)
|
|
74
|
+
thor (0.14.6)
|
|
75
|
+
treetop (1.4.9)
|
|
76
|
+
polyglot (>= 0.3.1)
|
|
77
|
+
tzinfo (0.3.25)
|
|
78
|
+
xmlss (0.2.0)
|
|
79
|
+
enumeration (~> 1.1.0)
|
|
80
|
+
nokogiri (~> 1.4.0)
|
|
81
|
+
|
|
82
|
+
PLATFORMS
|
|
83
|
+
ruby
|
|
84
|
+
|
|
85
|
+
DEPENDENCIES
|
|
86
|
+
osheet!
|
|
87
|
+
rails (= 3.0.3)
|
|
88
|
+
sqlite3-ruby
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
|
6
|
+
# you've limited to :test, :development, or :production.
|
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
|
8
|
+
|
|
9
|
+
module Three
|
|
10
|
+
class Application < Rails::Application
|
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
12
|
+
# Application configuration should go into files in config/initializers
|
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
14
|
+
|
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
17
|
+
|
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
21
|
+
|
|
22
|
+
# Activate observers that should always be running.
|
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
24
|
+
|
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
28
|
+
|
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
31
|
+
# config.i18n.default_locale = :de
|
|
32
|
+
|
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
|
35
|
+
|
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
37
|
+
config.encoding = "utf-8"
|
|
38
|
+
|
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
|
+
config.filter_parameters += [:password]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
# Set up gems listed in the Gemfile.
|
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
|
5
|
+
begin
|
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
|
7
|
+
require 'bundler'
|
|
8
|
+
Bundler.setup
|
|
9
|
+
rescue Bundler::GemNotFound => e
|
|
10
|
+
STDERR.puts e.message
|
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
|
12
|
+
exit!
|
|
13
|
+
end if File.exist?(gemfile)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
|
3
|
+
development:
|
|
4
|
+
adapter: sqlite3
|
|
5
|
+
database: db/development.sqlite3
|
|
6
|
+
pool: 5
|
|
7
|
+
timeout: 5000
|
|
8
|
+
|
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
|
10
|
+
# re-generated from your development database when you run "rake".
|
|
11
|
+
# Do not set this db to the same as development or production.
|
|
12
|
+
test:
|
|
13
|
+
adapter: sqlite3
|
|
14
|
+
database: db/test.sqlite3
|
|
15
|
+
pool: 5
|
|
16
|
+
timeout: 5000
|
|
17
|
+
|
|
18
|
+
production:
|
|
19
|
+
adapter: sqlite3
|
|
20
|
+
database: db/production.sqlite3
|
|
21
|
+
pool: 5
|
|
22
|
+
timeout: 5000
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Three::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_view.debug_rjs = true
|
|
15
|
+
config.action_controller.perform_caching = false
|
|
16
|
+
|
|
17
|
+
# Don't care if the mailer can't send
|
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
|
19
|
+
|
|
20
|
+
# Print deprecation notices to the Rails logger
|
|
21
|
+
config.active_support.deprecation = :log
|
|
22
|
+
|
|
23
|
+
# Only use best-standards-support built into browsers
|
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Three::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
|
5
|
+
# Code is not reloaded between requests
|
|
6
|
+
config.cache_classes = true
|
|
7
|
+
|
|
8
|
+
# Full error reports are disabled and caching is turned on
|
|
9
|
+
config.consider_all_requests_local = false
|
|
10
|
+
config.action_controller.perform_caching = true
|
|
11
|
+
|
|
12
|
+
# Specifies the header that your server uses for sending files
|
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
|
14
|
+
|
|
15
|
+
# For nginx:
|
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
|
17
|
+
|
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
|
19
|
+
# just comment this out and Rails will serve the files
|
|
20
|
+
|
|
21
|
+
# See everything in the log (default is :info)
|
|
22
|
+
# config.log_level = :debug
|
|
23
|
+
|
|
24
|
+
# Use a different logger for distributed setups
|
|
25
|
+
# config.logger = SyslogLogger.new
|
|
26
|
+
|
|
27
|
+
# Use a different cache store in production
|
|
28
|
+
# config.cache_store = :mem_cache_store
|
|
29
|
+
|
|
30
|
+
# Disable Rails's static asset server
|
|
31
|
+
# In production, Apache or nginx will already do this
|
|
32
|
+
config.serve_static_assets = false
|
|
33
|
+
|
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
|
+
|
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
39
|
+
|
|
40
|
+
# Enable threaded mode
|
|
41
|
+
# config.threadsafe!
|
|
42
|
+
|
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
|
45
|
+
config.i18n.fallbacks = true
|
|
46
|
+
|
|
47
|
+
# Send deprecation notices to registered listeners
|
|
48
|
+
config.active_support.deprecation = :notify
|
|
49
|
+
end
|