rollbar_search_url 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8b58b5928753a1335298730dfb4ed6a1f306252c
4
+ data.tar.gz: 12cfe649dd9ed08dfefeec64b24c33013c6b1780
5
+ SHA512:
6
+ metadata.gz: d9e4a1d06e826af0019db07e2dc590cc586d8f5915974b339c60cf9097a0625bf671cc412f02410babbf71cb26a68f129121e7e80cecc9e570a0e14191d1e171
7
+ data.tar.gz: f0280d31cf4b12057fca2767ddaba037f3895c4d6430841c93a57dd1b867442285499d111783d01a88378606ff2f216de875fa20733a71d1a8a0512db877a5c8
data/.dockerignore ADDED
@@ -0,0 +1 @@
1
+ .git
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Dockerfile ADDED
@@ -0,0 +1,12 @@
1
+ FROM ruby:2.2.2
2
+ MAINTAINER flomotlik@gmail.com
3
+
4
+ RUN mkdir -p /app/lib/rollbar_search_url
5
+ WORKDIR /app
6
+ ADD Gemfile /app/Gemfile
7
+ ADD Gemfile.lock /app/Gemfile.lock
8
+ ADD rollbar_search_url.gemspec /app/rollbar_search_url.gemspec
9
+ Add lib/rollbar_search_url/version.rb /app/lib/rollbar_search_url/version.rb
10
+ RUN bundle install -j24
11
+
12
+ ADD . /app
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rollbar_search_url.gemspec
4
+ gemspec
5
+
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rollbar_search_url (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ minitest (5.7.0)
10
+ rake (10.4.2)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.9)
17
+ minitest
18
+ rake (~> 10.0)
19
+ rollbar_search_url!
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Florian Motlik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # RollbarSearchURL
2
+
3
+ This gem allows you to create URLs wo use with Rollbar RQL in an ActiveRecord like syntax
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rollbar_search_url'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rollbar_search_url
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require 'rollbar_search_url'
25
+ query = RollbarSearchUrl::Query.new user:YOUR_USERNAME, project: YOUR_PROJECT_NAME
26
+ query.where 'timestamp > unix_timestamp() - 60 * 60 * 24'
27
+ query.where 'request.commit_id = abcde'
28
+ query.order_by 'timestamp DESC'
29
+ query.url
30
+ ```
31
+
32
+ You can use the url method to get a link to an RQL site
33
+
34
+ The gem supports the following methods
35
+
36
+ * select
37
+ * where
38
+ * group_by
39
+ * order_by
40
+ * limit
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it ( https://github.com/flomotlik/rollbar_search_url/fork )
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/test*.rb']
7
+ t.verbose = true
8
+ #t.options = "-p"
9
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rollbar_search_url"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ app:
2
+ build:
3
+ image: flomotlik/discourse
4
+ dockerfile_path: Dockerfile
@@ -0,0 +1,2 @@
1
+ - service: app
2
+ command: bundle exec rake test
@@ -0,0 +1,64 @@
1
+ require "rollbar_search_url/version"
2
+
3
+ module RollbarSearchUrl
4
+
5
+ BASE_URL = "https://rollbar.com/%{user}/%{project}/rql"
6
+
7
+ class Query
8
+
9
+ def initialize user: "", project: ""
10
+ raise ArgumentError if user.nil? || project.nil? || user.empty? || project.empty?
11
+ @user = user
12
+ @project = project
13
+ @where = []
14
+ @select = []
15
+ @limit = nil
16
+ @order_by = ""
17
+ @group_by = ""
18
+ end
19
+
20
+ def select select_statement
21
+ @select << select_statement
22
+ self
23
+ end
24
+
25
+ def where where_statement
26
+ @where << where_statement
27
+ self
28
+ end
29
+
30
+ def group_by group_by_statement
31
+ @group_by = group_by_statement
32
+ self
33
+ end
34
+
35
+ def order_by order_by_statement
36
+ @order_by = order_by_statement
37
+ self
38
+ end
39
+
40
+ def limit limit
41
+ @limit = limit
42
+ self
43
+ end
44
+
45
+ def url
46
+ URI.escape(BASE_URL % {user: @user, project: @project} + "?q=#{query}")
47
+ end
48
+
49
+ private
50
+
51
+ def query
52
+ statements = []
53
+ statements << "select"
54
+ statements << (@select.empty? ? ['*'] : @select).join(', ')
55
+ statements << "from item_occurrence"
56
+ statements << "where #{@where.join ' and '} " unless @where.empty?
57
+ statements << "group by #{@group_by}" unless @group_by.empty?
58
+ statements << "order by #{@order_by}" unless @order_by.empty?
59
+ statements << "limit #{@limit}" unless @limit.nil?
60
+
61
+ statements.join ' '
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ module RollbarSearchUrl
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rollbar_search_url/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rollbar_search_url"
8
+ spec.version = RollbarSearchUrl::VERSION
9
+ spec.authors = ["Florian Motlik"]
10
+ spec.email = ["flomotlik@gmail.com"]
11
+
12
+ spec.summary = "Create Rollbar search urls"
13
+ spec.homepage = "https://github.com/flomotlik/rollbar_search_url"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.9"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "minitest"
32
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rollbar_search_url
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Florian Motlik
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - flomotlik@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".dockerignore"
63
+ - ".ruby-version"
64
+ - CODE_OF_CONDUCT.md
65
+ - Dockerfile
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - codeship-services.yml
74
+ - codeship-steps.yml
75
+ - lib/rollbar_search_url.rb
76
+ - lib/rollbar_search_url/version.rb
77
+ - rollbar_search_url.gemspec
78
+ homepage: https://github.com/flomotlik/rollbar_search_url
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ allowed_push_host: https://rubygems.org
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.4.5
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Create Rollbar search urls
103
+ test_files: []