houston-core 0.7.0.beta → 0.7.0.beta2

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: 0efd9f80386dab4ef09c84d5b11abebf1257f427
4
- data.tar.gz: 779925e55cfdd71e82eeb17d6e73c66c68119289
3
+ metadata.gz: aa625661458dbddde905b7b756187fec26d0d3e9
4
+ data.tar.gz: c84af6744c354cb36bdc0cf8bd62ae850882eb30
5
5
  SHA512:
6
- metadata.gz: cf161cfcdaacc94b20552944be87359bf276aad129a84899508264f025d1d881174f15b4d83ff48a530d105d65c7a6ab42b5a1222cee64b63778d307154ffdd1
7
- data.tar.gz: c856faa195a025dceb63555e7cef6c85dc49a8ed3abfa2f4f93fd6d7d99097a87b18b2dfef47c7b732dc6738149826187a0ff5dea98504d49e208e34f981a9c0
6
+ metadata.gz: a88962ab8eb7a3812f8f434ce3f7533a96932fe18508e4b47f4fdf91e401a83b6b2b6f6b075f0875ca324d792f4b5fa65129706ae3c4ab82e7d342b26f2f8a74
7
+ data.tar.gz: 1bb2c4920241fb70a7152d69cfcafa7d42e26e94c7905b496df4705b458a677ec01c6dc37cc3d13c66feb798a40954437b8a137072e5915256429c6595b26d7f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houston-core (0.7.0.beta)
4
+ houston-core (0.7.0.beta2)
5
5
  activerecord-import
6
6
  activerecord-pluck_in_batches
7
7
  addressable (~> 2.3.8)
@@ -199,7 +199,7 @@ GEM
199
199
  mime-types (>= 1.16, < 4)
200
200
  method_source (0.8.2)
201
201
  mime-types (2.99.1)
202
- mini_portile2 (2.0.0)
202
+ mini_portile2 (2.1.0)
203
203
  minitest (5.8.4)
204
204
  minitest-reporters (1.1.8)
205
205
  ansi
@@ -216,8 +216,9 @@ GEM
216
216
  net-ldap (0.12.1)
217
217
  net-ssh (2.9.4)
218
218
  netrc (0.11.0)
219
- nokogiri (1.6.7.2)
220
- mini_portile2 (~> 2.0.0.rc2)
219
+ nokogiri (1.6.8)
220
+ mini_portile2 (~> 2.1.0)
221
+ pkg-config (~> 1.1.7)
221
222
  oauth2 (1.1.0)
222
223
  faraday (>= 0.8, < 0.10)
223
224
  jwt (~> 1.0, < 1.5.2)
@@ -241,6 +242,7 @@ GEM
241
242
  activerecord (>= 3.1)
242
243
  activesupport (>= 3.1)
243
244
  arel
245
+ pkg-config (1.1.7)
244
246
  premailer (1.8.6)
245
247
  css_parser (>= 1.3.6)
246
248
  htmlentities (>= 4.0.0)
@@ -11,9 +11,13 @@ module Houston
11
11
 
12
12
 
13
13
  module ClassMethods
14
- def find_by_prop(prop_name, value)
14
+ def with_prop(prop_name, value)
15
15
  Houston::Props.valid_prop_name!(prop_name)
16
- result = where(["props->>'#{prop_name}' = ?", value]).limit(1).first
16
+ where(["props->>? = ?", prop_name, value])
17
+ end
18
+
19
+ def find_by_prop(prop_name, value)
20
+ result = with_prop(prop_name, value).limit(1).first
17
21
 
18
22
  if !result && block_given?
19
23
  result = yield value
@@ -1,7 +1,7 @@
1
1
  module NavigationHelper
2
2
 
3
3
  def render_navigation(key)
4
- renderer = Houston.config.get_navigation_renderer(key)
4
+ renderer = Houston.get_navigation_renderer(key)
5
5
  instance_eval &renderer
6
6
  rescue KeyError
7
7
  Rails.logger.error "\e[31;1mThere is no navigation renderer named #{key.inspect}\e[0m"
@@ -16,7 +16,7 @@ module NavigationHelper
16
16
  end
17
17
 
18
18
  def render_nav_for_feature(feature)
19
- feature = Houston.config.get_project_feature feature
19
+ feature = Houston.get_project_feature feature
20
20
  return unless feature.permitted?(current_ability, current_project)
21
21
 
22
22
  render_nav_link feature.name, feature.project_path(current_project), icon: feature.icon
@@ -27,12 +27,12 @@ module UrlHelper
27
27
 
28
28
 
29
29
  def feature_path(project, feature)
30
- feature = Houston.config.get_project_feature feature
30
+ feature = Houston.get_project_feature feature
31
31
  feature.project_path project
32
32
  end
33
33
 
34
34
  def link_to_project_feature(project, feature)
35
- feature = Houston.config.get_project_feature feature
35
+ feature = Houston.get_project_feature feature
36
36
  link_to feature.name, feature.project_path(project)
37
37
  end
38
38
 
@@ -70,7 +70,7 @@
70
70
  <label class="control-label">Features</label>
71
71
  <div class="controls" style="padding-top: 5px; padding-bottom: 5px;">
72
72
  <% Houston.config.project_features.each do |feature_slug| %>
73
- <% feature = Houston.config.get_project_feature(feature_slug) %>
73
+ <% feature = Houston.get_project_feature(feature_slug) %>
74
74
  <label for="selected_features_<%= feature_slug %>">
75
75
  <%= check_box_tag "project[selected_features][]", feature_slug, @project.feature?(feature_slug), id: "selected_features_#{feature_slug}", class: "project-feature" %>
76
76
  <%= feature.name %>
@@ -57,7 +57,7 @@
57
57
 
58
58
 
59
59
  <%= f.fields_for :props do |f| %>
60
- <% Houston.config.user_options.each do |form| %>
60
+ <% Houston.user_options.each do |form| %>
61
61
  <hr />
62
62
 
63
63
  <div class="control-group">
@@ -1,10 +1,7 @@
1
1
  require File.expand_path("../boot", __FILE__)
2
2
 
3
3
  require "rails/all"
4
-
5
- require_relative "../lib/configuration.rb" # Loads Houston's configuration
6
- require_relative "../lib/houston_server.rb"
7
- require_relative "../lib/houston_daemonize.rb"
4
+ require "houston/boot"
8
5
 
9
6
  # Require gems listed in gemspec
10
7
  require "activerecord-import"
@@ -1,10 +1,10 @@
1
- Houston.config.add_navigation_renderer :sprint do
1
+ Houston.add_navigation_renderer :sprint do
2
2
  if can?(:read, Sprint)
3
3
  render_nav_link "Sprint", main_app.current_sprint_path, icon: "fa-burndown"
4
4
  end
5
5
  end
6
6
 
7
- Houston.config.add_navigation_renderer :pulls do
7
+ Houston.add_navigation_renderer :pulls do
8
8
  if can?(:read, Github::PullRequest)
9
9
  render_nav_link "Pulls", main_app.pulls_path, icon: "octokit-pull-request"
10
10
  end
@@ -12,27 +12,27 @@ end
12
12
 
13
13
 
14
14
 
15
- Houston.config.add_project_feature :ideas do
15
+ Houston.add_project_feature :ideas do
16
16
  name "Ideas"
17
17
  icon "fa-lightbulb-o"
18
18
  path { |project| Houston::Application.routes.url_helpers.project_open_ideas_path(project) }
19
19
  ability { |ability, project| ability.can?(:read, project.tickets.build) }
20
20
  end
21
21
 
22
- Houston.config.add_project_feature :bugs do
22
+ Houston.add_project_feature :bugs do
23
23
  name "Bugs"
24
24
  icon "fa-bug"
25
25
  path { |project| Houston::Application.routes.url_helpers.project_open_bugs_path(project) }
26
26
  ability { |ability, project| ability.can?(:read, project.tickets.build) }
27
27
  end
28
28
 
29
- Houston.config.add_project_feature :testing do
29
+ Houston.add_project_feature :testing do
30
30
  name "Testing"
31
31
  icon "fa-comments"
32
32
  path { |project| Houston::Application.routes.url_helpers.project_testing_report_path(project) }
33
33
  end
34
34
 
35
- Houston.config.add_project_feature :releases do
35
+ Houston.add_project_feature :releases do
36
36
  name "Releases"
37
37
  icon "fa-paper-plane"
38
38
  path { |project| Houston::Application.routes.url_helpers.releases_path(project) }
@@ -64,7 +64,7 @@ Houston.config.add_project_feature :releases do
64
64
 
65
65
  end
66
66
 
67
- Houston.config.add_project_feature :settings do
67
+ Houston.add_project_feature :settings do
68
68
  name "Settings"
69
69
  icon "fa-gear"
70
70
  path { |project| Houston::Application.routes.url_helpers.edit_project_path(project) }
@@ -0,0 +1,4 @@
1
+ require "houston/boot/configuration"
2
+ require "houston/boot/server"
3
+ require "houston/boot/daemonize"
4
+ require "houston/boot/extensions"
@@ -1,8 +1,8 @@
1
- root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
1
+ root = File.expand_path(File.join(File.dirname(__FILE__), "../../.."))
2
2
  require File.join(root, "lib/core_ext/hash")
3
3
  require File.join(root, "lib/core_ext/kernel")
4
4
  require File.join(root, "lib/core_ext/exception")
5
- require File.join(root, "lib/houston_observer")
5
+ require File.join(root, "lib/houston/boot/observer")
6
6
 
7
7
  $:.unshift File.expand_path(File.join(root, "app/adapters"))
8
8
  require "houston/adapters"
@@ -15,9 +15,6 @@ module Houston
15
15
  @root = Rails.root
16
16
  @modules = []
17
17
  @gems = []
18
- @navigation_renderers = {}
19
- @user_options = {}
20
- @available_project_features = {}
21
18
  @ticket_types = {}
22
19
  @authentication_strategy = :database
23
20
  @authentication_strategy_configuration = {}
@@ -124,51 +121,10 @@ module Houston
124
121
  @navigation ||= []
125
122
  end
126
123
 
127
- def add_navigation_renderer(name, &block)
128
- @navigation_renderers[name] = block
129
- end
130
-
131
- def get_navigation_renderer(name)
132
- @navigation_renderers.fetch(name)
133
- end
134
-
135
-
136
-
137
- def add_user_option(slug, &block)
138
- dsl = FormBuilderDsl.new
139
- dsl.instance_eval(&block)
140
- form = dsl.form
141
- form.slug = slug
142
-
143
- @user_options[slug] = form
144
- end
145
-
146
- def user_options
147
- @user_options.values
148
- end
149
-
150
-
151
-
152
124
  def project_features(*args)
153
125
  @project_features = args if args.any?
154
- return @available_project_features.keys unless @project_features
155
- @project_features & @available_project_features.keys
156
- end
157
-
158
- def get_project_feature(slug)
159
- @available_project_features[slug]
160
- end
161
-
162
- def add_project_feature(slug, &block)
163
- dsl = ProjectFeatureDsl.new
164
- dsl.instance_eval(&block)
165
- feature = dsl.feature
166
- feature.slug = slug
167
- raise ArgumentError, "Project Feature must supply name, but #{slug.inspect} doesn't" unless feature.name
168
- raise ArgumentError, "Project Feature must supply icon, but #{slug.inspect} doesn't" unless feature.icon
169
- raise ArgumentError, "Project Feature must supply path lambda, but #{slug.inspect} doesn't" unless feature.path_block
170
-
171
- @available_project_features[slug] = feature
126
+ return Houston.available_project_features unless @project_features
127
+ @project_features & Houston.available_project_features
172
128
  end
173
129
 
174
130
 
@@ -429,7 +385,7 @@ module Houston
429
385
  end
430
386
 
431
387
  def method_missing(name, *args, &block)
432
- puts "\e[33mMissing Configuration option: #{name}\e[0m"
388
+ puts "\e[31mMissing Configuration option: \e[1m#{name}\e[0;90m\n#{caller[0]}\e[0m\n\n"
433
389
  nil
434
390
  end
435
391
 
@@ -509,82 +465,7 @@ module Houston
509
465
 
510
466
 
511
467
 
512
- class ProjectFeature
513
- attr_accessor :name, :slug, :icon, :path_block, :ability_block, :fields
514
-
515
- def initialize
516
- self.fields = []
517
- end
518
-
519
- def project_path(project)
520
- path_block.call project
521
- end
522
-
523
- def permitted?(ability, project)
524
- return true if ability_block.nil?
525
- ability_block.call ability, project
526
- end
527
- end
528
-
529
-
530
-
531
- class ProjectFeatureDsl
532
- attr_reader :feature
533
468
 
534
- def initialize
535
- @feature = ProjectFeature.new
536
- end
537
-
538
- def name(value)
539
- feature.name = value
540
- end
541
-
542
- def icon(value)
543
- feature.icon = value
544
- end
545
-
546
- def path(&block)
547
- feature.path_block = block
548
- end
549
-
550
- def ability(&block)
551
- feature.ability_block = block
552
- end
553
-
554
- def field(slug, &block)
555
- dsl = FormBuilderDsl.new
556
- dsl.instance_eval(&block)
557
- form = dsl.form
558
- form.slug = slug
559
- feature.fields.push form
560
- end
561
- end
562
-
563
-
564
-
565
- class ProjectFeatureForm
566
- attr_accessor :slug, :name, :render_block
567
-
568
- def render(view, f)
569
- view.instance_exec(f, &render_block).html_safe
570
- end
571
- end
572
-
573
- class FormBuilderDsl
574
- attr_reader :form
575
-
576
- def initialize
577
- @form = ProjectFeatureForm.new
578
- end
579
-
580
- def name(value)
581
- form.name = value
582
- end
583
-
584
- def html(&block)
585
- form.render_block = block
586
- end
587
- end
588
469
 
589
470
 
590
471
 
@@ -0,0 +1,136 @@
1
+ module Houston
2
+ module Extensions
3
+
4
+
5
+
6
+ def add_navigation_renderer(name, &block)
7
+ @navigation_renderers[name] = block
8
+ end
9
+
10
+ def get_navigation_renderer(name)
11
+ @navigation_renderers.fetch(name)
12
+ end
13
+
14
+
15
+
16
+ def add_user_option(slug, &block)
17
+ dsl = FormBuilderDsl.new
18
+ dsl.instance_eval(&block)
19
+ form = dsl.form
20
+ form.slug = slug
21
+
22
+ @user_options[slug] = form
23
+ end
24
+
25
+ def user_options
26
+ @user_options.values
27
+ end
28
+
29
+
30
+
31
+ def available_project_features
32
+ @available_project_features.keys
33
+ end
34
+
35
+ def get_project_feature(slug)
36
+ @available_project_features[slug]
37
+ end
38
+
39
+ def add_project_feature(slug, &block)
40
+ dsl = ProjectFeatureDsl.new
41
+ dsl.instance_eval(&block)
42
+ feature = dsl.feature
43
+ feature.slug = slug
44
+ raise ArgumentError, "Project Feature must supply name, but #{slug.inspect} doesn't" unless feature.name
45
+ raise ArgumentError, "Project Feature must supply icon, but #{slug.inspect} doesn't" unless feature.icon
46
+ raise ArgumentError, "Project Feature must supply path lambda, but #{slug.inspect} doesn't" unless feature.path_block
47
+
48
+ @available_project_features[slug] = feature
49
+ end
50
+
51
+
52
+
53
+ private
54
+
55
+ class ProjectFeature
56
+ attr_accessor :name, :slug, :icon, :path_block, :ability_block, :fields
57
+
58
+ def initialize
59
+ self.fields = []
60
+ end
61
+
62
+ def project_path(project)
63
+ path_block.call project
64
+ end
65
+
66
+ def permitted?(ability, project)
67
+ return true if ability_block.nil?
68
+ ability_block.call ability, project
69
+ end
70
+ end
71
+
72
+ class ProjectFeatureDsl
73
+ attr_reader :feature
74
+
75
+ def initialize
76
+ @feature = ProjectFeature.new
77
+ end
78
+
79
+ def name(value)
80
+ feature.name = value
81
+ end
82
+
83
+ def icon(value)
84
+ feature.icon = value
85
+ end
86
+
87
+ def path(&block)
88
+ feature.path_block = block
89
+ end
90
+
91
+ def ability(&block)
92
+ feature.ability_block = block
93
+ end
94
+
95
+ def field(slug, &block)
96
+ dsl = FormBuilderDsl.new
97
+ dsl.instance_eval(&block)
98
+ form = dsl.form
99
+ form.slug = slug
100
+ feature.fields.push form
101
+ end
102
+ end
103
+
104
+ class ProjectFeatureForm
105
+ attr_accessor :slug, :name, :render_block
106
+
107
+ def render(view, f)
108
+ view.instance_exec(f, &render_block).html_safe
109
+ end
110
+ end
111
+
112
+ class FormBuilderDsl
113
+ attr_reader :form
114
+
115
+ def initialize
116
+ @form = ProjectFeatureForm.new
117
+ end
118
+
119
+ def name(value)
120
+ form.name = value
121
+ end
122
+
123
+ def html(&block)
124
+ form.render_block = block
125
+ end
126
+ end
127
+
128
+ end
129
+
130
+
131
+
132
+ @navigation_renderers = {}
133
+ @user_options = {}
134
+ @available_project_features = {}
135
+ extend Houston::Extensions
136
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module Houston
2
- VERSION = "0.7.0.beta"
2
+ VERSION = "0.7.0.beta2"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  root = File.expand_path(File.join(File.dirname(__FILE__), "../.."))
2
- require File.join(root, "lib/configuration")
2
+ require File.join(root, "lib/houston/boot/configuration")
3
3
 
4
4
  namespace :keypair do
5
5
  task :generate do |t|
@@ -7,9 +7,9 @@ namespace :keypair do
7
7
  puts "#{Houston.config.keypair} exists"
8
8
  exit
9
9
  end
10
-
10
+
11
11
  tmp = Rails.root.to_s
12
-
12
+
13
13
  `openssl genrsa -des3 -passout pass:#{Houston.config.passphrase.shellescape} -out #{tmp}/config/private.pem 2048`
14
14
  `openssl rsa -in #{tmp}/config/private.pem -passin pass:#{Houston.config.passphrase.shellescape} -out #{tmp}/config/public.pem -outform PEM -pubout`
15
15
  `cat #{tmp}/config/private.pem #{tmp}/config/public.pem >> #{Houston.config.keypair}`
@@ -135,7 +135,7 @@ Houston.config do
135
135
  # Menus are provided by Houston and modules.
136
136
  # Additional navigation can be defined by calling
137
137
  #
138
- # Houston.config.add_navigation_renderer
138
+ # Houston.add_navigation_renderer
139
139
  #
140
140
  # For examples, see config/initializers/add_navigation_renderers.rb
141
141
  #
@@ -1,3 +1,3 @@
1
- # Houston.config.add_navigation_renderer :<%= name %> do
1
+ # Houston.add_navigation_renderer :<%= name %> do
2
2
  # render_nav_link "<%= camelized %>", Houston::<%= camelized %>::Engine.routes.url_helpers.root_path, icon: "fa-thumbs-up"
3
3
  # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houston-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.beta
4
+ version: 0.7.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-25 00:00:00.000000000 Z
11
+ date: 2016-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1409,7 +1409,6 @@ files:
1409
1409
  - db/seeds.rb
1410
1410
  - db/structure.sql
1411
1411
  - houston-core.gemspec
1412
- - lib/configuration.rb
1413
1412
  - lib/core_ext/array.rb
1414
1413
  - lib/core_ext/duration.rb
1415
1414
  - lib/core_ext/exception.rb
@@ -1418,11 +1417,14 @@ files:
1418
1417
  - lib/generators/instance_generator.rb
1419
1418
  - lib/generators/module_generator.rb
1420
1419
  - lib/houston/application.rb
1420
+ - lib/houston/boot.rb
1421
+ - lib/houston/boot/configuration.rb
1422
+ - lib/houston/boot/daemonize.rb
1423
+ - lib/houston/boot/extensions.rb
1424
+ - lib/houston/boot/observer.rb
1425
+ - lib/houston/boot/server.rb
1421
1426
  - lib/houston/cli.rb
1422
1427
  - lib/houston/version.rb
1423
- - lib/houston_daemonize.rb
1424
- - lib/houston_observer.rb
1425
- - lib/houston_server.rb
1426
1428
  - lib/parallel_enumerable.rb
1427
1429
  - lib/rack/oembed.rb
1428
1430
  - lib/tasks/.gitkeep