work-bench 1.0.4 → 1.0.5

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/.gitignore CHANGED
@@ -1,8 +1,10 @@
1
1
  *.gem
2
2
  .bundle
3
+ .sass-cache/
3
4
  Gemfile.lock
4
5
  .DS_Store
5
6
  /pkg
6
7
  /.idea
7
8
  /doc
8
9
  /.yardoc
10
+ TODO
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Workbench
2
2
 
3
- Workbench is a quick and simple local web server for prototyping web applications and sites.
3
+ Workbench is a quick and simple local web server for prototyping web applications and sites. It support HAML, SASS and Compass out the box.
4
4
 
5
5
  ## Install
6
6
 
@@ -24,6 +24,8 @@ Inside project directory run:
24
24
 
25
25
  workbench start
26
26
 
27
+ Now type in the browser `http://localhost:4000`. And you will see the start page.
28
+
27
29
  ## Export prototype
28
30
 
29
31
  You can export your work using:
@@ -44,8 +46,11 @@ You can specify the JS libraries to be used in your project.
44
46
 
45
47
  The list of libraries available:
46
48
 
47
- workbench js --list
49
+ workbench js
50
+
51
+ ## normalize.css
52
+
53
+ You may add awesome [normalize.css](https://github.com/jonathantneal/normalize.css) to project. Just use `--normalize` or `--no-normalize` in options. This feature is **enable** by default.
48
54
 
49
- For add JS libraries to existing project in project dir type:
55
+ workbench init --normalize
50
56
 
51
- workbench js --js json
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -10,66 +10,61 @@ module Workbench
10
10
  File.join(File.dirname(__FILE__), '..', '..', 'template')
11
11
  end
12
12
 
13
- def self.destination_root
14
- $root
15
- end
16
-
17
- desc 'start [--port] [--workers]', 'Start server in current directory'
13
+ desc 'start [PATH] [--port] [--workers]', 'Start server in current directory'
18
14
  long_desc 'Start server in current directory'
19
15
  method_option :port, :aliases => '-p', :type => :numeric, :default => 4000, :desc => 'Port'
20
16
  method_option :workers, :aliases => '-w', :type => :numeric, :default => 4, :desc => 'Workers'
21
- def start
17
+ def start path = '.'
18
+ $root = File.expand_path path
22
19
  puts 'Starting HTTP server...'
23
-
24
- app = Workbench::Application.new
25
- app.start options[:port], options[:workers]
26
-
20
+ app = Workbench::Application.new
21
+ app.start options[:port], options[:workers]
27
22
  end
28
23
 
29
- desc 'init [--js=frameworks]', 'Initialize empty project in current directory'
24
+ desc 'init [PATH] [--js=frameworks]', 'Initialize empty project in current directory'
30
25
  long_desc 'Initialize empty project in current directory'
31
26
  method_option :js, :type => :array, :default => ['jquery'], :desc => 'Install specific JS frameworks', :banner => 'jquery jquery-ui json'
32
- def init
27
+ method_option :normalize, :type => :boolean, :default => true, :desc => 'Add _normalize.css (https://github.com/jonathantneal/normalize.css)'
28
+ def init path = '.'
33
29
  puts 'Create empty project'
30
+
31
+ self.destination_root = File.expand_path path
32
+ empty_directory path unless '.' == path
33
+
34
34
  empty_directory 'haml'
35
35
  empty_directory 'sass'
36
36
  empty_directory 'public/css'
37
37
  empty_directory 'public/js'
38
38
  empty_directory 'public/img'
39
39
 
40
- copy_file '_normalize.scss', 'sass/_normalize.scss'
40
+ if options[:normalize]
41
+ copy_file '_normalize.scss', 'sass/_normalize.scss'
42
+ end
41
43
 
42
44
  unless options[:js].include? 'jquery'
43
45
  options[:js].push('jquery')
44
46
  end
45
47
 
46
- invoke :js
48
+ js_libs = Workbench::JSLibs.list
49
+ options[:js].each do |js|
50
+ if js_libs[js]
51
+ get js_libs[js], "public/js/#{File.basename(js_libs[js])}"
52
+ end
53
+ end unless options[:js].empty?
47
54
 
48
55
  copy_file 'scripts.js', 'public/js/scripts.js'
49
- copy_file 'style.sass', 'sass/style.sass'
50
- copy_file 'index.haml', 'haml/index.haml'
56
+ template 'style.sass', 'sass/style.sass'
57
+ template 'index.haml', 'haml/index.haml'
51
58
  copy_file 'Gemfile', 'Gemfile'
52
- copy_file '.rvmrc', '.rvmrc'
53
59
  end
54
60
 
55
- desc 'js [--js=frameworks]', 'Add javascript library to project'
56
- method_option :js, :type => :array, :desc => 'Install specific JS frameworks', :banner => 'jquery jquery-ui json'
57
- method_option :list, :default => false, :desc => 'Show available frameworks', :banner => ''
61
+ desc 'js', 'Show available frameworks'
58
62
  def js
59
63
  js_libs = Workbench::JSLibs.list
60
-
61
- if options[:list]
62
- puts 'Available JS library'
63
- js_libs.each do |index, item|
64
- puts " * #{index} => #{item}"
65
- end
66
- else
67
- options[:js].each do |js|
68
- if js_libs[js]
69
- get js_libs[js], "public/js/#{File.basename(js_libs[js])}"
70
- end
71
- end if options[:js]
72
- end
64
+ puts 'Available JS library'
65
+ js_libs.each do |index, item|
66
+ puts " * #{index} => #{item}"
67
+ end
73
68
  end
74
69
 
75
70
  desc 'export [PATH]', 'Export project'
@@ -1,3 +1,3 @@
1
1
  module Workbench
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
data/template/index.haml CHANGED
@@ -2,10 +2,14 @@
2
2
  %html
3
3
  %head
4
4
  %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
5
- %title Проект
6
- %link{:href => "/css/style.css", :media => "all", :rel => "stylesheet", :type => "text/css"}
7
- %script{:src => "/js/jquery.js", :type => "text/javascript"}
5
+ %title Example project
6
+ <%- l = Workbench::JSLibs.list -%>
7
+ <%- unless options[:js].empty? then -%>
8
+ <%- options[:js].each do |lib| -%>
9
+ %script{:src => "/js/<%= File.basename(l[lib]) %>", :type => "text/javascript"}
10
+ <%- end -%>
11
+ <%- end -%>
8
12
  %script{:src => "/js/scripts.js", :type => "text/javascript"}
13
+ %link{:href => "/css/style.css", :media => "all", :rel => "stylesheet", :type => "text/css"}
9
14
  %body
10
-
11
- %h1 Hi man!
15
+ %h1 Hi there!
data/template/scripts.js CHANGED
@@ -1,3 +0,0 @@
1
- $(function(){
2
- // You code here
3
- });
data/template/style.sass CHANGED
@@ -1,2 +1,2 @@
1
1
  @import compass
2
- @import normalize
2
+ <% if options[:normalize] then %>@import normalize<% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work-bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard
16
- requirement: &70316211536420 !ruby/object:Gem::Requirement
16
+ requirement: &70109725946080 !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: :development
23
23
  prerelease: false
24
- version_requirements: *70316211536420
24
+ version_requirements: *70109725946080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: maruku
27
- requirement: &70316211535980 !ruby/object:Gem::Requirement
27
+ requirement: &70109725945620 !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: :development
34
34
  prerelease: false
35
- version_requirements: *70316211535980
35
+ version_requirements: *70109725945620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70316211535440 !ruby/object:Gem::Requirement
38
+ requirement: &70109725945120 !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: *70316211535440
46
+ version_requirements: *70109725945120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack-test
49
- requirement: &70316211535000 !ruby/object:Gem::Requirement
49
+ requirement: &70109725944700 !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: *70316211535000
57
+ version_requirements: *70109725944700
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: unicorn
60
- requirement: &70316211534460 !ruby/object:Gem::Requirement
60
+ requirement: &70109725944160 !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: *70316211534460
68
+ version_requirements: *70109725944160
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: haml
71
- requirement: &70316211534000 !ruby/object:Gem::Requirement
71
+ requirement: &70109725943660 !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: *70316211534000
79
+ version_requirements: *70109725943660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: compass
82
- requirement: &70316211533460 !ruby/object:Gem::Requirement
82
+ requirement: &70109725943120 !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: *70316211533460
90
+ version_requirements: *70109725943120
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rack-cache
93
- requirement: &70316211532840 !ruby/object:Gem::Requirement
93
+ requirement: &70109725942540 !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: *70316211532840
101
+ version_requirements: *70109725942540
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rack-contrib
104
- requirement: &70316211530980 !ruby/object:Gem::Requirement
104
+ requirement: &70109725940600 !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: *70316211530980
112
+ version_requirements: *70109725940600
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: thor
115
- requirement: &70316211530500 !ruby/object:Gem::Requirement
115
+ requirement: &70109725940140 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70316211530500
123
+ version_requirements: *70109725940140
124
124
  description: A quick and simple local web server for prototyping web applications
125
125
  with HAML, SASS and Compass support.
126
126
  email: konstantin.savelyev@gmail.com
@@ -145,7 +145,6 @@ files:
145
145
  - lib/work_bench/renderer.rb
146
146
  - lib/work_bench/server.rb
147
147
  - lib/work_bench/version.rb
148
- - template/.rvmrc
149
148
  - template/Gemfile
150
149
  - template/_normalize.scss
151
150
  - template/index.haml
data/template/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.2