rudisco 1.0.0 → 1.0.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: 96a8153da4c9000bc97fd6002722c56ab8b6a43b
4
- data.tar.gz: 1f82e722e9ed26c5eb72457eca89e3a326b43842
3
+ metadata.gz: 490c4122e6c310e5a5f00d3386961739b953e6e2
4
+ data.tar.gz: eeff09d8283972388cc6cea9456e848b45cef581
5
5
  SHA512:
6
- metadata.gz: 266e7f221800b475a8af008b75556460f496b90c6579e04144cc37fa4e4a516c0695fea0b9622e5f9cbea67cb32e2a95162d0a0aeb1f0fb286aa1831cbb8a69d
7
- data.tar.gz: 77fa868a5cdf7497bc4d4cdc93732ccacf683185215a7007ee2c5c41dcebc697b97b6c354d82fc6f942a0de94fb1549afd47d5c8fdf13eb983b103100db4adf0
6
+ metadata.gz: 57e7934452d0733d9cf044516f75a85aa4e1d7f542febbbb22742a684242f54c9df052f14a58eb86e22ad34209d872e8f8c609e3bcb78e752eb62e178c8a3a56
7
+ data.tar.gz: 4671faa96ac2a274ea2ad6e2d30db6224016248fcfb9a1a7ecc2096452bd3ab82bb873be631a96e088eda8897549c7200cd70b7d01e74ca172a690f70d4743f5
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- require File.join(__dir__, '..', 'sources', 'rudisco')
3
+ require File.join(__dir__, '..', 'lib', 'rudisco')
4
4
 
5
5
  Rudisco::CLI::Application.start ARGV
File without changes
File without changes
@@ -8,7 +8,7 @@ module Rudisco
8
8
  # @param [String] url
9
9
 
10
10
  def self.open_in_browser(url)
11
- return if url.to_s.empty?
11
+ raise NotAUrl, url unless url =~ URI::regexp(['http','https'])
12
12
 
13
13
  if defined?(Launchy) && Launchy.respond_to?(:open)
14
14
  Launchy.open url
@@ -36,7 +36,7 @@ module Rudisco
36
36
  # Raised when +path+ is not a path to directory.
37
37
 
38
38
  def self.download(url, path)
39
- raise NotAUrl, url unless url.is_a?(String) && !url.empty?
39
+ raise NotAUrl, url unless url =~ URI::regexp(['http','https'])
40
40
  raise DirNotExists, path unless Dir.exists? path
41
41
 
42
42
  system "wget -P #{path} #{url} > /dev/null 2>&1"
@@ -56,7 +56,7 @@ module Rudisco
56
56
  # where it should be saved already exists.
57
57
 
58
58
  def self.git_clone(url, path)
59
- raise NotAUrl, url unless url.is_a?(String) && !url.empty?
59
+ raise NotAUrl, url unless url =~ URI::regexp(['http','https'])
60
60
  raise DirShouldNotExists, path if Dir.exists? path
61
61
 
62
62
  system "git clone #{url} #{path} > /dev/null 2>&1"
@@ -8,23 +8,23 @@ module Rudisco
8
8
  # CREATE TABLE `gems` (
9
9
  # `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
10
10
  #
11
- # `name` Text,
12
- # `description` Text,
13
- # `authors` Text,
14
- # `version` Text,
15
- # `license` Text,
16
- # `sha` Text,
11
+ # `name` Text,
12
+ # `description` Text,
13
+ # `authors` Text,
14
+ # `version` Text,
15
+ # `license` Text,
16
+ # `sha` Text,
17
17
  #
18
- # `source_code_url` Text,
19
- # `project_url` Text,
20
- # `gem_url` Text,
21
- # `wiki_url` Text,
22
- # `documentation_url` Text,
23
- # `mailing_list_url` Text,
24
- # `bug_tracker_url` Text,
18
+ # `source_code_url` Text,
19
+ # `project_url` Text,
20
+ # `gem_url` Text,
21
+ # `wiki_url` Text,
22
+ # `documentation_url` Text,
23
+ # `mailing_list_url` Text,
24
+ # `bug_tracker_url` Text,
25
25
  #
26
- # `total_downloads` Integer,
27
- # `version_downloads` Integer,
26
+ # `total_downloads` Integer,
27
+ # `version_downloads` Integer,
28
28
  #
29
29
  # `need_update` Boolean DEFAULT (1)
30
30
  # );
@@ -92,7 +92,7 @@ module Rudisco
92
92
  end
93
93
 
94
94
  ##
95
- # Clones gem from git.
95
+ # Clones gem from git-source.
96
96
  #
97
97
  # @param [Hash] params
98
98
  # @option params [String] :path (ENV['HOME'])
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
  module Rudisco
4
4
  path_to_database =
5
- File.join(__dir__, '../../sources/database/rudisco.db')
5
+ ENV['RUDISCO_DB'] || File.join(__dir__, '../../lib/database/rudisco.db')
6
6
 
7
7
  Sequel.connect "sqlite://#{path_to_database}",
8
8
  max_connections: 40,
@@ -2,7 +2,7 @@
2
2
  namespace 'Rudisco' do
3
3
  desc "(long-term task) Starts multithread Rudisco::Gem table update"
4
4
  task 'update' do
5
- require File.join(__dir__, '..', 'sources', 'rudisco.rb')
5
+ require File.join(__dir__, '..', 'lib', 'rudisco.rb')
6
6
 
7
7
  puts "task Rudisco:update launched!"
8
8
 
data/readme.md CHANGED
@@ -58,7 +58,7 @@ Table _gems_ consist of next columns: _name, description, authors, version, lice
58
58
  ```
59
59
  ### Update database
60
60
 
61
- #### Throw CLI
61
+ #### Through CLI
62
62
 
63
63
  ```shell
64
64
  $ gem install rudisco
@@ -75,9 +75,9 @@ Table _gems_ consist of next columns: _name, description, authors, version, lice
75
75
 
76
76
  ## CLI
77
77
 
78
- ![Alt text](./docs/images/image.jpg)
78
+ ![Alt text](./doc/images/image.jpg)
79
79
 
80
- ### commands list
80
+ ### Commands list
81
81
 
82
82
  ```shell
83
83
  $ rudisco clone GEM_NAME # Clones gem sources from git
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Rudisco
5
+ describe Helpers do
6
+ context "#open_in_browser" do
7
+ it 'raises an exception when +url+ is not a string' do
8
+ expect { described_class.open_in_browser(:url) }
9
+ .to raise_exception described_class::NotAUrl
10
+ end
11
+
12
+ it 'raises an exception when +url+ is a empty string' do
13
+ expect { described_class.open_in_browser('') }
14
+ .to raise_exception described_class::NotAUrl
15
+ end
16
+ end # context "#open_in_browser"
17
+
18
+
19
+ context "#download" do
20
+ it 'raises an exception when +url+ is a empty string' do
21
+ expect { described_class.download('', nil) }
22
+ .to raise_exception described_class::NotAUrl
23
+ end
24
+ end # context "#download"
25
+
26
+ context "#git_clone" do
27
+ it 'raises an exception when +url+ is a empty string' do
28
+ expect { described_class.git_clone('', nil) }
29
+ .to raise_exception described_class::NotAUrl
30
+ end
31
+ end # context "#git_clone"
32
+ end # describe "Helpers"
33
+ end # module Rudisco
@@ -9,7 +9,7 @@ module Rudisco
9
9
  end
10
10
 
11
11
  it 'works as Sequel ORM' do
12
- expect(described_class.where {total_downloads > 10000000 }.count)
12
+ expect(described_class.where {total_downloads > 30 }.count)
13
13
  .to be > 0
14
14
  end
15
15
 
@@ -35,6 +35,24 @@ module Rudisco
35
35
  expect{ sample.action :misspelled_action }
36
36
  .to raise_exception GemActions::Unknown
37
37
  end
38
+
39
+ it 'completes an action for single cortege' do
40
+ allow_any_instance_of(Rudisco::GemActions)
41
+ .to receive(:open_in_browser).and_throw(:method_called)
42
+
43
+ cortege = described_class.first
44
+ expect{cortege.action :open_in_browser}.to throw_symbol
45
+ end
46
+
47
+ it 'completes an action for each cortege in Gems#dataset' do
48
+ allow_any_instance_of(Rudisco::GemActions)
49
+ .to receive(:open_in_browser).and_throw(:method_called)
50
+
51
+ dataset = described_class.limit(3)
52
+ dataset.each do |cortege|
53
+ expect{cortege.action :open_in_browser}.to throw_symbol
54
+ end
55
+ end
38
56
  end # describe "#action"
39
57
  end # describe Gem
40
58
  end # module Rudisco
@@ -1,5 +1,9 @@
1
1
  # encoding: utf-8
2
- require_relative '../sources/rudisco'
2
+
3
+ ## PATH TO TEST DATABASE
4
+ ENV['RUDISCO_DB'] = File.join(__dir__, 'database', 'rudisco.db')
5
+
6
+ require_relative '../lib/rudisco'
3
7
 
4
8
  RSpec.configure do |config|
5
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudisco
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuzichev Michael
@@ -120,27 +120,27 @@ files:
120
120
  - Gemfile
121
121
  - Rakefile
122
122
  - bin/rudisco
123
- - docs/images/image.jpg
123
+ - lib/database/rudisco.db
124
+ - lib/rudisco.rb
125
+ - lib/rudisco/cli/cli.rb
126
+ - lib/rudisco/cli/presentation.rb
127
+ - lib/rudisco/cli/presentation/download.rb
128
+ - lib/rudisco/cli/presentation/find.rb
129
+ - lib/rudisco/cli/presentation/git_clone.rb
130
+ - lib/rudisco/cli/presentation/open.rb
131
+ - lib/rudisco/cli/presentation/show.rb
132
+ - lib/rudisco/cli/presentation/update.rb
133
+ - lib/rudisco/helpers.rb
134
+ - lib/rudisco/models/gem.rb
135
+ - lib/rudisco/models/gem/actions.rb
136
+ - lib/rudisco/models/gem/dataset_methods.rb
137
+ - lib/rudisco/models/gem/rubygems_scanner.rb
138
+ - lib/rudisco/project_structure.rb
139
+ - lib/rudisco/sqlite.rb
124
140
  - license.md
125
141
  - rakefiles/rudisco.rake
126
142
  - readme.md
127
- - sources/database/rudisco.db
128
- - sources/rudisco.rb
129
- - sources/rudisco/cli/cli.rb
130
- - sources/rudisco/cli/presentation.rb
131
- - sources/rudisco/cli/presentation/download.rb
132
- - sources/rudisco/cli/presentation/find.rb
133
- - sources/rudisco/cli/presentation/git_clone.rb
134
- - sources/rudisco/cli/presentation/open.rb
135
- - sources/rudisco/cli/presentation/show.rb
136
- - sources/rudisco/cli/presentation/update.rb
137
- - sources/rudisco/helpers.rb
138
- - sources/rudisco/models/gem.rb
139
- - sources/rudisco/models/gem/actions.rb
140
- - sources/rudisco/models/gem/dataset_methods.rb
141
- - sources/rudisco/models/gem/rubygems_scanner.rb
142
- - sources/rudisco/project_structure.rb
143
- - sources/rudisco/sqlite.rb
143
+ - spec/rudisco/helpers_spec.rb
144
144
  - spec/rudisco/models/gem_spec.rb
145
145
  - spec/spec_helper.rb
146
146
  homepage: https://github.com/Medvedu/rudisco
@@ -150,7 +150,7 @@ metadata: {}
150
150
  post_install_message:
151
151
  rdoc_options: []
152
152
  require_paths:
153
- - sources
153
+ - lib
154
154
  required_ruby_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="
@@ -165,7 +165,7 @@ requirements:
165
165
  - wget
166
166
  - git
167
167
  rubyforge_project:
168
- rubygems_version: 2.5.1
168
+ rubygems_version: 2.6.8
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: 'Rubygems sqlite3 database (includes information about ~ 126000 gems). Table
@@ -173,4 +173,5 @@ summary: 'Rubygems sqlite3 database (includes information about ~ 126000 gems).
173
173
  source_code_url and more. Supports CLI.'
174
174
  test_files:
175
175
  - spec/spec_helper.rb
176
+ - spec/rudisco/helpers_spec.rb
176
177
  - spec/rudisco/models/gem_spec.rb
Binary file