socks 0.0.1.alpha → 0.0.5.alpha

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/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx-19mode
6
+ notifications:
7
+ recipients:
8
+ - main@seven7.flowdock.com
9
+ - beakr@ninjanizr.com
10
+ on_success: always
11
+ on_failure: always
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ - 0.0.5.alpha
2
+ * Executable created
3
+ * README creation and testing
4
+ * Bundler setup for dependency management
5
+
6
+ - 0.0.1.alpha
7
+ * Initial Creation
data/Guardfile ADDED
@@ -0,0 +1,19 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2, :cli => "--color --format documentation" do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+ # Capybara request specs
17
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
18
+ end
19
+
data/README.md CHANGED
@@ -1,29 +1,48 @@
1
1
  # Socks
2
+ [![Build Status](https://secure.travis-ci.org/Beakr/socks.png)](http://travis-ci.org/Beakr/socks)
2
3
 
3
- TODO: Write a gem description
4
+ [![Dependency Status](https://gemnasium.com/Beakr/socks.png)](https://gemnasium.com/Beakr/socks)
4
5
 
5
- ## Installation
6
+ Socks -- an experiment in Ruby programming by building a small Ruby microframework for the web.
6
7
 
7
- Add this line to your application's Gemfile:
8
+ ## Using Socks for your app
8
9
 
9
- gem 'socks'
10
+ First, install the gem:
10
11
 
11
- And then execute:
12
+ ```sh
13
+ $ gem install socks
14
+ ```
12
15
 
13
- $ bundle
16
+ And run:
14
17
 
15
- Or install it yourself as:
18
+ ```sh
19
+ $ socks new my_app
20
+ ```
16
21
 
17
- $ gem install socks
22
+ You will recieve the latest directory skeleton and Socks tools to make your app.
18
23
 
19
- ## Usage
24
+ ## Running the server
20
25
 
21
- TODO: Write usage instructions here
26
+ Start up a simple Rack Server on `localhost:4000` using:
27
+
28
+ ```sh
29
+ $ socks start
30
+ ```
22
31
 
23
32
  ## Contributing
24
33
 
25
34
  1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Added some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
35
+ 2. Create your feature branch `(git checkout -b my-new-feature)`
36
+ 3. Commit your changes `(git commit -am 'Added some feature')`
37
+ 4. Push to the branch `(git push origin my-new-feature)`
29
38
  5. Create new Pull Request
39
+
40
+ ## License
41
+
42
+ See LICENSE (MIT).
43
+
44
+ ## Thanks
45
+
46
+ I'd like to thank [Sickill](https://github.com/sickill) for his amazing Rack web framework tutorial. Without it, it would be a much harder time getting Socks to work!
47
+
48
+ ### *Thanks for using Socks!*
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ task :default => [ :spec ]
6
+
7
+ desc 'Run RSpec tests'
8
+ RSpec::Core::RakeTask.new
data/bin/socks CHANGED
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'commander/import'
5
+ require 'socks'
6
+ require 'fileutils'
7
+
8
+ program :version, Socks::VERSION
9
+ program :description, 'A Ruby-Rack-based microframework'
10
+
11
+ command :new do |c|
12
+ c.syntax = 'socks new [options]'
13
+ c.summary = 'Create a new Socks app'
14
+ c.description = 'Use Rack and other utilities to make a new Socks app from scratch'
15
+ c.action do |args, opt|
16
+
17
+ # Pull out the first arg in args[]
18
+ app = args[0]
19
+
20
+ # -------------------------------------------------------------------------
21
+ # File Contents |
22
+ # -------------------------------------------------------------------------
23
+
24
+ config_ru = "# config.ru is used for running rack-based applications. Please do not edit this file without proper understanding of Rack
25
+ # or some bad things may happen.
26
+
27
+ require \"#{app}\"
28
+
29
+ # Bundler setup
30
+ require 'bundler'
31
+ Bundler.setup
32
+ Bundler.require
33
+
34
+ # Used so Rack can automatically get updated to file contents without
35
+ # a ten second cooldown
36
+ use Rack::Reloader, 0
37
+
38
+ # Used for automatically getting stylesheet and javascript data into
39
+ # your markup templates, as well as running the app.
40
+ run Rack::Cascade.new([Rack::File.new('assets'), #{app.capitalize}])"
41
+
42
+ gemfile = "# List dependencies for your app in your Gemfile, then run the `bundle` command
43
+
44
+ source \"http://rubygems.org\"
45
+
46
+ # Socks itself!
47
+ gem \"socks\", \"~> #{Socks::VERSION}\"
48
+
49
+ # Rack HTTP
50
+ gem \"rack\"
51
+
52
+ # Startup your server with thin
53
+ gem \"thin\"
54
+
55
+ # Or use Foreman
56
+ # gem \"foreman\"
57
+
58
+ # Use Usher for routes (required)
59
+ gem 'usher'
60
+
61
+ # Use Warden for authentication
62
+ # gem \"warden\"
63
+
64
+ # Use RSpec for tests
65
+ gem \"rspec\""
66
+
67
+ gitignore = ".DS_Store"
68
+
69
+ app_template = "require \"socks\""
70
+
71
+ # -------------------------------------------------------------------------
72
+ # Creation |
73
+ # -------------------------------------------------------------------------
74
+
75
+ FileUtils.mkdir app
76
+ FileUtils.cd app
77
+ FileUtils.mkdir %w( views assets app )
78
+ FileUtils.touch "#{app}.rb"
79
+ FileUtils.touch %w( config.ru Gemfile .gitignore )
80
+
81
+ # -------------------------------------------------------------------------
82
+ # File Initialization |
83
+ # -------------------------------------------------------------------------
84
+
85
+
86
+ system("echo '#{config_ru}' >> config.ru")
87
+ system("echo '#{gemfile}' >> Gemfile")
88
+ system("echo '#{gitignore}' >> .gitignore")
89
+
90
+ system("echo '#{app_template}' >> #{app}.rb")
91
+
92
+ end
93
+ end
94
+
95
+ command :start do |c|
96
+ c.syntax = 'socks start [options]'
97
+ c.description = 'Startup a Rack server'
98
+ c.action do |args, options|
99
+ system('rackup -Ilib -p 4000') # Startup server including code in lib/ that runs on port 4000
100
+ end
101
+ end
102
+
103
+ command :version do |c|
104
+ c.syntax = 'socks version [options]'
105
+ c.description = 'Display the current version (altertative to --version)'
106
+ c.action do |args, options|
107
+ Socks::VERSION
108
+ end
109
+ end
110
+
@@ -0,0 +1,10 @@
1
+ require 'erb'
2
+
3
+ module Socks
4
+ class Templates
5
+ def erb(temp)
6
+ path = File.expand_path("../../views/#{temp}.erb", __FILE__)
7
+ ERB.new(temp).result(binding)
8
+ end
9
+ end
10
+ end
data/lib/socks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Socks
2
- VERSION = "0.0.1.alpha"
2
+ VERSION = "0.0.5.alpha"
3
3
  end
data/lib/socks.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "socks/version"
2
+ require "socks/templates"
2
3
 
3
4
  module Socks
4
5
  end
data/socks.gemspec CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/socks/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Chris Clarke"]
6
6
  gem.email = ["beakr@ninjanizr.com"]
7
- gem.description = %q{An experiment and web microframework for Ruby using Rack.}
7
+ gem.description = %q{An in-development web framework using Rack.}
8
8
  gem.summary = %q{A WIP web microframework for Ruby using Rack.}
9
9
  gem.homepage = ""
10
10
 
@@ -14,4 +14,13 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "socks"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Socks::VERSION
17
+
18
+ # Rack HTTP
19
+ gem.add_dependency "rack"
20
+ gem.add_dependency "usher"
21
+
22
+ gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "rspec"
24
+ gem.add_development_dependency "guard"
25
+ gem.add_development_dependency "bundler"
17
26
  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.1.alpha
4
+ version: 0.0.5.alpha
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,105 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-27 00:00:00.000000000 Z
13
- dependencies: []
14
- description: An experiment and web microframework for Ruby using Rack.
12
+ date: 2012-04-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: usher
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: An in-development web framework using Rack.
15
111
  email:
16
112
  - beakr@ninjanizr.com
17
113
  executables:
@@ -20,12 +116,16 @@ extensions: []
20
116
  extra_rdoc_files: []
21
117
  files:
22
118
  - .gitignore
119
+ - .travis.yml
120
+ - CHANGELOG
23
121
  - Gemfile
122
+ - Guardfile
24
123
  - LICENSE
25
124
  - README.md
26
125
  - Rakefile
27
126
  - bin/socks
28
127
  - lib/socks.rb
128
+ - lib/socks/templates.rb
29
129
  - lib/socks/version.rb
30
130
  - socks.gemspec
31
131
  homepage: ''