socks 0.0.7.beta → 0.0.8.beta

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ - 0.0.8.beta
2
+ * Bug fixes
3
+ * Cleanup
4
+
1
5
  - 0.0.7.beta
2
6
  * Got server running
3
7
  * Cleaned up app structure
data/README.md CHANGED
@@ -3,32 +3,52 @@
3
3
 
4
4
  [![Dependency Status](https://gemnasium.com/Beakr/socks.png)](https://gemnasium.com/Beakr/socks)
5
5
 
6
- Socks -- an experiment in Ruby programming by building a small Ruby microframework for the web.
6
+ Socks is a web framework and Ruby library supported by Rack for making complex or very simple webapps fast.
7
7
 
8
- ## Using Socks for your app
8
+ ## Why Socks?
9
9
 
10
- First, install the gem:
10
+ Socks is as simple as [Sinatra](), yet as complex/powerful as [Rails](). The goal is to be able to write a simple app quickly, and still retain enough power to keep complex/powerful apps going.
11
+
12
+ ## Installation
13
+
14
+ Choose the one that fits your need:
11
15
 
12
16
  ```sh
13
- $ gem install socks
17
+ $ gem install socks --pre # General, global install + command-line app
18
+ ```
19
+
20
+ ```ruby
21
+ gem 'socks' # For Gemfiles
22
+
23
+ gem.add_dependency "socks" # For your Gemspec
14
24
  ```
25
+ ## Quick Start
15
26
 
16
- And run:
27
+ First, create a new Socks app using:
17
28
 
18
29
  ```sh
19
- $ socks new my_app
30
+ $ socks new myapp
31
+ $ cd myapp
20
32
  ```
21
33
 
22
- You will recieve the latest directory skeleton and Socks tools to make your app.
34
+ Next, go to `config/router.rb` and paste in the following between the `Router = HttpROuter.new do ... end` statement:
23
35
 
24
- ## Running the server
36
+ ```ruby
37
+ get('/') { |env| [200, {'Content-type' => 'text/plain'}, ['This is my first Socks app!']] }
38
+ ```
25
39
 
26
- Start up a simple Rack Server on `localhost:4000` using:
40
+ Afterward, use:
27
41
 
28
42
  ```sh
29
43
  $ socks start
30
44
  ```
31
45
 
46
+ To spin up a web server on `localhost:4000`.
47
+
48
+ Take a look, you should see the following text appear in your web browser:
49
+
50
+ This is my first Socks app!
51
+
32
52
  ## Contributing
33
53
 
34
54
  1. Fork it
data/TODO.md CHANGED
@@ -1,7 +1,6 @@
1
1
  TODO
2
2
  ====
3
3
 
4
- * Make Rack actually render route contents
5
4
  * Add templates for erb, markdown, possibly HAML, etc.
6
5
  * Add assets with CSS or SASS support and Javascript and possibly Coffeescript
7
6
  support
data/bin/socks CHANGED
@@ -7,6 +7,8 @@ require 'fileutils'
7
7
 
8
8
  program :version, Socks::VERSION
9
9
  program :description, 'A Ruby-Rack-based microframework'
10
+
11
+ default_command :about
10
12
 
11
13
  command :new do |c|
12
14
  c.syntax = 'socks new [options]'
@@ -33,7 +35,7 @@ Bundler.setup
33
35
  require File.expand_path(\"../config/router.rb\", __FILE__)
34
36
 
35
37
  # Controllers
36
- Dir[\"#{app}/app/controllers\" + \"*.rb\"].each do |file|
38
+ Dir[\"../app/controllers\" + \"*.rb\"].each do |file|
37
39
  require file
38
40
  end
39
41
 
@@ -70,6 +72,10 @@ gem \"http_router\"
70
72
  # Use RSpec for tests
71
73
  gem \"rspec\""
72
74
 
75
+ rakefile = "# Socks generates many helpful Rake tasks for you!
76
+ require \"socks\"
77
+ Socks::Tasks.install"
78
+
73
79
  gitignore = ".DS_Store"
74
80
 
75
81
  procfile = "web: bundle exec rackup config.ru -p 4000"
@@ -93,7 +99,7 @@ end
93
99
  FileUtils.cd app
94
100
  FileUtils.mkdir %w( app config )
95
101
  FileUtils.mkdir %w( app/controllers app/views ) # Sub-dirs
96
- FileUtils.touch %w( config.ru Gemfile .gitignore Procfile )
102
+ FileUtils.touch %w( config.ru Gemfile Rakefile .gitignore Procfile )
97
103
 
98
104
  # -------------------------------------------------------------------------
99
105
  # File Initialization |
@@ -102,6 +108,8 @@ end
102
108
 
103
109
  system("echo '#{config_ru}' >> config.ru")
104
110
  system("echo '#{gemfile}' >> Gemfile")
111
+ system("echo '#{rakefile}' >> Rakefile")
112
+
105
113
  system("echo '#{gitignore}' >> .gitignore")
106
114
  system("echo '#{procfile}' >> Procfile")
107
115
 
@@ -109,6 +117,8 @@ end
109
117
 
110
118
  system("echo '#{router_template}' >> config/router.rb")
111
119
 
120
+ system("bundle")
121
+
112
122
  end
113
123
  end
114
124
 
@@ -143,6 +153,7 @@ command :start do |c|
143
153
  c.description = 'Startup a Rack server'
144
154
  c.action do |args, options|
145
155
  system('foreman start') # Startup server including code in lib/ that runs on port 4000
156
+ notify "Socks server is up"
146
157
  end
147
158
  end
148
159
 
@@ -154,6 +165,13 @@ command :version do |c|
154
165
  end
155
166
  end
156
167
 
168
+ command :about do |c|
169
+ c.syntax = 'socks about [options]'
170
+ c.action do |args, options|
171
+ system("echo \"\e[32m Usage: socks new APP_NAME\"")
172
+ end
173
+ end
174
+
157
175
  # -------------------------------------------------------------------------
158
176
  # Helpers |
159
177
  # -------------------------------------------------------------------------
@@ -0,0 +1,16 @@
1
+ # Content helpers are used for small responses with Rack (usually in router.rb) for rendering pure text, or HTML.
2
+
3
+ module Socks
4
+ class ContentHelpers
5
+
6
+ # A pure text formatting
7
+ def txt(str)
8
+ [200, {'Content-type' => 'text/plain'}, ["#{str}"]]
9
+ end
10
+
11
+ def html(str)
12
+ [200, {'Content-type' => 'text/html'}, ["#{str}"]]
13
+ end
14
+
15
+ end
16
+ end
data/lib/socks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Socks
2
- VERSION = "0.0.7.beta"
2
+ VERSION = "0.0.8.beta"
3
3
  end
data/lib/socks.rb CHANGED
@@ -1,6 +1,12 @@
1
+ #Dir.glob(File.dirname(__FILE__) + '/socks/*.rb', &method(:require))
1
2
  require "socks/version"
2
3
  require "socks/base_controller"
3
4
  require "socks/templates"
5
+ require "socks/content_helpers"
6
+
7
+ ## Tasks
8
+ #require File.expand_path("../socks/tasks.rb", __FILE__)
9
+ #require File.expand_path("../socks/rake_tasks.rb", __FILE__)
4
10
 
5
11
  module Socks
6
12
  end
data/socks.gemspec CHANGED
@@ -18,9 +18,11 @@ Gem::Specification.new do |gem|
18
18
  # Rack HTTP
19
19
  gem.add_dependency "rack"
20
20
  gem.add_dependency "http_router"
21
+ gem.add_dependency "commander" # For command-line app
21
22
 
22
23
  gem.add_development_dependency "rake"
23
24
  gem.add_development_dependency "rspec"
24
25
  gem.add_development_dependency "guard"
25
26
  gem.add_development_dependency "bundler"
27
+ gem.add_development_dependency "debugger"
26
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.beta
4
+ version: 0.0.8.beta
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-04-29 00:00:00.000000000 Z
12
+ date: 2012-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: commander
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rake
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +123,22 @@ dependencies:
107
123
  - - ! '>='
108
124
  - !ruby/object:Gem::Version
109
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: debugger
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
110
142
  description: An in-development web framework using Rack.
111
143
  email:
112
144
  - beakr@ninjanizr.com
@@ -127,6 +159,7 @@ files:
127
159
  - bin/socks
128
160
  - lib/socks.rb
129
161
  - lib/socks/base_controller.rb
162
+ - lib/socks/content_helpers.rb
130
163
  - lib/socks/templates.rb
131
164
  - lib/socks/version.rb
132
165
  - skel/config_ru