cheatorious 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx-2.0
6
+ - jruby
7
+ - ruby-head
8
+ - ree
data/GEM_VERSION ADDED
@@ -0,0 +1 @@
1
+ v0.0.0+2
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Cheatorious
2
+
3
+ generator of simple, searchable, command line cheatsheets
4
+
5
+ This gem is not ready yet, more info comming soon...
@@ -0,0 +1,36 @@
1
+ # encoding: UTF-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ version_file = File.expand_path "../GEM_VERSION", __FILE__
6
+ File.delete version_file if File.exists? version_file
7
+
8
+ require 'step-up'
9
+ require 'cheatorious'
10
+
11
+ Gem::Specification.new do |s|
12
+ s.name = "cheatorious"
13
+ s.version = Cheatorious::VERSION
14
+ s.platform = Gem::Platform::RUBY
15
+ s.summary = "generator of simple, searchable, command line cheatsheets"
16
+ s.require_paths = ['lib']
17
+ excepts = %w[
18
+ .gitignore
19
+ cheatsheets.gemspec
20
+ Gemfile
21
+ Gemfile.lock
22
+ Rakefile
23
+ ]
24
+ tests = `git ls-files -- {script,test}/*`.split("\n")
25
+ s.files = `git ls-files`.split("\n") - excepts - tests + %w[GEM_VERSION]
26
+
27
+ s.author = "Luis Cipriani"
28
+ s.email = "lfcipriani@gmail.com"
29
+ s.homepage = "https://github.com/abril/cheatorious"
30
+
31
+ # s.add_dependency('dependency', '>= 1.0.0')
32
+
33
+ # s.add_development_dependency('cover_me')
34
+ # s.add_development_dependency('ruby-debug19')
35
+ s.add_development_dependency('step-up')
36
+ end
File without changes
@@ -0,0 +1,102 @@
1
+ module Cheatorious
2
+ class CheatSheet
3
+
4
+ class << self
5
+ def compile(name, &block)
6
+ c = self.new(name, &block)
7
+ c.compile!
8
+ end
9
+ end
10
+
11
+ attr_reader :name
12
+
13
+ def initialize(name, &block)
14
+ @name = name
15
+ @block = block
16
+ @keys = {}
17
+ @cheat_hash = {
18
+ :cheatsheet => {
19
+ :root => {}
20
+ }
21
+ }
22
+ @current_section = @cheat_hash[:cheatsheet][:root]
23
+ @separator = ""
24
+ end
25
+
26
+ def compile!
27
+ self.instance_eval(&@block)
28
+ return @cheat_hash
29
+ end
30
+
31
+ def description(info)
32
+ root["description"] = info
33
+ end
34
+
35
+ def version(numbers)
36
+ root["version"] = numbers.to_s
37
+ end
38
+
39
+ def author(*args)
40
+ root["author"] = args
41
+ end
42
+
43
+ def key_separator(separator)
44
+ @separator = separator
45
+ end
46
+
47
+ def key(identifier, value)
48
+ @keys[identifier] = value
49
+ end
50
+
51
+ def section(name, &block)
52
+ @current_section[:sections] = {} unless @current_section.key?(:sections)
53
+ @current_section[:sections][name] = {} unless @current_section[:sections].key?(name)
54
+ parent_section = @current_section
55
+ @current_section = @current_section[:sections][name]
56
+
57
+ self.instance_eval(&block)
58
+
59
+ @current_section = parent_section
60
+ end
61
+
62
+ def ___(name, *values)
63
+ @current_section[:entries] = {} unless @current_section.key?(:entries)
64
+ @current_section[:entries][name] = [] unless @current_section[:entries].key?(name)
65
+ values.each do |v|
66
+ @current_section[:entries][name] << v
67
+ end
68
+ end
69
+
70
+ def method_missing(method, *args)
71
+ method_name = method.to_s
72
+
73
+ if method_name.start_with?("_")
74
+ method_name = method_name[/_(.*)/,1].to_sym
75
+ return @keys[method_name] + (args[0].nil? ? "" : @separator + args[0].to_s) if @keys.key?(method_name)
76
+ end
77
+
78
+ super
79
+ end
80
+
81
+ private
82
+
83
+ def root
84
+ @cheat_hash
85
+ end
86
+
87
+ def sheet
88
+ @cheat_hash[:cheatsheet]
89
+ end
90
+
91
+ end
92
+ end
93
+
94
+ # hash = {
95
+ # "description" => "bla",
96
+ # "cheatsheet" => {
97
+ # :root => {
98
+ # :entries => { "Save File" => [":w"] },
99
+ # :sections => { "files" => {} }
100
+ # }
101
+ # }
102
+ # }
@@ -0,0 +1,19 @@
1
+ # encoding: UTF-8
2
+ module Cheatorious
3
+ module VERSION #:nodoc:
4
+ version = nil
5
+ version_file = ::File.expand_path('../../../GEM_VERSION', __FILE__)
6
+ version = File.read(version_file) if ::File.exists?(version_file)
7
+ if version.nil? && ::File.exists?(::File.expand_path('../../../.git', __FILE__))
8
+ version = ::StepUp::Driver::Git.new.last_version_tag("HEAD", true) rescue "v0.0.0+0"
9
+ ::File.open(version_file, "w"){ |f| f.write version }
10
+ end
11
+
12
+ STRING = version.gsub(/^v([^\+]+)\+?\d*$/, '\1')
13
+ MAJOR, MINOR, PATCH, TINY = STRING.scan(/\d+/)
14
+
15
+ def self.to_s
16
+ STRING
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: UTF-8
2
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__))
3
+
4
+ # Dependencies
5
+ require "rubygems"
6
+ require "bundler/setup"
7
+
8
+ # Gem requirements
9
+ module Cheatorious
10
+ autoload :CheatSheet, "cheatorious/cheatsheet"
11
+ autoload :VERSION , 'cheatorious/version'
12
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: UTF-8
2
+ namespace :gem_name do
3
+ desc 'task description'
4
+ task :utils => :environment do
5
+ # this task loads up the gem environment
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cheatorious
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Luis Cipriani
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: step-up
16
+ requirement: &2152980340 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2152980340
25
+ description:
26
+ email: lfcipriani@gmail.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - .travis.yml
32
+ - README.md
33
+ - cheatorious.gemspec
34
+ - lib/cheatorious.rb
35
+ - lib/cheatorious/.gitkeep
36
+ - lib/cheatorious/cheatsheet.rb
37
+ - lib/cheatorious/version.rb
38
+ - lib/tasks/task_sample.rake
39
+ - GEM_VERSION
40
+ homepage: https://github.com/abril/cheatorious
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ segments:
53
+ - 0
54
+ hash: -2831247960477896023
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 1.8.10
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: generator of simple, searchable, command line cheatsheets
67
+ test_files: []