cup 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cup (0.0.4)
4
+ cup (0.0.6)
5
5
  coffee-script
6
6
  rack (= 1.3.3)
7
7
  rake
data/README.markdown ADDED
@@ -0,0 +1,127 @@
1
+ # Cup
2
+
3
+ INSERT A PICTURE OF A CUP
4
+
5
+ Command lines tools and a web application to help in developing javascript libraries and applications independently of anything else.
6
+
7
+
8
+ ## Command Line App
9
+
10
+ Output from `cup help`:
11
+
12
+ Tasks:
13
+ cup build # builds and minifies (with uglifier) into ./build/
14
+ cup concatenate # concatenates to STDOUT
15
+ cup create NAME # Creates a new directory structure with the specified name. Can also be called like: cup <name> [options]
16
+ cup help [TASK] # Describe available tasks or one specific task
17
+ cup ify # cupifys the current directory, creating a Cupfile etc.
18
+ cup minify # minifies to STDOUT with uglifier
19
+ cup rackup # Create a config.ru. Do this if you want to use powder
20
+ cup server [PORT] # Starts a sinatra app which serves spec runners etc.
21
+ cup version # The version of cup and the version of the Cup project in this directory if a Cupfile exists
22
+
23
+
24
+
25
+ ### The create Command
26
+
27
+ This command produces a folder containing:
28
+
29
+ * vendor: for vendor js libraries such as jquery and jasmine which are automatically downloaded. Note, the latest version of jquery is downloaded by default, for jasmine, cup currently downloaded v1.1
30
+ * spec: where you will place you carefully prepared jasmine specs ;)
31
+ * spec/visual: some special case spec (more on this in the Browser App section below)
32
+ * lib: this is where libraries to be included in the build should be placed
33
+ * src: duh.
34
+ * Cupfile: a file which is used to describe the cup project (more in the Cupfile section below)
35
+ * licence.txt: A default open source licence
36
+
37
+
38
+ ## Cupfile
39
+
40
+ Sample Cupfile (ruby) with comments:
41
+
42
+ Cup.define do
43
+
44
+ name 'my project' # MUST be a valid file name
45
+ version '0.0.1' # must be of the form X.Y.Z where X, Y and Z are numbers
46
+ licence 'MIT.txt'
47
+
48
+ javascripts do
49
+
50
+ vendor 'only_one.js' # <-- no :* symbol means only those explicitly listed scripts will be loaded
51
+
52
+ spec 'path/within/spec/dir.js', :* # <-- :* symbol means "all others"
53
+
54
+ # if lib load order was not explicitly declared cup defaults to the equivalent:
55
+
56
+ lib :*
57
+
58
+ src [
59
+ 'an.js',
60
+ 'array.js',
61
+ 'can.js',
62
+ 'also.js',
63
+ 'be.js',
64
+ 'used.js',
65
+ 'so/can/glob-like/patterns/**/*.js'] # happily, patterns and arrays can be used too.
66
+ end
67
+
68
+ uglifier_options :mangle => true # uglifier defaults can be overriden
69
+
70
+ before_build do
71
+ # whatever you want
72
+ end
73
+
74
+ after_build do
75
+ # whatever you want
76
+ end
77
+ end
78
+
79
+ Note: Multiple inclusions of the same javascript result in the omission of all but the first reference
80
+
81
+ ## Browser App
82
+
83
+ * root: an overview of the project including links to build output and a file list for the project
84
+ * debug: a page on which the src javascripts and vendor javascripts are loaded but no specs, good for debugging and experimenting with your code in the console
85
+ * empty: the same as debug, but a completely empty page (no cup app header or css). This is for debugging UI components withoutany interference from the stylesheets or controls in the cup application itself.
86
+ * src: run specs on the lib and src files
87
+ * concatenated: run specs on the concatenated version of build output
88
+ * minifed: run specs on the minified version of the build output
89
+ * visual: exercise visual specs (see below)
90
+
91
+
92
+ The browser application includes Rack Middleware that acts as a directory server for all paths that are not routes in the main application. For example: `http://<host>:<port>/lib` will serve a directory listing for the lib folder.
93
+
94
+ Every page on the browser application builds the javascripts. An error page is displayed to indicate the build failed and the browser is redirected to a page that loads lib and src files so that their syntax can be checked in Web Inspector or Firebug.
95
+
96
+ ### Visual Specs
97
+
98
+ Visual specs help to facilitate the visual verifcation of behaviour which maybe required to support automated specs when developing UI components. Examples of visual spec criteria:
99
+
100
+ * An animation doesn't flicker
101
+ * A the colours scheme works
102
+ * A slider control is responsive when rapidly changing its position
103
+
104
+ To create a visual spec, add a slim template in the `spec/visual` directory. Any directory structure within `spec/visual` may be used to organise visual specs as you see fit. An index of available visual specs is available in the browser app.
105
+
106
+ Each slim template under `spec/visual` is a partial and will be injected into the body of a page with the src, lib and vendor javascript loaded in the order specified by the Cupfile.
107
+
108
+
109
+ Note: No style sheets are automatically loaded for visual specs.
110
+ Note: No javascripts are loaded from the `spec/visual` directory unless explicitly reference in the Cupfile.
111
+
112
+
113
+ ### Javascripts load order, stylesheets and the Cupfile
114
+
115
+ All javascripts and stylesheets are automatically included with the exception of javascripts within the spec/visual directory.
116
+ SASS is automatically processed. The automatic loading of stylesheets cannot be overridden.
117
+ The loading of javascripts can be controlled using the Cupfile with the following constraint...
118
+
119
+ Javascripts are loaded from these paths in this order:
120
+
121
+ 1. vendor
122
+ 2. spec (only on pages which run specs)
123
+ 3. lib
124
+ 4. src
125
+
126
+ Build output is referenced instead of lib and src on the relevant pages (such as when running spec on minifed build output). Only lib and src (in that order) are considered build input.
127
+
data/TODO CHANGED
@@ -1,13 +1,3 @@
1
- > RUN every command line task
2
- > VISIT every server page
3
-
4
- >> rebuild js-core-ext (rename to js-core-ext), eventify, z, superview
5
-
6
- > INSPECT concatenated and minified output
7
-
8
- > README
9
- ---- Later ----
10
-
11
- Rails app integration
12
- * integrate with the jasmine-rails gem to run specs on the command line
13
- * integrate with the asset pipeline
1
+ > README.markdown needs proofing, update the gemspec description and summary
2
+ > TODO: ICON
3
+ > download jasmine to spec/env
data/js/extra_matchers.js CHANGED
@@ -1,7 +1,10 @@
1
1
  /*
2
2
 
3
+ This file will be overwritten by 'cup ify' command
4
+
3
5
  These jasmine matchers are included by default when a project is created with cup.
4
6
 
7
+
5
8
  */
6
9
  beforeEach(function() {
7
10
  this.addMatchers({
@@ -12,18 +15,10 @@ beforeEach(function() {
12
15
  return this.actual instanceof ctor;
13
16
  },
14
17
  toContain: function (a) {
15
- return this.actual.contains(a);
18
+ return !!~this.actual.indexOf(a);
16
19
  },
17
20
  toBeEmpty: function () {
18
21
  return this.actual.isEmpty();
19
- },
20
- toThrowAnError: function () {
21
- try {
22
- this.actual()
23
- } catch (e) {
24
- return e instanceof Error;
25
- }
26
- return false;
27
22
  }
28
23
  });
29
24
  });
@@ -38,7 +38,7 @@ Cup.define do |cup|
38
38
  licence 'licence.txt'
39
39
 
40
40
  javascripts do
41
- vendor 'jasmine.js', :*
41
+ spec 'env/jasmine.js', 'env/jasmine-html.js', :*
42
42
  end
43
43
 
44
44
  end
@@ -46,7 +46,7 @@ CUPFILE
46
46
  end
47
47
 
48
48
  def standard_directories
49
- %w|src lib vendor spec spec/visual|.map {|dir| root + dir}
49
+ %w|src lib vendor spec spec/visual spec/env|.map {|dir| root + dir}
50
50
  end
51
51
 
52
52
  def jquery_file
@@ -54,7 +54,7 @@ CUPFILE
54
54
  end
55
55
 
56
56
  def extra_matchers_file
57
- root + 'vendor' + 'extra_matchers.js'
57
+ root + 'spec/env' + 'extra_matchers.js'
58
58
  end
59
59
 
60
60
  def rackup_file
@@ -108,7 +108,7 @@ LICENSE
108
108
  set -o errexit # exit if it hits the fan
109
109
  set -o nounset # using unset variables is an error
110
110
 
111
- cd #{root + 'vendor'}
111
+ cd #{root + 'spec/env'}
112
112
 
113
113
  curl --silent #{JasmineStandaloneDistributionURL} > jasmine.zip
114
114
  unzip jasmine.zip -d jasmine
@@ -130,7 +130,7 @@ LICENSE
130
130
  desc "create NAME", "Creates a new directory structure with the specified name. Can also be called like: cup <name> [options]"
131
131
  def create(name)
132
132
 
133
- unless /^[\w-]+$/ =~ name
133
+ unless valid_cup_name?(name)
134
134
  raise "#{name} is not a valid filename (letters, numbers, underscore and dashes only)"
135
135
  end
136
136
 
@@ -141,32 +141,21 @@ LICENSE
141
141
  return
142
142
  end
143
143
 
144
- empty_directory helper.root
145
- helper.standard_directories.each {|dir| empty_directory dir}
144
+ cupify_with helper, name
145
+ end
146
146
 
147
- create_file helper.cupfile, helper.cupfile_default_content(name)
147
+ desc "ify", 'cupifys the current directory, creating a Cupfile etc.'
148
+ def ify
149
+ path = current_path
148
150
 
149
- create_file helper.licence_file, helper.get_licence
151
+ name = File.basename(path)
152
+ name = 'new cup' unless valid_cup_name? name
150
153
 
151
- jquery = helper.get_jquery
152
-
153
- if jquery
154
- say_status(:downloaded, "#{Helper::JasmineStandaloneDistributionURL}", :green)
155
- create_file helper.jquery_file, jquery
156
- else
157
- say_status(:failed, "download #{Helper::JQueryURL}", :red)
158
- end
159
-
160
- if helper.download_jasmine
161
- say_status(:downloaded, "#{Helper::JasmineStandaloneDistributionURL} and unpacked into vendor", :green)
162
- else
163
- say_status(:failed, "download/unpack #{Helper::JasmineStandaloneDistributionURL}", :red)
164
- end
165
-
166
- create_file helper.extra_matchers_file, helper.get_extra_matchers
154
+ helper = Helper.new(path)
155
+ cupify_with(helper, name)
167
156
  end
168
157
 
169
- desc "build", 'builds and minifies into ./build/'
158
+ desc "build", 'builds and minifies (with uglifier) into ./build/'
170
159
  def build
171
160
  Cup.build! :cli => self
172
161
  end
@@ -176,7 +165,7 @@ LICENSE
176
165
  $stdout.puts Cup.concatenate!
177
166
  end
178
167
 
179
- desc "minify", 'minifies to STDOUT'
168
+ desc "minify", 'minifies to STDOUT with uglifier'
180
169
  def minify
181
170
  $stdout.puts Cup.minify!
182
171
  end
@@ -217,6 +206,39 @@ CONFIG_RU
217
206
 
218
207
  private
219
208
 
209
+ def current_path
210
+ Pathname.new('.').expand_path
211
+ end
212
+ def valid_cup_name? name
213
+ /^[\w-]+$/ =~ name
214
+ end
215
+ def cupify_with helper, name
216
+
217
+ empty_directory helper.root
218
+ helper.standard_directories.each {|dir| empty_directory dir}
219
+
220
+ create_file helper.cupfile, helper.cupfile_default_content(name)
221
+
222
+ create_file helper.licence_file, helper.get_licence
223
+
224
+ jquery = helper.get_jquery
225
+
226
+ if jquery
227
+ say_status(:download, "#{Helper::JQueryURL}", :green)
228
+ create_file helper.jquery_file, jquery
229
+ else
230
+ say_status(:failure, "download #{Helper::JQueryURL}", :red)
231
+ end
232
+
233
+ if helper.download_jasmine
234
+ say_status(:download, "#{Helper::JasmineStandaloneDistributionURL} unpacked into spec/env", :green)
235
+ else
236
+ say_status(:failure, "download/unpack #{Helper::JasmineStandaloneDistributionURL}", :red)
237
+ end
238
+
239
+ create_file helper.extra_matchers_file, helper.get_extra_matchers
240
+ end
241
+
220
242
  def pwd_helper
221
243
  Helper.new(Cup::Directory.current.path.to_s)
222
244
  end
data/lib/cup/cupfile.rb CHANGED
@@ -8,7 +8,7 @@ module Cup
8
8
  def initialize path
9
9
 
10
10
  @path = path
11
- @javascripts = {}
11
+ @javascript_patterns = {}
12
12
  @uglifier_options = {}
13
13
  @before_build = lambda {}
14
14
  @after_build = lambda {}
@@ -23,7 +23,31 @@ module Cup
23
23
  end
24
24
 
25
25
  def javascripts
26
- @javascripts
26
+
27
+ javascripts = {}
28
+ current_directory = File.dirname(File.expand_path(self.path))
29
+
30
+ @javascript_patterns.each do |subdir, patterns|
31
+ javascripts[subdir] = patterns.map do |pattern|
32
+
33
+ default_catch_all = pattern == :*
34
+
35
+ pattern = '**/*.js' if default_catch_all
36
+
37
+ if pattern
38
+ expanded_pattern = current_directory + "/#{subdir}/#{pattern}"
39
+ FileList[expanded_pattern].select do |f|
40
+ if subdir == :spec and f.start_with?(current_directory + "/spec/visual")
41
+ false
42
+ else
43
+ File.extname(f).downcase == '.js'
44
+ end
45
+ end
46
+ end
47
+ end.flatten.compact.uniq
48
+ end
49
+
50
+ javascripts
27
51
  end
28
52
 
29
53
  def valid?
@@ -49,25 +73,7 @@ module Cup
49
73
 
50
74
  def set_javascript_patterns_for subdir, *patterns
51
75
 
52
- current_directory = File.dirname(File.expand_path(self.path))
53
-
54
- @javascripts[subdir] = patterns.map do |pattern|
55
-
56
- default_catch_all = pattern == :*
57
-
58
- pattern = '**/*.js' if default_catch_all
59
-
60
- if pattern
61
- expanded_pattern = current_directory + "/#{subdir}/#{pattern}"
62
- FileList[expanded_pattern].select do |f|
63
- if subdir == :spec and f.start_with?(current_directory + "/spec/visual")
64
- false
65
- else
66
- File.extname(f).downcase == '.js'
67
- end
68
- end
69
- end
70
- end.flatten.compact.uniq
76
+ @javascript_patterns[subdir] = patterns
71
77
  end
72
78
 
73
79
  def licence_file_exists?
data/lib/cup/directory.rb CHANGED
@@ -26,7 +26,7 @@ module Cup
26
26
  @cupfile ||= Cup::Cupfile.new(path + 'Cupfile')
27
27
 
28
28
  unless @cupfile.valid?
29
- raise Cup::Cupfile::CupfileError.new("Cupfile not valid: #{@cupfile.path.to_s}\n#{@cupfile.error_messages("\n")}")
29
+ fail Cup::Cupfile::CupfileError.new("Cupfile not valid: #{@cupfile.path.to_s}\n#{@cupfile.error_messages("\n")}")
30
30
  end
31
31
 
32
32
  @cupfile
@@ -34,7 +34,7 @@ module Cup
34
34
 
35
35
  set :server, %w{thin mongrel webrick}
36
36
  set :views, gem_root_path('views')
37
- set :public_folder, Cup::Directory.current.path.to_s
37
+ set :public_folder, false #Cup::Directory.current.path.to_s
38
38
 
39
39
  def view_scope(javascripts_scheme=:debug)
40
40
  @view_scope = ViewScope.new self, javascripts_scheme
@@ -129,6 +129,12 @@ module Cup
129
129
  view File.read(visual.full_path), :layout => :blank
130
130
  end
131
131
 
132
+ get '**/*.sass' do
133
+ file = File.relative_path(Cup::Directory.current.path, request.path[1..-1])
134
+ return pass unless File.file? file
135
+ sass File.read(file)
136
+ end
137
+
132
138
  not_found do
133
139
  view :not_found
134
140
  end
data/lib/cup/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cup
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -4,6 +4,15 @@ require 'fileutils'
4
4
 
5
5
  describe Cup::CommandLine do
6
6
 
7
+ before :all do
8
+ @stdout = $stdout
9
+ $stdout = StringIO.new
10
+ end
11
+
12
+ after :all do
13
+ $stdout = @stdout
14
+ end
15
+
7
16
  before :each do
8
17
  puts "\n"
9
18
  end
@@ -16,56 +25,47 @@ describe Cup::CommandLine do
16
25
  let(:test_cup_name) { "test_cup_#{Time.now.utc.to_i}" }
17
26
  let(:test_cup_path) { Pathname.new("test_cup_#{Time.now.utc.to_i}") }
18
27
 
19
- describe '#create' do
28
+ def remove_test_cup
29
+ FileUtils.rm_r test_cup_path.expand_path if File.exists? test_cup_path.expand_path
30
+ end
31
+
32
+ after(:each){ remove_test_cup }
33
+
34
+ share_examples_for :cupifying_a_directory do
20
35
 
21
- after :each do
22
- FileUtils.rm_r test_cup_name if File.exists? test_cup_name
36
+ before :each do
37
+ cli.stub(:create_file)
38
+ cli.stub(:empty_directory)
39
+ remove_test_cup
23
40
  end
24
41
 
25
- it 'should raise an exception if the name is not a valid filename' do
26
- expect {
27
- cli.create 'invalid/filename'
28
- }.to raise_error
29
- end
42
+ it 'creates a default Cupfile' do
30
43
 
31
- it 'should not create a new cup dir if one of the same name exists' do
32
- Dir.stub(:exists?).and_return(true)
33
- cli.create test_cup_name
34
- Dir.unstub!(:exists?)
35
- File.should_not exist(test_cup_name)
36
- end
44
+ cupfile_path = Pathname.new("#{test_cup_name}/Cupfile").expand_path
37
45
 
38
- it 'should create a new cup dir' do
39
- cli.create test_cup_name
40
- File.should exist(test_cup_name)
41
- end
46
+ str = nil
42
47
 
43
- it 'creates a default Cupfile' do
44
- cli.create test_cup_name
45
- cupfile_path = "#{test_cup_name}/Cupfile"
46
- File.should exist(cupfile_path)
47
- File.size(cupfile_path).should be > 0
48
- end
48
+ cli.should_receive(:create_file).with(cupfile_path, instance_of(String)) do |path, string|
49
+ str = string
50
+ end
49
51
 
50
- it "creates empty src, lib and spec and spec/visual directories" do
51
52
  cli.create test_cup_name
52
- %w(src lib spec spec/visual).each do |dir|
53
- dir = test_cup_path + dir
54
- File.should exist(dir)
53
+ str.length.should be > 0
54
+ end
55
55
 
56
- File.should be_directory(dir)
56
+ it "creates empty src, lib and spec and spec/visual spec/env directories" do
57
57
 
58
- if dir == test_cup_path + 'spec'
59
- Dir["#{dir}/*"].count.should == 1
60
- else
61
- Dir["#{dir}/*"].should be_empty
62
- end
58
+ %w(src lib spec spec/visual spec/env).each do |dir|
59
+ dir = test_cup_path + dir
60
+ cli.should_receive(:empty_directory).with(dir.expand_path)
63
61
  end
62
+
63
+ setup_cup
64
64
  end
65
65
 
66
- it "it downloads jquery into the vendor directory by default" do
67
- cli.create test_cup_name
68
- File.should exist("#{test_cup_name}/vendor/jquery.min.js")
66
+ it "it downloads jquery into the vendor directory" do
67
+ cli.should_receive(:create_file).with(Pathname.new("#{test_cup_name}/vendor/jquery.min.js").expand_path, instance_of(String))
68
+ setup_cup
69
69
  end
70
70
 
71
71
  it 'should not raise an error if jquery fails to download' do
@@ -77,7 +77,7 @@ describe Cup::CommandLine do
77
77
  end
78
78
 
79
79
  expect {
80
- cli.create test_cup_name
80
+ setup_cup
81
81
  }.to_not raise_error
82
82
 
83
83
  stub_create_helper_downloaders
@@ -92,35 +92,87 @@ describe Cup::CommandLine do
92
92
  end
93
93
 
94
94
  expect {
95
- cli.create test_cup_name
95
+ setup_cup
96
96
  }.to_not raise_error
97
97
 
98
98
  stub_create_helper_downloaders
99
99
  end
100
100
 
101
- it 'should download jasmine into vendor' do
102
- cli.create test_cup_name
103
- path = Pathname.new(test_cup_name)
101
+ it 'should download jasmine into spec/env' do
102
+
103
+ cli.unstub(:create_file)
104
104
 
105
- File.should exist(path + 'vendor' + 'jasmine-html.js')
106
- File.should exist(path + 'vendor' + 'jasmine.js')
107
- File.should exist(path + 'vendor' + 'jasmine.css')
105
+ setup_cup
106
+
107
+ mkdir_p test_cup_path + 'spec/env'
108
+
109
+ File.should exist(test_cup_path + 'spec/env' + 'jasmine-html.js')
110
+ File.should exist(test_cup_path + 'spec/env' + 'jasmine.js')
111
+ File.should exist(test_cup_path + 'spec/env' + 'jasmine.css')
108
112
  end
109
113
 
110
- it 'should copy extra_matchers.js from the gem into vendor' do
111
- cli.create test_cup_name
112
- path = Pathname.new(test_cup_name)
113
- File.should exist(path + 'vendor' + 'extra_matchers.js')
114
+ it 'should copy extra_matchers.js from the gem into spec/env' do
115
+
116
+ path = test_cup_path + 'spec/env' + 'extra_matchers.js'
117
+ cli.should_receive(:create_file).with(path.expand_path, instance_of(String))
118
+ setup_cup
114
119
  end
115
120
 
116
121
  it 'should create a licence file populated with the year and user as author' do
117
- cli.create test_cup_name
118
- path = "#{test_cup_name}/licence.txt"
119
- File.should exist(path)
120
- licence = File.read path
122
+ path = Pathname.new("#{test_cup_name}/licence.txt").expand_path
123
+
124
+ licence = nil
125
+ cli.should_receive(:create_file).with(path, instance_of(String)) do |path, string|
126
+ licence = string
127
+ end
128
+
129
+ setup_cup
130
+
121
131
  licence.should include Time.now.year.to_s
122
132
  licence.should include ENV['USER']
123
133
  end
134
+
135
+ end
136
+
137
+ describe '#ify' do
138
+
139
+ before :each do
140
+ cli.stub(:current_path).and_return(test_cup_path)
141
+ end
142
+
143
+ def setup_cup
144
+
145
+ cli.ify
146
+ end
147
+
148
+ it_behaves_like :cupifying_a_directory
149
+ end
150
+
151
+ describe '#create' do
152
+
153
+ def setup_cup
154
+ cli.create test_cup_name
155
+ end
156
+
157
+ it_behaves_like :cupifying_a_directory
158
+
159
+ it 'should raise an exception if the name is not a valid filename' do
160
+ expect {
161
+ cli.create 'invalid/filename'
162
+ }.to raise_error
163
+ end
164
+
165
+ it 'should not create a new cup dir if one of the same name exists' do
166
+ Dir.stub(:exists?).and_return(true)
167
+ cli.create test_cup_name
168
+ Dir.unstub!(:exists?)
169
+ File.should_not exist(test_cup_name)
170
+ end
171
+
172
+ it 'should create a new cup dir' do
173
+ cli.create test_cup_name
174
+ File.should directory(test_cup_name)
175
+ end
124
176
  end
125
177
 
126
178
  describe '#rackup' do
@@ -76,6 +76,14 @@ describe Cup::Cupfile do
76
76
  cupfile.javascripts[dir.to_sym].should_not be_empty
77
77
  end
78
78
  end
79
+
80
+ it 'should return different results is the filesystem changes' do
81
+ expect {
82
+ new_file = Cup::Directory.current.path + 'src' + 'newsrc_file.js'
83
+ File.should_not exist(new_file)
84
+ File.open(new_file, 'a') {}
85
+ }.to change {cupfile.javascripts[:src].count}.by(1)
86
+ end
79
87
  end
80
88
 
81
89
  describe '#set_javascript_patterns_for' do
@@ -103,13 +111,13 @@ describe Cup::Cupfile do
103
111
  end
104
112
 
105
113
  it 'should expand paths to within their key directory' do
106
- filelist = FileList["#{File.expand_path(test_example_cup_path.to_s)}/lib/**/*.js"]
114
+ filelist = Dir["#{File.expand_path(test_example_cup_path.to_s)}/lib/**/*.js"]
107
115
  set_patterns :lib, '**/*.js'
108
116
  cupfile.javascripts[:lib].should == filelist
109
117
  end
110
118
 
111
119
  it 'should turn :* into a match-all pattern' do
112
- filelist = FileList["#{File.expand_path(test_example_cup_path.to_s)}/lib/**/*.js"]
120
+ filelist = Dir["#{File.expand_path(test_example_cup_path.to_s)}/lib/**/*.js"]
113
121
 
114
122
  set_patterns :lib, :*
115
123
  cupfile.javascripts[:lib].should == filelist
@@ -7,7 +7,7 @@ describe Cup::Server::App do
7
7
  end
8
8
 
9
9
  it 'should serve public from the cup directory' do
10
- app.settings.public_folder.should == Cup::Directory.current.path.to_s
10
+ app.settings.public_folder.should == false #Cup::Directory.current.path.to_s
11
11
  end
12
12
 
13
13
  it 'should serve views and public from the cup/views directory' do
@@ -8,11 +8,11 @@ def stub_create_helper_downloaders
8
8
  end
9
9
 
10
10
  def download_jasmine
11
- %x{
12
- touch #{root + 'vendor/jasmine.js'}
13
- touch #{root + 'vendor/jasmine-html.js'}
14
- touch #{root + 'vendor/jasmine.css'}
15
- }
11
+ spec_env = root + 'spec/env'
12
+ FileUtils.mkdir_p spec_env unless File.directory? spec_env
13
+ FileUtils.touch spec_env + 'jasmine.js'
14
+ FileUtils.touch spec_env + 'jasmine-html.js'
15
+ FileUtils.touch spec_env + 'jasmine.css'
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-14 00:00:00.000000000Z
12
+ date: 2011-10-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &2151875340 !ruby/object:Gem::Requirement
16
+ requirement: &2152089920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151875340
24
+ version_requirements: *2152089920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2151871680 !ruby/object:Gem::Requirement
27
+ requirement: &2152056960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151871680
35
+ version_requirements: *2152056960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: therubyracer
38
- requirement: &2151868660 !ruby/object:Gem::Requirement
38
+ requirement: &2152051520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151868660
46
+ version_requirements: *2152051520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: uglifier
49
- requirement: &2151867040 !ruby/object:Gem::Requirement
49
+ requirement: &2151940820 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2151867040
57
+ version_requirements: *2151940820
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sinatra
60
- requirement: &2151864480 !ruby/object:Gem::Requirement
60
+ requirement: &2151931940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2151864480
68
+ version_requirements: *2151931940
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: slim
71
- requirement: &2151855760 !ruby/object:Gem::Requirement
71
+ requirement: &2151912880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2151855760
79
+ version_requirements: *2151912880
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sass
82
- requirement: &2151845540 !ruby/object:Gem::Requirement
82
+ requirement: &2151895180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2151845540
90
+ version_requirements: *2151895180
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: coffee-script
93
- requirement: &2151841740 !ruby/object:Gem::Requirement
93
+ requirement: &2151883300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2151841740
101
+ version_requirements: *2151883300
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: yard
104
- requirement: &2151834240 !ruby/object:Gem::Requirement
104
+ requirement: &2151880700 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2151834240
112
+ version_requirements: *2151880700
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rack
115
- requirement: &2151828780 !ruby/object:Gem::Requirement
115
+ requirement: &2151875000 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - =
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.3.3
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2151828780
123
+ version_requirements: *2151875000
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: ruby-debug19
126
- requirement: &2151827380 !ruby/object:Gem::Requirement
126
+ requirement: &2151872260 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2151827380
134
+ version_requirements: *2151872260
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: rspec
137
- requirement: &2151822720 !ruby/object:Gem::Requirement
137
+ requirement: &2151870340 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2151822720
145
+ version_requirements: *2151870340
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: shoulda
148
- requirement: &2151819580 !ruby/object:Gem::Requirement
148
+ requirement: &2151867340 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2151819580
156
+ version_requirements: *2151867340
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: statemachine
159
- requirement: &2151816340 !ruby/object:Gem::Requirement
159
+ requirement: &2151864300 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2151816340
167
+ version_requirements: *2151864300
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rack-test
170
- requirement: &2151814200 !ruby/object:Gem::Requirement
170
+ requirement: &2151852720 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2151814200
178
+ version_requirements: *2151852720
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: thin
181
- requirement: &2151810760 !ruby/object:Gem::Requirement
181
+ requirement: &2151846160 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2151810760
189
+ version_requirements: *2151846160
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: sinatra-reloader
192
- requirement: &2151806320 !ruby/object:Gem::Requirement
192
+ requirement: &2151840500 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,7 +197,7 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2151806320
200
+ version_requirements: *2151840500
201
201
  description:
202
202
  email:
203
203
  - sjltaylor@gmail.com
@@ -212,7 +212,7 @@ files:
212
212
  - .rspec
213
213
  - Gemfile
214
214
  - Gemfile.lock
215
- - README.md
215
+ - README.markdown
216
216
  - Rakefile
217
217
  - TODO
218
218
  - bin/cup
data/README.md DELETED
@@ -1,86 +0,0 @@
1
- Cup
2
- ===
3
-
4
- ## From ruby:
5
-
6
- Cup.build
7
- Cup.cup_name
8
- Cup.minified
9
- Cup.concatenated
10
- Cup.version
11
-
12
-
13
- ## CLI helper output
14
-
15
- * INSERT HERE
16
-
17
-
18
- ## Features
19
-
20
-
21
- * Automatically includes javascripts, easy DSL for customizing their order
22
- >>>> but NOT from inside spec/visuals1
23
-
24
- * can uglify your project `cup build`
25
- ** concatenates lib**/*.js and src/**/*.js into unminified and minified outputs in ./build
26
-
27
- * `cup serve`
28
- ** landing page for all serve capabilities
29
- ** serve specs in concatenated and debug modes
30
- ** serve visual spec index and serve spec/visual/**/*.spec.erb
31
- ** includes all css files in every request
32
- ** sinatra server extendable by add `server do <sinatra endpoints> end` to the Cupfile
33
-
34
- @pages ||= {
35
- :root => Page.new.tap do |page|
36
- page.path = '/'
37
- page.name = 'root'
38
- page.template = :root
39
- page.description = 'List of available pages'
40
- end,
41
- :debug => Page.new.tap do |page|
42
- page.path = '/debug'
43
- page.name = 'debug'
44
- page.template = :debug
45
- page.description = 'Headed page with lib and src javascript included'
46
- end,
47
- :empty => Page.new.tap do |page|
48
- page.path = '/empty'
49
- page.name = 'empty'
50
- page.template = :debug
51
- page.options[:layout] = false
52
- page.description = 'Totally blank page with lib and src javascript included'
53
- end,
54
- :spec => Page.new.tap do |page|
55
- page.path = '/spec'
56
- page.name = 'specs'
57
- page.template = :spec
58
- page.options[:javascripts_scheme] = :spec
59
- page.description = 'Run Jasmine specs on lib and src'
60
- end,
61
- :spec_concatenated => Page.new.tap do |page|
62
- page.path = '/spec/concatenated'
63
- page.name = 'specs on build output'
64
- page.template = :spec
65
- page.options[:javascripts_scheme] = :spec_concatenated
66
- page.description = 'Run Jasmine specs on the build output'
67
- end,
68
- :spec_minified => Page.new.tap do |page|
69
- page.path = '/spec/minified'
70
- page.name = 'specs on minified build output'
71
- page.template = :spec
72
- page.options[:javascripts_scheme] = :spec_minified
73
- page.description = 'Run Jasmine specs on minified build output'
74
- end,
75
- :spec_visual => Page.new.tap do |page|
76
- page.path = '/spec/visual'
77
- page.name = 'visual specs'
78
- page.template = :spec
79
- page.description = 'View available visual specs'
80
- end
81
- }
82
-
83
- * uglified options overridable in Cupfile
84
- before_build and after_build hooks are available too
85
- * requires git
86
-