puppet-library 0.11.0 → 0.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5501e3e79913a9181ca6b829be328e8c6b3e3c64
4
- data.tar.gz: 6625c303010b85e82a6f6d121379becb92634eff
3
+ metadata.gz: 318299128135093f04410ff8266b6b13276d1926
4
+ data.tar.gz: 1d1d6e3fa14700b925fc544ffad3bc8fda8140a1
5
5
  SHA512:
6
- metadata.gz: 2cfa2f30bc16b177d5c272fa495b3d3b5f522959507faf17612b3234c2eb13fc19835b64d8703103692102e25a186188de8b977fd7764eb3c2083ab5e4ec0908
7
- data.tar.gz: 4df43a457d93c2722154f295aeec9c43e250f4dba2ef7be9e881e2d56348c7adeafe88bd8c8186ee1cf171f844cb07865be2effb4a15258b1ecd1d55dc0e01a0
6
+ metadata.gz: 50528c35cf90a196f27fdb525e47cef146f3df818929b94350fe88b97c5d9ee8734d52d23ad4f9ddde937233fd73043712e20ced9f0b4cf0a0bca65a1a6d952b
7
+ data.tar.gz: be971c3867dfc917ebfa107526483c2a29011f02910cd749856fd689aac666e08b65c1c2f69a2d70173378ddecd775d839fdf16159dcf4a7aa6fb94664c01d8a
data/CHANGELOG.yml CHANGED
@@ -75,3 +75,7 @@
75
75
  - Fixed issue with "Too many open files" caused by Git repo forges on Ruby 1.8
76
76
  - Fixed issue Git repo forges with tags without Modulefiles
77
77
  - Fixed issue Git repo forges with no description in Modulefile
78
+ - tag: v0.12.0
79
+ changes:
80
+ - Load web UI asynchronously to improve performance
81
+ - Updated API documentation
data/TODO.yml CHANGED
@@ -1,27 +1,25 @@
1
1
  features:
2
- - Web UI:
3
- - asynchronous (index page loads too slowly)
4
- - Git repo forge:
5
- - make it more flexible:
6
- - fail gracefully if we can't contact the remote repo
7
- - Performance:
8
- - cache stuff so it's faster
9
- - logging:
10
- - use Ruby logging
11
- - include some verbose logging
12
- - improve error messages (e.g. for when a module can't be untarred)
13
- - Named subforges:
14
- - per-subforge queries
15
- - upload modules (web form and API)
16
- - browse proxy cache
17
- - clear proxy cache (web form and API)
18
- - delete modules from disk (web form)
19
- - Authentication
20
- - Config APIs:
21
- - documentation
2
+ - Git repo forge:
3
+ - make it more flexible:
4
+ - fail gracefully if we can't contact the remote repo
5
+ - Performance:
6
+ - cache stuff so it's faster
7
+ - logging:
8
+ - use Ruby logging
9
+ - include some verbose logging
10
+ - improve error messages (e.g. for when a module can't be untarred)
11
+ - Named subforges:
12
+ - per-subforge queries
13
+ - upload modules (web form and API)
14
+ - browse proxy cache
15
+ - clear proxy cache (web form and API)
16
+ - delete modules from disk (web form)
17
+ - Authentication
18
+ - Config APIs:
19
+ - documentation
22
20
 
23
21
  dubious_features:
24
- - Proxy modules' source in a directory (supported individually for now: should we just leave it that way?)
25
- - Make proxy cache TTL configurable
26
- - Allow failover between module repositories
27
- - Look in /etc/puppet-library.yml for config by default
22
+ - Proxy modules' source in a directory (supported individually for now: should we just leave it that way?)
23
+ - Make proxy cache TTL configurable
24
+ - Allow failover between module repositories
25
+ - Look in /etc/puppet-library.yml for config by default
@@ -15,6 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
+ @javascript
18
19
  Feature: Module list page
19
20
  As a user
20
21
  I want to see a list of available modules
@@ -15,6 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
+ @javascript
18
19
  Feature: Module search
19
20
  As a user
20
21
  I want to search the modules
@@ -17,6 +17,7 @@
17
17
 
18
18
  require 'puppet_library'
19
19
  require 'capybara/cucumber'
20
+ require 'capybara/poltergeist'
20
21
 
21
22
  class ServerWorld
22
23
  def server
@@ -30,6 +31,7 @@ end
30
31
 
31
32
  world = ServerWorld.new
32
33
  Capybara.app = world.server
34
+ Capybara.javascript_driver = :poltergeist
33
35
 
34
36
  World do
35
37
  world
@@ -16,11 +16,25 @@
16
16
  -# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  %h1 Modules
19
- %ul
20
- - modules.each do |mod|
21
- %li
22
- %b
23
- %a{:href => mod["full_name"]}= mod["full_name"]
24
- %ul
25
- - mod["releases"].each do |release|
26
- %li= release["version"]
19
+ .loading
20
+ Loding module list...
21
+ %ul.modules
22
+
23
+ :javascript
24
+ $(document).ready(function() {
25
+ $.getJSON("modules.json?q=#{query}", function(modules) {
26
+ $.each(modules, function(index, module) {
27
+ var item = $("<li/>");
28
+ item.append($("<b/>").append($("<a/>").attr("href", module.full_name).text(module.full_name)));
29
+
30
+ var versionList = $("<ul/>");
31
+ $.each(module.releases, function(index, release) {
32
+ versionList.append($("<li>").text(release.version));
33
+ });
34
+
35
+ item.append(versionList);
36
+ item.appendTo(".modules");
37
+ });
38
+ $(".loading").hide();
39
+ });
40
+ });
@@ -69,7 +69,7 @@
69
69
  %input.form-control.search-query{ :name => "search", :type => "search", :placeholder => "Search modules" }
70
70
  %span.input-group-btn
71
71
  %button.btn.btn-primary{ :type => "submit" } Search
72
+ %script{ :src => "https://code.jquery.com/jquery-2.1.0.min.js" }
72
73
  .container
73
74
  = yield
74
- %script{ :src => "https://code.jquery.com/jquery-2.1.0.min.js" }
75
75
  %script{ :src => "https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js" }
@@ -26,12 +26,12 @@ module PuppetLibrary::Forge
26
26
  #
27
27
  # <b>Usage:</b>
28
28
  #
29
- # forge = PuppetLibrary::Forge::Cache.configure do |repo|
29
+ # forge = PuppetLibrary::Forge::Cache.configure do
30
30
  # # The URL of the remote forge
31
- # repo.url = "http://forge.example.com
31
+ # url "http://forge.example.com"
32
32
  #
33
33
  # # The path to cache the files to on disk
34
- # repo.path = "/var/modules/cache
34
+ # path "/var/modules/cache"
35
35
  # end
36
36
  class Cache < Proxy
37
37
 
@@ -31,9 +31,9 @@ module PuppetLibrary::Forge
31
31
  #
32
32
  # <b>Usage:</b>
33
33
  #
34
- # forge = PuppetLibrary::Forge::Directory.configure do |repo|
34
+ # forge = PuppetLibrary::Forge::Directory.configure do
35
35
  # # The path to serve the modules from
36
- # repo.path = "/var/modules/cache
36
+ # path "/var/modules/cache"
37
37
  # end
38
38
  class Directory < PuppetLibrary::Forge::Abstract
39
39
 
@@ -29,12 +29,12 @@ module PuppetLibrary::Forge
29
29
  #
30
30
  # <b>Usage:</b>
31
31
  #
32
- # forge = PuppetLibrary::Forge::GitRepository.configure do |repo|
32
+ # forge = PuppetLibrary::Forge::GitRepository.configure do
33
33
  # # The location of the git repository
34
- # repo.source = "http://example.com/mymodule.git
34
+ # source "http://example.com/mymodule.git"
35
35
  #
36
36
  # # A regular expression describing which tags to serve
37
- # repo.include_tags = /[0-9.]+/
37
+ # include_tags /[0-9.]+/
38
38
  # end
39
39
  class GitRepository < PuppetLibrary::Forge::Abstract
40
40
 
@@ -27,9 +27,9 @@ module PuppetLibrary::Forge
27
27
  #
28
28
  # <b>Usage:</b>
29
29
  #
30
- # forge = PuppetLibrary::Forge::Proxy.configure do |repo|
30
+ # forge = PuppetLibrary::Forge::Proxy.configure do
31
31
  # # The URL of the remote forge
32
- # repo.url = "http://forge.example.com
32
+ # url "http://forge.example.com"
33
33
  # end
34
34
  class Proxy < Forge
35
35
 
@@ -26,6 +26,13 @@ module PuppetLibrary::Forge
26
26
  #
27
27
  # <b>Note:</b>
28
28
  # The module directory must have a +Modulefile+.
29
+ #
30
+ # <b>Usage:</b>
31
+ #
32
+ # forge = PuppetLibrary::Forge::Source.configure do
33
+ # # The path of the module's source
34
+ # path "/var/modules/mymodulesource"
35
+ # end
29
36
  class Source < PuppetLibrary::Forge::Abstract
30
37
  def self.configure(&block)
31
38
  config_api = PuppetLibrary::Util::ConfigApi.for(Source) do
@@ -27,12 +27,16 @@ module PuppetLibrary
27
27
  #
28
28
  # A Rack application that can be configured as follows:
29
29
  #
30
- # server = PuppetLibrary::Server.configure do |library|
30
+ # server = PuppetLibrary::Server.configure
31
31
  # # Look for my modules locally
32
- # library.forge PuppetLibrary::Forge::Directory.new("/var/lib/modules")
32
+ # forge :directory do
33
+ # path "/var/lib/modules"
34
+ # end
33
35
  #
34
36
  # # Get everything else from the Puppet Forge
35
- # library.forge PuppetLibrary::Forge::Proxy.new("http://forge.puppetlabs.com")
37
+ # forge :proxy do
38
+ # url "http://forge.puppetlabs.com"
39
+ # end
36
40
  # end
37
41
  #
38
42
  # run server
@@ -73,9 +77,7 @@ module PuppetLibrary
73
77
 
74
78
  get "/" do
75
79
  query = params[:search]
76
- modules = @forge.search_modules(query)
77
-
78
- haml :index, { :locals => { "modules" => modules } }
80
+ haml :index, { :locals => { "query" => query } }
79
81
  end
80
82
 
81
83
  get "/modules.json" do
@@ -58,19 +58,26 @@ module PuppetLibrary::Util
58
58
  config_class = Class.new(Config) do
59
59
  define_method(:params) { params }
60
60
  params.each do |param|
61
- define_method(param.name.to_sym) do |new_value|
62
- set(param, new_value)
63
- end
64
-
65
- define_method("get_#{param.name}".to_sym) do
66
- get(param)
67
- end
61
+ define_getter(param)
62
+ define_setter(param)
68
63
  end
69
64
  end
70
65
  PuppetLibrary.const_set(class_name, config_class)
71
66
  end
72
67
 
73
68
  class Config
69
+ def self.define_getter(param)
70
+ define_method("get_#{param.name}".to_sym) do
71
+ get(param)
72
+ end
73
+ end
74
+
75
+ def self.define_setter(param)
76
+ define_method(param.name.to_sym) do |new_value|
77
+ set(param, new_value)
78
+ end
79
+ end
80
+
74
81
  def initialize
75
82
  @values = {}
76
83
  end
@@ -35,7 +35,7 @@ module Gem
35
35
  end
36
36
  end
37
37
 
38
- def Dependency.new(name, spec)
38
+ def Dependency.new(name, spec = ">=0")
39
39
  super(name, spec.to_s.gsub("-", ".pre."))
40
40
  rescue ArgumentError
41
41
  # If it starts with numbers, use those
@@ -16,5 +16,5 @@
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  module PuppetLibrary
19
- VERSION = "0.11.0"
19
+ VERSION = "0.12.0"
20
20
  end
@@ -64,5 +64,7 @@ Gem::Specification.new do |spec|
64
64
  spec.add_development_dependency "capybara"
65
65
  spec.add_development_dependency "nokogiri" # Rubygems 1.8 fails to resolve this on Ruby 2.0.0
66
66
  spec.add_development_dependency "cucumber"
67
+ spec.add_development_dependency "selenium-webdriver"
68
+ spec.add_development_dependency "poltergeist"
67
69
  end
68
70
  end
data/spec/server_spec.rb CHANGED
@@ -61,14 +61,10 @@ module PuppetLibrary
61
61
  "desc" => "Puppet module for Apache"
62
62
  }
63
63
  ]
64
- expect(forge).to receive(:search_modules).with(nil).and_return(modules)
65
64
 
66
65
  get "/"
67
66
 
68
- expect(last_response.body).to include "Modules"
69
- expect(last_response.body).to include "puppetlabs/apache"
70
- expect(last_response.body).to include "0.0.1"
71
- expect(last_response.body).to include "0.0.2"
67
+ expect(last_response.body).to include '"modules.json?q="'
72
68
  end
73
69
 
74
70
  context "when a search term is provided" do
@@ -85,14 +81,10 @@ module PuppetLibrary
85
81
  "desc" => "Puppet module for Apache"
86
82
  }
87
83
  ]
88
- expect(forge).to receive(:search_modules).with("apache").and_return(modules)
89
84
 
90
85
  get "/?search=apache"
91
86
 
92
- expect(last_response.body).to include "Modules"
93
- expect(last_response.body).to include "puppetlabs/apache"
94
- expect(last_response.body).to include "0.0.1"
95
- expect(last_response.body).to include "0.0.2"
87
+ expect(last_response.body).to include "modules.json?q=apache"
96
88
  end
97
89
  end
98
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - drrb
@@ -318,6 +318,34 @@ dependencies:
318
318
  - - '>='
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: selenium-webdriver
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - '>='
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - '>='
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: poltergeist
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - '>='
340
+ - !ruby/object:Gem::Version
341
+ version: '0'
342
+ type: :development
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - '>='
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
321
349
  description: A private Puppet forge
322
350
  email:
323
351
  - drrrrrrrrrrrb@gmail.com
@@ -431,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
459
  version: '0'
432
460
  requirements: []
433
461
  rubyforge_project:
434
- rubygems_version: 2.2.1
462
+ rubygems_version: 2.0.3
435
463
  signing_key:
436
464
  specification_version: 4
437
465
  summary: Puppet Library is a private Puppet module server that's compatible with librarian-puppet.