github-api-client 0.1.1.rc2 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users, :force => true do |t|
4
+ %w(login token type name company location blog email language).each do |attr|
5
+ t.string attr
6
+ end
7
+
8
+ %w(gravatar_id public_repo_count public_gist_count following_count followers_count score record).each do |attr|
9
+ t.integer attr
10
+ end
11
+
12
+ %w(created_at pushed).each do |attr|
13
+ t.datetime attr
14
+ end
15
+ end
16
+ end
17
+
18
+ def self.down
19
+ drop_table :users
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ class CreateFollowings < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :followings, :id => false, :force => true do |t|
4
+ t.references :follower
5
+ t.references :following
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :followings
11
+ end
12
+ end
data/lib/github_api.rb CHANGED
@@ -1,30 +1,48 @@
1
1
  #!/usr/bin/ruby
2
- $LOAD_PATH << './github_api' << './lib/github_api'
2
+ $: << './github_api' << './lib/github_api'
3
3
 
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+ gem 'github-api-client'
4
7
  require 'net/http'
5
8
  require 'uri'
6
9
  require 'yaml'
7
10
  require 'singleton'
8
11
  require 'active_record'
9
12
 
13
+ module GitHub #:nodoc:
14
+ module Config
15
+ Path = {:dir => ENV['HOME'] + "/.github", :dbfile => ENV['HOME'] + "/.github/github.db", :migrations => Gem.loaded_specs['github-api-client'].full_gem_path + "/db/migrate", :secrets => ENV['HOME'] + "/.github" + "/secrets.yml"}
16
+
17
+ def self.setup
18
+ Dir.mkdir GitHub::Config::Path[:dir] rescue nil
19
+ ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => GitHub::Config::Path[:dbfile]
20
+ ActiveRecord::Migrator.migrate(GitHub::Config::Path[:migrations], nil)
21
+ end
22
+ end
23
+ end
10
24
 
11
- Dir.mkdir ENV['HOME'] + "/.github" if !Dir.entries(ENV['HOME']).include? ".github"
12
- ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => "#{ENV['HOME']}/.github/ruby.db"
25
+ GitHub::Config.setup
13
26
 
14
27
  require 'base'
15
28
  require 'user'
16
29
  require 'browser'
17
- require 'rainbow'
30
+ gem 'rainbow'
18
31
 
19
32
 
20
33
  begin
21
- unless $user = GitHub::User.where(YAML::load_file('config/secrets.yml')['user']).first
22
- $user = GitHub::User.create(YAML::load_file('config/secrets.yml')['user'])
23
- end rescue puts "Run rake db:migrate task and restart application"
34
+ unless $user = GitHub::User.where(YAML::load_file(GitHub::Config::Path[:secrets])['user']).first
35
+ $user = GitHub::User.create(YAML::load_file(GitHub::Config::Path[:secrets])['user'])
36
+ end
24
37
 
25
38
  rescue Errno::ENOENT
26
39
  puts "Could not load config/secrets.yml, have you defined it?"
27
- end
28
-
29
- module GitHub #:nodoc:
40
+ puts "Putting example secrets file in your #{GitHub::Config::Path[:secrets]}"
41
+ File.open(GitHub::Config::Path[:secrets], 'w') do |f|
42
+ f.write <<-config
43
+ user:
44
+ login: login
45
+ token: private_token
46
+ config
47
+ end
30
48
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-api-client
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
8
  - 1
9
- - rc2
10
- version: 0.1.1.rc2
9
+ version: 0.1.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - "Jakub Oko\xC5\x84ski"
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-28 00:00:00 +01:00
17
+ date: 2010-11-29 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -27,12 +26,13 @@ dependencies:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
28
  segments:
30
- - 0
31
- version: "0"
29
+ - 1
30
+ - 1
31
+ version: "1.1"
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: active_record
35
+ name: activerecord
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
@@ -46,6 +46,21 @@ dependencies:
46
46
  version: 3.0.3
47
47
  type: :runtime
48
48
  version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: sqlite3-ruby
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 3
60
+ - 2
61
+ version: 1.3.2
62
+ type: :runtime
63
+ version_requirements: *id003
49
64
  description: Library for easy GitHub API browsing
50
65
  email: kuba@okonski.org
51
66
  executables: []
@@ -59,6 +74,8 @@ files:
59
74
  - lib/github_api/base.rb
60
75
  - lib/github_api/browser.rb
61
76
  - lib/github_api/user.rb
77
+ - db/migrate/002_create_followings.rb
78
+ - db/migrate/001_create_users.rb
62
79
  has_rdoc: true
63
80
  homepage: http://github.com/farnoy/github-api-client
64
81
  licenses: []
@@ -79,13 +96,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
96
  required_rubygems_version: !ruby/object:Gem::Requirement
80
97
  none: false
81
98
  requirements:
82
- - - ">"
99
+ - - ">="
83
100
  - !ruby/object:Gem::Version
84
101
  segments:
85
- - 1
86
- - 3
87
- - 1
88
- version: 1.3.1
102
+ - 0
103
+ version: "0"
89
104
  requirements: []
90
105
 
91
106
  rubyforge_project: