jsus 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG +5 -0
- data/Gemfile +7 -4
- data/VERSION +1 -1
- data/bin/jsus +1 -5
- data/cucumber.yml +1 -1
- data/features/command-line/external_dependency_resolution.feature +4 -4
- data/features/command-line/generate_includes.feature +34 -0
- data/features/command-line/mooforge_compatibility_layer.feature +1 -1
- data/features/command-line/postproc.feature +12 -3
- data/features/command-line/structure_json.feature +5 -40
- data/features/data/ExternalDependencyWithExternalDependency/Leonardo/Source/Core.js +2 -2
- data/features/step_definitions/cli_steps.rb +15 -9
- data/features/support/env.rb +1 -1
- data/jsus.gemspec +25 -7
- data/lib/extensions/rgl.rb +2 -1
- data/lib/jsus/cli.rb +43 -27
- data/lib/jsus/container.rb +71 -51
- data/lib/jsus/middleware.rb +2 -3
- data/lib/jsus/package.rb +27 -129
- data/lib/jsus/packager.rb +10 -6
- data/lib/jsus/pool.rb +48 -20
- data/lib/jsus/source_file.rb +119 -198
- data/lib/jsus/tag.rb +72 -106
- data/lib/jsus/util.rb +14 -4
- data/lib/jsus/util/compressor.rb +1 -1
- data/lib/jsus/util/documenter.rb +1 -1
- data/lib/jsus/util/mixins.rb +7 -0
- data/lib/jsus/util/mixins/operates_on_sources.rb +29 -0
- data/lib/jsus/util/post_processor.rb +35 -0
- data/lib/jsus/util/post_processor/base.rb +32 -0
- data/lib/jsus/util/post_processor/moocompat12.rb +19 -0
- data/lib/jsus/util/post_processor/mooltie8.rb +19 -0
- data/lib/jsus/util/post_processor/semicolon.rb +18 -0
- data/lib/jsus/util/validator/base.rb +3 -23
- data/lib/jsus/util/watcher.rb +8 -6
- data/spec/data/Extensions/app/javascripts/Core/Source/Hash.js +13 -0
- data/spec/data/Extensions/app/javascripts/Core/Source/Mash.js +13 -0
- data/spec/data/Extensions/app/javascripts/Core/package.yml +3 -1
- data/spec/data/Extensions/app/javascripts/Orwik/Extensions/Mash.js +16 -0
- data/spec/data/Extensions/app/javascripts/Orwik/package.yml +2 -1
- data/spec/data/OutsideDependencies/app/javascripts/Orwik/package.yml +3 -3
- data/spec/data/SimpleSources/dependent_source_one.js +15 -0
- data/spec/data/SimpleSources/replacement_source_one.js +13 -0
- data/spec/data/SimpleSources/simple_source_one.js +13 -0
- data/spec/data/SimpleSources/simple_source_two.js +13 -0
- data/spec/data/extension_1.js +15 -0
- data/spec/data/extension_2.js +15 -0
- data/spec/data/replacement.js +15 -0
- data/spec/jsus/container_spec.rb +72 -14
- data/spec/jsus/package_spec.rb +10 -128
- data/spec/jsus/packager_spec.rb +11 -11
- data/spec/jsus/pool_spec.rb +13 -22
- data/spec/jsus/source_file_spec.rb +66 -215
- data/spec/jsus/tag_spec.rb +24 -69
- data/spec/jsus/util/documenter_spec.rb +1 -1
- data/spec/jsus/util/post_processor/moocompat12_spec.rb +23 -0
- data/spec/jsus/util/post_processor/mooltie8_spec.rb +23 -0
- data/spec/jsus/util/post_processor/semicolon_spec.rb +21 -0
- data/spec/jsus/util/post_processors/base_spec.rb +6 -0
- data/spec/jsus/util/tree_spec.rb +3 -3
- data/spec/jsus/util/validator/base_spec.rb +4 -2
- data/spec/jsus/util/watcher_spec.rb +12 -2
- data/spec/shared/mixins_segs.rb +38 -0
- data/spec/spec_helper.rb +6 -0
- metadata +28 -10
- data/features/data/tmp2/package.js +0 -35
- data/features/data/tmp2/scripts.json +0 -13
- data/features/data/tmp2/tree.json +0 -26
- data/lib/jsus/compiler.rb +0 -28
- data/spec/shared/class_stubs.rb +0 -31
@@ -3,36 +3,16 @@ module Jsus
|
|
3
3
|
# Base for any validator class.
|
4
4
|
module Validator
|
5
5
|
class Base
|
6
|
+
include Mixins::OperatesOnSources
|
7
|
+
|
6
8
|
# Constructor accepts pool or array or container and adds every file
|
7
9
|
# to its source files set.
|
8
10
|
# @param [Jsus::Pool, Jsus::Container, Array] source files to validate
|
9
11
|
# @api public
|
10
|
-
def initialize(pool_or_array_or_container)
|
12
|
+
def initialize(pool_or_array_or_container = [])
|
11
13
|
self.source_files = pool_or_array_or_container
|
12
14
|
end
|
13
15
|
|
14
|
-
# @return [Array] source files for validation
|
15
|
-
# @api public
|
16
|
-
def source_files
|
17
|
-
@source_files ||= []
|
18
|
-
end
|
19
|
-
alias_method :sources, :source_files
|
20
|
-
|
21
|
-
# @param [Jsus::Pool, Jsus::Container, Array] pool_or_array_or_container
|
22
|
-
# source files for validation
|
23
|
-
# @api public
|
24
|
-
def source_files=(pool_or_array_or_container)
|
25
|
-
case pool_or_array_or_container
|
26
|
-
when Pool
|
27
|
-
@source_files = pool_or_array_or_container.sources.to_a
|
28
|
-
when Array
|
29
|
-
@source_files = pool_or_array_or_container
|
30
|
-
when Container
|
31
|
-
@source_files = pool_or_array_or_container.to_a
|
32
|
-
end
|
33
|
-
end
|
34
|
-
alias_method :sources=, :source_files=
|
35
|
-
|
36
16
|
# @return [Boolean] whether or not given sources conform to given set of rules
|
37
17
|
# @api public
|
38
18
|
def validate
|
data/lib/jsus/util/watcher.rb
CHANGED
@@ -3,13 +3,14 @@ class Jsus::Util::Watcher
|
|
3
3
|
# Watches input directories and their subdirectories for changes in
|
4
4
|
# js source files and package metadata files.
|
5
5
|
# @param [String, Array] input_dirs directory or directories to watch
|
6
|
+
# @param [String, Array] ignored_dirs directory or directories to ignore
|
6
7
|
# @yield [filename] Callback to trigger on creation / update / removal of
|
7
8
|
# any file in given directories
|
8
9
|
# @yieldparam [String] filename Updated filename full path
|
9
10
|
# @return [FSSM::Monitor] fssm monitor instance
|
10
11
|
# @api public
|
11
|
-
def watch(input_dirs, &callback)
|
12
|
-
new(input_dirs, &callback)
|
12
|
+
def watch(input_dirs, ignored_dirs = [], &callback)
|
13
|
+
new(input_dirs, ignored_dirs, &callback)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -17,12 +18,13 @@ class Jsus::Util::Watcher
|
|
17
18
|
# Jsus::Util::Watcher.watch instead.
|
18
19
|
# @see .watch
|
19
20
|
# @api semipublic
|
20
|
-
def initialize(input_dirs, &callback)
|
21
|
+
def initialize(input_dirs, ignored_dirs = [], &callback)
|
21
22
|
require 'fssm'
|
22
23
|
@callback = callback
|
23
24
|
input_dirs = Array(input_dirs).compact
|
24
25
|
@semaphore = Mutex.new
|
25
26
|
watcher = self
|
27
|
+
@ignored_dirs = Array(ignored_dirs).map {|dir| File.expand_path(dir) }
|
26
28
|
FSSM.monitor do
|
27
29
|
input_dirs.each do |dir|
|
28
30
|
dir = File.expand_path(dir)
|
@@ -49,9 +51,9 @@ class Jsus::Util::Watcher
|
|
49
51
|
# @api semipublic
|
50
52
|
def watch_callback(base, match)
|
51
53
|
Thread.new do
|
52
|
-
|
53
|
-
|
54
|
-
@callback.call(full_path)
|
54
|
+
full_path = File.join(base, match)
|
55
|
+
unless @ignored_dirs.any? {|dir| full_path.index(dir) == 0 }
|
56
|
+
run { @callback.call(full_path) }
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end # watch_callback
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: Orwik
|
2
2
|
filename: orwik.js
|
3
3
|
web: http://orwik.com
|
4
4
|
description: Orwik widgets and essensial things
|
@@ -6,7 +6,7 @@ license: MIT-Style License, http://mootools.net/license
|
|
6
6
|
copyright: 2008-2010 Yaroslaff Fedin http://orwik.com/people/inviz
|
7
7
|
authors: Orwik team, http://developers.orwik.com
|
8
8
|
files:
|
9
|
-
- "Source/Widget/Widget.js"
|
9
|
+
- "Source/Widget/Widget.js"
|
10
10
|
- "Source/Widget/Input/Input.js"
|
11
11
|
- "Source/Widget/Input/Input.Color.js" #Files are unsorted. Figure out the order please
|
12
|
-
- "Source/Library/Color.js"
|
12
|
+
- "Source/Library/Color.js"
|
data/spec/jsus/container_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
|
4
4
|
describe Jsus::Container do
|
5
|
-
let(:simple_source) {
|
6
|
-
let(:another_simple_source) {
|
7
|
-
let(:dependant_source) {
|
8
|
-
let(:replacement_source) {
|
5
|
+
let(:simple_source) { Jsus::SourceFile.from_file("spec/data/SimpleSources/simple_source_one.js", :namespace => "Test") }
|
6
|
+
let(:another_simple_source) { Jsus::SourceFile.from_file("spec/data/SimpleSources/simple_source_two.js", :namespace => "Test") }
|
7
|
+
let(:dependant_source) { Jsus::SourceFile.from_file("spec/data/SimpleSources/dependent_source_one.js", :namespace => "Test") }
|
8
|
+
let(:replacement_source) { Jsus::SourceFile.from_file("spec/data/SimpleSources/replacement_source_one.js", :namespace => "Test") }
|
9
9
|
let(:simple_container) { Jsus::Container.new(simple_source, another_simple_source) }
|
10
10
|
let(:container_with_dependency) { Jsus::Container.new(dependant_source, simple_source) }
|
11
11
|
|
@@ -14,6 +14,12 @@ describe Jsus::Container do
|
|
14
14
|
simple_container.should have_exactly(2).sources
|
15
15
|
simple_container.sources.should include(simple_source, another_simple_source)
|
16
16
|
end
|
17
|
+
|
18
|
+
it "should not lose data when initialized from another container" do
|
19
|
+
container = Jsus::Container.new(simple_source, replacement_source, another_simple_source)
|
20
|
+
container.to_a.should =~ [simple_source, replacement_source]
|
21
|
+
Jsus::Container.new(container).to_a.should =~ [simple_source, replacement_source]
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
describe "#<<" do
|
@@ -59,19 +65,13 @@ describe Jsus::Container do
|
|
59
65
|
end
|
60
66
|
|
61
67
|
it "should generate routes from given root" do
|
62
|
-
subject.required_files("/
|
68
|
+
subject.required_files(File.expand_path("spec/data/SimpleSources")).should == [File.basename(simple_source.filename), File.basename(dependant_source.filename)]
|
63
69
|
end
|
64
70
|
end
|
65
71
|
|
66
72
|
context "lazy sorting" do
|
67
73
|
subject { container_with_dependency.sort! }
|
68
74
|
|
69
|
-
it "should remove replaced files" do
|
70
|
-
subject << replacement_source
|
71
|
-
subject.should include(replacement_source)
|
72
|
-
subject.should_not include(simple_source)
|
73
|
-
end
|
74
|
-
|
75
75
|
it "should only call topsort when it's needed" do
|
76
76
|
subject.should_not_receive(:topsort)
|
77
77
|
subject.sort!
|
@@ -82,11 +82,69 @@ describe Jsus::Container do
|
|
82
82
|
subject.should_not_receive(:topsort)
|
83
83
|
subject << simple_source
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
it "should call topsort for kicker methods" do
|
87
87
|
subject << simple_source
|
88
|
-
subject.should_receive(:topsort)
|
88
|
+
subject.should_receive(:topsort).and_return([])
|
89
89
|
subject.each {|source| }
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
|
+
context "when extensions are present" do
|
94
|
+
let(:klass) { Jsus::SourceFile.from_file("spec/data/Extensions/app/javascripts/Core/Source/Class.js", :namespace => "Core") }
|
95
|
+
let(:hash) { Jsus::SourceFile.from_file("spec/data/Extensions/app/javascripts/Core/Source/Hash.js", :namespace => "Core") }
|
96
|
+
let(:mash) { Jsus::SourceFile.from_file("spec/data/Extensions/app/javascripts/Core/Source/Mash.js", :namespace => "Core") }
|
97
|
+
let(:sources) { [klass, hash, mash] }
|
98
|
+
let(:klass_ext) { Jsus::SourceFile.from_file("spec/data/Extensions/app/javascripts/Orwik/Extensions/Class.js", :namespace => "Orwik") }
|
99
|
+
let(:mash_ext) { Jsus::SourceFile.from_file("spec/data/Extensions/app/javascripts/Orwik/Extensions/Mash.js", :namespace => "Orwik") }
|
100
|
+
let(:extensions) { [klass_ext, mash_ext] }
|
101
|
+
|
102
|
+
subject { described_class.new }
|
103
|
+
before(:each) do
|
104
|
+
sources.each {|sf| subject << sf }
|
105
|
+
extensions.each {|sf| subject << sf }
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should return extensions immediately after the sources they extend" do
|
109
|
+
subject.to_a.should =~ sources + extensions
|
110
|
+
subject.to_a.index(klass).should == subject.to_a.index(klass_ext) - 1
|
111
|
+
subject.to_a.index(mash).should == subject.to_a.index(mash_ext) - 1
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "when replacements are present" do
|
116
|
+
let(:source) { Jsus::SourceFile.from_file("spec/data/OutsideDependencies/app/javascripts/Core/Source/Class/Class.Extras.js", :namespace => "Core") }
|
117
|
+
let(:replacement) { Jsus::SourceFile.from_file("spec/data/replacement.js", :namespace => "Test") }
|
118
|
+
subject { described_class.new(source, replacement) }
|
119
|
+
|
120
|
+
it "should only include replacement in the output" do
|
121
|
+
subject.sources.should == [replacement]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "#provides" do
|
126
|
+
let(:source) { Jsus::SourceFile.from_file("features/data/Basic/Source/Library/Color.js", :namespace => "Base") }
|
127
|
+
let(:another_source) { Jsus::SourceFile.from_file("features/data/Basic/Source/Widget/Input/Input.Color.js", :namespace => "Base") }
|
128
|
+
subject { described_class.new(source, another_source) }
|
129
|
+
|
130
|
+
it "should include provided tags of all sources" do
|
131
|
+
subject.provides.map {|tag| tag.to_s}.should =~ ["Base/Color", "Base/Input.Color"]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "#requires" do
|
136
|
+
let(:source) { Jsus::SourceFile.from_file("features/data/Basic/Source/Library/Color.js", :namespace => "Base") }
|
137
|
+
let(:another_source) { Jsus::SourceFile.from_file("features/data/Basic/Source/Widget/Input/Input.Color.js", :namespace => "Base") }
|
138
|
+
subject { described_class.new(another_source) }
|
139
|
+
|
140
|
+
it "should include required tags of all sources" do
|
141
|
+
subject.provides.map {|tag| tag.to_s}.should =~ ["Base/Input.Color"]
|
142
|
+
subject.requires.map {|tag| tag.to_s}.should =~ ["Base/Color"]
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should exclude tags which are provided by other files" do
|
146
|
+
subject << source
|
147
|
+
subject.requires.map {|tag| tag.to_s}.should == []
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
data/spec/jsus/package_spec.rb
CHANGED
@@ -14,29 +14,26 @@ describe Jsus::Package do
|
|
14
14
|
let(:output_dir) { "spec/data/OutsideDependencies/public/javascripts/Orwik" }
|
15
15
|
|
16
16
|
it "should load header from package.yml" do
|
17
|
-
subject.name.should == "
|
17
|
+
subject.name.should == "Orwik"
|
18
18
|
subject.filename.should == "orwik.js"
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should pass pool in options and register itself in the pool" do
|
22
|
-
pool = Jsus::Pool.new
|
23
|
-
package = Jsus::Package.new(input_dir, :pool => pool)
|
24
|
-
package.pool.should == pool
|
25
|
-
pool.packages.should include(package)
|
26
|
-
end
|
27
|
-
|
28
21
|
it "should set provided modules from source files" do
|
29
22
|
subject.provides.should have_exactly(4).items
|
30
|
-
subject.
|
23
|
+
subject.provides.map {|p| p.to_s }.should include("Orwik/Color", "Orwik/Input", "Orwik/Input.Color", "Orwik/Widget")
|
31
24
|
end
|
32
25
|
|
33
26
|
it "should set up outside dependencies" do
|
34
|
-
subject.
|
27
|
+
subject.requires.map {|r| r.to_s}.should =~ ["Core/Class"]
|
35
28
|
end
|
36
29
|
|
37
30
|
it "should set directory field" do
|
38
31
|
subject.directory.should == File.expand_path(input_dir)
|
39
32
|
end
|
33
|
+
|
34
|
+
it "should assign source file itself as a package" do
|
35
|
+
subject.source_files.each {|sf| sf.package.should == subject }
|
36
|
+
end
|
40
37
|
end
|
41
38
|
|
42
39
|
context "with a package.json" do
|
@@ -45,139 +42,24 @@ describe Jsus::Package do
|
|
45
42
|
|
46
43
|
it "should load header from package.json" do
|
47
44
|
subject.name.should == "Sheet"
|
48
|
-
subject.
|
49
|
-
subject.
|
45
|
+
subject.provides.map {|p| p.to_s}.should =~ ["Sheet/Sheet", "Sheet/SheetParser.CSS"]
|
46
|
+
subject.requires.map {|r| r.to_s}.should =~ ["Sheet/CombineRegExp"]
|
50
47
|
end
|
51
48
|
|
52
49
|
end
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
56
|
-
describe "#compile" do
|
57
|
-
it "should create a merged js package from given files" do
|
58
|
-
subject.compile(output_dir)
|
59
|
-
File.exists?("#{output_dir}/orwik.js").should be_true
|
60
|
-
compiled_content = IO.read("#{output_dir}/orwik.js")
|
61
|
-
required_files = Dir["#{input_dir}/**/*.js"].map {|f| IO.read(f) }
|
62
|
-
required_files.each {|f| compiled_content.should include(f)}
|
63
|
-
end
|
64
|
-
|
65
|
-
context "when given nil" do
|
66
|
-
it "should not raise errors" do
|
67
|
-
lambda { subject.compile(nil) }.should_not raise_error
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should return a string with compiled content" do
|
71
|
-
compiled_content = subject.compile(nil)
|
72
|
-
required_files = Dir["#{input_dir}/**/*.js"].map {|f| IO.read(f) }
|
73
|
-
required_files.each {|f| compiled_content.should include(f)}
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#generate_scripts_info" do
|
79
|
-
it "should create scripts.json file containing all the info about the package" do
|
80
|
-
subject.generate_scripts_info(output_dir)
|
81
|
-
File.exists?("#{output_dir}/scripts.json").should be_true
|
82
|
-
info = JSON.parse(IO.read("#{output_dir}/scripts.json"))
|
83
|
-
info = info["Orwik"]
|
84
|
-
info["provides"].should have_exactly(4).items
|
85
|
-
info["provides"].should include("Color", "Widget", "Input", "Input.Color")
|
86
|
-
end
|
87
|
-
|
88
|
-
context "when external dependencies are included" do
|
89
|
-
let(:lib_dir) { "spec/data/ChainDependencies/app/javascripts" }
|
90
|
-
let(:pool) { Jsus::Pool.new(lib_dir) }
|
91
|
-
subject { Jsus::Package.new("spec/data/ExternalDependencies/app/javascripts/Orwik", :pool => pool) }
|
92
|
-
|
93
|
-
it "should show included external dependencies as provided" do
|
94
|
-
subject.include_dependencies!
|
95
|
-
subject.generate_scripts_info(output_dir)
|
96
|
-
info = JSON.parse(IO.read("#{output_dir}/scripts.json"))
|
97
|
-
info = info["Orwik"]
|
98
|
-
info["provides"].should have_exactly(4).items
|
99
|
-
info["provides"].should include("Test", "Hash/Hash", "Class/Class", 'Mash/Mash')
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should not show included external dependencies as required" do
|
103
|
-
subject.include_dependencies!
|
104
|
-
subject.generate_scripts_info(output_dir)
|
105
|
-
info = JSON.parse(IO.read("#{output_dir}/scripts.json"))
|
106
|
-
info = info["Orwik"]
|
107
|
-
info["requires"].should == ["Class"]
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "#generate_tree" do
|
113
|
-
it "should create a json file containing tree information and dependencies" do
|
114
|
-
subject.generate_tree(output_dir)
|
115
|
-
File.exists?("#{output_dir}/tree.json").should be_true
|
116
|
-
tree = JSON.parse(IO.read("#{output_dir}/tree.json"))
|
117
|
-
tree["Library"]["Color"]["provides"].should == ["Color"]
|
118
|
-
tree["Widget"]["Widget"]["provides"].should == ["Widget"]
|
119
|
-
tree["Widget"]["Input"]["Input"]["requires"].should == ["Widget"]
|
120
|
-
tree["Widget"]["Input"]["Input"]["provides"].should == ["Input"]
|
121
|
-
tree["Widget"]["Input"]["Input.Color"]["requires"].should have_exactly(2).elements
|
122
|
-
tree["Widget"]["Input"]["Input.Color"]["requires"].should include("Input", "Color")
|
123
|
-
tree["Widget"]["Input"]["Input.Color"]["provides"].should == ["Input.Color"]
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should allow different filenames" do
|
127
|
-
subject.generate_tree(output_dir, "structure.json")
|
128
|
-
File.exists?("#{output_dir}/structure.json").should be_true
|
129
|
-
tree = JSON.parse(IO.read("#{output_dir}/structure.json"))
|
130
|
-
tree["Library"]["Color"]["provides"].should == ["Color"]
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
53
|
describe "#required_files" do
|
135
|
-
it "should list required files in correct order" do
|
136
|
-
required_files = subject.required_files
|
137
|
-
input_index = required_files.index {|s| s=~ /\/Input.js$/}
|
138
|
-
color_index = required_files.index {|s| s=~ /\/Color.js$/}
|
139
|
-
input_color_index = required_files.index {|s| s=~ /\/Input.Color.js$/}
|
140
|
-
input_index.should < input_color_index
|
141
|
-
color_index.should < input_color_index
|
142
|
-
end
|
143
|
-
|
144
54
|
it "should not include extensions" do
|
145
55
|
required_files = Jsus::Package.new("spec/data/Extensions/app/javascripts/Orwik").required_files
|
146
56
|
required_files.should be_empty
|
147
57
|
end
|
148
58
|
end
|
149
59
|
|
150
|
-
describe "#include_dependencies!" do
|
151
|
-
let(:lib_dir) { "spec/data/ChainDependencies/app/javascripts" }
|
152
|
-
let(:pool) { Jsus::Pool.new(lib_dir) }
|
153
|
-
subject { Jsus::Package.new("spec/data/ExternalDependencies/app/javascripts/Orwik", :pool => pool) }
|
154
|
-
|
155
|
-
it "should include external dependencies into self" do
|
156
|
-
subject.include_dependencies!
|
157
|
-
subject.should have(3).linked_external_dependencies
|
158
|
-
compiled = subject.compile(output_dir)
|
159
|
-
["Class", "Hash", "Mash"].each do |name|
|
160
|
-
compiled.should include(IO.read("#{lib_dir}/#{name}/Source/#{name}.js"))
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe "#include_extensions!" do
|
166
|
-
let(:lib_dir) { "spec/data/Extensions/app/javascripts" }
|
167
|
-
let(:pool) { Jsus::Pool.new(lib_dir) }
|
168
|
-
subject { Jsus::Package.new("spec/data/Extensions/app/javascripts/Core", :pool => pool) }
|
169
|
-
|
170
|
-
it "should include extensions into source files" do
|
171
|
-
subject.source_files[0].extensions.should be_empty
|
172
|
-
subject.include_extensions!
|
173
|
-
subject.source_files[0].extensions.should have_exactly(1).item
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
60
|
describe "#filename" do
|
179
61
|
it "should convert package name to snake_case" do
|
180
62
|
subject.filename.should == "orwik.js"
|
181
63
|
end
|
182
64
|
end
|
183
|
-
end
|
65
|
+
end
|