serve 0.11.7 → 1.0.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.
@@ -0,0 +1,3 @@
1
+ <% @title = "Hello World!" %>
2
+
3
+ <h1><%= hello "World" %></h1>
@@ -0,0 +1 @@
1
+ /hello
@@ -0,0 +1,5 @@
1
+ module ViewHelpers
2
+ def hello(name)
3
+ "Hello \#{name}!"
4
+ end
5
+ end
@@ -6,13 +6,14 @@ describe Serve::Application do
6
6
  before :each do
7
7
  @app = Serve::Application.new
8
8
  @defopts = {
9
- :help => false,
10
- :help => false,
11
- :version => false,
12
- :environment => 'development',
13
- :port => 4000,
14
- :address => '0.0.0.0',
15
- :root => Dir.pwd
9
+ :help => false,
10
+ :version => false,
11
+ :environment => 'development',
12
+ :port => 4000,
13
+ :address => '0.0.0.0',
14
+ :root => Dir.pwd,
15
+ :convert => nil,
16
+ :create => nil
16
17
  }
17
18
  end
18
19
 
@@ -62,6 +63,34 @@ describe Serve::Application do
62
63
  @app.parse([dir])[:root].should == File.expand_path(dir)
63
64
  end
64
65
 
66
+ it "should parse ceate" do
67
+ create = ['create', 'newapp', '/Users/user']
68
+ @app.parse(create)[:create][:name].should == 'newapp'
69
+ @app.parse(create)[:create][:directory].should == '/Users/user'
70
+ @app.parse(create)[:create][:framework].should be_nil
71
+ end
72
+
73
+ it "should parse convert" do
74
+ convert = ['convert', '/Users/user']
75
+ @app.parse(convert)[:convert][:directory].should == '/Users/user'
76
+ @app.parse(convert)[:convert][:framework].should be_nil
77
+ end
78
+
79
+
80
+ it "should parse create with a javascript framework" do
81
+ create = ['create', 'newapp', '/Users/user', '-j', 'jquery']
82
+ @app.parse(create)[:create][:name].should == 'newapp'
83
+ @app.parse(create)[:create][:directory].should == '/Users/user'
84
+ @app.parse(create)[:create][:framework].should == 'jquery'
85
+ end
86
+
87
+ it "should parse convert with a javascript framework" do
88
+ convert = ['convert', '/Users/user', '--javascript', 'mootools']
89
+ @app.parse(convert)[:convert][:directory].should == '/Users/user'
90
+ @app.parse(convert)[:convert][:framework].should == 'mootools'
91
+ end
92
+
93
+
65
94
  it "should detect invalid arguments" do
66
95
  lambda { @app.parse(["--invalid"]) }.should raise_error(Serve::Application::InvalidArgumentsError)
67
96
  lambda { @app.parse(["invalid"]) }.should raise_error(Serve::Application::InvalidArgumentsError)
@@ -0,0 +1,107 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+ require 'serve/project'
3
+ require 'fileutils'
4
+
5
+ describe Serve::Project do
6
+
7
+ describe "Creating a new serve project" do
8
+
9
+ class SilentOut
10
+ def puts(*args); end
11
+ def print(*args); end
12
+ end
13
+
14
+ before(:all) do
15
+ @options = {
16
+ :name => 'test_mockup',
17
+ :directory => File.dirname(__FILE__),
18
+ :framework => 'jquery'
19
+ }
20
+
21
+ @mockup = Serve::Project.new(@options)
22
+ @mockup.stdout = SilentOut.new
23
+ @mockup.stderr = SilentOut.new
24
+
25
+ @mockup_file = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), @options[:name]))).relative_path_from(Pathname.new(Dir.pwd)).to_s
26
+ end
27
+
28
+ after(:all) do
29
+ FileUtils.rm_rf(@mockup_file)
30
+ end
31
+
32
+ it "should have a project name" do
33
+ @mockup.name.should == 'test_mockup'
34
+ end
35
+
36
+ it "should have a project directory" do
37
+ @mockup.location.should == @mockup_file
38
+ end
39
+
40
+ it "should have a framework" do
41
+ @mockup.framework.should == 'jquery'
42
+ end
43
+
44
+ describe "The created files" do
45
+ before(:all) do
46
+ @mockup.create
47
+ end
48
+
49
+ it "should create a directory" do
50
+ File.exists?(@mockup_file).should be_true
51
+ end
52
+
53
+ it "should have a public directory" do
54
+ File.exists?(File.join(@mockup_file, 'public')).should be_true
55
+ end
56
+
57
+ it "should have a javascript directory" do
58
+ File.exists?(File.join(@mockup_file, 'public/javascripts')).should be_true
59
+ end
60
+
61
+ it "should have a stylesheets directory" do
62
+ File.exists?(File.join(@mockup_file, 'public/stylesheets')).should be_true
63
+ end
64
+
65
+ it "should have an images directory" do
66
+ File.exists?(File.join(@mockup_file, 'public/images')).should be_true
67
+ end
68
+
69
+ it "should have a sass directory" do
70
+ File.exists?(File.join(@mockup_file, 'sass')).should be_true
71
+ end
72
+
73
+ it "should have a tmp directory" do
74
+ File.exists?(File.join(@mockup_file, 'tmp')).should be_true
75
+ end
76
+
77
+ it "should have a views directory" do
78
+ File.exists?(File.join(@mockup_file, 'views')).should be_true
79
+ end
80
+
81
+ it "should have config.ru file" do
82
+ File.exists?(File.join(@mockup_file, 'config.ru')).should be_true
83
+ end
84
+
85
+ it "should have a compass.config file" do
86
+ File.exists?(File.join(@mockup_file, 'compass.config')).should be_true
87
+ end
88
+
89
+ it "should have a LICENSE file" do
90
+ File.exists?(File.join(@mockup_file, 'LICENSE')).should be_true
91
+ end
92
+
93
+ it "should have a dot gitignore file" do
94
+ File.exists?(File.join(@mockup_file, '.gitignore')).should be_true
95
+ end
96
+
97
+ it "should have a README file" do
98
+ File.exists?(File.join(@mockup_file, 'README.markdown')).should be_true
99
+ end
100
+
101
+ it "should have a restart file" do
102
+ File.exists?(File.join(@mockup_file, 'tmp/restart.txt')).should be_true
103
+ end
104
+ end
105
+
106
+ end
107
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,9 +4,4 @@ require 'rubygems'
4
4
  gem 'activesupport'
5
5
 
6
6
  require 'serve'
7
- require 'spec'
8
- require 'spec/autorun'
9
-
10
- Spec::Runner.configure do |config|
11
-
12
- end
7
+ require 'rspec'
metadata CHANGED
@@ -1,22 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serve
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 11
9
- - 7
10
- version: 0.11.7
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - John W. Long
14
14
  - Adam I. Williams
15
+ - Robert Evans
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-07-22 00:00:00 -04:00
20
+ date: 2010-11-03 00:00:00 -04:00
20
21
  default_executable: serve
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
@@ -25,7 +26,7 @@ dependencies:
25
26
  requirement: &id001 !ruby/object:Gem::Requirement
26
27
  none: false
27
28
  requirements:
28
- - - ">="
29
+ - - ~>
29
30
  - !ruby/object:Gem::Version
30
31
  hash: 29
31
32
  segments:
@@ -41,32 +42,64 @@ dependencies:
41
42
  requirement: &id002 !ruby/object:Gem::Requirement
42
43
  none: false
43
44
  requirements:
44
- - - ">="
45
+ - - ~>
45
46
  - !ruby/object:Gem::Version
46
- hash: 9
47
+ hash: 5
47
48
  segments:
48
- - 2
49
49
  - 3
50
- - 5
51
- version: 2.3.5
50
+ - 0
51
+ - 1
52
+ version: 3.0.1
52
53
  type: :runtime
53
54
  version_requirements: *id002
54
55
  - !ruby/object:Gem::Dependency
55
- name: rspec
56
+ name: tzinfo
56
57
  prerelease: false
57
58
  requirement: &id003 !ruby/object:Gem::Requirement
58
59
  none: false
59
60
  requirements:
60
- - - ">="
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ hash: 61
64
+ segments:
65
+ - 0
66
+ - 3
67
+ - 23
68
+ version: 0.3.23
69
+ type: :runtime
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: i18n
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
61
78
  - !ruby/object:Gem::Version
62
79
  hash: 13
63
80
  segments:
81
+ - 0
82
+ - 4
64
83
  - 1
84
+ version: 0.4.1
85
+ type: :runtime
86
+ version_requirements: *id004
87
+ - !ruby/object:Gem::Dependency
88
+ name: rspec
89
+ prerelease: false
90
+ requirement: &id005 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ hash: 13
96
+ segments:
65
97
  - 2
66
- - 9
67
- version: 1.2.9
98
+ - 0
99
+ - 1
100
+ version: 2.0.1
68
101
  type: :development
69
- version_requirements: *id003
102
+ version_requirements: *id005
70
103
  description: Serve is a small Rack-based web server that makes it easy to serve ERB or HAML from any directory. Serve is an ideal tool for building HTML prototypes of Rails applications. Serve can also handle SASS, Textile, and Markdown if the appropriate gems are installed.
71
104
  email: me@johnwlong.com
72
105
  executables:
@@ -97,6 +130,9 @@ files:
97
130
  - lib/serve/handlers/sass_handler.rb
98
131
  - lib/serve/handlers/static_handler.rb
99
132
  - lib/serve/handlers/textile_handler.rb
133
+ - lib/serve/javascripts.rb
134
+ - lib/serve/out.rb
135
+ - lib/serve/project.rb
100
136
  - lib/serve/rack.rb
101
137
  - lib/serve/rails.rb
102
138
  - lib/serve/rails/configuration.rb
@@ -104,12 +140,22 @@ files:
104
140
  - lib/serve/rails/routing.rb
105
141
  - lib/serve/rails/serve_controller.rb
106
142
  - lib/serve/response_cache.rb
143
+ - lib/serve/templates/LICENSE
144
+ - lib/serve/templates/README.markdown
145
+ - lib/serve/templates/_layout.html.erb
146
+ - lib/serve/templates/application.sass
147
+ - lib/serve/templates/compass.config
148
+ - lib/serve/templates/config.ru
149
+ - lib/serve/templates/gitignore
150
+ - lib/serve/templates/hello.html.erb
151
+ - lib/serve/templates/index.redirect
152
+ - lib/serve/templates/view_helpers.rb
107
153
  - lib/serve/version.rb
108
154
  - lib/serve/view_helpers.rb
109
155
  - rails/init.rb
110
156
  - spec/application_spec.rb
157
+ - spec/project_spec.rb
111
158
  - spec/response_cache_spec.rb
112
- - spec/spec.opts
113
159
  - spec/spec_helper.rb
114
160
  has_rdoc: true
115
161
  homepage: http://github.com/jlong/serve
@@ -147,5 +193,6 @@ specification_version: 3
147
193
  summary: Serve is a small web server that makes it easy to serve ERB or HAML from any directory.
148
194
  test_files:
149
195
  - spec/application_spec.rb
196
+ - spec/project_spec.rb
150
197
  - spec/response_cache_spec.rb
151
198
  - spec/spec_helper.rb
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --colour