flukso4r 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of flukso4r might be problematic. Click here for more details.

Files changed (3) hide show
  1. data/VERSION +1 -1
  2. metadata +2 -3
  3. data/bin/flukso_export_db +0 -108
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flukso4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Dalheimer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-26 00:00:00 +01:00
12
+ date: 2010-03-10 00:00:00 +01:00
13
13
  default_executable: flukso_query
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,6 @@ files:
50
50
  - VERSION
51
51
  - bin/flukso_archive_watts
52
52
  - bin/flukso_create_db
53
- - bin/flukso_export_db
54
53
  - bin/flukso_query
55
54
  - lib/flukso.rb
56
55
  - lib/flukso/api.rb
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This file is part of fluksobot
3
- # (c) 2009 Mathias Dalheimer, md@gonium.net
4
- #
5
- # FluksoBot is free software; you can
6
- # redistribute it and/or modify it under the terms of the GNU General Public
7
- # License as published by the Free Software Foundation; either version 2 of
8
- # the License, or any later version.
9
- #
10
- # FluksoBot is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU General Public License
16
- # along with FluksoBot; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
-
19
- # Read the fluksobot location
20
- libpath=File.join(File.dirname(__FILE__), '..', 'lib')
21
- $:.unshift << libpath
22
- #puts "Using libraty path #{$:.join(":")}"
23
-
24
- require 'rubygems'
25
- require 'optparse'
26
- require 'ostruct'
27
- require 'flukso'
28
-
29
- ###
30
- ## Commandline parser
31
- #
32
- class Optparser
33
- CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
34
- CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
35
- #
36
- # Return a structure describing the options.
37
- #
38
- def self.parse(args)
39
- # The options specified on the command line will be collected in *options*.
40
- # We set default values here.
41
- options = OpenStruct.new
42
- options.inplace = false
43
- options.encoding = "utf8"
44
- options.verbose = false
45
- opts = OptionParser.new do |opts|
46
- opts.banner = "Usage: #{$0} [options]"
47
- opts.separator ""
48
- opts.separator "Specific options:"
49
- opts.on("-c", "--config FILE", "The configuration file to use.") do |file|
50
- options.config_file = file
51
- end
52
- # Boolean switch.
53
- opts.on("-f", "--force", "Ignore warnings") do |f|
54
- options.force = f
55
- end
56
- opts.on("-v", "--verbose", "Run verbosely") do |v|
57
- options.verbose = v
58
- end
59
- opts.on_tail("-h", "--help", "Show this message") do
60
- puts opts
61
- exit
62
- end
63
- end
64
- opts.parse!(args)
65
- options
66
- end
67
- end
68
-
69
- ###
70
- ## Script startup
71
- #
72
- options = Optparser.parse(ARGV)
73
- $verbose = options.verbose
74
- $force = options.force
75
- puts "FluksoBot database setup script."
76
- if options.config_file == nil
77
- puts "Please provide a configuration file... (-h for details)."
78
- exit(-1);
79
- end
80
- if not File.exists?(options.config_file)
81
- puts " Configuration file #{options.config_file} not found - no database configuration available!"
82
- exit(-3);
83
- else
84
- $CONFIG=YAML.load_file(options.config_file);
85
- puts "Using this configuration:" if $verbose
86
- puts "#{$CONFIG}" if $verbose
87
- dbfile=$CONFIG['DB_FILE']
88
- end
89
- if $verbose
90
- puts " Using database file #{dbfile}"
91
- end
92
- # check and expand paths.
93
- if not File.exists?(dbfile)
94
- puts " Database does not exists. Aborting."
95
- exit(-2);
96
- end
97
-
98
- # The database does not exist. Create the DB and populate it with
99
- # tables.
100
-
101
- db=Flukso::FluksoDB.open($CONFIG["DB_FILE"], $CONFIG["DB_TABLE_NAME"]);
102
- begin
103
- last=db.find_reading_last();
104
- puts "Last reading: #{last}"
105
- rescue Flukso::ElementNotFoundError => e
106
- puts "Empty database - not able to provide last reading."
107
- end
108
- db.close