versionizer 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7abc7e8daffcb13871d8dff1f970b1009d5287c9
4
+ data.tar.gz: d2db32394ad05c872e4af923f31bd5c9d36726bd
5
+ SHA512:
6
+ metadata.gz: 7b74362249774112e3b8c3ade7e2637d018e49def0759eea1d186db37491a24adb996cef51b95ece308ac2568f3d085728d7c097731875f3a3ab35b2a55d948c
7
+ data.tar.gz: a2f1b00044596fb0b951ac3c0a395dfe33e6416cf5587d6d14290c03eebd9b98d6fb3053a92837cb9ddadd8261f99b9ab4d9df55e2a0e3876d3ec94586a0c7e0
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ spec\lib\tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
+ - ruby-head
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in github_versioning.gemspec
4
+ gemspec
5
+
6
+ ###########################################
7
+
8
+ #For Testing
9
+ group :test do
10
+ gem 'rspec-rails'
11
+ gem "generator_spec" # -> Test Generators https://github.com/stevehodgkiss/generator_spec
12
+ gem 'rails'
13
+ gem 'coveralls', require: false
14
+ end
15
+
16
+ #General
17
+ gem 'github_api'
18
+
19
+ ###########################################
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 richpeck
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ [Image]
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/versionizer.svg)](http://badge.fury.io/rb/versionizer)
4
+ [![Dependency Status](https://gemnasium.com/richpeck/versionizer.svg)](https://gemnasium.com/richpeck/versionizer)
5
+ [![Code Climate](https://codeclimate.com/github/richpeck/versionizer/badges/gpa.svg)](https://codeclimate.com/github/richpeck/versionizer)
6
+ [![Build Status](https://travis-ci.org/richpeck/versionizer.svg?branch=master)](https://travis-ci.org/richpeck/versionizer)
7
+ [![Coverage Status](https://img.shields.io/coveralls/richpeck/versionizer.svg)](https://coveralls.io/r/richpeck/versionizer)
8
+
9
+ Retrieves `release` data from `Github` and allows you to integrate into your system (even with Private Repos)
10
+
11
+ Gives you the ability to create a **synced release system** for your app - drawing on the [releases](https://help.github.com/articles/creating-releases) you push to `Github`. The latest release will be available for your app to use (typically by storing it in your database).
12
+
13
+ `Github_Versioning` works by giving you a simple **`github:update` rake task**. This task will pull the latest `releases` from your designated `repo`, allowing you to keep your app's releases in line with your git repository.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ gem 'versionizer'
22
+
23
+ And then execute:
24
+
25
+ $ bundle install
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install versionizer
30
+
31
+ With the gem installed, simply run:
32
+
33
+ $ rails g versionizer:install #-> creates #config/initializers/versionizer.rb
34
+
35
+ ---
36
+
37
+ ## Usage
38
+
39
+ 1. Set up your [Github API Key](https://github.com/settings/tokens/new)
40
+ 2. `Install` the config file (above)
41
+ 3. Include your github `username` and `API key` in the config*
42
+ 4. Call the rake task `rake github:update` to pull the requested data from `Github`
43
+ 5. The gem will store the data as you require
44
+
45
+ ---
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it ( https://github.com/[my-github-username]/github_versioning/fork )
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ #Fix for Travis build issue -> https://coderwall.com/p/sdxxaa
4
+ require 'rspec/core/rake_task'
5
+ task :default => :spec
6
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,28 @@
1
+ ##########################################
2
+
3
+ require 'rails/generators' # -> Required to use generators
4
+ require 'versionizer' # -> Gem functionality (for RSPEC)
5
+
6
+ ##########################################
7
+
8
+ #-> https://github.com/plataformatec/devise/blob/master/test/generators/install_generator_test.rb
9
+
10
+ module Versionizer
11
+ class InstallGenerator < Rails::Generators::Base
12
+ source_root File.expand_path("../templates", __FILE__)
13
+
14
+ desc "Creates Initializer For GitHubVersioning Gem"
15
+
16
+ #Declarations
17
+ def vars
18
+ @user = Versionizer.config.user
19
+ @api = Versionizer.config.api
20
+ @repo = Versionizer.config.repo
21
+ end
22
+
23
+ # Copy Initializer Files
24
+ def copy_initializer
25
+ template "initializer.rb", "config/initializers/versionizer.rb"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ #Versionizer
2
+
3
+ ###########################################
4
+
5
+ # You can add different settings using this block
6
+ # Use the docs at http://github.com/richpeck/versionizer for info
7
+
8
+ ###########################################
9
+
10
+ Versionizer.setup do |config|
11
+ config.user = "<%= @user %>" #-> Your Github Username
12
+ config.api = "<%= @api %>" #-> Your Github API Key
13
+ config.repo = "<%= @repo %>" #-> Your Github Repo to track
14
+ end
@@ -0,0 +1,2 @@
1
+ #https://github.com/kjvarga/sitemap_generator/blob/master/lib/tasks/sitemap_generator_tasks.rake
2
+ load(File.expand_path(File.join(File.dirname(__FILE__), '../versionizer/tasks.rb')))
@@ -0,0 +1,30 @@
1
+ require "versionizer/version"
2
+ require "versionizer/config"
3
+
4
+ module Versionizer
5
+
6
+ #Railtie - http://stackoverflow.com/questions/742633/make-rake-task-from-gem-available-everywhere
7
+ require "versionizer/railtie" if defined?(Rails)
8
+
9
+ #Save
10
+ def self.save repo
11
+ option = Option.find_by name: "version"
12
+ option.update!(value: repo.first.tag_name)
13
+ end
14
+
15
+ ####################
16
+ # Config #
17
+ ####################
18
+
19
+ #Ref http://robots.thoughtbot.com/mygem-configure-block
20
+ mattr_accessor :config, :table
21
+
22
+ #Vars
23
+ @@config ||= Config.new
24
+
25
+ #Block (for initializer)
26
+ def self.setup
27
+ yield(config) if block_given?
28
+ end
29
+
30
+ end
@@ -0,0 +1,19 @@
1
+ ###########################################
2
+
3
+ # Refs
4
+ # http://stackoverflow.com/questions/10584638/setting-up-configuration-settings-when-writing-a-gem
5
+ # http://robots.thoughtbot.com/mygem-configure-block
6
+
7
+ ###########################################
8
+
9
+ module Versionizer
10
+ class Config
11
+ attr_accessor :user, :api, :repo
12
+
13
+ def initialize
14
+ @user = "richpeck"
15
+ @api = "29fbd56c3ab779a8ef22df8e52671c8c1c1ff194"
16
+ @repo = "sgm"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ #http://stackoverflow.com/questions/742633/make-rake-task-from-gem-available-everywhere
2
+ require 'versionizer'
3
+ require 'rails'
4
+
5
+ module Versionizer
6
+ class Railtie < Rails::Railtie
7
+ rake_tasks do
8
+ require File.expand_path('../tasks', __FILE__) # https://github.com/kjvarga/sitemap_generator/blob/master/lib/sitemap_generator/railtie.rb
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ #########################################
2
+
3
+ require 'rake' #-> Tasks Structure https://github.com/kjvarga/sitemap_generator/blob/master/lib/sitemap_generator/tasks.rb
4
+ require 'github_api'
5
+
6
+ #########################################
7
+
8
+ ##GITHUB AUTHENTICATION RAKE
9
+ #Authorization API Key = https://github.com/settings/applications#personal-access-tokens
10
+
11
+ #Github
12
+ namespace :version do
13
+
14
+ # Have to load "Github" gem into environment. Github object depends on it being
15
+ # present & available
16
+
17
+ # Update
18
+ task :update => :environment do
19
+ github = Github.new basic_auth: 'richpeck:29fbd56c3ab779a8ef22df8e52671c8c1c1ff194'
20
+ repo = github.repos.releases.list "richpeck", "sgm"
21
+
22
+ #Versionizer.save repo
23
+ end
24
+
25
+ end
@@ -0,0 +1,3 @@
1
+ module Versionizer
2
+ VERSION = "0.0.9"
3
+ end
@@ -0,0 +1,37 @@
1
+ ##########################################
2
+
3
+ require "spec_helper"
4
+ require "generator_spec"
5
+
6
+ ##########################################
7
+
8
+ #Install Generator
9
+ describe Versionizer::InstallGenerator do
10
+
11
+ #Setup
12
+ GeneratorSpec::TestCase
13
+
14
+ #Destination
15
+ destination File.expand_path("../../tmp", __FILE__)
16
+
17
+ #Before
18
+ before(:all) do
19
+ prepare_destination
20
+ run_generator
21
+ end
22
+
23
+ #Create
24
+ it "creates the files" do
25
+ assert_file "config/initializers/versionizer.rb"
26
+ end
27
+
28
+ #Config
29
+ it "has valid config" do
30
+ assert_file "config/initializers/versionizer.rb" do |file|
31
+ assert_match("config.user =", file)
32
+ assert_match("config.api =", file)
33
+ assert_match("config.repo =", file)
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,32 @@
1
+ ##########################################
2
+
3
+ require 'spec_helper'
4
+ require 'rake'
5
+
6
+ ##########################################
7
+
8
+ #Rake Task
9
+ describe "GitHub Connectivity Test" do
10
+
11
+ #Declarations
12
+ let(:github) { Github.new }
13
+ let(:user) { 'wycats' }
14
+ let(:repos) { github.repos.list user: user}
15
+
16
+ #Load
17
+ before do
18
+ load "./lib/tasks/github.rake"
19
+ Rake::Task.define_task(:environment)
20
+ end
21
+
22
+ #Connect
23
+ it "receives data from Github" do
24
+ #expect(repos.first).to be_success # -> should receive response code 200
25
+ end
26
+
27
+ #Rake
28
+ it "opens the Rake Task" do
29
+ Rake::Task["version:update"].invoke
30
+ end
31
+
32
+ end
@@ -0,0 +1,39 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+
18
+ ##########################################
19
+
20
+ #Dependencies
21
+ require 'github_api'
22
+ require 'coveralls'
23
+ Coveralls.wear!
24
+
25
+ #Generators
26
+ require 'generators/versionizer/install_generator'
27
+
28
+ #Env
29
+ ENV["RAILS_ENV"] = 'test'
30
+
31
+ ##########################################
32
+
33
+ RSpec.configure do |config|
34
+ # Run specs in random order to surface order dependencies. If you find an
35
+ # order dependency and want to debug it, you can fix the order by providing
36
+ # the seed, which is printed after each run.
37
+ # --seed 1234
38
+ config.order = 'random'
39
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'versionizer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "versionizer"
8
+ spec.version = Versionizer::VERSION
9
+ spec.authors = ["Richard Peck"]
10
+ spec.email = ["support@frontlineutilities.co.uk"]
11
+ spec.summary = %q{"Versions" for your app using Github "Releases" feature}
12
+ spec.description = %q{Pull Github "Release" data into your app - forming a central way to define "versions"}
13
+ spec.homepage = "http://frontlineutilities.co.uk"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'github_api', '~> 0.12.1'
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+
26
+ spec.post_install_message = "Thank you for installing"
27
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: versionizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Richard Peck
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: github_api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.12.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
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
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Pull Github "Release" data into your app - forming a central way to define
70
+ "versions"
71
+ email:
72
+ - support@frontlineutilities.co.uk
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rspec
79
+ - .travis.yml
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/generators/versionizer/install_generator.rb
85
+ - lib/generators/versionizer/templates/initializer.rb
86
+ - lib/tasks/github.rake
87
+ - lib/versionizer.rb
88
+ - lib/versionizer/config.rb
89
+ - lib/versionizer/railtie.rb
90
+ - lib/versionizer/tasks.rb
91
+ - lib/versionizer/version.rb
92
+ - spec/lib/generators/install_generator_spec.rb
93
+ - spec/lib/version_spec.rb
94
+ - spec/spec_helper.rb
95
+ - versionizer.gemspec
96
+ homepage: http://frontlineutilities.co.uk
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message: Thank you for installing
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.4.1
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: '"Versions" for your app using Github "Releases" feature'
120
+ test_files:
121
+ - spec/lib/generators/install_generator_spec.rb
122
+ - spec/lib/version_spec.rb
123
+ - spec/spec_helper.rb