spontaneous 0.2.0.alpha5 → 0.2.0.alpha6
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 +0 -3
- data/Rakefile +6 -0
- data/lib/spontaneous/schema.rb +15 -3
- data/lib/spontaneous/version.rb +1 -1
- data/spontaneous.gemspec +5 -2
- data/test/integration/test_installation.rb +31 -0
- data/test/test_integration_helper.rb +9 -0
- data/test/unit/test_schema.rb +34 -16
- metadata +21 -2
data/Gemfile
CHANGED
@@ -10,8 +10,5 @@ group :development do
|
|
10
10
|
gem 'shoulda', '~> 2.11.3', :git => 'https://github.com/dasch/shoulda.git', :branch => 'minitest'
|
11
11
|
gem 'selenium-client', '~> 1.2.18', :platforms => [:mri_18]
|
12
12
|
# gem 'Selenium', '~> 1.1.14'
|
13
|
-
gem 'harmony', '~> 0.5', :platforms => [:mri_18]
|
14
|
-
gem 'ruby-debug', :platforms => [:mri_18]
|
15
|
-
gem 'locat', :path => '/Users/garry/Dropbox/Development/spontaneous3/locat'
|
16
13
|
end
|
17
14
|
|
data/Rakefile
CHANGED
@@ -121,6 +121,12 @@ namespace :test do
|
|
121
121
|
test.pattern = 'test/javascript/**/test_*.rb'
|
122
122
|
test.verbose = true
|
123
123
|
end
|
124
|
+
Rake::TestTask.new(:integration) do |test|
|
125
|
+
test.libs << 'test'
|
126
|
+
test.ruby_opts << '-rubygems'
|
127
|
+
test.pattern = 'test/integration/**/test_*.rb'
|
128
|
+
test.verbose = true
|
129
|
+
end
|
124
130
|
end
|
125
131
|
|
126
132
|
|
data/lib/spontaneous/schema.rb
CHANGED
@@ -33,18 +33,25 @@ module Spontaneous
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def load_map
|
36
|
-
if exists?
|
37
|
-
map = YAML.load_file(@path)
|
36
|
+
if exists? && (map = parse_map)
|
38
37
|
map.each do | uid, reference |
|
39
38
|
uids.load(uid, reference)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
43
|
+
def parse_map
|
44
|
+
YAML.load_file(@path)
|
45
|
+
end
|
46
|
+
|
44
47
|
def exists?
|
45
48
|
::File.exists?(@path)
|
46
49
|
end
|
47
50
|
|
51
|
+
def valid?
|
52
|
+
exists? && parse_map.is_a?(Hash)
|
53
|
+
end
|
54
|
+
|
48
55
|
# def invert_map
|
49
56
|
# @inverse_map = generate_inverse
|
50
57
|
# end
|
@@ -86,6 +93,10 @@ module Spontaneous
|
|
86
93
|
def exists?
|
87
94
|
true
|
88
95
|
end
|
96
|
+
|
97
|
+
def valid?
|
98
|
+
true
|
99
|
+
end
|
89
100
|
end
|
90
101
|
|
91
102
|
class Schema
|
@@ -112,7 +123,8 @@ module Spontaneous
|
|
112
123
|
changes = e.modification
|
113
124
|
# if the map file is missing, then this is a first run and we can just
|
114
125
|
# create the thing by populating it with the current schema
|
115
|
-
|
126
|
+
|
127
|
+
if !map.valid?
|
116
128
|
logger.warn("Generating new schema")
|
117
129
|
generate_new_schema
|
118
130
|
else
|
data/lib/spontaneous/version.rb
CHANGED
data/spontaneous.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
## If your rubyforge_project name is different, then edit it and comment out
|
15
15
|
## the sub! line in the Rakefile
|
16
16
|
s.name = 'spontaneous'
|
17
|
-
s.version = '0.2.0.
|
18
|
-
s.date = '2012-10-
|
17
|
+
s.version = '0.2.0.alpha6'
|
18
|
+
s.date = '2012-10-17'
|
19
19
|
s.rubyforge_project = 'spontaneous'
|
20
20
|
|
21
21
|
## Make sure your summary is short. The description may be as long
|
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
## List your runtime dependencies here. Runtime dependencies are those
|
50
50
|
## that are needed for an end user to actually USE your code.
|
51
51
|
s.add_dependency('activesupport', ["~> 3.2.0"])
|
52
|
+
s.add_dependency('i18n', ["~> 0.6.0"]) # this is an undeclared activesupport dependency
|
52
53
|
s.add_dependency('base58', ["~> 0.1.0"])
|
53
54
|
s.add_dependency('bundler', ["> 1.0.15"])
|
54
55
|
s.add_dependency('coffee-script', ["~> 2.2.0"])
|
@@ -737,12 +738,14 @@ Gem::Specification.new do |s|
|
|
737
738
|
test/functional/test_back.rb
|
738
739
|
test/functional/test_front.rb
|
739
740
|
test/functional/test_user_manager.rb
|
741
|
+
test/integration/test_installation.rb
|
740
742
|
test/javascript/env.js
|
741
743
|
test/javascript/test_dom.rb
|
742
744
|
test/javascript/test_markdown.rb
|
743
745
|
test/support/custom_matchers.rb
|
744
746
|
test/support/timing.rb
|
745
747
|
test/test_helper.rb
|
748
|
+
test/test_integration_helper.rb
|
746
749
|
test/test_javascript.rb
|
747
750
|
test/ui/test_page_editing.rb
|
748
751
|
test/ui_helper.rb
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.expand_path('../../test_integration_helper', __FILE__)
|
4
|
+
|
5
|
+
describe "Installation" do
|
6
|
+
def system(command)
|
7
|
+
puts "SYSTEM #{command.inspect}"
|
8
|
+
Kernel.system command
|
9
|
+
end
|
10
|
+
|
11
|
+
before do
|
12
|
+
@root = Dir.mktmpdir
|
13
|
+
Dir.chdir(@root)
|
14
|
+
puts "root.before"
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when starting with a base system" do
|
18
|
+
before do
|
19
|
+
puts "describe.before"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "will allow the installation of the spontaneous gem" do
|
23
|
+
assert_raises "Precondition failed, spontaneous gem is already installed", Gem::LoadError do
|
24
|
+
Gem::Specification.find_by_name("spontaneous")
|
25
|
+
end
|
26
|
+
system "gem install spontaneous --prerelease --no-rdoc --no-ri"
|
27
|
+
spec = Gem::Specification.find_by_name("spontaneous")
|
28
|
+
asssert_instance_of Gem::Specification, spec, "spontaneous gem should have been installed"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/test/unit/test_schema.rb
CHANGED
@@ -611,9 +611,26 @@ class SchemaTest < MiniTest::Spec
|
|
611
611
|
|
612
612
|
context "Map writing" do
|
613
613
|
context "Non-existant maps" do
|
614
|
+
def expected_schema
|
615
|
+
classes = [ ::A, ::B]
|
616
|
+
expected = Hash[ classes.map { |klass| [ klass.schema_id.to_s, klass.schema_name ] } ]
|
617
|
+
expected.merge!({
|
618
|
+
A.field_prototypes[:title].schema_id.to_s => A.field_prototypes[:title].schema_name,
|
619
|
+
A.field_prototypes[:introduction].schema_id.to_s => A.field_prototypes[:introduction].schema_name,
|
620
|
+
A.layout_prototypes[:sparse].schema_id.to_s => A.layout_prototypes[:sparse].schema_name,
|
621
|
+
A.boxes[:posts].schema_id.to_s => A.boxes[:posts].schema_name,
|
622
|
+
A.boxes[:posts].field_prototypes[:description].schema_id.to_s => A.boxes[:posts].field_prototypes[:description].schema_name,
|
623
|
+
B.field_prototypes[:location].schema_id.to_s => B.field_prototypes[:location].schema_name,
|
624
|
+
B.style_prototypes[:daring].schema_id.to_s => B.style_prototypes[:daring].schema_name,
|
625
|
+
})
|
626
|
+
expected
|
627
|
+
end
|
628
|
+
|
614
629
|
setup do
|
615
630
|
@map_file = File.expand_path('../../../tmp/schema.yml', __FILE__)
|
616
|
-
|
631
|
+
|
632
|
+
::FileUtils.rm_f(@map_file) if ::File.exists?(@map_file)
|
633
|
+
|
617
634
|
@site.schema.schema_map_file = @map_file
|
618
635
|
class ::A < Spontaneous::Page
|
619
636
|
field :title
|
@@ -628,29 +645,30 @@ class SchemaTest < MiniTest::Spec
|
|
628
645
|
style :daring
|
629
646
|
end
|
630
647
|
end
|
648
|
+
|
631
649
|
teardown do
|
632
650
|
Object.send(:remove_const, :A) rescue nil
|
633
651
|
Object.send(:remove_const, :B) rescue nil
|
634
652
|
FileUtils.rm(@map_file) if ::File.exists?(@map_file)
|
635
653
|
end
|
654
|
+
|
636
655
|
should "get created with verification" do
|
637
656
|
S.schema.validate!
|
638
|
-
classes = [ ::A, ::B]
|
639
|
-
@inheritance_map = nil
|
640
|
-
# would like to do all of this using mocks, but don't know how to do that
|
641
|
-
# without fecking up the whole schema id creation process
|
642
|
-
expected = Hash[ classes.map { |klass| [ klass.schema_id.to_s, klass.schema_name ] } ]
|
643
|
-
expected.merge!({
|
644
|
-
A.field_prototypes[:title].schema_id.to_s => A.field_prototypes[:title].schema_name,
|
645
|
-
A.field_prototypes[:introduction].schema_id.to_s => A.field_prototypes[:introduction].schema_name,
|
646
|
-
A.layout_prototypes[:sparse].schema_id.to_s => A.layout_prototypes[:sparse].schema_name,
|
647
|
-
A.boxes[:posts].schema_id.to_s => A.boxes[:posts].schema_name,
|
648
|
-
A.boxes[:posts].field_prototypes[:description].schema_id.to_s => A.boxes[:posts].field_prototypes[:description].schema_name,
|
649
|
-
B.field_prototypes[:location].schema_id.to_s => B.field_prototypes[:location].schema_name,
|
650
|
-
B.style_prototypes[:daring].schema_id.to_s => B.style_prototypes[:daring].schema_name,
|
651
|
-
})
|
652
657
|
File.exists?(@map_file).should be_true
|
653
|
-
YAML.load_file(@map_file).should ==
|
658
|
+
YAML.load_file(@map_file).should == expected_schema
|
659
|
+
end
|
660
|
+
|
661
|
+
# Having the generator create an empty config/schema.yml is a useful way of
|
662
|
+
# identifying a spontaneous site (for use by bin/spot)
|
663
|
+
should "get overwritten if invalid or empty" do
|
664
|
+
File.open(@map_file, "w") do |f|
|
665
|
+
f.write("# schema")
|
666
|
+
end
|
667
|
+
File.exists?(@map_file).should be_true
|
668
|
+
S.schema.map.valid?.should be_false
|
669
|
+
S.schema.validate!
|
670
|
+
S.schema.map.valid?.should be_true
|
671
|
+
YAML.load_file(@map_file).should == expected_schema
|
654
672
|
end
|
655
673
|
end
|
656
674
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spontaneous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.alpha6
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: i18n
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.6.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.6.0
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: base58
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1315,12 +1331,14 @@ files:
|
|
1315
1331
|
- test/functional/test_back.rb
|
1316
1332
|
- test/functional/test_front.rb
|
1317
1333
|
- test/functional/test_user_manager.rb
|
1334
|
+
- test/integration/test_installation.rb
|
1318
1335
|
- test/javascript/env.js
|
1319
1336
|
- test/javascript/test_dom.rb
|
1320
1337
|
- test/javascript/test_markdown.rb
|
1321
1338
|
- test/support/custom_matchers.rb
|
1322
1339
|
- test/support/timing.rb
|
1323
1340
|
- test/test_helper.rb
|
1341
|
+
- test/test_integration_helper.rb
|
1324
1342
|
- test/test_javascript.rb
|
1325
1343
|
- test/ui/test_page_editing.rb
|
1326
1344
|
- test/ui_helper.rb
|
@@ -1392,4 +1410,5 @@ specification_version: 2
|
|
1392
1410
|
summary: Spontaneous is a next-generation Ruby CMS
|
1393
1411
|
test_files:
|
1394
1412
|
- test/test_helper.rb
|
1413
|
+
- test/test_integration_helper.rb
|
1395
1414
|
- test/test_javascript.rb
|