socks 0.2.10.beta → 0.2.11.beta

Sign up to get free protection for your applications and to get access to all the features.
data/bin/socks CHANGED
@@ -1,23 +1,34 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
- require 'commander/import'
3
+ require 'rubygems' # Only needed for early versions.
4
+ require 'commander/import' # Commander
5
+
6
+ # Socks
5
7
  require 'socks'
8
+ require 'socks/version'
9
+ require 'socks/helpers'
10
+
11
+ # For mkdir(), cd(), touch(), etc.
6
12
  require 'fileutils'
7
13
 
8
- program :version, Socks::VERSION
14
+
15
+ program :version, '0.2.10.beta'
9
16
  program :description, 'A Ruby-Rack-based microframework'
10
17
 
11
- default_command :about
18
+ default_command :about # Set default command to show the Socks 'about' page.
12
19
 
13
20
  command :new do |c|
14
21
  c.syntax = 'socks new [options]'
15
22
  c.summary = 'Create a new Socks app'
16
23
  c.description = 'Use Rack and other utilities to make a new Socks app from scratch'
17
- c.action do |args, opt|
24
+
25
+ c.action do |args, opts|
26
+
27
+ # Helpers!
28
+ include Socks::Helpers
18
29
 
19
- # Pull out the first arg in args[]
20
- app = args[0]
30
+ # Pull out the first arg in args[...]
31
+ app = args[0] # This is the app name.
21
32
 
22
33
  # -------------------------------------------------------------------------
23
34
  # File Contents |
@@ -45,7 +56,7 @@ use Rack::Reloader, 0
45
56
 
46
57
  # Used to run your router (app!)
47
58
  # Go to config/router.rb to declare routes
48
- run #{app.capitalize}::Router"
59
+ run #{to_class(app.capitalize)}::Router"
49
60
 
50
61
  gemfile = "# List dependencies for your app in your Gemfile, then run the `bundle` command
51
62
 
@@ -95,7 +106,7 @@ require File.expand_path(\"../lib/custom_tasks.rb\", __FILE__)"
95
106
  require \"http_router\"
96
107
  require \"socks\"
97
108
 
98
- module #{app.capitalize}
109
+ module #{to_class(app.capitalize)}
99
110
  Router = HttpRouter.new do
100
111
 
101
112
  # See what you can do at https://github.com/joshbuddy/http_router
@@ -197,6 +208,7 @@ end
197
208
  system("echo '#{cont_template}' >> app/controllers/#{cont}_controller.rb")
198
209
 
199
210
  end
211
+
200
212
  end
201
213
 
202
214
  command :start do |c|
@@ -224,6 +236,14 @@ command :version do |c|
224
236
  end
225
237
  end
226
238
 
239
+ command :update do |c|
240
+ c.syntax = 'socks update [options]'
241
+ c.description = 'Updated Socks'
242
+ c.action do |args, opts|
243
+ system('gem update socks')
244
+ end
245
+ end
246
+
227
247
  command :about do |c|
228
248
  c.syntax = 'socks about [options]'
229
249
  c.action do |args, options|
@@ -5,6 +5,8 @@ require "socks/helpers"
5
5
 
6
6
  require "socks/tasks/rake_tasks"
7
7
 
8
+ # TODO: Move the above below the module definition.
9
+
8
10
  module Socks
9
11
 
10
12
  def self.config
@@ -15,4 +17,4 @@ module Socks
15
17
  config.configure attr, &block
16
18
  end
17
19
 
18
- end
20
+ end
@@ -4,6 +4,8 @@
4
4
  # end
5
5
  #
6
6
 
7
+ # TODO: Get this working!
8
+
7
9
  module Socks
8
10
  class Config
9
11
 
@@ -1,6 +1,15 @@
1
1
  require 'socks/tasks/rake_tasks'
2
2
 
3
3
  module Socks
4
- class Helpers
4
+ module Helpers
5
+
6
+ def to_class(str)
7
+ str.gsub(/(_|-)/, '') # At least it gets rid of _ and - for now.
8
+ end
9
+
10
+ def shell(code)
11
+ system(code)
12
+ end
13
+
5
14
  end
6
15
  end
@@ -4,7 +4,7 @@ module Socks
4
4
 
5
5
  # This class is used as helpers, misc methods, etc. for the App:Router class
6
6
  # generated in your app.
7
- class Router
7
+ module Router
8
8
  include Socks::RouterHelpers
9
9
  end
10
10
  end
@@ -10,7 +10,7 @@ module Socks
10
10
  # @param [String] The string to display
11
11
  # @return [text] The text rendered onto the screen
12
12
  def txt(str)
13
- return [200, {'Content-type' => 'text/plain'}, ["#{str}"]]
13
+ [200, {'Content-type' => 'text/plain'}, [str]]
14
14
  end
15
15
 
16
16
  end
@@ -1,6 +1,26 @@
1
1
  require 'rake'
2
+ require 'socks/helpers'
2
3
 
3
- desc 'Run your RSpec tests'
4
- task :test do
5
- sh 'rspec .'
4
+ desc 'About Socks'
5
+ task :about do
6
+
7
+ puts "Socks is a small, elegant, and simple framework for making web-apps using"
8
+ puts "Ruby, Rack, and many other various Gems."
9
+
10
+ puts ""
11
+
12
+ puts "Socks started out as a small experiment (originally called simple_rack)"
13
+ puts "that supplied a few methods for making apps."
14
+
15
+ puts ""
16
+
17
+ puts "Now that I've found so many interesting gems and resources, Socksc cont-"
18
+ puts "inues to retain in development, now with much more than ever planned!"
19
+
6
20
  end
21
+
22
+ desc 'Run your RSpec tests'
23
+ task(:test) { system('rspec .') }
24
+
25
+ desc 'View your todos using do_it'
26
+ task(:todos) { system('do_it') }
@@ -1,6 +1,5 @@
1
1
  module Socks
2
2
 
3
- # The current version of Socks
4
- VERSION = "0.2.10.beta"
3
+ VERSION = '0.2.11.beta'
5
4
 
6
5
  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.2.10.beta
4
+ version: 0.2.11.beta
5
5
  prerelease: 7
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-05-06 00:00:00.000000000 Z
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack