fat_free_crm 0.20.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +170 -0
- data/README.md +3 -6
- data/app/assets/config/manifest.js +3 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/application_helper.rb +22 -3
- data/app/helpers/tasks_helper.rb +1 -2
- data/app/models/entities/account.rb +1 -1
- data/app/models/entities/campaign.rb +1 -1
- data/app/models/entities/contact.rb +1 -1
- data/app/models/entities/lead.rb +1 -1
- data/app/models/entities/opportunity.rb +1 -1
- data/app/models/polymorphic/avatar.rb +1 -30
- data/app/models/polymorphic/task.rb +1 -0
- data/app/views/home/index.xls.builder +1 -0
- data/app/views/shared/_address.html.haml +1 -1
- data/config/application.rb +13 -0
- data/config/environments/development.rb +3 -0
- data/config/puma.rb +2 -2
- data/config/storage.yml +34 -0
- data/db/migrate/20100928030617_drop_openid_tables.rb +2 -1
- data/db/migrate/20230526211831_create_active_storage_tables.active_storage.rb +51 -0
- data/db/migrate/20230526212613_convert_to_active_storage.rb +91 -0
- data/db/schema.rb +65 -35
- data/db/seeds/fields.rb +7 -21
- data/lib/development_tasks/license.rake +10 -10
- data/lib/fat_free_crm/errors.rb +2 -10
- data/lib/fat_free_crm/exceptions.rb +1 -0
- data/lib/fat_free_crm/fields.rb +4 -5
- data/lib/fat_free_crm/gem_dependencies.rb +0 -1
- data/lib/fat_free_crm/i18n.rb +1 -1
- data/lib/fat_free_crm/version.rb +3 -3
- metadata +16 -279
- data/.docker/nginx/sites-enabled/ffcrm.conf +0 -8
- data/.github/workflows/brakeman-analysis.yml +0 -46
- data/.github/workflows/rubocop-analysis.yml +0 -40
- data/.github/workflows/ruby.yml +0 -52
- data/.gitignore +0 -39
- data/.rubocop.yml +0 -73
- data/.rubocop_todo.yml +0 -286
- data/.teatro.yml +0 -3
- data/.travis.yml +0 -60
- data/CONTRIBUTORS.md +0 -135
- data/Capfile +0 -27
- data/Dockerfile +0 -51
- data/Gemfile +0 -106
- data/Gemfile.lock +0 -529
- data/Guardfile +0 -26
- data/Procfile +0 -1
- data/SECURITY.md +0 -11
- data/Vagrantfile +0 -92
- data/custom_plan.rb +0 -11
- data/docker-compose.yml +0 -27
- data/fat_free_crm.gemspec +0 -62
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/.gitkeep~master +0 -0
- data/script/rails +0 -8
- data/spec/controllers/admin/groups_controller_spec.rb +0 -11
- data/spec/controllers/admin/users_controller_spec.rb +0 -251
- data/spec/controllers/applications_controller_spec.rb +0 -43
- data/spec/controllers/comments_controller_spec.rb +0 -195
- data/spec/controllers/emails_controller_spec.rb +0 -37
- data/spec/controllers/entities/accounts_controller_spec.rb +0 -607
- data/spec/controllers/entities/campaigns_controller_spec.rb +0 -645
- data/spec/controllers/entities/contacts_controller_spec.rb +0 -705
- data/spec/controllers/entities/leads_controller_spec.rb +0 -1009
- data/spec/controllers/entities/opportunities_controller_spec.rb +0 -904
- data/spec/controllers/entities_controller_spec.rb +0 -47
- data/spec/controllers/home_controller_spec.rb +0 -235
- data/spec/controllers/lists_controller_spec.rb +0 -11
- data/spec/controllers/tasks_controller_spec.rb +0 -517
- data/spec/controllers/users_controller_spec.rb +0 -375
- data/spec/factories/account_factories.rb +0 -40
- data/spec/factories/campaign_factories.rb +0 -30
- data/spec/factories/contact_factories.rb +0 -45
- data/spec/factories/field_factories.rb +0 -40
- data/spec/factories/lead_factories.rb +0 -36
- data/spec/factories/list_factories.rb +0 -13
- data/spec/factories/opportunity_factories.rb +0 -39
- data/spec/factories/sequences.rb +0 -32
- data/spec/factories/setting_factories.rb +0 -15
- data/spec/factories/shared_factories.rb +0 -70
- data/spec/factories/subscription_factories.rb +0 -13
- data/spec/factories/tag_factories.rb +0 -12
- data/spec/factories/task_factories.rb +0 -29
- data/spec/factories/user_factories.rb +0 -66
- data/spec/features/acceptance_helper.rb +0 -11
- data/spec/features/accounts_spec.rb +0 -126
- data/spec/features/admin/groups_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -40
- data/spec/features/campaigns_spec.rb +0 -104
- data/spec/features/contacts_spec.rb +0 -134
- data/spec/features/dashboard_spec.rb +0 -67
- data/spec/features/devise/sign_in_spec.rb +0 -58
- data/spec/features/devise/sign_up_spec.rb +0 -36
- data/spec/features/leads_spec.rb +0 -138
- data/spec/features/opportunities_overview_spec.rb +0 -88
- data/spec/features/opportunities_spec.rb +0 -132
- data/spec/features/support/autocomlete_helper.rb +0 -17
- data/spec/features/support/browser.rb +0 -28
- data/spec/features/support/headless.rb +0 -19
- data/spec/features/support/paths.rb +0 -48
- data/spec/features/support/selector_helpers.rb +0 -36
- data/spec/features/tasks_spec.rb +0 -94
- data/spec/fixtures/rails.png +0 -0
- data/spec/helpers/accounts_helper_spec.rb +0 -73
- data/spec/helpers/admin/field_groups_helper_spec.rb +0 -20
- data/spec/helpers/admin/plugins_helper_spec.rb +0 -11
- data/spec/helpers/admin/settings_helper_spec.rb +0 -11
- data/spec/helpers/admin/users_helper_spec.rb +0 -11
- data/spec/helpers/application_helper_spec.rb +0 -86
- data/spec/helpers/authentications_helper_spec.rb +0 -16
- data/spec/helpers/campaigns_helper_spec.rb +0 -16
- data/spec/helpers/comments_helper_spec.rb +0 -16
- data/spec/helpers/contacts_helper_spec.rb +0 -16
- data/spec/helpers/emails_helper_spec.rb +0 -11
- data/spec/helpers/fields_helper_spec.rb +0 -12
- data/spec/helpers/groups_helper_spec.rb +0 -21
- data/spec/helpers/home_helper_spec.rb +0 -16
- data/spec/helpers/leads_helper_spec.rb +0 -16
- data/spec/helpers/lists_helper_spec.rb +0 -21
- data/spec/helpers/opportunities_helper_spec.rb +0 -16
- data/spec/helpers/passwords_helper_spec.rb +0 -16
- data/spec/helpers/tasks_helper_spec.rb +0 -20
- data/spec/helpers/users_helper_spec.rb +0 -39
- data/spec/lib/comment_extensions_spec.rb +0 -42
- data/spec/lib/core_ext/string_spec.rb +0 -23
- data/spec/lib/errors_spec.rb +0 -32
- data/spec/lib/fields_spec.rb +0 -101
- data/spec/lib/mail_processor/base_spec.rb +0 -169
- data/spec/lib/mail_processor/comment_replies_spec.rb +0 -70
- data/spec/lib/mail_processor/dropbox_spec.rb +0 -306
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +0 -173
- data/spec/lib/permissions_spec.rb +0 -155
- data/spec/lib/secret_token_generator_spec.rb +0 -69
- data/spec/lib/view_factory_spec.rb +0 -69
- data/spec/mailers/devise_mailer_spec.rb +0 -35
- data/spec/mailers/subscription_mailer_spec.rb +0 -48
- data/spec/mailers/user_mailer_spec.rb +0 -115
- data/spec/models/entities/account_contact_spec.rb +0 -34
- data/spec/models/entities/account_opportunity_spec.rb +0 -34
- data/spec/models/entities/account_spec.rb +0 -206
- data/spec/models/entities/campaign_spec.rb +0 -131
- data/spec/models/entities/contact_opportunity_spec.rb +0 -34
- data/spec/models/entities/contact_spec.rb +0 -314
- data/spec/models/entities/lead_spec.rb +0 -102
- data/spec/models/entities/opportunity_spec.rb +0 -299
- data/spec/models/fields/custom_field_date_pair_spec.rb +0 -92
- data/spec/models/fields/custom_field_pair_spec.rb +0 -76
- data/spec/models/fields/custom_field_spec.rb +0 -129
- data/spec/models/fields/field_group_spec.rb +0 -29
- data/spec/models/fields/field_spec.rb +0 -69
- data/spec/models/list_spec.rb +0 -19
- data/spec/models/observers/entity_observer_spec.rb +0 -74
- data/spec/models/polymorphic/address_spec.rb +0 -34
- data/spec/models/polymorphic/avatar_spec.rb +0 -46
- data/spec/models/polymorphic/comment_spec.rb +0 -45
- data/spec/models/polymorphic/email_spec.rb +0 -53
- data/spec/models/polymorphic/task_spec.rb +0 -395
- data/spec/models/polymorphic/version_spec.rb +0 -241
- data/spec/models/setting_spec.rb +0 -77
- data/spec/models/users/abilities/user_ability_spec.rb +0 -70
- data/spec/models/users/group_spec.rb +0 -11
- data/spec/models/users/permission_spec.rb +0 -58
- data/spec/models/users/preference_spec.rb +0 -71
- data/spec/models/users/user_spec.rb +0 -238
- data/spec/routing/accounts_routing_spec.rb +0 -60
- data/spec/routing/admin/users_routing_spec.rb +0 -40
- data/spec/routing/campaigns_routing_spec.rb +0 -64
- data/spec/routing/comments_routing_spec.rb +0 -32
- data/spec/routing/contacts_routing_spec.rb +0 -60
- data/spec/routing/emails_routing_spec.rb +0 -40
- data/spec/routing/leads_routing_spec.rb +0 -88
- data/spec/routing/opportunities_routing_spec.rb +0 -64
- data/spec/routing/tasks_routing_spec.rb +0 -68
- data/spec/routing/users_routing_spec.rb +0 -106
- data/spec/shared/controllers.rb +0 -99
- data/spec/shared/models.rb +0 -141
- data/spec/spec_helper.rb +0 -117
- data/spec/support/assert_select.rb +0 -167
- data/spec/support/devise_helpers.rb +0 -28
- data/spec/support/feature_helpers.rb +0 -32
- data/spec/support/macros.rb +0 -49
- data/spec/support/mail_processor_mocks.rb +0 -37
- data/spec/support/uploaded_file.rb +0 -10
- data/spec/views/accounts/_edit.haml_spec.rb +0 -43
- data/spec/views/accounts/_new.haml_spec.rb +0 -42
- data/spec/views/accounts/create.js.haml_spec.rb +0 -52
- data/spec/views/accounts/destroy.js.haml_spec.rb +0 -34
- data/spec/views/accounts/edit.js.haml_spec.rb +0 -66
- data/spec/views/accounts/index.haml_spec.rb +0 -43
- data/spec/views/accounts/index.js.haml_spec.rb +0 -34
- data/spec/views/accounts/new.js.haml_spec.rb +0 -44
- data/spec/views/accounts/show.haml_spec.rb +0 -38
- data/spec/views/accounts/update.js.haml_spec.rb +0 -93
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +0 -30
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +0 -31
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +0 -24
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +0 -25
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +0 -29
- data/spec/views/admin/users/_create.haml_spec.rb +0 -23
- data/spec/views/admin/users/create.js.haml_spec.rb +0 -41
- data/spec/views/admin/users/destroy.js.haml_spec.rb +0 -47
- data/spec/views/admin/users/edit.js.haml_spec.rb +0 -44
- data/spec/views/admin/users/index.haml_spec.rb +0 -22
- data/spec/views/admin/users/index.js.haml_spec.rb +0 -26
- data/spec/views/admin/users/new.js.haml_spec.rb +0 -34
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/show.haml_spec.rb +0 -18
- data/spec/views/admin/users/suspend.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/update.js.haml_spec.rb +0 -37
- data/spec/views/application/auto_complete.haml_spec.rb +0 -48
- data/spec/views/campaigns/_edit.haml_spec.rb +0 -44
- data/spec/views/campaigns/_new.haml_spec.rb +0 -41
- data/spec/views/campaigns/create.js.haml_spec.rb +0 -49
- data/spec/views/campaigns/destroy.js.haml_spec.rb +0 -31
- data/spec/views/campaigns/edit.js.haml_spec.rb +0 -66
- data/spec/views/campaigns/index.haml_spec.rb +0 -37
- data/spec/views/campaigns/index.js.haml_spec.rb +0 -34
- data/spec/views/campaigns/new.js.haml_spec.rb +0 -50
- data/spec/views/campaigns/show.haml_spec.rb +0 -38
- data/spec/views/campaigns/update.js.haml_spec.rb +0 -78
- data/spec/views/comments/edit.js.haml_spec.rb +0 -30
- data/spec/views/contacts/_edit.haml_spec.rb +0 -73
- data/spec/views/contacts/_new.haml_spec.rb +0 -52
- data/spec/views/contacts/create.js.haml_spec.rb +0 -65
- data/spec/views/contacts/destroy.js.haml_spec.rb +0 -45
- data/spec/views/contacts/edit.js.haml_spec.rb +0 -74
- data/spec/views/contacts/index.haml_spec.rb +0 -37
- data/spec/views/contacts/index.js.html_spec.rb +0 -34
- data/spec/views/contacts/new.js.haml_spec.rb +0 -47
- data/spec/views/contacts/show.haml_spec.rb +0 -35
- data/spec/views/contacts/update.js.haml_spec.rb +0 -128
- data/spec/views/home/index.haml_spec.rb +0 -36
- data/spec/views/home/index.js.haml_spec.rb +0 -33
- data/spec/views/home/options.js.haml_spec.rb +0 -53
- data/spec/views/leads/_convert.haml_spec.rb +0 -30
- data/spec/views/leads/_edit.haml_spec.rb +0 -47
- data/spec/views/leads/_new.haml_spec.rb +0 -45
- data/spec/views/leads/_sidebar_show.haml_spec.rb +0 -31
- data/spec/views/leads/convert.js.haml_spec.rb +0 -79
- data/spec/views/leads/create.js.haml_spec.rb +0 -67
- data/spec/views/leads/destroy.js.haml_spec.rb +0 -47
- data/spec/views/leads/edit.js.haml_spec.rb +0 -76
- data/spec/views/leads/index.haml_spec.rb +0 -37
- data/spec/views/leads/index.js.haml_spec.rb +0 -34
- data/spec/views/leads/new.js.haml_spec.rb +0 -47
- data/spec/views/leads/promote.js.haml_spec.rb +0 -135
- data/spec/views/leads/reject.js.haml_spec.rb +0 -45
- data/spec/views/leads/show.haml_spec.rb +0 -32
- data/spec/views/leads/update.js.haml_spec.rb +0 -118
- data/spec/views/opportunities/_edit.haml_spec.rb +0 -70
- data/spec/views/opportunities/_new.haml_spec.rb +0 -51
- data/spec/views/opportunities/create.js.haml_spec.rb +0 -86
- data/spec/views/opportunities/destroy.js.haml_spec.rb +0 -64
- data/spec/views/opportunities/edit.js.haml_spec.rb +0 -75
- data/spec/views/opportunities/index.haml_spec.rb +0 -38
- data/spec/views/opportunities/index.js.haml_spec.rb +0 -35
- data/spec/views/opportunities/new.js.haml_spec.rb +0 -54
- data/spec/views/opportunities/show.haml_spec.rb +0 -35
- data/spec/views/opportunities/update.js.haml_spec.rb +0 -143
- data/spec/views/tasks/_edit.haml_spec.rb +0 -50
- data/spec/views/tasks/complete.js.haml_spec.rb +0 -67
- data/spec/views/tasks/create.js.haml_spec.rb +0 -119
- data/spec/views/tasks/destroy.js.haml_spec.rb +0 -57
- data/spec/views/tasks/edit.js.haml_spec.rb +0 -76
- data/spec/views/tasks/index.haml_spec.rb +0 -46
- data/spec/views/tasks/new.js.haml_spec.rb +0 -49
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +0 -45
- data/spec/views/tasks/update.js.haml_spec.rb +0 -140
- data/spec/views/users/avatar.js.haml_spec.rb +0 -35
- data/spec/views/users/change_password.js.haml_spec.rb +0 -51
- data/spec/views/users/edit.js.haml_spec.rb +0 -35
- data/spec/views/users/password.js.haml_spec.rb +0 -36
- data/spec/views/users/update.js.haml_spec.rb +0 -46
- data/spec/views/users/upload_avatar.js.haml_spec.rb +0 -45
- data/vendor/gems/globby-0.1.2/LICENSE.txt +0 -20
- data/vendor/gems/globby-0.1.2/README.md +0 -65
- data/vendor/gems/globby-0.1.2/Rakefile +0 -9
- data/vendor/gems/globby-0.1.2/lib/globby/glob.rb +0 -90
- data/vendor/gems/globby-0.1.2/lib/globby/globject.rb +0 -18
- data/vendor/gems/globby-0.1.2/lib/globby/result.rb +0 -20
- data/vendor/gems/globby-0.1.2/lib/globby.rb +0 -47
- data/vendor/gems/globby-0.1.2/spec/gitignore_spec.rb +0 -109
- data/vendor/gems/globby-0.1.2/spec/globby_spec.rb +0 -93
- data/zeus.json +0 -22
@@ -1,140 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/tasks/update" do
|
11
|
-
include TasksHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "Changing due date" do
|
18
|
-
before do
|
19
|
-
assign(:task_before_update, build_stubbed(:task, bucket: "due_asap"))
|
20
|
-
assign(:task, @task = build_stubbed(:task, bucket: "due_tomorrow"))
|
21
|
-
assign(:view, "pending")
|
22
|
-
assign(:task_total, stub_task_total("pending"))
|
23
|
-
end
|
24
|
-
|
25
|
-
it "from Tasks tab: should remove task from current bucket and hide empty bucket" do
|
26
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"
|
27
|
-
render
|
28
|
-
|
29
|
-
expect(rendered).to include(%/$('#task_#{@task.id}').remove();/)
|
30
|
-
expect(rendered).to include(%/$('#list_due_asap').fadeOut/)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "from Tasks tab: should show updated task in a new bucket" do
|
34
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"
|
35
|
-
render
|
36
|
-
expect(rendered).to include("$('#due_tomorrow').prepend('<li class=\\'highlight task\\' id=\\'task_#{@task.id}\\'")
|
37
|
-
expect(rendered).to include("$('#task_#{@task.id}').effect('highlight'")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "from Tasks tab: should update tasks sidebar" do
|
41
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"
|
42
|
-
render
|
43
|
-
|
44
|
-
expect(rendered).to include("$('#due_tomorrow').prepend('<li class=\\'highlight task\\' id=\\'task_#{@task.id}\\'")
|
45
|
-
expect(rendered).to have_text("Assigned")
|
46
|
-
expect(rendered).to have_text("Recent Items")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "from asset page: should update task partial in place" do
|
50
|
-
render
|
51
|
-
expect(rendered).to include("$('#task_#{@task.id}').html('<li class=\\'highlight task\\' id=\\'task_#{@task.id}\\'")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "from asset page: should update recently viewed items" do
|
55
|
-
render
|
56
|
-
expect(rendered).to have_text("Recent Items")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "Reassigning" do
|
61
|
-
before do
|
62
|
-
assign(:task_total, stub_task_total("pending"))
|
63
|
-
end
|
64
|
-
|
65
|
-
it "pending task to somebody from Tasks tab: should remove the task and show flash message (assigned)" do
|
66
|
-
assignee = build_stubbed(:user)
|
67
|
-
assign(:task_before_update, build_stubbed(:task, assignee: nil))
|
68
|
-
assign(:task, @task = build_stubbed(:task, assignee: assignee))
|
69
|
-
assign(:view, "pending")
|
70
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks"
|
71
|
-
|
72
|
-
render
|
73
|
-
expect(rendered).to include("$('#task_#{@task.id}').remove();")
|
74
|
-
expect(rendered).to have_text("view assigned tasks")
|
75
|
-
expect(rendered).to include("$('#flash').html")
|
76
|
-
expect(rendered).to include("crm.flash('notice', true)")
|
77
|
-
end
|
78
|
-
|
79
|
-
it "assigned tasks to me from Tasks tab: should remove the task and show flash message (pending)" do
|
80
|
-
assignee = build_stubbed(:user)
|
81
|
-
assign(:task_before_update, build_stubbed(:task, assignee: assignee))
|
82
|
-
assign(:task, @task = build_stubbed(:task, assignee: nil))
|
83
|
-
assign(:view, "assigned")
|
84
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks?view=assigned"
|
85
|
-
|
86
|
-
render
|
87
|
-
expect(rendered).to include("$('#task_#{@task.id}').remove();")
|
88
|
-
expect(rendered).to have_text("view pending tasks")
|
89
|
-
expect(rendered).to include("$('#flash').html")
|
90
|
-
expect(rendered).to include("crm.flash('notice', true)")
|
91
|
-
end
|
92
|
-
|
93
|
-
it "assigned tasks to somebody else from Tasks tab: should re-render task partial" do
|
94
|
-
assign(:task_before_update, build_stubbed(:task, assignee: build_stubbed(:user)))
|
95
|
-
assign(:task, @task = build_stubbed(:task, assignee: build_stubbed(:user)))
|
96
|
-
assign(:view, "assigned")
|
97
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks?view=assigned"
|
98
|
-
|
99
|
-
render
|
100
|
-
expect(rendered).to include("$('#task_#{@task.id}').html('<li class=\\'highlight task\\' id=\\'task_#{@task.id}\\'")
|
101
|
-
end
|
102
|
-
|
103
|
-
it "from Tasks tab: should update tasks sidebar" do
|
104
|
-
assign(:task_before_update, build_stubbed(:task, assignee: nil))
|
105
|
-
assign(:task, @task = build_stubbed(:task, assignee: build_stubbed(:user)))
|
106
|
-
assign(:view, "assigned")
|
107
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/tasks?view=assigned"
|
108
|
-
render
|
109
|
-
|
110
|
-
expect(rendered).to include("$('#sidebar').html")
|
111
|
-
expect(rendered).to have_text("Recent Items")
|
112
|
-
expect(rendered).to have_text("Assigned")
|
113
|
-
end
|
114
|
-
|
115
|
-
it "from asset page: should should re-render task partial" do
|
116
|
-
assign(:task_before_update, build_stubbed(:task, assignee: nil))
|
117
|
-
assign(:task, @task = build_stubbed(:task, assignee: build_stubbed(:user)))
|
118
|
-
render
|
119
|
-
|
120
|
-
expect(rendered).to include("$('#task_#{@task.id}').html('<li class=\\'highlight task\\' id=\\'task_#{@task.id}\\'")
|
121
|
-
end
|
122
|
-
|
123
|
-
it "from asset page: should update recently viewed items" do
|
124
|
-
assign(:task_before_update, build_stubbed(:task, assignee: nil))
|
125
|
-
assign(:task, @task = build_stubbed(:task, assignee: build_stubbed(:user)))
|
126
|
-
render
|
127
|
-
|
128
|
-
expect(rendered).to have_text("Recent Items")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
it "error: should re-disiplay [Edit Task] form" do
|
133
|
-
assign(:task_before_update, build_stubbed(:task))
|
134
|
-
assign(:task, @task = build_stubbed(:task))
|
135
|
-
@task.errors.add(:name)
|
136
|
-
|
137
|
-
render
|
138
|
-
expect(rendered).to include("$('#task_submit').enable()")
|
139
|
-
end
|
140
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe "/users/avatar" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:user, current_user)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "cancel: should hide [Upload Avatar] form and restore title" do
|
19
|
-
params[:cancel] = "true"
|
20
|
-
|
21
|
-
render
|
22
|
-
expect(rendered).to include("crm.flip_form('upload_avatar')")
|
23
|
-
expect(rendered).to include("crm.set_title('upload_avatar', 'My Profile')")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "edit profile: should hide [Edit Profile] and [Change Password] forms and show [Upload Avatar]" do
|
27
|
-
render
|
28
|
-
|
29
|
-
expect(rendered).to include("$('#upload_avatar').html")
|
30
|
-
expect(rendered).to include("crm.hide_form('edit_profile');")
|
31
|
-
expect(rendered).to include("crm.hide_form('change_password');")
|
32
|
-
expect(rendered).to include("crm.flip_form('upload_avatar');")
|
33
|
-
expect(rendered).to include("crm.set_title('upload_avatar', 'Upload Picture');")
|
34
|
-
end
|
35
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/users/change_password" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:user, @user = current_user)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "no errors:" do
|
19
|
-
it "should flip [Change Password] form" do
|
20
|
-
render
|
21
|
-
|
22
|
-
expect(rendered).not_to include("user_#{@user.id}")
|
23
|
-
expect(rendered).to include("crm.flip_form('change_password');")
|
24
|
-
expect(rendered).to include("crm.set_title('change_password', 'My Profile');")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should show flash message" do
|
28
|
-
render
|
29
|
-
|
30
|
-
expect(rendered).to include("#flash")
|
31
|
-
expect(rendered).to include("crm.flash('notice')")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "validation errors:" do
|
36
|
-
it "should redraw the [Change Password] form" do
|
37
|
-
@user.errors.add(:current_password, "error")
|
38
|
-
render
|
39
|
-
|
40
|
-
expect(rendered).to include("$('#change_password').html")
|
41
|
-
expect(rendered).to include("$('#current_password').focus();")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should redraw the [Change Password] form and correctly set focus" do
|
45
|
-
@user.errors.add(:user_password, "error")
|
46
|
-
render
|
47
|
-
|
48
|
-
expect(rendered).to include("$('#user_password').focus();")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/users/edit" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:user, @user = current_user)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "cancel: should hide [Edit Profile] form and restore title" do
|
19
|
-
params[:cancel] = "true"
|
20
|
-
|
21
|
-
render
|
22
|
-
expect(rendered).to include("crm.flip_form('edit_profile')")
|
23
|
-
expect(rendered).to include("crm.set_title('edit_profile', 'My Profile');")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "edit profile: should hide [Upload Avatar] and [Change Password] forms and show [Edit Profile]" do
|
27
|
-
render
|
28
|
-
|
29
|
-
expect(rendered).to include("$('#edit_profile').html")
|
30
|
-
expect(rendered).to include("crm.hide_form('upload_avatar');")
|
31
|
-
expect(rendered).to include("crm.hide_form('change_password');")
|
32
|
-
expect(rendered).to include("crm.flip_form('edit_profile');")
|
33
|
-
expect(rendered).to include("crm.set_title('edit_profile', 'Edit Profile');")
|
34
|
-
end
|
35
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/users/password" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:user, current_user)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "cancel: should hide [Change Password] form and restore title" do
|
19
|
-
params[:cancel] = "true"
|
20
|
-
|
21
|
-
render
|
22
|
-
expect(rendered).to include("crm.flip_form('change_password')")
|
23
|
-
expect(rendered).to include("crm.set_title('change_password', 'My Profile')")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "edit profile: should hide [Edit Profile] and [Upload Avatar] forms and show [Change Password]" do
|
27
|
-
render
|
28
|
-
|
29
|
-
expect(rendered).to include("$('#change_password').html")
|
30
|
-
expect(rendered).to include("crm.hide_form('edit_profile');")
|
31
|
-
expect(rendered).to include("crm.hide_form('upload_avatar');")
|
32
|
-
expect(rendered).to include("crm.flip_form('change_password');")
|
33
|
-
expect(rendered).to include("crm.set_title('change_password', 'Change Password');")
|
34
|
-
expect(rendered).to include("$('#current_password').focus();")
|
35
|
-
end
|
36
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/users/update" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:user, @user = current_user)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "no errors:" do
|
19
|
-
it "should flip [Edit Profile] form" do
|
20
|
-
render
|
21
|
-
expect(rendered).to include("crm.flip_form('edit_profile')")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should update Welcome, user!" do
|
25
|
-
render
|
26
|
-
expect(rendered).to include("$('#welcome_username').html('#{@user.first_name}')")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should update actual user profile information" do
|
30
|
-
render
|
31
|
-
expect(rendered).to include("$('#profile').html")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "validation errors :" do
|
36
|
-
before do
|
37
|
-
@user.errors.add(:first_name)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should redraw the [Edit Profile] form" do
|
41
|
-
render
|
42
|
-
expect(rendered).to include("$('#edit_profile').html")
|
43
|
-
expect(rendered).to include("$('#user_email').focus();")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/users/upload_avatar" do
|
11
|
-
include UsersHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "no errors:" do
|
18
|
-
before do
|
19
|
-
@avatar = build_stubbed(:avatar, entity: current_user)
|
20
|
-
allow(current_user).to receive(:avatar).and_return(@avatar)
|
21
|
-
assign(:user, @user = current_user)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should flip [Upload Avatar] form" do
|
25
|
-
render
|
26
|
-
expect(rendered).not_to include("user_#{@user.id}")
|
27
|
-
expect(rendered).to include("crm.flip_form('upload_avatar'")
|
28
|
-
expect(rendered).to include("crm.set_title('upload_avatar', 'My Profile')")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "validation errors:" do
|
33
|
-
before do
|
34
|
-
@avatar = build_stubbed(:avatar, entity: current_user)
|
35
|
-
@avatar.errors.add(:image, "error")
|
36
|
-
allow_any_instance_of(User).to receive(:avatar).and_return(@avatar)
|
37
|
-
assign(:user, @user = current_user)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should redraw the [Upload Avatar] form" do
|
41
|
-
render
|
42
|
-
expect(rendered).to include("$('#upload_avatar').html")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Jon Jensen
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# globby
|
2
|
-
|
3
|
-
[<img src="https://travis-ci.org/jenseng/globby.svg" />](http://travis-ci.org/jenseng/globby)
|
4
|
-
|
5
|
-
globby is a [`.gitignore`](http://www.kernel.org/pub/software/scm/git/docs/gitignore.html)-style
|
6
|
-
file globber for ruby.
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Put `gem 'globby'` in your Gemfile.
|
11
|
-
|
12
|
-
## Usage
|
13
|
-
|
14
|
-
# all files matched by the rules
|
15
|
-
Globby.select(rules)
|
16
|
-
|
17
|
-
# all other files
|
18
|
-
Globby.reject(rules)
|
19
|
-
|
20
|
-
# ooh chaining!
|
21
|
-
Globby.select(rules).reject(other_rules)
|
22
|
-
|
23
|
-
### An example:
|
24
|
-
|
25
|
-
> rules = File.read('.gitignore').split(/\n/)
|
26
|
-
-> ["Gemfile.lock", "doc", "*.gem"]
|
27
|
-
|
28
|
-
> pp Globby.select(rules)
|
29
|
-
["Gemfile.lock",
|
30
|
-
"doc/Foreigner.html",
|
31
|
-
"doc/Foreigner/Adapter.html",
|
32
|
-
"doc/Gemfile.html",
|
33
|
-
"doc/Immigrant.html",
|
34
|
-
...
|
35
|
-
"immigrant-0.1.3.gem",
|
36
|
-
"immigrant-0.1.4.gem"]
|
37
|
-
=> nil
|
38
|
-
|
39
|
-
## Why on earth would I ever use this?
|
40
|
-
|
41
|
-
* You're curious what is getting `.gitignore`'d and/or you want to do something
|
42
|
-
with those files.
|
43
|
-
* You're writing a library/tool that will have its own list of ignored/tracked
|
44
|
-
files. My use case is for an I18n library that extracts strings from ruby
|
45
|
-
files... I need to provide users a nice configurable way to blacklist given
|
46
|
-
files/directories/patterns.
|
47
|
-
|
48
|
-
## Compatibility Notes
|
49
|
-
|
50
|
-
globby is compatible with `.gitignore` rules; it respects negated patterns, and
|
51
|
-
ignores comments or empty patterns. That said, it supports some things that may
|
52
|
-
or may not work in your version of git. These platform-dependent `.gitignore`
|
53
|
-
behaviors are platform independent in globby and can always be used:
|
54
|
-
|
55
|
-
* Recursive wildcards à la ant/zsh/ruby. `**` matches directories recursively.
|
56
|
-
* [glob(7)](https://www.kernel.org/doc/man-pages/online/pages/man7/glob.7.html)-style
|
57
|
-
bracket expressions, i.e. character classes, ranges, complementation, named
|
58
|
-
character classes, collating symbols and equivalence class expressions. Note
|
59
|
-
that the syntax for some of these is slightly different than what you would
|
60
|
-
find in regular expressions. Refer to [the documentation](https://www.kernel.org/doc/man-pages/online/pages/man7/glob.7.html)
|
61
|
-
for more info.
|
62
|
-
|
63
|
-
## License
|
64
|
-
|
65
|
-
Copyright (c) 2013-2016 Jon Jensen, released under the MIT license
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module Globby
|
2
|
-
class Glob
|
3
|
-
def initialize(pattern)
|
4
|
-
pattern = pattern.dup
|
5
|
-
@inverse = pattern.sub!(/\A!/, '')
|
6
|
-
# remove meaningless wildcards
|
7
|
-
pattern.sub!(/\A\/?(\*\*\/)+/, '')
|
8
|
-
pattern.sub!(/(\/\*\*)+\/\*\z/, '/**')
|
9
|
-
@pattern = pattern
|
10
|
-
end
|
11
|
-
|
12
|
-
def match(files)
|
13
|
-
return [] unless files
|
14
|
-
files.grep(to_regexp)
|
15
|
-
end
|
16
|
-
|
17
|
-
def inverse?
|
18
|
-
@inverse
|
19
|
-
end
|
20
|
-
|
21
|
-
def directory?
|
22
|
-
@pattern =~ /\/\z/
|
23
|
-
end
|
24
|
-
|
25
|
-
def exact_match?
|
26
|
-
@pattern =~ /\A\// && @pattern !~ /[\*\?]/
|
27
|
-
end
|
28
|
-
|
29
|
-
# see https://www.kernel.org/doc/man-pages/online/pages/man7/glob.7.html
|
30
|
-
GLOB_BRACKET_EXPR = /
|
31
|
-
\[ # brackets
|
32
|
-
!? # (maybe) negation
|
33
|
-
\]? # (maybe) right bracket
|
34
|
-
(?: # one or more:
|
35
|
-
\[[^\/\]]+\] # named character class, collating symbol or equivalence class
|
36
|
-
| [^\/\]] # non-right bracket character (could be part of a range)
|
37
|
-
)+
|
38
|
-
\]/x
|
39
|
-
GLOB_ESCAPED_CHAR = /\\./
|
40
|
-
GLOB_RECURSIVE_WILDCARD = /\/\*\*(?:\/|\z)/
|
41
|
-
GLOB_WILDCARD = /[\?\*]/
|
42
|
-
|
43
|
-
GLOB_TOKENIZER = /(
|
44
|
-
#{GLOB_BRACKET_EXPR} |
|
45
|
-
#{GLOB_ESCAPED_CHAR} |
|
46
|
-
#{GLOB_RECURSIVE_WILDCARD}
|
47
|
-
)/x
|
48
|
-
|
49
|
-
def to_regexp
|
50
|
-
parts = @pattern.split(GLOB_TOKENIZER) - [""]
|
51
|
-
|
52
|
-
result = String.new(parts.first.sub!(/\A\//, '') ? '\A' : '(\A|/)')
|
53
|
-
parts.each do |part|
|
54
|
-
result << part_to_regexp(part)
|
55
|
-
end
|
56
|
-
if result[-1, 1] == '/'
|
57
|
-
result << '\z'
|
58
|
-
elsif result[-2, 2] == '.*'
|
59
|
-
result.slice!(-2, 2)
|
60
|
-
else
|
61
|
-
result << '\/?\z'
|
62
|
-
end
|
63
|
-
Regexp.new result
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def part_to_regexp(part)
|
69
|
-
case part
|
70
|
-
when GLOB_BRACKET_EXPR
|
71
|
-
# fix negation and escape right bracket
|
72
|
-
part.sub(/\A\[!/, '[^').sub(/\A(\[\^?)\]/, '\1\]')
|
73
|
-
when GLOB_ESCAPED_CHAR
|
74
|
-
part
|
75
|
-
when GLOB_RECURSIVE_WILDCARD
|
76
|
-
part[-1, 1] == '/' ? "/(.+/)?" : "/.*"
|
77
|
-
when GLOB_WILDCARD
|
78
|
-
(part.split(/(#{GLOB_WILDCARD})/) - [""]).inject("") do |result, p|
|
79
|
-
result << case p
|
80
|
-
when '?'; '[^/]'
|
81
|
-
when '*'; '[^/]' + (result.end_with?("/") ? '+' : '*')
|
82
|
-
else Regexp.escape(p)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
else # literal path component (maybe with slashes)
|
86
|
-
part
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Globby
|
2
|
-
class GlObject
|
3
|
-
attr_reader :files, :dirs
|
4
|
-
|
5
|
-
def initialize(files = Set.new, dirs = Set.new)
|
6
|
-
@files = files
|
7
|
-
@dirs = dirs
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.all
|
11
|
-
files, dirs = Dir.glob('**/*', File::FNM_DOTMATCH).
|
12
|
-
reject { |f| f =~ /(\A|\/)\.\.?\z/ }.
|
13
|
-
partition { |f| File.file?(f) || File.symlink?(f) }
|
14
|
-
dirs.map!{ |d| d + "/" }
|
15
|
-
new(files, dirs)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Globby
|
2
|
-
class Result < Array
|
3
|
-
def initialize(files, dirs)
|
4
|
-
@dirs = dirs
|
5
|
-
super files.sort
|
6
|
-
end
|
7
|
-
|
8
|
-
def select(patterns)
|
9
|
-
Globby::select(patterns, to_globject)
|
10
|
-
end
|
11
|
-
|
12
|
-
def reject(patterns)
|
13
|
-
Globby::reject(patterns, to_globject)
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_globject
|
17
|
-
GlObject.new(self, @dirs)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'globby/glob'
|
3
|
-
require 'globby/globject'
|
4
|
-
require 'globby/result'
|
5
|
-
|
6
|
-
module Globby
|
7
|
-
class << self
|
8
|
-
def select(patterns, source = GlObject.all)
|
9
|
-
result = GlObject.new
|
10
|
-
evaluate_patterns(patterns, source, result)
|
11
|
-
|
12
|
-
if result.dirs && result.dirs.size > 0
|
13
|
-
# now go merge/subtract files under directories
|
14
|
-
dir_patterns = result.dirs.map{ |dir| "/#{dir}**" }
|
15
|
-
evaluate_patterns(dir_patterns, GlObject.new(source.files), result)
|
16
|
-
end
|
17
|
-
|
18
|
-
Result.new result.files, source.dirs
|
19
|
-
end
|
20
|
-
|
21
|
-
def reject(patterns, source = GlObject.all)
|
22
|
-
Result.new(source.files - select(patterns, source), source.dirs)
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def evaluate_patterns(patterns, source, result)
|
28
|
-
patterns.each do |pattern|
|
29
|
-
next unless pattern =~ /\A[^#]/
|
30
|
-
evaluate_pattern pattern, source, result
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def evaluate_pattern(pattern, source, result)
|
35
|
-
glob = Globby::Glob.new(pattern)
|
36
|
-
method, candidates = glob.inverse? ?
|
37
|
-
[:subtract, result] :
|
38
|
-
[:merge, source]
|
39
|
-
|
40
|
-
dir_matches = glob.match(candidates.dirs)
|
41
|
-
file_matches = []
|
42
|
-
file_matches = glob.match(candidates.files) unless glob.directory? || glob.exact_match? && !dir_matches.empty?
|
43
|
-
result.dirs.send method, dir_matches unless dir_matches.empty?
|
44
|
-
result.files.send method, file_matches unless file_matches.empty?
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|