Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Can list lexers, namespaces renamings

  • Loading branch information...
commit d4d8b9fef3be221801f875bbacfa23f530a36ebb 1 parent 45f9266
Marc Lagrange authored
View
3  Gemfile.lock
@@ -4,6 +4,7 @@ PATH
yespaste (0.1)
activeresource
clint
+ json
mime-types
ruby-debug
@@ -22,6 +23,7 @@ GEM
clint (0.2.7)
columnize (0.3.2)
i18n (0.5.0)
+ json (1.4.6)
linecache (0.43)
mime-types (1.16)
ruby-debug (0.10.4)
@@ -36,6 +38,7 @@ PLATFORMS
DEPENDENCIES
activeresource
clint
+ json
mime-types
ruby-debug
yespaste!
View
3  lib/yespaste.rb
@@ -1,7 +1,7 @@
# encoding: utf-8
module YesPaste
- # Current client version
+ # Current client version
VERSION = "0.1"
end
@@ -15,6 +15,7 @@ module YesPaste
require 'pp'
require 'yespaste/cli'
+require 'yespaste/errors/ares'
require 'yespaste/cli/utils/config'
require 'yespaste/cli/commands/help'
require 'yespaste/cli/commands/lexers'
View
2  lib/yespaste/cli.rb
@@ -36,7 +36,7 @@ def self.run(args)
# yespaste lexers list
c.subcommand nil do |sub|
- c.subcommand YesPaste::CLI::Commands::Lexers::Command
+ c.subcommand YesPaste::CLI::Commands::Lexers
end
end # self.run
View
26 lib/yespaste/cli/commands/lexers.rb
@@ -1,13 +1,27 @@
# encoding: utf-8
-module YesPaste::CLI::Commands::Lexers
- class Command
+autoload :Paste, 'yespaste/resources'
+
+module YesPaste::CLI::Commands
+ class Lexers
def initialize(args)
@args = args
end
def self.list
- puts "Lexers List called: #{@args}"
- end
- end
-end
+ begin
+ lexers = Paste.get(:lexers)
+ rescue => e
+ puts "Woops, an error occured: #{e}"
+ end
+
+ lexers.each do |lexer|
+ puts "* #{lexer["fullname"]}"
+ puts " Keyword: #{lexer["keywrd"]}"
+ puts " Names: #{lexer["names"].join(",")}"
+ puts " Filename: #{lexer["filename"]}"
+ puts
+ end # lexers.each
+ end # self.list
+ end # Lexers
+end # YesPaste::CLI::Commands
View
1  lib/yespaste/cli/utils/config.rb
@@ -44,6 +44,7 @@ def check_config
$stderr.puts "Check config file!"
exit 1
end
+ # TODO: check required elements in config
end
def create_default_config
View
5 lib/yespaste/errors/ares.rb
@@ -0,0 +1,5 @@
+# encoding: utf-8
+
+class AresErrors
+ # Probably will be used in the future
+end
View
19 lib/yespaste/resources.rb
@@ -0,0 +1,19 @@
+require 'active_resource'
+
+class Paste < ActiveResource::Base
+ if $cfg["resource"]["user"] or $cfg["resource"]["password"]
+ self.user = $cfg["resource"]["user"]
+ self.password = $cfg["resource"]["password"]
+ end
+ self.site = $cfg["resource"]["site"]
+ self.timeout = $cfg["resource"]["timeout"]
+end
+
+class PasteFile < ActiveResource::Base
+ if $cfg["resource"]["user"] or $cfg["resource"]["password"]
+ self.user = $cfg["resource"]["user"]
+ self.password = $cfg["resource"]["password"]
+ end
+ self.site = $cfg["resource"]["site"]
+ self.timeout = $cfg["resource"]["timeout"]
+end
View
1  yespaste.gemspec
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('mime-types')
s.add_runtime_dependency('activeresource')
s.add_runtime_dependency('ruby-debug')
+ s.add_runtime_dependency('json')
end
Please sign in to comment.
Something went wrong with that request. Please try again.