ric 0.9.1 → 0.9.4c

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY ADDED
@@ -0,0 +1,3 @@
1
+ # would like to have this in YML format :)
2
+ 2011-01-16 v0.9.2:
3
+ - Added uniquify from rbates just to copy it.
data/Manifest CHANGED
@@ -1,28 +1,14 @@
1
+ HISTORY
1
2
  Manifest
2
3
  README
3
4
  Rakefile
4
5
  TODO
5
6
  bin/ric
6
7
  docs/journal.txt
7
- images/desktop/linux-lightbulb.png
8
- images/icons/database/db-commit.png
9
- images/icons/development/application.png
10
- images/icons/development/grave.png
11
- images/icons/development/iFuck.png
12
- images/icons/development/ontology.png
13
- images/icons/development/pointers.png
14
- images/icons/development/svn.png
15
- images/icons/development/tools.png
16
- images/icons/disks/Ric 120GB.ico
17
- images/icons/linux/ldap.png
18
- images/icons/privacy.png
19
- images/icons/social/facebook_64.png
20
- images/icons/social/linkedin_64.png
21
- images/icons/social/rss_64.png
22
- images/icons/social/twitter_64.png
23
- images/icons/tux/scientific.png
8
+ init.rb
24
9
  lib/helpers/rails_helper.rb
10
+ lib/ric.rb
11
+ lib/ric/colors.rb
25
12
  lib/ric/html.rb
26
- lib/ric_colors.rb
27
- lib/riclib.rb
13
+ lib/uniquify.rb
28
14
  var/www/index.html
data/Rakefile CHANGED
@@ -1,19 +1,17 @@
1
-
2
1
  require 'rubygems'
3
2
  require 'rake'
4
3
  require 'echoe'
5
4
 
6
- # from here: http://buzaz.com/index.php/2010/01/03/how-to-build-a-ruby-gem/
7
-
8
- Echoe.new('ric', '0.9.1') do |p|
9
- p.description = "My firstgem with various utilities (colors and tests now).
5
+ Echoe.new('ric', '0.9.4c') do |p|
6
+ p.description = "My first gem with various utilities (colors and tests now).
10
7
  My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence
11
8
  with hence!)"
12
9
  p.url = "http://github.com/palladius/riclib"
13
10
  p.author = "Riccardo Carlesso"
14
11
  p.email = "['p','ll','diusbonton].join('a') @ gmail.com"
15
12
  p.ignore_pattern = ["tmp/*", "script/*",
16
- "images/*/*/*jpg", "images/*/*jpg", "*.jpg" , 'images',
17
- "private/*"]
18
- p.development_dependencies = []
13
+ "images/*/*/*", "images/*/*", 'images',
14
+ "private/*"
15
+ ]
16
+ p.development_dependencies = [ ]
19
17
  end
data/init.rb ADDED
@@ -0,0 +1,13 @@
1
+ #require 'lib/ric/color'
2
+ require 'uniquify'
3
+ require 'ric'
4
+ include Ric
5
+
6
+
7
+ #require 'rails_stuff'
8
+ #require 'doesnt_exist'
9
+ #require File.expand_path('lib/ric/colors.rb', File.dirname( __FILE__) )
10
+ #require File.expand_path('ric/html.rb', File.dirname( __FILE__) )
11
+ #require File.expand_path('helpers/rails_helper.rb', File.dirname( __FILE__) )
12
+
13
+ puts "ric: Welcome to Riccardo Carlesso first gem :)"
data/lib/ric.rb ADDED
@@ -0,0 +1,48 @@
1
+
2
+ # RICLIB!
3
+ module Ric
4
+
5
+ #include Ric::Colors
6
+
7
+ def self.say_hello
8
+ puts 'Riclib: hello world'
9
+ end
10
+
11
+
12
+ def self.ric_help
13
+ ret <<-HTML
14
+ == Ric (formerly RicLib) ==
15
+ This is Riccardo library (my first gem!). Try the following commands maybe
16
+ Try some of the following:
17
+
18
+ pred 'This is in red'
19
+ pyellow 'This is yellow instead'
20
+
21
+ HTML
22
+ puts( ret )
23
+ ret
24
+ end
25
+ #alias :help :ric_help
26
+ #alias :about :ric_help
27
+
28
+ def self.version
29
+ '(Wet) 0.9.1' # its NOT dry (yet)! Someone help with Gem version!
30
+ end
31
+
32
+ def load_libs
33
+ green(:ok)
34
+ end
35
+
36
+ # you can require more than one gem and a symbol as well :)
37
+ def richiedi(gems)
38
+ puts "Riccardo personal super-'require'.. "
39
+ case gems.class.to_s
40
+ when 'String'
41
+ return require gems
42
+ when 'Array'
43
+ return require gems
44
+ else
45
+ return require gems.to_s
46
+ end
47
+ end
48
+ end
File without changes
data/lib/ric/html.rb CHANGED
@@ -1,5 +1,37 @@
1
1
  module Ric::Html
2
2
 
3
+ def test
4
+ anything_to_html({:note => 'remove me', :foo => :bar } )
5
+ end
6
+
7
+ # REMOVE ME!
8
+ def anything_to_html(son,opts={})
9
+ ret = '(RailsHelper :: anything_to_html)' if opts.fetch(:verbose,true) # TODO change dflt to false
10
+ if opts != {}
11
+ ret << "(Options: " + anything_to_html(opts) + ")"
12
+ end
13
+ if son.class == Array
14
+ ret << "<ul class='subtopic' >"
15
+ son.each{|subtopic|
16
+ ret << content_tag(:li, anything_to_html(subtopic).html_safe ) # '- ' +
17
+ }
18
+ ret << "</ul>"
19
+ elsif son.class == Hash
20
+ #ret << hash_to_html(son)
21
+ ret += '<ul class="maintopic" >'
22
+ son.each{ |k,val|
23
+ ret << content_tag(:li, ( anything_to_html(k) + ' => ' + anything_to_html(val) ).html_safe )
24
+ }
25
+ ret << "</ul>"
26
+ elsif son.class == String
27
+ ret << "<font color='navy' class='ricclass_string' >#{son}</font>"
28
+ elsif son.class == Symbol
29
+ ret << "<i><font color='gray' class='ricclass_symbol' >:#{son}</font></i>"
30
+ else
31
+ ret << "(Unknown Class: #{son.class}) <b>#{son}</b>"
32
+ end
33
+ ret.html_safe
34
+ end
3
35
 
4
36
 
5
37
  end #/RicHtml
data/lib/uniquify.rb ADDED
@@ -0,0 +1,50 @@
1
+ # copied from RBates
2
+ # http://railscasts.com/episodes/135-making-a-gem
3
+
4
+ module Uniquify
5
+
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ def ensure_unique(name)
11
+ begin
12
+ self[name] = yield
13
+ end while self.class.exists?(name => self[name])
14
+ end
15
+
16
+ module ClassMethods
17
+
18
+ def uniquify(*args, &block)
19
+ options = { :length => 8, :chars => ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a }
20
+ options.merge!(args.pop) if args.last.kind_of? Hash
21
+ args.each do |name|
22
+ before_create do |record|
23
+ if block
24
+ record.ensure_unique(name, &block)
25
+ else
26
+ record.ensure_unique(name) do
27
+ Array.new(options[:length]) { options[:chars].to_a[rand(options[:chars].to_a.size)] }.join
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ end
35
+ end
36
+
37
+ class ActiveRecord::Base
38
+ include Uniquify
39
+
40
+ # returns an array of ids
41
+ def self.ids
42
+ map{|active_record| active_record.id }
43
+ end
44
+
45
+ def self.names
46
+ map{|active_record| active_record.name.to_s rescue active_record.to_s }
47
+ end
48
+
49
+ end
50
+
data/ric.gemspec CHANGED
@@ -2,25 +2,25 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ric}
5
- s.version = "0.9.1"
5
+ s.version = "0.9.4c"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Riccardo Carlesso"]
9
9
  s.date = %q{2011-01-16}
10
10
  s.default_executable = %q{ric}
11
- s.description = %q{My firstgem with various utilities (colors and tests now).
11
+ s.description = %q{My first gem with various utilities (colors and tests now).
12
12
  My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence
13
13
  with hence!)}
14
14
  s.email = %q{['p','ll','diusbonton].join('a') @ gmail.com}
15
15
  s.executables = ["ric"]
16
- s.extra_rdoc_files = ["README", "TODO", "bin/ric", "lib/helpers/rails_helper.rb", "lib/ric/html.rb", "lib/ric_colors.rb", "lib/riclib.rb"]
17
- s.files = ["Manifest", "README", "Rakefile", "TODO", "bin/ric", "docs/journal.txt", "images/desktop/linux-lightbulb.png", "images/icons/database/db-commit.png", "images/icons/development/application.png", "images/icons/development/grave.png", "images/icons/development/iFuck.png", "images/icons/development/ontology.png", "images/icons/development/pointers.png", "images/icons/development/svn.png", "images/icons/development/tools.png", "images/icons/disks/Ric 120GB.ico", "images/icons/linux/ldap.png", "images/icons/privacy.png", "images/icons/social/facebook_64.png", "images/icons/social/linkedin_64.png", "images/icons/social/rss_64.png", "images/icons/social/twitter_64.png", "images/icons/tux/scientific.png", "lib/helpers/rails_helper.rb", "lib/ric/html.rb", "lib/ric_colors.rb", "lib/riclib.rb", "var/www/index.html", "ric.gemspec"]
16
+ s.extra_rdoc_files = ["README", "TODO", "bin/ric", "lib/helpers/rails_helper.rb", "lib/ric.rb", "lib/ric/colors.rb", "lib/ric/html.rb", "lib/uniquify.rb"]
17
+ s.files = ["HISTORY", "Manifest", "README", "Rakefile", "TODO", "bin/ric", "docs/journal.txt", "init.rb", "lib/helpers/rails_helper.rb", "lib/ric.rb", "lib/ric/colors.rb", "lib/ric/html.rb", "lib/uniquify.rb", "var/www/index.html", "ric.gemspec"]
18
18
  s.homepage = %q{http://github.com/palladius/riclib}
19
19
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ric", "--main", "README"]
20
20
  s.require_paths = ["lib"]
21
21
  s.rubyforge_project = %q{ric}
22
22
  s.rubygems_version = %q{1.4.2}
23
- s.summary = %q{My firstgem with various utilities (colors and tests now). My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence with hence!)}
23
+ s.summary = %q{My first gem with various utilities (colors and tests now). My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence with hence!)}
24
24
 
25
25
  if s.respond_to? :specification_version then
26
26
  s.specification_version = 3
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ric
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
5
- prerelease:
4
+ hash: 112
5
+ prerelease: 5
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 4
10
+ - c
11
+ version: 0.9.4c
11
12
  platform: ruby
12
13
  authors:
13
14
  - Riccardo Carlesso
@@ -20,7 +21,7 @@ default_executable:
20
21
  dependencies: []
21
22
 
22
23
  description: |-
23
- My firstgem with various utilities (colors and tests now).
24
+ My first gem with various utilities (colors and tests now).
24
25
  My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence
25
26
  with hence!)
26
27
  email: "['p','ll','diusbonton].join('a') @ gmail.com"
@@ -33,37 +34,24 @@ extra_rdoc_files:
33
34
  - TODO
34
35
  - bin/ric
35
36
  - lib/helpers/rails_helper.rb
37
+ - lib/ric.rb
38
+ - lib/ric/colors.rb
36
39
  - lib/ric/html.rb
37
- - lib/ric_colors.rb
38
- - lib/riclib.rb
40
+ - lib/uniquify.rb
39
41
  files:
42
+ - HISTORY
40
43
  - Manifest
41
44
  - README
42
45
  - Rakefile
43
46
  - TODO
44
47
  - bin/ric
45
48
  - docs/journal.txt
46
- - images/desktop/linux-lightbulb.png
47
- - images/icons/database/db-commit.png
48
- - images/icons/development/application.png
49
- - images/icons/development/grave.png
50
- - images/icons/development/iFuck.png
51
- - images/icons/development/ontology.png
52
- - images/icons/development/pointers.png
53
- - images/icons/development/svn.png
54
- - images/icons/development/tools.png
55
- - images/icons/disks/Ric 120GB.ico
56
- - images/icons/linux/ldap.png
57
- - images/icons/privacy.png
58
- - images/icons/social/facebook_64.png
59
- - images/icons/social/linkedin_64.png
60
- - images/icons/social/rss_64.png
61
- - images/icons/social/twitter_64.png
62
- - images/icons/tux/scientific.png
49
+ - init.rb
63
50
  - lib/helpers/rails_helper.rb
51
+ - lib/ric.rb
52
+ - lib/ric/colors.rb
64
53
  - lib/ric/html.rb
65
- - lib/ric_colors.rb
66
- - lib/riclib.rb
54
+ - lib/uniquify.rb
67
55
  - var/www/index.html
68
56
  - ric.gemspec
69
57
  has_rdoc: true
@@ -105,6 +93,6 @@ rubyforge_project: ric
105
93
  rubygems_version: 1.4.2
106
94
  signing_key:
107
95
  specification_version: 3
108
- summary: My firstgem with various utilities (colors and tests now). My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence with hence!)
96
+ summary: My first gem with various utilities (colors and tests now). My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence with hence!)
109
97
  test_files: []
110
98
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/riclib.rb DELETED
@@ -1,29 +0,0 @@
1
-
2
- # RICLIB!
3
-
4
- module Ric
5
- require File.expand_path('./ric_colors.rb', File.dirname( __FILE__) )
6
- #include RicColors
7
-
8
- def self.say_hello
9
- puts 'Riclib: hello world'
10
- end
11
-
12
-
13
- def self.help
14
- puts "Riclib: This is Riccardo library (my first gem!)"
15
- end
16
-
17
- def version
18
- "Should be 0.9.0 -- but this is NOT dry! ;)"
19
- end
20
-
21
- def green(s)
22
- "TODO_VERDE(#{s})"
23
- end
24
-
25
- def load_libs
26
- green(:ok)
27
- end
28
- end
29
-