influx_orm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8a7b5578eb6a3f2fd54b4a2a957e2e44fecefaf
4
- data.tar.gz: 926aad7a901cdb7aa68953a30704e2f669c8b745
3
+ metadata.gz: a7cfd03c923d45d9cac1d1aee1300767b044173e
4
+ data.tar.gz: eb5b2c4f5b3a429dd6f212ecc2e9fdd6220b7efa
5
5
  SHA512:
6
- metadata.gz: 5d1f657aec7974ab2fe5f16eac459278e8b37e3707a38ac6e3ef0f4d5d39509cb3928d92d40dafebc13fde255d395be9e5a21f9f4dc4fb148c8e3e548339eb1b
7
- data.tar.gz: e3fdffc820127be9810f2b5b0a07fa5977136124114bf3cd0f36203309755470f3e785b35bc0df15be20dc092137415652be697ef21d521c4b03f528927d8014
6
+ metadata.gz: 00300c22851953445452d9cfbae58559e0e3e26faa521c88c1b8f9c1b4d63af0721537dd9e9bef321a28648b4341d5c6a5999f4e6efac31e42e91affa28b9fd7
7
+ data.tar.gz: 77616be8dbfb53fd1e55213a652cc97572123f6bcbbb05e67bd71a802c3a735a580e6acccc1bace96e9c853c20cc33a44da1254f4f3eb9d9b6ad3ce3284b8a80
data/.gitignore CHANGED
@@ -13,3 +13,5 @@
13
13
 
14
14
  *.swp
15
15
  spec/examples.txt
16
+
17
+ *.gem
data/.travis.yml CHANGED
@@ -1,5 +1,40 @@
1
- sudo: false
1
+ sudo: enable
2
+ dist: trusty
2
3
  language: ruby
4
+
5
+ cache: bundler
6
+
3
7
  rvm:
8
+ - 2.1.10
9
+ - 2.2.7
10
+ - 2.3.4
4
11
  - 2.4.1
5
- before_install: gem install bundler -v 1.14.6
12
+
13
+ gemfile:
14
+ - gemfiles/activesupport-4.0
15
+ - gemfiles/activesupport-4.1
16
+ - gemfiles/activesupport-4.2
17
+ - gemfiles/activesupport-5.0
18
+ - gemfiles/activesupport-5.1
19
+
20
+ matrix:
21
+ exclude:
22
+ - {rvm: '2.1.10', gemfile: 'gemfiles/activesupport-5.0'}
23
+ - {rvm: '2.1.10', gemfile: 'gemfiles/activesupport-5.1'}
24
+ - {rvm: '2.4.1', gemfile: 'gemfiles/activesupport-4.0'}
25
+ - {rvm: '2.4.1', gemfile: 'gemfiles/activesupport-4.1'}
26
+
27
+ addons:
28
+ apt:
29
+ sources:
30
+ - sourceline: 'deb https://repos.influxdata.com/ubuntu trusty stable'
31
+ key_url: 'https://repos.influxdata.com/influxdb.key'
32
+
33
+ packages:
34
+ influxdb
35
+
36
+ before_install:
37
+ - sudo service influxdb start
38
+ - gem install bundler --no-doc
39
+
40
+ script: bundle exec rspec
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
- # source 'https://rubygems.org'
2
- source 'https://gems.ruby-china.org'
1
+ source 'https://rubygems.org'
3
2
 
4
3
  # Specify your gem's dependencies in influx_orm.gemspec
5
4
  gemspec
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A simple influxdb orm for ruby, base [influxdb-ruby](https://github.com/influxdata/influxdb-ruby)
4
4
 
5
+ [![Build Status](https://travis-ci.org/xiejiangzhi/influx_orm.svg?branch=master)](https://travis-ci.org/xiejiangzhi/influx_orm)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -0,0 +1,7 @@
1
+ # source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
3
+
4
+ # Specify your gem's dependencies in influx_orm.gemspec
5
+ gemspec path: '../'
6
+
7
+ gem 'activesupport', '~> 4.0.0'
@@ -0,0 +1,7 @@
1
+ # source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
3
+
4
+ # Specify your gem's dependencies in influx_orm.gemspec
5
+ gemspec path: '../'
6
+
7
+ gem 'activesupport', '~> 4.1.0'
@@ -0,0 +1,7 @@
1
+ # source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
3
+
4
+ # Specify your gem's dependencies in influx_orm.gemspec
5
+ gemspec path: '../'
6
+
7
+ gem 'activesupport', '~> 4.2.0'
@@ -0,0 +1,7 @@
1
+ # source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
3
+
4
+ # Specify your gem's dependencies in influx_orm.gemspec
5
+ gemspec path: '../'
6
+
7
+ gem 'activesupport', '~> 5.0.0'
@@ -0,0 +1,7 @@
1
+ # source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
3
+
4
+ # Specify your gem's dependencies in influx_orm.gemspec
5
+ gemspec path: '../'
6
+
7
+ gem 'activesupport', '~> 5.1.0'
data/influx_orm.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency "influxdb", "~> 0.3.14"
25
- spec.add_dependency "activesupport", ">= 3.0"
25
+ spec.add_dependency "activesupport", ">= 4.0"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.14"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -30,7 +30,9 @@ module InfluxORM::Model
30
30
  # dependent class method: attrs_to_point
31
31
  def import(points_attrs)
32
32
  points = points_attrs.map do |point_attrs|
33
- attrs_to_point(point_attrs).merge!({series: table_name})
33
+ r = attrs_to_point(point_attrs)
34
+ r[:series] ||= table_name
35
+ r
34
36
  end
35
37
  connection.import(points)
36
38
  end
@@ -1,3 +1,3 @@
1
1
  module InfluxORM
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/influx_orm.rb CHANGED
@@ -3,6 +3,7 @@ require "influx_orm/version"
3
3
  require 'influxdb'
4
4
 
5
5
  require 'active_support'
6
+ require 'active_support/core_ext/module/remove_method'
6
7
  require 'active_support/core_ext'
7
8
 
8
9
  module InfluxORM
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influx_orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhi.xie
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '3.0'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -112,9 +112,13 @@ files:
112
112
  - bin/setup
113
113
  - examples/model.rb
114
114
  - examples/multiple_config.rb
115
+ - gemfiles/activesupport-4.0
116
+ - gemfiles/activesupport-4.1
117
+ - gemfiles/activesupport-4.2
118
+ - gemfiles/activesupport-5.0
119
+ - gemfiles/activesupport-5.1
115
120
  - influx_orm.gemspec
116
121
  - lib/influx_orm.rb
117
- - lib/influx_orm/:noh
118
122
  - lib/influx_orm/attributes.rb
119
123
  - lib/influx_orm/configuration.rb
120
124
  - lib/influx_orm/connection.rb
data/lib/influx_orm/:noh DELETED
@@ -1,37 +0,0 @@
1
- module InfluxORM
2
- class Connection
3
- attr_reader :config, :database, :client_config, :configuration
4
-
5
- def initialize(options, configuration)
6
- @config = options.with_indifferent_access
7
- @configuration = configuration
8
- end
9
-
10
- def db
11
- @db ||= InfluxDB::Client.new(config)
12
- end
13
-
14
- def query(sql)
15
- log(sql) { db.query(sql) }
16
- end
17
-
18
- def insert(table_name, point)
19
- log("INSERT to #{table_name}: #{point.to_sql}") { db.write_point(table_name, point) }
20
- end
21
-
22
- def import(data)
23
- db.write_points(data)
24
- end
25
-
26
- private
27
-
28
- def log(log, &block)
29
- t = Time.now
30
- block.call
31
- ensure
32
- c = (Time.now - t) * 1000
33
- configuration.logger.info("[InfluxORM] (%.3f ms) %s" % [c, log])
34
- end
35
- end
36
- end
37
-